Class PluginWorkUnit
- java.lang.Object
-
- chemaxon.marvin.plugin.concurrent.PluginWorkUnit
-
- All Implemented Interfaces:
chemaxon.util.concurrent.WorkUnit
,Callable
- Direct Known Subclasses:
DefaultPluginWorkUnit
,ReusablePluginWorkUnit
@PublicAPI public abstract class PluginWorkUnit extends Object implements chemaxon.util.concurrent.WorkUnit
Work unit performing plugin calculation. The input is the input molecule.- Since:
- Marvin 5.0
- See Also:
MolInputProducer
-
-
Field Summary
Fields Modifier and Type Field Description protected CalculatorPlugin
plugin
The plugin object.protected Molecule
target
The target molecule.
-
Constructor Summary
Constructors Constructor Description PluginWorkUnit()
Constructor.PluginWorkUnit(CalculatorPlugin plugin)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object
call()
Performs the calculation and returns the result returned bygetResult()
.protected String
getHeader()
Returns the table header.abstract Object
getResult()
Returns the calculation result after the plugin has beenCalculatorPlugin.run()
.Exception
getWrapperException(Exception e)
Returns a wrapper exception to be returned.void
setInput(Object obj)
Sets the input molecule.void
setPlugin(CalculatorPlugin plugin)
Sets the plugin object.
-
-
-
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 bysetPlugin(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(Object obj) throws ExecutionException
Sets the input molecule.- Specified by:
setInput
in interfacechemaxon.util.concurrent.WorkUnit
- Parameters:
obj
- the input molecule- Throws:
ExecutionException
-
call
public Object call() throws Exception
Performs the calculation and returns the result returned bygetResult()
.
-
getHeader
protected String getHeader()
Returns the table header.- Returns:
- the table header
-
getWrapperException
public Exception getWrapperException(Exception e)
Returns a wrapper exception to be returned.- Parameters:
e
- the base exception- Returns:
- the wrapper exception
-
getResult
public abstract Object getResult() throws Exception
Returns the calculation result after the plugin has beenCalculatorPlugin.run()
. Subclasses should override this to return a specific calculation result.- Returns:
- the calculation result
- Throws:
Exception
-
-