org.oddjob.script
Class InvokeJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BasePrimary
          extended by org.oddjob.framework.SimpleJob
              extended by org.oddjob.framework.SerializableJob
                  extended by 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.java

Example

Examples elsewhere. The JMXServiceJob job has an example of invoking a JMX operation.
See Also:
Serialized Form
Author:
rob

Field Summary
 
Fields inherited from class org.oddjob.framework.SimpleJob
stateHandler, stop
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
InvokeJob()
          Constructor.
 
Method Summary
protected  int execute()
          Execute this job.
 String getFunction()
           
 ArooaValue getParameters(int index)
           
 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 setFunction(String function)
           
 void setParameters(int index, ArooaValue parameter)
           
 void setSource(Invoker source)
           
 
Methods inherited from class org.oddjob.framework.SimpleJob
fireDestroyedState, force, getStateChanger, hardReset, onDestroy, run, sleep, softReset, stateHandler, stop
 
Methods inherited from class org.oddjob.framework.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toString
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stoppable
stop
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

InvokeJob

public InvokeJob()
Constructor.

Method Detail

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()