Package com.sas.services

# Class ServiceState

java.lang.Object
com.sas.services.ServiceState

All Implemented Interfaces:
  `Serializable`

public class ServiceState extends Object implements Serializable
A service's state.

When a service is first instantiated it will be in a `SERVICE_STATE_UNINITIALIZED` state. Once the service has been initialized and is ready for use it transitions to a state of `SERVICE_STATE_INITIALIZED`.

Should the service need to be deactivated it will transition to a state of `SERVICE_STATE_DEACTIVATED`. This may occur if the service needs to go offline while it is being reconfigured or if the service is no longer available. In the reconfiguration case the service will transition back to a state of `SERVICE_STATE_INITIALIZED` once its ready to resume services.

Since:
  1.0
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final short`
  `SERVICE_STATE_DEACTIVATED`
  Service state: deactivated The service has been deactivated and is not currently available for use.
  `static final short`
  `SERVICE_STATE_INITIALIZED`
  Service state: initialized The service has been initialized and is ready for use.
  `static final short`
  `SERVICE_STATE_UNINITIALIZED`
  Service state: uninitialized The service is uninitialized and should not be used.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServiceState()`
  Constructs a default instance.
  `ServiceState(short serviceState)`
  Constructs an instance using the specified service state.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final String`
  `getDescription()`
  Gets a description of the service state.
  `static final String`
  `getDescriptionForState(short serviceState)`
  Gets a description of the specified service state.
  `final short`
  `getServiceState()`
  Gets the current state of the service.
  `static final boolean`
  `isStateDeactivated(short serviceState)`
  Determines whether or not the state of the specified service is `SERVICE_STATE_DEACTIVATED`.
  `static final boolean`
  `isStateInitialized(short serviceState)`
  Determines whether or not the state of the specified service is `SERVICE_STATE_INITIALIZED`.
  `static final boolean`
  `isStateUninitialized(short serviceState)`
  Determines whether or not the state of the specified service is `SERVICE_STATE_UNINITIALIZED`.
  `final void`
  `setServiceState(short serviceState)`
  Sets the state of the service.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SERVICE_STATE_UNINITIALIZED

    public static final short SERVICE_STATE_UNINITIALIZED
    Service state: uninitialized The service is uninitialized and should not be used.
    See Also:
      - `SERVICE_STATE_INITIALIZED`
      - `SERVICE_STATE_DEACTIVATED`
      - Constant Field Values

  - ### SERVICE_STATE_INITIALIZED

    public static final short SERVICE_STATE_INITIALIZED
    Service state: initialized The service has been initialized and is ready for use.
    See Also:
      - `SERVICE_STATE_UNINITIALIZED`
      - `SERVICE_STATE_DEACTIVATED`
      - Constant Field Values

  - ### SERVICE_STATE_DEACTIVATED

    public static final short SERVICE_STATE_DEACTIVATED
    Service state: deactivated The service has been deactivated and is not currently available for use. This may occur if a service is being reconfigured or if the service has been destroyed.
    See Also:
      - `SERVICE_STATE_UNINITIALIZED`
      - `SERVICE_STATE_INITIALIZED`
      - Constant Field Values

- ## Constructor Details

  - ### ServiceState

    public ServiceState()
    Constructs a default instance.

  - ### ServiceState

    public ServiceState(short serviceState) throws ServiceException
    Constructs an instance using the specified service state.
    Parameters:
      `serviceState` - Service's state.
    Throws:
      `ServiceException` - if an invalid state is specified.

- ## Method Details

  - ### getServiceState

    public final short getServiceState()
    Gets the current state of the service. The state will be one of
    - SERVICE_STATE_UNINITIALIZED
    - SERVICE_STATE_INITIALIZED
    - SERVICE_STATE_DEACTIVATED
    Returns:
      Service's state.

  - ### setServiceState

    public final void setServiceState(short serviceState) throws ServiceException
    Sets the state of the service. The state must be one of
    - SERVICE_STATE_UNINITIALIZED
    - SERVICE_STATE_INITIALIZED
    - SERVICE_STATE_DEACTIVATED
    Parameters:
      `serviceState` - Service's state.
    Throws:
      `ServiceException` - if an invalid service state is specified.

  - ### getDescription

    public final String getDescription()
    Gets a description of the service state.
    Returns:
      Description of the service state.

  - ### isStateUninitialized

    public static final boolean isStateUninitialized(short serviceState)
    Determines whether or not the state of the specified service is `SERVICE_STATE_UNINITIALIZED`.
    Parameters:
      `serviceState` - A service state which will be compared for equality to the uninitialized state.
    Returns:
      `true` if the service is uninitialized or `false` if it isn't.

  - ### isStateInitialized

    public static final boolean isStateInitialized(short serviceState)
    Determines whether or not the state of the specified service is `SERVICE_STATE_INITIALIZED`.
    Parameters:
      `serviceState` - A service state which will be compared for equality to the initialized state.
    Returns:
      `true` if the service is initialized or `false` if it isn't.

  - ### isStateDeactivated

    public static final boolean isStateDeactivated(short serviceState)
    Determines whether or not the state of the specified service is `SERVICE_STATE_DEACTIVATED`.
    Parameters:
      `serviceState` - A service state which will be compared for equality to the deactivated state.
    Returns:
      `true` if the service is deactivated or `false` if it isn't.

  - ### getDescriptionForState

    public static final String getDescriptionForState(short serviceState) throws IllegalArgumentException
    Gets a description of the specified service state.
    Parameters:
      `serviceState` - The state for which a description is desired.
    Returns:
      Description for the specified service state.
    Throws:
      `IllegalArgumentException` - if an invalid service state is specified.