org.oddjob.state
Enum JobState

java.lang.Object
  extended by java.lang.Enum<JobState>
      extended by org.oddjob.state.JobState
All Implemented Interfaces:
Serializable, Comparable<JobState>, State

public enum JobState
extends Enum<JobState>
implements State

Encapsulate the allowed states for a job.

Author:
Rob Gordon

Enum Constant Summary
COMPLETE
          Indicates job has completed.
DESTROYED
          The job has been destroyed.
EXCEPTION
          Indicates an exception has occurred.
EXECUTING
          Indicates the job is executing.
INCOMPLETE
          Indicates the job is not complete.
READY
          Indicates the job is ready to be executing.
 
Method Summary
static JobState stateFor(String state)
          Utility function to convert a state text to to the JobState.
static JobState valueOf(String name)
          Returns the enum constant of this type with the specified name.
static JobState[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.state.State
isComplete, isDestroyed, isDone, isException, isIncomplete, isReady, isStoppable
 

Enum Constant Detail

READY

public static final JobState READY
Indicates the job is ready to be executing. The Oddjob Framework will only execute a job which is in this state.


EXECUTING

public static final JobState EXECUTING
Indicates the job is executing.


INCOMPLETE

public static final JobState INCOMPLETE
Indicates the job is not complete. Typically this is not unexpected, for instance a job which looks for a file, and a parent job will re-execute the job again at a later date.


COMPLETE

public static final JobState COMPLETE
Indicates job has completed.


EXCEPTION

public static final JobState EXCEPTION
Indicates an exception has occurred. This is generally recoverable. Such as database failure, disk full etc.


DESTROYED

public static final JobState DESTROYED
The job has been destroyed. It can no longer be used.

Method Detail

values

public static JobState[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (JobState c : JobState.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static JobState valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

stateFor

public static JobState stateFor(String state)
Utility function to convert a state text to to the JobState.

Parameters:
state - Case insensitive text.
Returns:
The corresponding jobState or null if it's invalid.