[Home] [Index] [Previous] [Next]

Depending on Oddjob

Introduction

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.

The Interfaces

Oddjob queries and manipulates it's component through five main interfaces.

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.

Extension Points

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;
	}
}

[Home] [Index] [Previous] [Next]