So far all interaction to Oddjob has been quite casual. All the jobs you've written could be moved to Spring or Expresso, and with a small amount of configuration changes - everything would work.
This section explains the interfaces and extension points that would tie you to Oddjob, and what you get in exchange.
Oddjob queries and manipulates it's component through five main interfaces.
If you want to change how your jobs sate is controlled implement this interface.
If you want to have your own functionality for the hard/soft reset actions then implment this interace.
If you want to have child components that are visable to others, in Oddjob Explorer, for instance - then implement this interface.
Implementing this interface allows a custom stop method.
Implementing this interface allows a job to provide it's own changeable icon.
Stateful is the interface that Oddjob checks before it attempts to wrap your Runnable job or service. If your component is Runnable or has the service method signature then you must implement Stateful to get custom control over your component.
If your component isn't Runnable or has the service method signature then you can pretty much pick and choose which interfaces to implement.
A
FolderJob just implements Structural
, Stoppable
and Iconic
.
There are a few extension points to provide some help with implementing all those interfaces.
SimpleJob for simple things, and StructuralJob which helps with children.
In both you
only need to implement an execute()
method. Here's a quick example:
package org.oddjob.devguide; import org.oddjob.framework.SimpleJob; public class ExtendedJob extends SimpleJob { protected int execute() { System.out.println("Hello World!"); return 0; } }