com.tivoli.twg.engine
Class TWGObject

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
Direct Known Subclasses:
TWGActiveConsole, TWGExtension, TWGManagedObjectSet, TWGPersistentObject, TWGPopupEvent, TWGRelationship, TWGRelationshipSet, TWGTaskActivation

public class TWGObject
extends java.lang.Object

Base class for engine objects (both non-persistent and persistent). Primary purpose is to generate a unique object ID and add the object to a global hask table.


Constructor Summary
TWGObject()
          Constructor for TWGObject: assign new ID and add object to hash table
TWGObject(boolean do_insert)
          Constructor for TWGObject: if insert requested, assign new ID and add object to hash table, if not, object ID is invalid.
 
Method Summary
static java.util.Enumeration AllObjects()
          Enumerate all TWGObjects
static java.util.Enumeration AllObjects(java.lang.Class cls)
          Enumerate all TWGObject instances derived from a given class.
 void Delete()
          Delete the object (without deleting any persistent state).
 void Destroy()
          Destroy a TWGObject.
static void DumpTWGObjects()
          Dump list of all TWGObject instances (debug)
static TWGObject FindObject(long oid)
          Find object, given an object ID
 boolean isDeleted()
          Test if object is deleted object
 boolean isNewObject()
          Test if object is new object (doesn't have a valid object ID yet)
 boolean isPersistent()
          Test if object is persistent object
static boolean isPersistent(long oid)
          Test if object is persistent object ID
 boolean isValid()
          Test if object has valid object ID
static boolean isValid(long oid)
          Test if object has valid object ID
 long ObjectID()
          Return the object ID
 long setDistinctObjectID()
          Assign distinct initial dynamic object ID : used for making non-persistent objects constructed with the TWGObject(false) constructor valid.
 void SetObjectID(long oid)
          Change the object ID to a new value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGObject

public TWGObject(boolean do_insert)
Constructor for TWGObject: if insert requested, assign new ID and add object to hash table, if not, object ID is invalid.

Parameters:
do_insert - - if true, insert in hash table, else do not

TWGObject

public TWGObject()
Constructor for TWGObject: assign new ID and add object to hash table

Method Detail

Delete

public void Delete()
Delete the object (without deleting any persistent state). Subclasses should override this method in order to add any code necessary to "disconnect" the object from any data structures, and then call the super.Delete() method at the end. The base Delete() method sets the ObjectID() to DELETED_OBJECT_ID using the SetObjectID(), so any logic which manages object inclusion in data structures through subclassing this method doesn't need to be repeated.


Destroy

public void Destroy()
             throws TWGObjectDestroyException
Destroy a TWGObject. This method is used to destroy an object, both in a runtime sense and in a persistent sense. The base version of Destroy() calls Delete(), so subclasses only need to add code needed to delete persistent characteristics of the object (which should not have been deleted by Delete()). Any override of Destroy() should call super.Destroy() after they've completed their actions.

Throws:
TWGObjectDestroyException - if error during destroy

ObjectID

public long ObjectID()
              throws InvalidObjectIDException
Return the object ID

Returns:
the object ID of the TWGObject instance
Throws:
InvalidObjectIDException - if object ID is not valid

SetObjectID

public void SetObjectID(long oid)
                 throws DuplicateObjectIDException
Change the object ID to a new value

Parameters:
oid - - new object ID value
Throws:
DuplicateObjectIDException - if ID is duplicate

FindObject

public static TWGObject FindObject(long oid)
Find object, given an object ID

Parameters:
oid - - object ID of object to find
Returns:
TWGObject reference found, or null if not found

isValid

public final boolean isValid()
Test if object has valid object ID

Returns:
true if valid, false if not

isValid

public static final boolean isValid(long oid)
Test if object has valid object ID

Parameters:
oid - - object ID to be tested
Returns:
true if valid, false if not

isPersistent

public final boolean isPersistent()
Test if object is persistent object

Returns:
true if persistent, false if not

isPersistent

public static final boolean isPersistent(long oid)
Test if object is persistent object ID

Parameters:
oid - - object ID to be tested
Returns:
true if persistent, false if not

isDeleted

public final boolean isDeleted()
Test if object is deleted object

Returns:
true if deleted, false if not

isNewObject

public final boolean isNewObject()
Test if object is new object (doesn't have a valid object ID yet)

Returns:
true if new, false if not

AllObjects

public static java.util.Enumeration AllObjects(java.lang.Class cls)
Enumerate all TWGObject instances derived from a given class.

Parameters:
cls - - class to be scanned for
Returns:
Enumeration for all matching TWGObject instances

AllObjects

public static java.util.Enumeration AllObjects()
Enumerate all TWGObjects

Returns:
Enumeration for all TWGObject instances

DumpTWGObjects

public static void DumpTWGObjects()
Dump list of all TWGObject instances (debug)


setDistinctObjectID

public long setDistinctObjectID()
Assign distinct initial dynamic object ID : used for making non-persistent objects constructed with the TWGObject(false) constructor valid.