org.oddjob.jobs.job
Class StartJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BasePrimary
          extended by org.oddjob.framework.SimpleJob
              extended by org.oddjob.framework.SerializableJob
                  extended by org.oddjob.jobs.job.StartJob
All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful

public class StartJob
extends SerializableJob

Description

This job will run another job. It is intended for starting services or jobs on remote servers which is why it is named start. If it used on a local job it will block until the local job has run.

Unlike the RunJob, this job will not monitor or reflect the state of the started job. To monitor the state of the started job the job could be followed by a MirrorState.

The start job won't reset the job to be started. If the job to start isn't started because it's in the wrong state this job will still COMPLETE. This job can be preceded by a ResetJob if resetting is required.

Example

Starting a service. A folder contains a choice of services. The service id to use is provided at runtime with a property such as -DpriceService=nonCachingPriceService. The selected service is started and used by the Pricing Job.
<oddjob>
  <job>
    <sequential>
      <jobs>
        <folder name="services">
          <jobs>
            <bean id="cachingPriceService" class="org.oddjob.examples.CachingPriceService"/>
            <bean id="nonCachingPriceService" class="org.oddjob.examples.NonCachingPriceService"/>
          </jobs>
        </folder>
        <start job="${${priceService}}"/>
        <bean id="pricingJob" class="org.oddjob.examples.PricingJob" priceService="${${priceService}}"/>
      </jobs>
    </sequential>
  </job>
</oddjob>
See Also:
Serialized Form
Author:
Rob Gordon

Field Summary
 
Fields inherited from class org.oddjob.framework.SimpleJob
stateHandler, stop
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
StartJob()
           
 
Method Summary
protected  int execute()
          Execute this job.
 Runnable getJob()
          Get the job.
 void setJob(Runnable node)
          Set the stop node directly.
 
Methods inherited from class org.oddjob.framework.SimpleJob
fireDestroyedState, force, getStateChanger, hardReset, onDestroy, onReset, onStop, run, sleep, softReset, stateHandler, stop
 
Methods inherited from class org.oddjob.framework.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

StartJob

public StartJob()
Method Detail

setJob

public void setJob(Runnable node)
Set the stop node directly.

Parameters:
node - The job.

getJob

public Runnable getJob()
Get the job.

Returns:
The node.

execute

protected int execute()
               throws Exception
Description copied from class: SimpleJob
Execute this job.

Specified by:
execute in class SimpleJob
Returns:
0 if the job is complete, anything else otherwise.
Throws:
Exception - If the unexpected occurs.