com.tivoli.twg.engine
Class TWGPersistentObject

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGPersistentObject
Direct Known Subclasses:
TWGAssociation, TWGConfigPanelBeans, TWGContentInfoBeans, TWGDatabase, TWGDatabaseQuery, TWGDatabaseTable, TWGDistConfigRecordDef, TWGFilter, TWGFilterFactory, TWGImageSet, TWGManagedObject, TWGManagedObjectFactory, TWGManagedObjectStatusGroup, TWGManagedObjectStatusSet, TWGPrivToken, TWGTask, TWGUser

public class TWGPersistentObject
extends TWGObject

Base class for persistent objects.


Field Summary
static java.lang.String CLASS_NAME
           
static int SIZEOF_BYTE
           
static int SIZEOF_CHAR
           
static int SIZEOF_DOUBLE
           
static int SIZEOF_FLOAT
           
static int SIZEOF_INT
           
static int SIZEOF_LONG
           
static int SIZEOF_SHORT
           
 
Constructor Summary
TWGPersistentObject()
          default constructor (required by newInstance() method of Class).
 
Method Summary
 void Destroy()
          Destroy a TWGPersistentObject.
static boolean enableAsyncWrites(boolean enable)
          Enable asynch writes
static long fromPersistID(int identifier)
          Convert persistent object identifier (int) to object identifier (long).
static void initialize()
          class initializer.
static boolean isNewPersistentStore()
          Test to see if persistent object store is new (i.e.
 boolean isSaveRequired()
          method for determining if save required.
 int PersistID()
          Get persistent identifier of object.
static TWGPersistentObject restore(long identifier)
          class method for restoring a persistent object.
static long[] restoreAll()
          class method for restoring all persistent objects.
protected  void restoreData(TWGPersistentObjectDictionary dictionary, boolean resolveObjectReferences)
          method for restoring persistent object data.
 void save()
          method for saving object data in persistent datastore.
 void save(java.lang.String targetClassName)
          method for saving object data in persistent datastore.
protected  void saveData(TWGPersistentObjectDictionary dictionary)
          method for saving persistent object data.
 void setSaveRequired()
          method for setting save required ("dirty") flag.
static void terminate()
          class terminator.
static int toPersistID(long identifier)
          Convert object identifier (long) to persistent object identitifer (int).
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, Delete, 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
 

Field Detail

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values

SIZEOF_BYTE

public static final int SIZEOF_BYTE
See Also:
Constant Field Values

SIZEOF_CHAR

public static final int SIZEOF_CHAR
See Also:
Constant Field Values

SIZEOF_DOUBLE

public static final int SIZEOF_DOUBLE
See Also:
Constant Field Values

SIZEOF_FLOAT

public static final int SIZEOF_FLOAT
See Also:
Constant Field Values

SIZEOF_INT

public static final int SIZEOF_INT
See Also:
Constant Field Values

SIZEOF_LONG

public static final int SIZEOF_LONG
See Also:
Constant Field Values

SIZEOF_SHORT

public static final int SIZEOF_SHORT
See Also:
Constant Field Values
Constructor Detail

TWGPersistentObject

public TWGPersistentObject()
default constructor (required by newInstance() method of Class).

Method Detail

initialize

public static void initialize()
                       throws TWGClassInitException
class initializer.

Throws:
TWGClassInitException

terminate

public static void terminate()
class terminator.


toPersistID

public static final int toPersistID(long identifier)
Convert object identifier (long) to persistent object identitifer (int).

Parameters:
identifier - object identifier from ObjectID() for persistent object.
Returns:
int persistent object identifier.

fromPersistID

public static final long fromPersistID(int identifier)
Convert persistent object identifier (int) to object identifier (long).

Parameters:
identifier - persistent object identifier from PersistID().
Returns:
long object identifier.

PersistID

public final int PersistID()
                    throws InvalidObjectIDException
Get persistent identifier of object.

Returns:
int persistent object identifier.
Throws:
InvalidObjectIDException - if invalid.

restoreAll

public static long[] restoreAll()
class method for restoring all persistent objects.

Returns:
list of persistent objects not restored (or null).

restore

public static TWGPersistentObject restore(long identifier)
                                   throws TWGPersistentObjectRestoreException
class method for restoring a persistent object.

Returns:
TWGPersistentObject restored object.
Throws:
TWGPersistentObjectRestoreException.
TWGPersistentObjectRestoreException

save

public final void save()
                throws TWGPersistentObjectSaveException
method for saving object data in persistent datastore.

Throws:
TWGPersistentObjectSaveException - if save failed.

save

public final void save(java.lang.String targetClassName)
                throws TWGPersistentObjectSaveException
method for saving object data in persistent datastore.

Parameters:
targetClassName - class name of persistent object to save in datastore.
Throws:
TWGPersistentObjectSaveException - if save fails

setSaveRequired

public final void setSaveRequired()
method for setting save required ("dirty") flag.


isSaveRequired

public final boolean isSaveRequired()
method for determining if save required.

Returns:
boolean true if save required, otherwise false.

Destroy

public void Destroy()
             throws TWGObjectDestroyException
Destroy a TWGPersistentObject. 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.

Overrides:
Destroy in class TWGObject
Throws:
TWGObjectDestroyException - if error during destroy

saveData

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

Throws:
TWGPersistentObjectSaveException - thrown to abort save procedure.

restoreData

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

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

isNewPersistentStore

public static boolean isNewPersistentStore()
Test to see if persistent object store is new (i.e. fresh server install). Only valid after TWGPersistentObject.initialize() completes.

Returns:
true if new store, false if not

enableAsyncWrites

public static boolean enableAsyncWrites(boolean enable)
Enable asynch writes

Parameters:
enable - - true if enabled, false if not
Returns:
previous setting