org.oddjob.state
Enum ServiceState

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

public enum ServiceState
extends Enum<ServiceState>
implements State

Encapsulate the allowed states for a service.

Author:
Rob Gordon

Enum Constant Summary
COMPLETE
          Indicates service has stopped.
DESTROYED
          The service has been destroyed.
EXCEPTION
          Indicates an exception has occurred.
READY
          Indicates the service is ready to be started.
STARTED
          Indicates the service has started and is now available to service requests.
STARTING
          Indicates the service is starting.
 
Method Summary
static ServiceState stateFor(String state)
          Utility function to convert a state text to to the JobState.
static ServiceState valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ServiceState[] 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 ServiceState READY
Indicates the service is ready to be started.


STARTING

public static final ServiceState STARTING
Indicates the service is starting. The execution thread is still in the start method.


STARTED

public static final ServiceState STARTED
Indicates the service has started and is now available to service requests.


COMPLETE

public static final ServiceState COMPLETE
Indicates service has stopped.


EXCEPTION

public static final ServiceState EXCEPTION
Indicates an exception has occurred. This is generally when trying to start the service. But may also happen at other times.


DESTROYED

public static final ServiceState DESTROYED
The service has been destroyed. It can no longer be used.

Method Detail

values

public static ServiceState[] 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 (ServiceState c : ServiceState.values())
    System.out.println(c);

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

valueOf

public static ServiceState 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 ServiceState 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.