com.tivoli.twg.engine
Class TWGManagedObjectStatusSet

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGPersistentObject
          extended bycom.tivoli.twg.engine.TWGManagedObjectStatusSet
All Implemented Interfaces:
TWGBaseShadowedObject, TWGDeltaShadow, TWGGetSetDescInterface, TWGGetSetInterface, TWGShadowedObject

public class TWGManagedObjectStatusSet
extends TWGPersistentObject
implements TWGShadowedObject, TWGDeltaShadow, TWGGetSetDescInterface

Persistent object for tracking association of managed objects with a given status definition in a given status set definition.


Field Summary
 
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject
CLASS_NAME, SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT
 
Constructor Summary
TWGManagedObjectStatusSet()
          Default constructor - used during restore only
TWGManagedObjectStatusSet(java.lang.String grp_id, java.lang.String stat_id)
          Status set constructor
 
Method Summary
static boolean clearManagedObjectStatus(long moid, java.lang.String grp_id, java.lang.String stat_id, boolean is_persist)
          Disassociate managed object with given status within given status group
static boolean clearManagedObjectStatus(LongValueSet moids, java.lang.String grp_id, java.lang.String stat_id, boolean set_persist, boolean set_nonpersist)
          Disassociate managed objects with given status within given status group
 void Delete()
          Handle delete of object
static TWGManagedObjectStatusSet findStatusSet(java.lang.String status_key)
          Find status set for given status key (group ID/status ID)
static TWGManagedObjectStatusSet findStatusSet(java.lang.String status_group, java.lang.String status)
          Find status set for given status group ID and status ID
static java.util.Collection getAllStatusSets()
          Get all defined status sets
 java.lang.String getAttributeDescription(java.lang.String id, java.util.Locale loc)
          Get description string for given attribute in given locale
 java.lang.String[] getAttributeIDList()
          Attribute ID enumeration : this method is expected to return a List of strings containing the String names of the attributes supported for a given object.
 int getAttributeType(java.lang.String id)
          Get type of attribute value for given attribute
 DataValue getAttributeValue(java.lang.String id, java.util.Locale loc)
          Get value of attribute with given ID
 java.lang.String getAttributeValueString(java.lang.String id, java.util.Locale loc)
          Get descriptive value string for given attribute in given locale
 java.lang.String GetConShadowClass()
          Get name of console shadow class.
 byte[] GetDeltaShadowRecord(java.util.Locale locale, long since_ver)
          Get buffer containing value delta since requested version stamp of the shadowed attributes to be delivered to the console shadow class.
 LongValueSet getManagedObjectIDs()
          Get reference to value set containing managed object IDs which have this status associated with them.
 byte[] GetShadowRecord(java.util.Locale locale)
          Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class.
 long GetShadowVersion()
          Get object state version.
 java.lang.String getStatusGroupID()
          Get status group ID
 java.lang.String getStatusID()
          Get status ID
 boolean isObjectAssociatedWithStatusSet(long moid)
          Test if given object is associated with status set
static void removeManagedObjectFromAllSets(TWGManagedObject twgmo)
          Clean up all associations to a given managed object
protected  void restoreData(TWGPersistentObjectDictionary dictionary, boolean resolveObjectReferences)
          Method for restoring persistent object data.
protected  void saveData(TWGPersistentObjectDictionary dictionary)
          Method for saving persistent object data.
 boolean setAttributeValue(java.lang.String id, DataValue val)
          Set value of attribute with given ID
static boolean setManagedObjectStatus(long moid, java.lang.String grp_id, java.lang.String stat_id, boolean is_persist)
          Associate managed object with given status in given status group
static boolean setManagedObjectStatus(LongValueSet moids, java.lang.String grp_id, java.lang.String stat_id, boolean set_persist, boolean set_nonpersist)
          Associate managed objects in set with given status in given status group
 LongValueSet testIDsForMembership(LongValueSet oids)
          Test given object IDs to see if any are in status set.
 void UpdateShadowVersion()
          Update object state version.
 
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject
Destroy, enableAsyncWrites, fromPersistID, initialize, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID, SetObjectID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGManagedObjectStatusSet

public TWGManagedObjectStatusSet()
Default constructor - used during restore only


TWGManagedObjectStatusSet

public TWGManagedObjectStatusSet(java.lang.String grp_id,
                                 java.lang.String stat_id)
Status set constructor

Parameters:
grp_id - - token ID for status group
stat_id - - token ID for status within status group
Method Detail

Delete

public void Delete()
Handle delete of object

Overrides:
Delete in class TWGObject

saveData

protected void saveData(TWGPersistentObjectDictionary dictionary)
                 throws TWGPersistentObjectSaveException
