public class InvokeJob extends SerializableJob implements Stoppable
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.
Oddjob will do it's best to convert arguments to the signature of the method or operation. An exception will result if it can't achieve this.
<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.java
<oddjob>
<job>
<invoke function="static totalPrice" id="invoke-totalPrice">
<args>
<tokenizer text="Red Apples, 24, 47.3"/>
</args>
<source>
<class name="org.oddjob.script.InvokeJobTest"/>
</source>
</invoke>
</job>
</oddjob>
See InvokeType for several more examples. Property configuration
is the same for the type and the job.
The JMXServiceJob job has an example of
invoking a JMX operation.
| Constructor and Description |
|---|
InvokeJob()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
execute()
Execute this job.
|
java.lang.Object[] |
getArgs() |
java.lang.String |
getFunction() |
ArooaValue |
getParameters(int index) |
java.lang.Object |
getResult() |
Invoker |
getSource() |
protected void |
onReset()
Allow sub classes to do something on reset.
|
protected void |
onStop()
Allow sub classes to do something on stop.
|
void |
setArgs(java.lang.Object[] args) |
void |
setFunction(java.lang.String function) |
void |
setParameters(int index,
ArooaValue parameter) |
void |
setSource(Invoker source) |
fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, run, sleep, softReset, stateHandler, stopconfigure, getName, logger, logger, loggerName, save, setName, toStringaddIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddStateListener, lastStateEvent, removeStateListenerprotected int execute()
throws java.lang.Throwable
SimpleJobprotected void onReset()
SimpleJobprotected void onStop()
throws FailedToStopException
SimpleJobonStop in class SimpleJobFailedToStopExceptionpublic Invoker getSource()
public void setSource(Invoker source)
public java.lang.String getFunction()
public void setFunction(java.lang.String function)
public ArooaValue getParameters(int index)
public void setParameters(int index,
ArooaValue parameter)
public java.lang.Object[] getArgs()
public void setArgs(java.lang.Object[] args)
public java.lang.Object getResult()