org.oddjob.jobs
Class SequenceJob

java.lang.Object
  extended by org.oddjob.jobs.SequenceJob
All Implemented Interfaces:
Serializable, Runnable

public class SequenceJob
extends Object
implements Runnable, Serializable

Description

Provide a sequence number which is incremented each time the job is executed.

Example

Using a sequence in a file name.
<oddjob id="this" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
    <job>
        <scheduling:timer id="daily">
            <schedule>
                <schedules:daily/>
            </schedule>
            <job>
                <scheduling:timer>
                    <schedule>
                        <schedules:count count="10"/>
                    </schedule>
                    <job>
                        <sequential>
                            <jobs>
                                <sequence id="seqnum" watch="${daily.current}"/>
                                <variables id="vars">
                                    <seqnumFormatted>
                                        <format format="0000" number="${seqnum.current}"/>
                                    </seqnumFormatted>
                                </variables>
                                <copy name="Create file" to="${work.dir}/sequence${vars.seqnumFormatted}.txt">
                                    <input>
                                        <value value="This text will be in every file."/>
                                    </input>
                                </copy>
                            </jobs>
                        </sequential>
                    </job>
                </scheduling:timer>
            </job>
        </scheduling:timer>
    </job>
</oddjob>
The watch property is set to watch when the daily scheule move forward so the sequence is restarted.
See Also:
Serialized Form
Author:
rob

Constructor Summary
SequenceJob()
           
 
Method Summary
 Integer getCurrent()
          Get the current sequence number.
 int getFrom()
           
 String getName()
          Get the name.
 Object getWatch()
           
 void run()
           
 void setCurrent(Integer current)
           
 void setFrom(int from)
           
 void setName(String name)
          Set the name
 void setWatch(Object watch)
          Set an object to watch.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequenceJob

public SequenceJob()
Method Detail

getName

public String getName()
Get the name.

Returns:
The name.

setName

public void setName(String name)
Set the name

Parameters:
name - The name.

getCurrent

public Integer getCurrent()
Get the current sequence number.

Returns:
The current sequence number.

setCurrent

public void setCurrent(Integer current)

setFrom

public void setFrom(int from)

getFrom

public int getFrom()

run

public void run()
Specified by:
run in interface Runnable

setWatch

public void setWatch(Object watch)
Set an object to watch.

Parameters:
reset - The reset to set.

getWatch

public Object getWatch()

toString

public String toString()
Overrides:
toString in class Object