Package org.ow2.clif.supervisor.api
Class BladeState
- java.lang.Object
-
- org.ow2.clif.supervisor.api.BladeState
-
- All Implemented Interfaces:
java.io.Serializable
public class BladeState extends java.lang.Object implements java.io.SerializableRepresentation of a blade state and utility methods to determine a global state resulting from individual blades states.- Author:
- Bruno Dillenseger, Joan Chaumont
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static BladeStateABORTEDprotected intcodeinteger value uniquely representing a blade statestatic BladeStateCOMPLETEDstatic BladeStateDEPLOYEDstatic BladeStateDEPLOYINGstatic BladeStateINCOHERENTstatic BladeStateINITIALIZEDstatic BladeStateINITIALIZINGprotected java.lang.Stringlabelan explicit state name (running, stopping, stopped...)static BladeStateNONEstatic BladeStateRESUMINGstatic BladeStateRUNNINGstatic BladeStateSTARTINGstatic BladeStateSTOPPEDstatic BladeStateSTOPPINGstatic BladeStateSUSPENDEDstatic BladeStateSUSPENDINGstatic BladeStateUNDEPLOYED
-
Constructor Summary
Constructors Modifier Constructor Description protectedBladeState(java.lang.String label)Creates a BladeState instance with the provided state label (unique name), and associates a unique code to this object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)equality is based on the state code valuestatic BladeStateget(int code)Gets the blade state instance associated to a state codeintgetCode()Gets the unique code representing this blade state.static BladeStategetGlobalState(java.util.Collection<BladeState> states)Return the global state resulting from some individual states.static booleanisRunning(java.util.Collection<BladeState> states)Determines if the global state resulting from some individual states is "running", i.e.static booleanisStationaryState(java.util.Collection<BladeState> states)Determines if the global state resulting from some individual states is a stationary state or a transitional state.java.lang.StringtoString()Gets the explicit name of this state (e.g.
-
-
-
Field Detail
-
UNDEPLOYED
public static final BladeState UNDEPLOYED
-
DEPLOYING
public static final BladeState DEPLOYING
-
DEPLOYED
public static final BladeState DEPLOYED
-
INITIALIZING
public static final BladeState INITIALIZING
-
INITIALIZED
public static final BladeState INITIALIZED
-
STARTING
public static final BladeState STARTING
-
RUNNING
public static final BladeState RUNNING
-
SUSPENDING
public static final BladeState SUSPENDING
-
SUSPENDED
public static final BladeState SUSPENDED
-
RESUMING
public static final BladeState RESUMING
-
COMPLETED
public static final BladeState COMPLETED
-
STOPPING
public static final BladeState STOPPING
-
STOPPED
public static final BladeState STOPPED
-
ABORTED
public static final BladeState ABORTED
-
INCOHERENT
public static final BladeState INCOHERENT
-
NONE
public static final BladeState NONE
-
code
protected int code
integer value uniquely representing a blade state
-
label
protected transient java.lang.String label
an explicit state name (running, stopping, stopped...)
-
-
Constructor Detail
-
BladeState
protected BladeState(java.lang.String label)
Creates a BladeState instance with the provided state label (unique name), and associates a unique code to this object. Also adds this new instance to an internal instances array, using the unique code as index. Not to be called directly, unless if extending the BladeState class to add other states. Get instances throughget(int)instead.- Parameters:
label- an explicit, and preferably unique and short, name describing this state.
-
-
Method Detail
-
get
public static BladeState get(int code)
Gets the blade state instance associated to a state code- Parameters:
code- the code representing a blade state- Returns:
- the blade state object associated to the provided code. This object is immutable and unique (the same object is always returned by subsequent calls with the same state code).
-
getGlobalState
public static BladeState getGlobalState(java.util.Collection<BladeState> states)
Return the global state resulting from some individual states.- Parameters:
states- individual states.- Returns:
- the state object representing the global state
-
isStationaryState
public static boolean isStationaryState(java.util.Collection<BladeState> states)
Determines if the global state resulting from some individual states is a stationary state or a transitional state.- Parameters:
states- individual states- Returns:
- true if the global state is stationary, false if it is transitional
-
isRunning
public static boolean isRunning(java.util.Collection<BladeState> states)
Determines if the global state resulting from some individual states is "running", i.e. if at least one state is "running" and the others are either running or terminated (stopped, completed or aborted).- Parameters:
states- individual states- Returns:
- true if at least one blade is running and the others are stopped, completed or aborted, false otherwise
-
toString
public java.lang.String toString()
Gets the explicit name of this state (e.g. running, stopped, etc.)- Overrides:
toStringin classjava.lang.Object- Returns:
- this state's explicit name
-
getCode
public int getCode()
Gets the unique code representing this blade state.- Returns:
- the state code
-
equals
public boolean equals(java.lang.Object obj)
equality is based on the state code value- Overrides:
equalsin classjava.lang.Object
-
-