[Index]

invoke


Invoke a java method or script snippet.

This is a wrapper for invoke. 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.


Property Summary

function The function/method to call.
name A name, can be any text.
parameters The values to use as arguments.
result  
source The java object or script Invocable on which to invoke the method/function.

Example Summary

Example 1 Invoking a method on a bean.
Example 2 Examples elsewhere.

Property Detail

function

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredYes.

The function/method to call.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

A name, can be any text.

parameters

Configured ByELEMENT
AccessREAD_WRITE
RequiredMust match the expected arguments.

The values to use as arguments.

result

AccessREAD_ONLY

source

Configured ByELEMENT
AccessREAD_WRITE
RequiredYes.

The java object or script Invocable on which to invoke the method/function.


Examples

Example 1

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:

java.io.IOException: No Resource found: org/oddjob/script/EchoService.java

Example 2

Examples elsewhere. The jmx:service job has an example of invoking a JMX operation.


(c) Rob Gordon 2005 - 2013