|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.oddjob.framework.BaseComponent
org.oddjob.framework.BasePrimary
org.oddjob.framework.StructuralJob
org.oddjob.Oddjob
Read a configuration, creates child jobs and executes them.
An Oddjob job allows an Oddjob instance to be created within an existing Oddjob configuration. This way complicated processes can be created in managable and separately testable units.
An Oddjob job can be visualised as having two sides. One side is in the configuration that creates the Oddjob. The other side is in the configuration that the Oddjob job creates and runs. An Oddjob can have two different ids - that which identifies it in the outer and that which identifies it in the inner configuration files. An Oddjob job should only have it's properties set in the outer configuration file. To enforce this the top level <oddjob> element only supports the id attribute.
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 serveral properties to support registering bespoke jobs types, and property proxies. An example would be
...
<oddjob name="Nested Oddjob"
file="nested.xml">
<componentType>
<value name="myjob" value="com.mycomp.ProcessingJob"/>
</componentType>
</oddjob>
...
The file nested.xml can then contain something like.
<oddjob> <myjob/> </oddjob>The classpath that the nested Oddjob will use can also be configured.
<oddjob id="this">
<oddjob file="${this.dir}/nested.xml">
<args>
<value value="apples"/>
</args>
</oddjob>
<l;/oddjob>
Oddjob with database persistance.
<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>
| Nested Class Summary | |
class |
Oddjob.OddjobHandler
Need our own handler to get the id element. |
class |
Oddjob.Root
The object which is the Oddjob root. |
| Field Summary | |
static ConsoleArchive |
CONSOLE
|
static java.lang.String |
CONVERTER_PROPERTIES
|
static java.lang.String |
JOB_PROPERTIES
|
static java.lang.String |
PROXY_PROPERTIES
|
static java.lang.String |
TYPE_PROPERTIES
|
| Fields inherited from class org.oddjob.framework.StructuralJob |
childHelper |
| Fields inherited from class org.oddjob.framework.BasePrimary |
stop |
| Fields inherited from class org.oddjob.framework.BaseComponent |
changes, destroyed, iconHelper, location, lock, stateHandler |
| Constructor Summary | |
Oddjob()
|
|
| Method Summary | |
protected void |
execute()
Execute this job. |
java.lang.Object[] |
getArgs()
|
java.lang.Object |
getArgs(int index)
Get the args by index. |
java.lang.ClassLoader |
getClassLoader()
Return a class loader. |
void |
getClasspath(java.io.File[] files)
Get the classpath files. |
java.io.File |
getDir()
|
java.io.File |
getFile()
|
ComponentPersister |
getPersister()
|
java.lang.String |
getSubstitution()
|
java.lang.String |
getVersion()
Get this Oddjob version. |
void |
hardReset()
Perform a hard reset. |
boolean |
isLoadOnly()
|
protected void |
load()
Load Oddjob from the configuration file. |
ArooaContext |
loadContext()
A getter for Load context without a getter as this isn't a published property. |
java.lang.Object |
lookup(java.lang.String path)
Lookup a component in the registry. |
void |
onDestroy()
Destroy this component. |
void |
setArgs(int index,
java.lang.Object arg)
Set an arg by index. |
void |
setArgs(java.lang.Object[] args)
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set a class loader. |
void |
setClasspath(java.io.File[] files)
Set the classpath files. |
void |
setComponentType(java.lang.String name,
java.lang.String className)
|
void |
setConfig(java.io.File file)
|
boolean |
setContext(ArooaContext context)
Called during construction by the framework to allow a component access to the context that's creating it. |
void |
setFile(java.io.File file)
Set the configuration file. |
void |
setInput(java.io.InputStream inputStream)
Set the input stream to read configuration from. |
void |
setLoadOnly(boolean loadOnly)
Set load only property. |
void |
setPersister(ComponentPersister persister)
|
void |
setPropertyProxy(java.lang.String name,
java.lang.String className)
|
void |
setSubstitution(java.lang.String substitution)
|
void |
setValueType(java.lang.String name,
java.lang.String className)
|
void |
softReset()
Perform a soft reset. |
| Methods inherited from class org.oddjob.framework.StructuralJob |
addStructuralListener, independant, removeStructuralListener, run, stop |
| Methods inherited from class org.oddjob.framework.BasePrimary |
configurationComplete, getLogger, getName, logger, setJobStateReady, setLogger, setName, sleep, toString |
| Methods inherited from class org.oddjob.framework.BaseComponent |
addIconListener, addJobStateListener, addPropertyChangeListener, arooaRuntime, arooaRuntime, canHardReset, canSoftReset, configure, destroy, getLocation, iconForId, lastJobStateEvent, removeIconListener, removeJobStateListener, removePropertyChangeListener, setJobStateComplete, setJobStateException, setJobStateNotComplete |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.oddjob.Structural |
addStructuralListener, removeStructuralListener |
| Methods inherited from interface org.oddjob.Stoppable |
stop |
| Methods inherited from interface org.oddjob.Stateful |
addJobStateListener, removeJobStateListener |
| Field Detail |
public static final java.lang.String JOB_PROPERTIES
public static final java.lang.String CONVERTER_PROPERTIES
public static final java.lang.String PROXY_PROPERTIES
public static final java.lang.String TYPE_PROPERTIES
public static final ConsoleArchive CONSOLE
| Constructor Detail |
public Oddjob()
| Method Detail |
public void setFile(java.io.File file)
file - The config file.public java.io.File getFile()
public java.io.File getDir()
public void setConfig(java.io.File file)
public void setInput(java.io.InputStream inputStream)
inputStream - The input stream.public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader - The classLoader;public java.lang.ClassLoader getClassLoader()
public void setClasspath(java.io.File[] files)
files - The files to set in the classpath.public void getClasspath(java.io.File[] files)
public java.lang.String getSubstitution()
public void setSubstitution(java.lang.String substitution)
substitution - The substitution to set.
public void setComponentType(java.lang.String name,
java.lang.String className)
public void setValueType(java.lang.String name,
java.lang.String className)
public void setPropertyProxy(java.lang.String name,
java.lang.String className)
public boolean setContext(ArooaContext context)
BasePrimaryIf this method returns true then it is an independent component responsible for it's own configuration and won't have it's configuration linked to its parents.
Subclasses overriding this method should always call super.setContext().
setContext in class BasePrimarycontext - The ArooaXMLContext.
protected void load()
protected void execute()
StructuralJob
execute in class StructuralJobpublic void onDestroy()
StructuralJob
onDestroy in class StructuralJobpublic void softReset()
softReset in interface ResetablesoftReset in class StructuralJobpublic void hardReset()
hardReset in interface ResetablehardReset in class StructuralJobpublic ComponentPersister getPersister()
public void setPersister(ComponentPersister persister)
public java.lang.Object lookup(java.lang.String path)
path - The path to the component
public boolean isLoadOnly()
public void setLoadOnly(boolean loadOnly)
loadOnly - true to load only, false to load and run.public java.lang.Object[] getArgs()
public java.lang.Object getArgs(int index)
index - The index.
public void setArgs(java.lang.Object[] args)
args - The args to set.
public void setArgs(int index,
java.lang.Object arg)
index - The indexarg - The arg.public ArooaContext loadContext()
public java.lang.String getVersion()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||