Method for saving persistent object data.

Overrides:
saveData in class TWGPersistentObject
Throws:
TWGPersistentObjectSaveException - thrown to abort save procedure.

restoreData

protected void restoreData(TWGPersistentObjectDictionary dictionary,
                           boolean resolveObjectReferences)
                    throws TWGPersistentObjectRestoreException
Method for restoring persistent object data.

Overrides:
restoreData in class TWGPersistentObject
Parameters:
resolveObjectReferences - used to indicate if object references should be resolved during restore.
Throws:
TWGPersistentObjectRestoreException - thrown to abort restore procedure.

setManagedObjectStatus

public static boolean setManagedObjectStatus(long moid,
                                             java.lang.String grp_id,
                                             java.lang.String stat_id,
                                             boolean is_persist)
                                      throws TWGPersistentObjectSaveException,
                                             InvalidObjectIDException
Associate managed object with given status in given status group

Parameters:
moid - - managed object ID to be associated with given status
grp_id - - token ID of status group
stat_id - - token ID of status within status group
is_persist - - true if persistent setting, false if transient (lost on restart)
Returns:
true if association added, false if already defined
Throws:
TWGPersistentObjectSaveException - if error saving update
InvalidObjectIDException - if bad status set or definition ID

setManagedObjectStatus

public static boolean setManagedObjectStatus(LongValueSet moids,
                                             java.lang.String grp_id,
                                             java.lang.String stat_id,
                                             boolean set_persist,
                                             boolean set_nonpersist)
                                      throws TWGPersistentObjectSaveException,
                                             InvalidObjectIDException
Associate managed objects in set with given status in given status group

Parameters:
moids - - managed object IDs to be associated with given status
grp_id - - token ID of status group
stat_id - - token ID of status within status group
set_persist - - true if persistent setting should be done
set_nonpersist - - true if nonpersistent setting should be done
Returns:
true if association added, false if already defined
Throws:
TWGPersistentObjectSaveException - if error saving update
InvalidObjectIDException - if bad status set or definition ID

clearManagedObjectStatus

public static boolean clearManagedObjectStatus(long moid,
                                               java.lang.String grp_id,
                                               java.lang.String stat_id,
                                               boolean is_persist)
                                        throws TWGPersistentObjectSaveException,
                                               InvalidObjectIDException
Disassociate managed object with given status within given status group

Parameters:
moid - - managed object ID to be disassociated with given status
grp_id - - token ID of status group
stat_id - - token ID of status within status group
is_persist - - true if persistent setting, false if transient (lost on restart)
Returns:
true if association removed, false if already removed
Throws:
TWGPersistentObjectSaveException - if error saving update
InvalidObjectIDException - if bad status set or definition ID

clearManagedObjectStatus

public static boolean clearManagedObjectStatus(LongValueSet moids,
                                               java.lang.String grp_id,
                                               java.lang.String stat_id,
                                               boolean set_persist,
                                               boolean set_nonpersist)
                                        throws TWGPersistentObjectSaveException,
                                               InvalidObjectIDException
Disassociate managed objects with given status within given status group

Parameters:
moids - - managed object set to be disassociated with given status
grp_id - - token ID of status group
stat_id - - token ID of status within status group
set_persist - - true if persistent setting
set_nonpersist - - true if nonpersistent setting
Returns:
true if association removed, false if already removed
Throws:
TWGPersistentObjectSaveException - if error saving update
InvalidObjectIDException - if bad status set or definition ID

UpdateShadowVersion

public void UpdateShadowVersion()
Update object state version. This method must call the TWGActiveConsole.nextShadowVersion() to update its internal state_version attribute (a 'long' instance variable). This method should be called by any methods of the object's class or subclasses which modify attributes which are send to the shadow objects on the console).

Specified by:
UpdateShadowVersion in interface TWGBaseShadowedObject

GetShadowVersion

public long GetShadowVersion()
Get object state version. This returns value of state_version.

Specified by:
GetShadowVersion in interface TWGBaseShadowedObject
Returns:
state_version attribute value

GetConShadowClass

public java.lang.String GetConShadowClass()
Get name of console shadow class. This returns the name of TWGConObject subclass which is used to hold the attributes shadowed to the console.

Specified by:
GetConShadowClass in interface TWGBaseShadowedObject
Returns:
com.tivoli.twg.engine.TWGConObject subclass which object shadows to

GetShadowRecord

