javax.slee.management
Class ServiceState

java.lang.Object
  |
  +--javax.slee.management.ServiceState
All Implemented Interfaces:
java.io.Serializable

public final class ServiceState
extends java.lang.Object
implements java.io.Serializable

This class defines an enumerated type that encapsulates the state of a Service.

A singleton instance of each enumerated value is guaranteed (via an implementation of readResolve() - refer java.io.Serializable), so that equality tests using == are always evaluated correctly. (This equality test is only guaranteed if this class is loaded in the application's boot class path, rather than dynamically loaded at runtime.)

See Also:
Serialized Form

Field Summary
static ServiceState ACTIVE
          The ACTIVE state indicates that the Service has been activated.
static ServiceState INACTIVE
          The INACTIVE state indicates that the Service has been successfully installed.
static int SERVICE_ACTIVE
          An integer representation of the ACTIVE state.
static int SERVICE_INACTIVE
          An integer representation of the INACTIVE state.
static int SERVICE_STOPPING
          An integer representation of the STOPPING state.
static ServiceState STOPPING
          The STOPPING state indicates that an active Service has been deactivated, but some instances of the Service are still running.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this Service state for equality with another.
static ServiceState fromInt(int state)
          Get a ServiceState object from an integer value.
 int hashCode()
          Get a hash code value for this Service state.
 boolean isActive()
          Determine if this ServiceState object represents the ACTIVE state of a Service.
 boolean isInactive()
          Determine if this ServiceState object represents the INACTIVE state of a Service.
 boolean isStopping()
          Determine if this ServiceState object represents the STOPPING state of a Service.
 int toInt()
          Get an integer value representation for this ServiceState object.
 java.lang.String toString()
          Get the textual representation of this Service state object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SERVICE_INACTIVE

public static final int SERVICE_INACTIVE
An integer representation of the INACTIVE state.

SERVICE_ACTIVE

public static final int SERVICE_ACTIVE
An integer representation of the ACTIVE state.

SERVICE_STOPPING

public static final int SERVICE_STOPPING
An integer representation of the STOPPING state.

INACTIVE

public static final ServiceState INACTIVE
The INACTIVE state indicates that the Service has been successfully installed. All required files and parameters have been set up, so that the Service may be activated, but it is currently not running. (This means that instances of the Service are not consuming memory or CPU resources.)

ACTIVE

public static final ServiceState ACTIVE
The ACTIVE state indicates that the Service has been activated. In this state, instances of the Service are created by the SLEE's event routing subsystem in response to initial events, and the Service instances are invoked to respond to events.

STOPPING

public static final ServiceState STOPPING
The STOPPING state indicates that an active Service has been deactivated, but some instances of the Service are still running. Once all Service instances have finished running, the Service state spontaneously returns to the INACTIVE state.
Method Detail

fromInt

public static ServiceState fromInt(int state)
                            throws java.lang.IllegalArgumentException
Get a ServiceState object from an integer value.
Parameters:
state - the state as an integer.
Returns:
a ServiceState object corresponding to state.
Throws:
java.lang.IllegalArgumentException - if state is not a valid state value.

toInt

public int toInt()
Get an integer value representation for this ServiceState object.
Returns:
an integer value representation for this ServiceState object.

isInactive

public boolean isInactive()
Determine if this ServiceState object represents the INACTIVE state of a Service.

This method is effectively equivalent to the conditional test: (this == INACTIVE), ie. the code:

    if (state.isInactive()) ...

is interchangeable with the code:

   if (state == ServiceState.INACTIVE) ...

Returns:
true if this object represents the INACTIVE state of a Service, false otherwise.

isActive

public boolean isActive()
Determine if this ServiceState object represents the ACTIVE state of a Service.

This method is effectively equivalent to the conditional test: (this == ACTIVE), ie. the code:

    if (state.isActive()) ...

is interchangeable with the code:

   if (state == ServiceState.ACTIVE) ...

Returns:
true if this object represents the ACTIVE state of a Service, false otherwise.

isStopping

public boolean isStopping()
Determine if this ServiceState object represents the STOPPING state of a Service.

This method is effectively equivalent to the conditional test: (this == STOPPING), ie. the code:

    if (state.isStopping()) ...

is interchangeable with the code:

   if (state == ServiceState.STOPPING) ...

Returns:
true if this object represents the STOPPING state of a Service, false otherwise.

equals

public boolean equals(java.lang.Object obj)
Compare this Service state for equality with another.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is an instance of this class representing the same Service state as this, false otherwise.

hashCode

public int hashCode()
Get a hash code value for this Service state.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value.

toString

public java.lang.String toString()
Get the textual representation of this Service state object.
Overrides:
toString in class java.lang.Object
Returns:
the textual representation of this Service state object.