org.apache.xbean.kernel
Class ServiceState

java.lang.Object
  extended by org.apache.xbean.kernel.ServiceState
All Implemented Interfaces:
Serializable

public final class ServiceState
extends Object
implements Serializable

The state of services within the Kernel. The state model is directly adapted from the J2EE Management Specification (JSR 77) with the removal of the FAILED state.

Since:
2.0
Author:
Dain Sundstrom
See Also:
Serialized Form

Field Summary
static ServiceState RUNNING
          This state indicates that the service is in the normal operational state.
static ServiceState STARTING
          This state indicates that the service is attempting to start but has not fully started yet.
static ServiceState STOPPED
          This state indicates that the service is stopped and not operational.
static ServiceState STOPPING
          This state indicates that the service is attempting to stop but has not fully stopped yet.
 
Method Summary
 int getIndex()
          Gets the unique index of this state.
 String getName()
          The unique name of this state.
static ServiceState getServiceState(int state)
          Converts the state index into corresponding state name.
static ServiceState parseServiceState(String state)
          Converts the state name in the corresponding state index.
 String toString()
          Returns the name of this state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STARTING

public static final ServiceState STARTING
This state indicates that the service is attempting to start but has not fully started yet. Normally, a service in this state is waiting for a required service to enter the RUNNING state.


RUNNING

public static final ServiceState RUNNING
This state indicates that the service is in the normal operational state.


STOPPING

public static final ServiceState STOPPING
This state indicates that the service is attempting to stop but has not fully stopped yet. Normally, a service in this state because another service is still usind this service.


STOPPED

public static final ServiceState STOPPED
This state indicates that the service is stopped and not operational.

Method Detail

getServiceState

public static ServiceState getServiceState(int state)
                                    throws IllegalArgumentException
Converts the state index into corresponding state name.

Parameters:
state - the state index
Returns:
the name of the state
Throws:
IllegalArgumentException - if the state index is not 0, 1, 2 or 3

parseServiceState

public static ServiceState parseServiceState(String state)
Converts the state name in the corresponding state index. This method performs a case insensitive comparison.

Parameters:
state - the state name
Returns:
the state index
Throws:
IllegalArgumentException - if the state index is not STARTING, RUNNING, STOPPING or FAILED

getIndex

public int getIndex()
Gets the unique index of this state. This index can be be used to retrieve this state instance using the getServiceState(int) method.

Returns:
the unique index of this state

getName

public String getName()
The unique name of this state. This uppercase name can be used to retrieve this state instance using the parseServiceState(String).

Returns:
the unique name of this state

toString

public String toString()
Returns the name of this state.

Overrides:
toString in class Object
Returns:
the unique name of this state


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.