com.odi
Interface IPersistentHooks

All Known Implementing Classes:
Attribute, OSAbstractSet, OSHashBag, OSHashtable, OSSmallMap, OSTreeMap, OSVector, Persistent, Type

public interface IPersistentHooks

The IPersistentHooks interface declares serveral "hook" methods which allow PSE/PSE Pro to notify a class instance of calls to certain methods defined in the IPersistent interface which are normally defined by the class file post-processor. This allows a user to take action upon these calls without requiring the user to implement the methods. As with any interface, every method defined in the IPersistentHooks interface must be defined in your class definition. There are several ways you can accomplish this.


Method Summary
 void postInitializeContents()
          Called by PSE/PSE Pro immediately after calling the initializeContents() method, which changes the state of a persistent object from hollow to active and clean.
 void preClearContents()
          Called by PSE/PSE Pro immediately before calling the clearContents() method, which changes the state of an object from active and clean to hollow.
 void preDestroyPersistent()
          Called by ObjectStore.destroy(object) before destruction of the specified object.
 void preFlushContents()
          Called by PSE/PSE Pro immediately before calling the flushContents() method, which changes the state of a persistent object from active and clean or dirty to active and clean.
 

Method Detail

postInitializeContents

public void postInitializeContents()
Called by PSE/PSE Pro immediately after calling the initializeContents() method, which changes the state of a persistent object from hollow to active and clean. Implement this method when you want to customize behavior. For example, you can use this method to copy some persistent fields to transient state.

If you provide an implementation of this method, you should be sure to call super.postInitializeContents() for any super classes.

If you do not define this method, you can run the postprocessor, which inserts a definition of this method as a null operation. Example


preFlushContents

public void preFlushContents()
Called by PSE/PSE Pro immediately before calling the flushContents() method, which changes the state of a persistent object from active and clean or dirty to active and clean. Implement this method when you want to customize behavior. For example, you can use this method to to copy any transient state to persistent fields before values are stored in the database as the result of an evict or commit operation.

If you provide an implementation of this method, you should be sure to call super.preFlushContents() for any super classes. If you do not define this method, you can run the postprocessor, which inserts a definition of this method as a null operation. Example


preClearContents

public void preClearContents()
Called by PSE/PSE Pro immediately before calling the clearContents() method, which changes the state of an object from active and clean to hollow. Implement this method when you want to customize behavior. For example, you can use this method to copy any persistent fields to transient state before the persistent state is cleared. Or, you can make transient pointers null so that the referenced objects can be garbage collected.

If you provide an implementation of this method, you should be sure to call super.preClearContents() for any super classes. If you do not define this method, you can run the postprocessor, which inserts a definition of this method as a null operation. Example


preDestroyPersistent

public void preDestroyPersistent()
Called by ObjectStore.destroy(object) before destruction of the specified object. A user-defined class can override this method to destroy any internal persistent data structures that it references. For example, if a user "Btree" class has internal persistent types that represent the leaves of the tree that are not visible through its API, the Btree.preDestroyPersistent() method can be defined to remove those leaves from the database. Btree.preDestroyPersistent should not call ObjectStore.destroy(this).

If you do not define this method, you can run the postprocessor, which inserts a definition of this method as a null operation.



Copyright 2005 Progress Software Corporation. All rights reserved.