org.oddjob.script
Class InvokeJob
java.lang.Object
org.oddjob.framework.BaseComponent
org.oddjob.framework.BasePrimary
org.oddjob.framework.SimpleJob
org.oddjob.framework.SerializableJob
org.oddjob.script.InvokeJob
- All Implemented Interfaces:
- Serializable, Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable
public class InvokeJob
- extends SerializableJob
- implements Stoppable
Description
Invoke a java method or script snippet.
This is a wrapper for InvokeType
. The result of the
invocation is placed in the result
property.
Note that stopping this job will simply attempt to interrupt the
thread invoking the method. The outcome of this will obviously vary.
Example
Invoking a method on a bean.
<oddjob>
<job>
<sequential>
<jobs>
<invoke id="invoke-job" function="echo">
<source>
<bean class="org.oddjob.script.EchoService"/>
</source>
<parameters>
<value value="Hello"/>
</parameters>
</invoke>
<echo id="echo">${invoke-job.result}</echo>
</jobs>
</sequential>
</job>
</oddjob>
Where EchoService
is:
org/oddjob/script/EchoService.javaExample
Examples elsewhere. The JMXServiceJob
job has an example of
invoking a JMX operation.- See Also:
- Serialized Form
- Author:
- rob
Methods inherited from class org.oddjob.framework.BaseComponent |
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession |
InvokeJob
public InvokeJob()
- Constructor.
execute
protected int execute()
throws Throwable
- Description copied from class:
SimpleJob
- Execute this job.
- Specified by:
execute
in class SimpleJob
- Returns:
- 0 if the job is complete, anything else otherwise.
- Throws:
Exception
- If the unexpected occurs.
Throwable
onReset
protected void onReset()
- Description copied from class:
SimpleJob
- Allow sub classes to do something on reset.
- Overrides:
onReset
in class SimpleJob
onStop
protected void onStop()
throws FailedToStopException
- Description copied from class:
SimpleJob
- Allow sub classes to do something on stop.
- Overrides:
onStop
in class SimpleJob
- Throws:
FailedToStopException
getSource
public Invoker getSource()
setSource
public void setSource(Invoker source)
getFunction
public String getFunction()
setFunction
public void setFunction(String function)
getParameters
public ArooaValue getParameters(int index)
setParameters
public void setParameters(int index,
ArooaValue parameter)
getResult
public Object getResult()