com.ibm.datapower.wamt
Class OperationStatus

java.lang.Object
  extended by com.ibm.datapower.wamt.OperationStatus

public class OperationStatus
extends java.lang.Object

This class defines valid values tracking the operation status of elements such as domains, and containers to hold these values. It also provides helper methods for aggregation of operation status to higher levels (i.e., a single value for a device or managed set). The color mapping for these states could be "up=green", "partial=yellow", "unknown=grey", "down=red".

An OperationStatus has no function. Setting its value does not accomplish anything. The OperationStatus is set by the heartbeat daemon and other tasks that probe the device for the operation status of domains. The OperationStatus is to be used for display only. The manager does not manage the operation status, except for the manually-initiated ability to stop and start domains. The manager only reads the domain status from the device.

Inside the device, individual configuration objects (all the way from domains to match rules and below) have an op-state , which is an abbreviation for "operation state". The two valid values inside the device for the op-state are "enabled" and "disabled". A "disabled" op-state could be caused by manually disabling a configuration object, or it could be caused by error such as a network port conflict or a missing required file resource for a configuration object. The device also provides the op-state setting for a domain - disabling a domain disables all the services in that domain.

AMP provides a way to query the device for the operation status of a domain, which is not the boolean enabled/disabled op-state of the domain configuration object itself, but instead is a rollup of the op-states of all the services in the domain - this means that the rollup of all the services could result in a non-boolean value such as "partial".

Although the device native op-state can refer to any configuration object, the OperationStatus refers only to domains. OperationStatus does not apply to firmware or settings.

This class will be used both by the clientAPI (task-level API) and the device communication layer (AMP). Consumers of the clientAPI should treat these objects as read-only, and invoke only the gettr methods. The only threads to call the settr methods should be internal threads.


Nested Class Summary
static class OperationStatus.Enumerated
          This holds the enumerated values that are allowed to be used with OperationStatus.
 
Field Summary
static java.lang.String COPYRIGHT_2009_2013
           
 
Constructor Summary
OperationStatus(OperationStatus.Enumerated currentStatus)
          Create a status object that can hold an enumerated state.
 
Method Summary
 java.lang.String getDisplayName()
          Get a human-readable name that represents the current OperationStatus object.
 java.lang.String getDisplayName(java.util.Locale locale)
          Get a human-readable name that represents the current OperationStatus object.
 java.lang.String getDisplayNameKey()
          Get a key that represents the description of the current OperationStatus object.
 OperationStatus.Enumerated getEnumerated()
          Retrieve the enumerated current status.
 boolean isDown()
          Since the status can be one of four values, this method checks if the status has the "down" value.
 boolean isPartiallyUp()
          Since the status can be one of four values, this method checks if the status has the enumerated "partial" value.
 boolean isUnknown()
          Since the status can be one of four values, this method checks if the status has the enumerated "unknown" value.
 boolean isUp()
          Since the status can be one of four values, this method checks if the status has the enumerated "up" value.
 void rollupFrom(OperationStatus[] lowerLevelStati)
          This contains the logic to walk through multiple lower-level status values to determine what the aggregated higher-level status value is.
 void setStatus(OperationStatus.Enumerated newStatus)
          Set the value of this status object to the new enumerated value.
static OperationStatus[] toOperationStatusArray(java.util.Collection operationStatusCollection)
          Convert a collection to an array.
 java.lang.String toString()
          Get a String representation of this object for the purpose of debugging or tracing or for a user interface.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT_2009_2013

public static final java.lang.String COPYRIGHT_2009_2013
See Also:
Constant Field Values
Constructor Detail

OperationStatus

public OperationStatus(OperationStatus.Enumerated currentStatus)
Create a status object that can hold an enumerated state. There are a finite/constrined set of enumerated state singletons, but you can create an inifinite number of objects to hold the state value.

Parameters:
currentStatus - the enumerated current status.
Method Detail

setStatus

public void setStatus(OperationStatus.Enumerated newStatus)
Set the value of this status object to the new enumerated value. This should be called only by threads internal to the manager. It has the public access modifier because it needs to be invoked from multiple packages.

Parameters:
newStatus - the enumerated new status

getEnumerated

public OperationStatus.Enumerated getEnumerated()
Retrieve the enumerated current status.

Returns:
the enumerated current status.

isUp

public boolean isUp()
Since the status can be one of four values, this method checks if the status has the enumerated "up" value.

Returns:
true if the status is "up", false otherwise
See Also:
isPartiallyUp(), isDown(), isUnknown()

isPartiallyUp

public boolean isPartiallyUp()
Since the status can be one of four values, this method checks if the status has the enumerated "partial" value.

Returns:
true if the status is "partial", false otherwise
See Also:
isUp(), isDown(), isUnknown()

isUnknown

public boolean isUnknown()
Since the status can be one of four values, this method checks if the status has the enumerated "unknown" value.

Returns:
true if the status is "unknown", false otherwise
See Also:
isUp(), isDown(), isPartiallyUp()

isDown

public boolean isDown()
Since the status can be one of four values, this method checks if the status has the "down" value.

Returns:
true if the status is "down", false otherwise
See Also:
isUp(), isPartiallyUp(), isUnknown()

rollupFrom

public void rollupFrom(OperationStatus[] lowerLevelStati)
This contains the logic to walk through multiple lower-level status values to determine what the aggregated higher-level status value is. The "this" object is where the aggregated higher-level status is stored.

A bottom-level element will have status of either up or down or unknown. A higher-level status is defined as an aggregation of multiple lower-level status items. If all the lower-level status are "up", then the higher-level status is "up" also. If all the lower-level status are "down", then the higher-level status is "down" also. If all the lower-level status are "unknown", then the higher-level status is also "unknown". If there is a mix of "up" and "down" and possibly "unknown" status in the lower-level, then the higher-level status is "partial". The color mapping for these states could be "up=green", "partial=yellow", "unknown=grey", "down=red".

Parameters:
lowerLevelStati - the lower-level status items to merge into the aggregated higher-level status that the this object represents.

toOperationStatusArray

public static OperationStatus[] toOperationStatusArray(java.util.Collection operationStatusCollection)
Convert a collection to an array. Since the rollupFrom(OperationStatus[]) method takes an array as a parameter, this method may be helpful for converting from an intermediate collection to a type which you can call that method.

Parameters:
operationStatusCollection - a collection that contains OperationStatus objects.
Returns:
an array of OperationStatus objects.

toString

public java.lang.String toString()
Get a String representation of this object for the purpose of debugging or tracing or for a user interface.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this object for the purpose of debugging or tracing or for a user interface.

getDisplayNameKey

public java.lang.String getDisplayNameKey()
Get a key that represents the description of the current OperationStatus object. This key may be used in nls enabled user interfaces.

Returns:
a key that represents the human-readable string that describes this object.

getDisplayName

public java.lang.String getDisplayName()
Get a human-readable name that represents the current OperationStatus object. This name may be used in user interfaces.

Returns:
a human-readable name that represents this object.

getDisplayName

public java.lang.String getDisplayName(java.util.Locale locale)
Get a human-readable name that represents the current OperationStatus object. This name may be used in user interfaces.

Parameters:
locale - The locale to be used in getting the human-readable name
Returns:
a human-readable name that represents this object.


© Copyright IBM Corp. 2006, 2010 All Rights Reserved.