An Oddjob job allows an Oddjob instance to be created within an existing Oddjob configuration. This way complicated processes can be created in manageable and separately testable units.
Oddjob creates a 'root' job on which to create the hierarchy. Through this root Oddjob aquires the first job to run and also exposes some of it's own properties for the jobs in the configuration to use. The root properties are:
| Name | Description |
|---|---|
| job | The top level job. Write Only |
| file | This configuration file. Read Only. |
| dir | This configuration files directory. Read Only. |
| args | For passing through value to the configuration. See below. Read Only. |
| oddjobServices | Provides access to Oddjobs underlying scheduler - for advanced use. Read Only. |
For these properties to be accessable this root oddjob must be given an id. This id is independent from the any id given to the outer Oddjob configuration.
The args property allows arguments to be passed into a nested Oddjob from the the outer oddjob or from the command line.
Properties of jobs in a nested Oddjob can be accessed using the notation ${nested-oddjob-id/job-id.property} where nested-oddjob-id is the id in the outer configuration, not the inner one.
Oddjob has an arooaDescriptor property that allows bespoke components and types. The classloader that the nested Oddjob will use can also be configured.
| Name | Description | Required |
|---|---|---|
| name | A name, can be any text. | No. |
| persister | A component which is able to save and restore jobs. | No. |
| args | An array of arguments the Oddjob configuration can use. | No. |
| descriptorFactory | An Arooa descriptor that will be used during component creation. | No. |
| file | The name of the configuration file. to configure this oddjob. | No. |
| xml | The configuration as text. | No. |
| classLoader | The classLoader to use when loading the configuration. | No. |
| dir | The name of the directory the configuration file is in. | R/O |
A simple nested Oddjob with one argument.
<oddjob id="this">
<job>
<oddjob file="${this.dir}/nested.xml">
<args>
<list>
<values>
<value value="apples"/>
</values>
</list>
</args>
</oddjob>
</job>
</oddjob>
Oddjob with database persistence.
<oddjob file="${this.dir}\job.oddjob.persist.xml"
name="A Database Persisted Oddjob">
<persister>
<sqlPersister>
<connection driver="org.hsqldb.jdbcDriver"
url="jdbc:hsqldb:hsql://localhost:11002/ojdb" username="sa"/>
</sqlPersister>
</persister>
</oddjob>