chemaxon.marvin.plugin.concurrent
Class PluginWorkUnit

java.lang.Object
  extended by chemaxon.marvin.plugin.concurrent.PluginWorkUnit
All Implemented Interfaces:
WorkUnit, java.util.concurrent.Callable
Direct Known Subclasses:
DefaultPluginWorkUnit, ReusablePluginWorkUnit

public abstract class PluginWorkUnit
extends java.lang.Object
implements WorkUnit

Work unit performing plugin calculation. The input is the input molecule.

Since:
Marvin 5.0
Author:
Nora Mate
See Also:
MolInputProducer

Field Summary
protected  CalculatorPlugin plugin
          The plugin object.
protected  Molecule target
          The target molecule.
 
Constructor Summary
PluginWorkUnit()
          Constructor.
PluginWorkUnit(CalculatorPlugin plugin)
          Constructor.
 
Method Summary
 java.lang.Object call()
          Performs the calculation and returns the result returned by getResult().
protected  java.lang.String getHeader()
          Returns the table header.
abstract  java.lang.Object getResult()
          Returns the calculation result after the plugin has been CalculatorPlugin.run().
 java.lang.Exception getWrapperException(java.lang.Exception e)
          Returns a wrapper exception to be returned.
 void setInput(java.lang.Object obj)
          Sets the input molecule.
 void setPlugin(CalculatorPlugin plugin)
          Sets the plugin object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

plugin

protected CalculatorPlugin plugin
The plugin object.


target

protected Molecule target
The target molecule.

Constructor Detail

PluginWorkUnit

public PluginWorkUnit()
Constructor. The plugin should be set by setPlugin(chemaxon.marvin.plugin.CalculatorPlugin).


PluginWorkUnit

public PluginWorkUnit(CalculatorPlugin plugin)
Constructor. Sets the plugin object.

Parameters:
plugin - the plugin object
Method Detail

setPlugin

public void setPlugin(CalculatorPlugin plugin)
Sets the plugin object.

Parameters:
plugin - the plugin object

setInput

public void setInput(java.lang.Object obj)
              throws java.util.concurrent.ExecutionException
Sets the input molecule.

Specified by:
setInput in interface WorkUnit
Parameters:
obj - the input molecule
Throws:
java.util.concurrent.ExecutionException

call

public java.lang.Object call()
                      throws java.lang.Exception
Performs the calculation and returns the result returned by getResult().

Specified by:
call in interface java.util.concurrent.Callable
Returns:
the calculation result
Throws:
java.lang.Exception

getHeader

protected java.lang.String getHeader()
Returns the table header.

Returns:
the table header

getWrapperException

public java.lang.Exception getWrapperException(java.lang.Exception e)
Returns a wrapper exception to be returned.

Parameters:
e - the base exception
Returns:
the wrapper exception

getResult

public abstract java.lang.Object getResult()
                                    throws java.lang.Exception
Returns the calculation result after the plugin has been CalculatorPlugin.run(). Subclasses should override this to return a specific calculation result.

Returns:
the calculation result
Throws:
java.lang.Exception