org.oddjob.jobs.structural
Class RepeatJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BasePrimary
          extended by org.oddjob.framework.StructuralJob<Runnable>
              extended by org.oddjob.jobs.structural.RepeatJob
All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable, Structural

public class RepeatJob
extends StructuralJob<Runnable>
implements Stoppable

Description

This job will repeatedly either for a number of times or until the until property is true;

Without either a until or a times the job will loop indefinitely.

Example

Repeat a job 3 times.
<oddjob>
    <job>
        <repeat times="3" id="repeat">
            <job>
                <echo>Hello ${repeat.count}</echo>
            </job>
        </repeat>
    </job>
</oddjob>
See Also:
Serialized Form
Author:
Rob Gordon.

Field Summary
 
Fields inherited from class org.oddjob.framework.StructuralJob
childHelper, childStateReflector, stateHandler, stop, structuralState
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
RepeatJob()
           
 
Method Summary
protected  void execute()
          Execute this job.
 int getCount()
           
protected  StateOperator getInitialStateOp()
          Subclasses must provide the StateOperator that will decide how to evaluate the children's state.
 int getTimes()
           
 boolean isUntil()
           
protected  void onReset()
          Allow sub classes to do something on reset.
 void setJob(Runnable child)
           
 void setTimes(int times)
           
 void setUntil(boolean until)
           
 
Methods inherited from class org.oddjob.framework.StructuralJob
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, isStop, onDestroy, onStop, removeStructuralListener, run, softReset, startChildStateReflector, 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.Stoppable
stop
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

RepeatJob

public RepeatJob()
Method Detail

getInitialStateOp

protected StateOperator getInitialStateOp()
Description copied from class: StructuralJob
Subclasses must provide the StateOperator that will decide how to evaluate the children's state.

Specified by:
getInitialStateOp in class StructuralJob<Runnable>
Returns:
A State Operator. Must not be null.

setJob

public void setJob(Runnable child)

Property: job

Description: The job who's execution to schedule.

Required: Yes.


execute

protected void execute()
Description copied from class: StructuralJob
Execute this job.

Specified by:
execute in class StructuralJob<Runnable>

onReset

protected void onReset()
Description copied from class: StructuralJob
Allow sub classes to do something on reset.

Overrides:
onReset in class StructuralJob<Runnable>

isUntil

public boolean isUntil()

setUntil

public void setUntil(boolean until)

getTimes

public int getTimes()

setTimes

public void setTimes(int times)

getCount

public int getCount()