script

Description

Execute a script. The script can be in any language supported by Apache Bean Scripting Framework. Oddjob currently comes bundled with the Groovy libraries but others can easily be added.

The named beans property allow values to be passed to and from the script.

The result of this job can altered by the script setting this jobs result property. 0 will complete, any other value will flag not complete.

Properties

NameDescriptionRequired
name A name, can be any text. No.
language The name of the language the script is in. Yes.
text The script as text No if the script is provided by another means.
file A file containing a script. No if the script is provided by another means.
beans A named bean which is made available to the script. The bean can be any type supported by map. No.
input The script provided as input. No if the script is provided by another means.
componentFactory The component factory exposed as a property so that it can be passed back into the script if required. Read only.
valueFactory The value factory exposed as a property so that it can be passed back into the script if required. Read only.
result The value factory exposed as a property so that it can be passed back into the script if required. No, If not supplied this job will always complete.

Example

Hello World.

 <script language="groovy">
   <text>
     printlnt "Hello World"
   </text>
 </script>
 

Setting todays date as a variable.

 <sequential>
   <script language="groovy">
     <text>
       vars.today=new Date()
     </text>
     <beans>
       <value name="vars" value="${vars}"/>
     </beans>
   </script>
   <variables id="vars"/>
 <sequential>
 

Setting the script job to not complete.

 <script id="s" language="groovy">
   <text>
     s.result = -1
   </text>
   <beans>
     <value name="s" value="${s}"/>
   </beans>
 </script>
 


(c) Rob Gordon 2005