public byte[] GetShadowRecord(java.util.Locale locale)
Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class. This data is delivered along with the ObjectID (so the ObjectID shouldn't be included in the shadowed data record).

Specified by:
GetShadowRecord in interface TWGBaseShadowedObject
Parameters:
locale - - Locale of requested data
Returns:
byte array containing opaque data representation of attribute values to be delivered to the console shadow class.

GetDeltaShadowRecord

public byte[] GetDeltaShadowRecord(java.util.Locale locale,
                                   long since_ver)
Get buffer containing value delta since requested version stamp of the shadowed attributes to be delivered to the console shadow class. This data is delivered along with the ObjectID (so the ObjectID shouldn't be included in the shadowed data record). If this interface is implemented, the GetShadowRecord() method implemented for the TWGBaseShadowedObject interface must be modified to call the GetDeltaShadowRecord() method with a since_ver setting of 0.

Specified by:
GetDeltaShadowRecord in interface TWGDeltaShadow
Parameters:
locale - - Locale requested (for any locale-specific content)
since_ver - - Version to be used as basis for delta (the version currently possessed by the caller).
Returns:
byte array containing opaque data representation of attribute values to be delivered to the console shadow class.

testIDsForMembership

public LongValueSet testIDsForMembership(LongValueSet oids)
Test given object IDs to see if any are in status set. Return set containing all which are in set.

Parameters:
oids - - object IDs to be tested
Returns:
set of matching oids

findStatusSet

public static TWGManagedObjectStatusSet findStatusSet(java.lang.String status_group,
                                                      java.lang.String status)
Find status set for given status group ID and status ID

Parameters:
status_group - - ID of status group
status - - ID of status in set
Returns:
set found, or null if not found

findStatusSet

public static TWGManagedObjectStatusSet findStatusSet(java.lang.String status_key)
Find status set for given status key (group ID/status ID)

Parameters:
status_key - - status key (group ID/status ID)
Returns:
set found, or null if not found

removeManagedObjectFromAllSets

public static void removeManagedObjectFromAllSets(TWGManagedObject twgmo)
Clean up all associations to a given managed object

Parameters:
twgmo - - managed object to be removed

getAllStatusSets

public static java.util.Collection getAllStatusSets()
Get all defined status sets

Returns:
collection of all status sets (not modifiable)

getManagedObjectIDs

public LongValueSet getManagedObjectIDs()
Get reference to value set containing managed object IDs which have this status associated with them.

Returns:
managed object IDs value set

getStatusGroupID

public java.lang.String getStatusGroupID()
Get status group ID

Returns:
status group ID

getStatusID

public java.lang.String getStatusID()
Get status ID

Returns:
status ID

isObjectAssociatedWithStatusSet

public boolean isObjectAssociatedWithStatusSet(long moid)
Test if given object is associated with status set

Parameters:
moid - - object ID
Returns:
true if associated, false if not

getAttributeIDList

public java.lang.String[] getAttributeIDList()
Attribute ID enumeration : this method is expected to return a List of strings containing the String names of the attributes supported for a given object. Subclasses of base classes implementing the interface should report additional attributes by adding them to the list returned by the base class.

Specified by:
getAttributeIDList in interface TWGGetSetInterface

getAttributeValue

public DataValue getAttributeValue(java.lang.String id,
                                   java.util.Locale loc)
Get value of attribute with given ID

Specified by:
getAttributeValue in interface TWGGetSetInterface
Parameters:
id - - attribute ID requested
loc - - locale to use for value, if applicable
Returns:
value object, or null if no value

setAttributeValue

public boolean setAttributeValue(java.lang.String id,
                                 DataValue val)
Set value of attribute with given ID

Specified by:
setAttributeValue in interface TWGGetSetInterface
Parameters:
id - - attribute ID to be set
val - - attribute value to be set
Returns:
true if set successful, false if not successful

getAttributeType

public int getAttributeType(java.lang.String id)
Get type of attribute value for given attribute

Specified by:
getAttributeType in interface TWGGetSetInterface
Parameters:
id - - attribute ID
Returns:
DataValue type of attribute, or DataValue.NONE_TYPE if undefined

getAttributeDescription

public java.lang.String getAttributeDescription(java.lang.String id,
                                                java.util.Locale loc)
Get description string for given attribute in given locale

Specified by:
getAttributeDescription in interface TWGGetSetDescInterface
Parameters:
id - - attribute ID
loc - - locale to use for description
Returns:
description string, or null if not available

getAttributeValueString

public java.lang.String getAttributeValueString(java.lang.String id,
                                                java.util.Locale loc)
Get descriptive value string for given attribute in given locale

Specified by:
getAttributeValueString in interface TWGGetSetDescInterface
Parameters:
id - - attribute ID
loc - - locale to use for description
Returns:
descriptive string for attribute value, or null if not available