org.umber.catalan.process.workers
Class XmlJob

java.lang.Object
  extended byorg.umber.catalan.process.workers.BaseMetadataHolder
      extended byorg.umber.catalan.process.workers.BaseJob
          extended byorg.umber.catalan.process.workers.XmlJob
All Implemented Interfaces:
IMetadataHolder, IWorker

public class XmlJob
extends BaseJob

A BaseJob based on an XML description of embedded Workers.

Author:
jsheets

Constructor Summary
XmlJob(Datum xml, WorkerRegistry registry)
          Creates a new instance of XmlJob.
 
Method Summary
 IWorkProperties getDefaultProperties()
          Retrieves the default properties for this IWorker.
 IWorkMetadata getMetadata()
          Retrieves descriptive metadata associated with this job implementation.
protected  IWorkProperties[] getWorkerRuntimeProperties()
          Retrieves customized runtime properties for each IWorker returned in getWorkers().
 IWorker[] getWorkers()
          Retrieves all embedded Workers associated with this BaseJob, in the order they will run for this BaseJob.
 
Methods inherited from class org.umber.catalan.process.workers.BaseJob
process, setDefaultProperties
 
Methods inherited from class org.umber.catalan.process.workers.BaseMetadataHolder
setOptionalProperties, setRequiredProperties, validateProperties, validateType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.umber.catalan.process.workers.IMetadataHolder
validateProperties, validateType
 

Constructor Detail

XmlJob

public XmlJob(Datum xml,
              WorkerRegistry registry)
Creates a new instance of XmlJob.

Parameters:
xml - XML BaseJob definition
registry - registry to instantiate IWorker objects from
Method Detail

getMetadata

public IWorkMetadata getMetadata()
Retrieves descriptive metadata associated with this job implementation. Does not provide metadata about workers nested inside this job.

Specified by:
getMetadata in interface IMetadataHolder
Overrides:
getMetadata in class BaseMetadataHolder
Returns:
worker metadata

getWorkers

public IWorker[] getWorkers()
Retrieves all embedded Workers associated with this BaseJob, in the order they will run for this BaseJob. The process() method will run on each IWorker, using the runtime properties passed into BaseJob.process() merged with the runtime properties for each IWorker from getWorkerRuntimeProperties().

Specified by:
getWorkers in class BaseJob
Returns:
embedded Workers

getWorkerRuntimeProperties

protected IWorkProperties[] getWorkerRuntimeProperties()
Retrieves customized runtime properties for each IWorker returned in getWorkers(). The arrays returned by these two methods must be the same size and contain no nulls. The BaseJob will pass the runtime properties into each IWorker.process() method.

This implementation returns the attributes from and as each IWorker's runtime properties.

Overrides:
getWorkerRuntimeProperties in class BaseJob
Returns:
runtime properties for each embedded IWorker

getDefaultProperties

public IWorkProperties getDefaultProperties()
Retrieves the default properties for this IWorker. It is up to the IWorker implementation how these properties are merged into the other available properties at process time.

This implementation merges the XmlJob's XML attributes with properties explicitly set with BaseJob.setDefaultProperties(). The XML properties take precedence over BaseJob properties.

Specified by:
getDefaultProperties in interface IWorker
Overrides:
getDefaultProperties in class BaseJob
Returns:
default properties