org.jpox.state
Class StateManagerImpl

java.lang.Object
  extended byorg.jpox.state.StateManagerImpl
All Implemented Interfaces:
javax.jdo.spi.StateManager, StateManager

public final class StateManagerImpl
extends java.lang.Object
implements StateManager

Implementation of the StateManager. Implemented here as one StateManager per Object so adds on functionality particular to each object. All PersistenceCapable objects will have a StateManager when they have had communication with the PersistenceManager. They will typically always have an identity also. The exception to that is for embedded/serialised objects.

Embedded/Serialised Objects

An object that is being embedded/serialised in an owning object will NOT have an identity unless the object is subject to a makePersistent() call also. When an object is embedded/serialised and a field is changed, the field will NOT be marked as dirty (unless it is also an object in its own right with an identity). When a field is changed any owning objects are updated so that they can update their tables accordingly.

Version:
$Revision: 1.193 $

Field Summary
static int EMBEDDED_COLLECTION_ELEMENT_PC
          Embedded (or serialised) Collection Element PC
static int EMBEDDED_MAP_KEY_PC
          Embedded (or serialised) Map Key PC
static int EMBEDDED_MAP_VALUE_PC
          Embedded (or serialised) Map Value PC
static int EMBEDDED_PC
          Embedded (or serialised) PC
protected static Localiser LOCALISER
          Localiser for messages.
protected  javax.jdo.spi.PersistenceCapable myPC
          The PersistenceCapable instance managed by this StateManager
static int PC
          PC
 
Constructor Summary
StateManagerImpl(javax.jdo.spi.PersistenceCapable pc, AbstractClassMetaData cmd, java.lang.Object id, java.lang.Object version)
          Constructor for creating SM instances to manage PersistenceCapable objects in detached state
StateManagerImpl(javax.jdo.spi.PersistenceCapable pc, PersistenceManager pm, boolean copyPc)
          Constructs a state manager to manage a PersistenceCapable instance that will be EMBEDDED/SERIALISED into another PersistenceCapable object.
StateManagerImpl(PersistenceManager pm, java.lang.Class pcClass, FieldValues fv)
          Constructs a state manager to manage a hollow or pclean instance having the given FieldValues.
StateManagerImpl(PersistenceManager pm, java.lang.Class pcClass, java.lang.Object id)
          Constructs a state manager to manage a hollow instance having the given object ID.
StateManagerImpl(PersistenceManager pm, java.lang.Class pcClass, java.lang.Object id, FieldValues fv)
          Constructs a state manager to manage a recently populated hollow instance having the given object ID and the given field values.
StateManagerImpl(PersistenceManager pm, java.lang.Object id, javax.jdo.spi.PersistenceCapable pc, boolean[] loaded)
          Constructor to create a StateManager for a PersistenceCapable object, assigning the specified id to the object.
StateManagerImpl(PersistenceManager pm, javax.jdo.spi.PersistenceCapable pc)
          Constructs a state manager to manage a Transactional Transient instance.
StateManagerImpl(PersistenceManager pm, javax.jdo.spi.PersistenceCapable pc, FieldValues preInsertChanges)
          Constructs a state manager to manage a transient instance that is becoming newly persistent.
 
Method Summary
 void addEmbeddedOwner(javax.jdo.spi.StateManager ownerSM, int ownerFieldNumber)
          Method to register an owner StateManager with this embedded/serialised object.
 void addInsertionNotifier(javax.jdo.spi.StateManager sm, ActivityState activityState)
          Method to add a notifier that we must contact when we have finished our insertion.
 java.lang.Object attachCopy(javax.jdo.spi.PersistenceCapable detachedPC, boolean embedded)
          Method to attach the detached PersistenceCapable instance
 void changeActivityState(ActivityState activityState)
          Change the activity state.
 void checkInheritance(FieldValues fv)
          Look to the database to determine which class this object is.
 void deletePersistent()
          Method to delete the object from persistence.
 void detach(FetchPlanState state)
          Method to detach this object.
 java.lang.Object detachCopy(FetchPlanState state)
          Method to make detached copy of this instance
 void disconnect()
          Disconnect the StateManager from the PersistenceManager and PC object.
 void dump(java.io.PrintWriter out)
          Utility to dump the contents of the StateManager.
 void evict()
          Method to change the object state to evicted.
 void flush()
          Flushes any dirty fields to the data store.
 boolean getBooleanField(javax.jdo.spi.PersistenceCapable pc, int field, boolean currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 byte getByteField(javax.jdo.spi.PersistenceCapable pc, int field, byte currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 char getCharField(javax.jdo.spi.PersistenceCapable pc, int field, char currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 AbstractClassMetaData getClassMetaData()
          Accessor for the ClassMetaData for this object.
 java.lang.String[] getDirtyFieldNames()
          Accessor for the names of the fields that are dirty.
 double getDoubleField(javax.jdo.spi.PersistenceCapable pc, int field, double currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 java.lang.Object getExternalObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return an object id that the user can use.
 float getFloatField(javax.jdo.spi.PersistenceCapable pc, int field, float currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 int getHighestFieldNumber()
          Accessor for the highest field number in this class
 java.lang.Object getInternalObjectId()
          Accessor for the internal object id of the object we are managing.
 int getIntField(javax.jdo.spi.PersistenceCapable pc, int field, int currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 CachedPC getL2CacheableObject()
          Accessor for a L2-Cacheable form of this PersistenceCapable object.
 LifeCycleState getLifecycleState()
          Accessor for the LifeCycleState
 java.lang.String[] getLoadedFieldNames()
          Accessor for the names of the fields that are loaded.
 long getLongField(javax.jdo.spi.PersistenceCapable pc, int field, long currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 MetaDataManager getMetaDataManager()
          Accessor for the MetaDataManager to use for this object.
 javax.jdo.spi.PersistenceCapable getObject()
          Accessor for the Persistent Capable object.
 java.lang.Object getObjectField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.Object currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 java.lang.Object getObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the JDO identity of the calling instance.
 PersistenceManager getPersistenceManager()
          Accessor for the PersistenceManager for this object.
 javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
          Accessor for the PersistenceManager that owns this instance.
 short getShortField(javax.jdo.spi.PersistenceCapable pc, int field, short currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 StoreManager getStoreManager()
          Accessor for the StoreManager used for this object.
 java.lang.String getStringField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.String currentValue)
          This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails).
 java.lang.Object getTransactionalObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the JDO identity of the calling instance.
 java.lang.Object getTransactionalVersion(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the transactional version of the calling instance.
 java.lang.Object getVersion(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the version of the calling instance.
 boolean isDeleted(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object has been deleted.
 boolean isDirty(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is dirty.
 boolean isEmbedded()
          Convenience accessor for whether this StateManager manages an embedded/serialised object.
 boolean isInserting()
          Tests whether this object is being inserted.
 boolean isLoaded(javax.jdo.spi.PersistenceCapable pc, int field)
          Return true if the field is cached in the calling instance.
 boolean isNew(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object has been newly made persistent.
 boolean isPersistent(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is persistent.
 boolean isRestoreValues()
          Accessor for the Restore Values flag
 boolean isTransactional(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is transactional.
 void loadFieldValues(FieldValues fv)
          Convenience method to load the passed field values.
 void loadUnloadedFieldsInFetchPlan()
          Fetchs from the database all fields that are not currently loaded and that are in the current fetch group.
 void loadUnloadedFieldsInFetchPlan(javax.jdo.FetchPlan fetchPlan)
          Fetchs from the database all fields in the actual fetch plan.
 void makeDirty(int field)
          Marks the given field dirty.
 void makeDirty(javax.jdo.spi.PersistenceCapable pc, java.lang.String fieldName)
          Mark the associated PersistenceCapable field dirty.
 void makeNontransactional()
          Method to change the object state to nontransactional.
 void makePersistent()
          Method to make the object persistent.
 void makePersistentTransactionalTransient()
          Makes Transactional Transient instances persistent
 void makeTransactional()
          Method to change the object state to transactional.
 void makeTransient(FetchPlanState state)
          Method to change the object state to transient.
 java.lang.Object newSCOEmptyInstance(int fieldNumber)
          Method to create a new SCO proxy wraper object for a field.
 java.lang.Object newSCOInstance(int fieldNumber, java.lang.Object value, boolean forUpdate)
          Method to store a new SCO field at the specified field number.
 void nullifyFields()
          Nullify fields with reference to PersistenceCapable or SCO instances
 void postCommit(javax.jdo.Transaction tx)
          This method is invoked when a commit is performed in a Transaction involving the PersistenceCapable managed by this StateManager
 void preRollback(javax.jdo.Transaction tx)
          This method is invoked when a rollback is performed in a Transaction involving the PersistenceCapable managed by this StateManager.
 void preSerialize(javax.jdo.spi.PersistenceCapable pc)
          Guarantee that the serializable transactional and persistent fields are loaded into the instance.
 void providedBooleanField(javax.jdo.spi.PersistenceCapable pc, int field, boolean currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedByteField(javax.jdo.spi.PersistenceCapable pc, int field, byte currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedCharField(javax.jdo.spi.PersistenceCapable pc, int field, char currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedDoubleField(javax.jdo.spi.PersistenceCapable pc, int field, double currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedFloatField(javax.jdo.spi.PersistenceCapable pc, int field, float currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedIntField(javax.jdo.spi.PersistenceCapable pc, int field, int currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedLongField(javax.jdo.spi.PersistenceCapable pc, int field, long currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedObjectField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, java.lang.Object currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedShortField(javax.jdo.spi.PersistenceCapable pc, int field, short currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 void providedStringField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.String currentValue)
          This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked.
 java.lang.Object provideField(int fieldNumber)
          Method to return the current value of a particular field.
 void provideFields(int[] fieldNumbers, FieldManager fm)
          Called from the StoreManager after StoreManager.update() is called to obtain updated values from the PersistenceCapable associated with this StateManager.
 void refresh()
          Method to refresh the object.
 void registerTransactional()
          Registers the pc class in the cache
 void removeEmbeddedOwner(javax.jdo.spi.StateManager ownerSM, int ownerFieldNumber)
          Method to remove an owner StateManager from this embedded/serialised objects owners list.
 void replaceField(int fieldNumber, java.lang.Object value)
          Method to change the value of a particular field.
 void replaceFields(int[] fieldNumbers, FieldManager fm)
          Called from the StoreManager to refresh data in the PersistenceCapable object associated with this StateManager.
 void replaceNonLoadedFields(int[] fieldNumbers, FieldManager fm)
          Called from the StoreManager to refresh data in the PersistenceCapable object associated with this StateManager.
 java.lang.Object replaceSCOField(int fieldNumber, java.lang.Object value)
          Method to replace a second-class object field value.
 boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable pc, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a boolean field.
 byte replacingByteField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a byte field.
 char replacingCharField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a char field.
 java.lang.Object[] replacingDetachedState(javax.jdo.spi.Detachable pc, java.lang.Object[] currentState)
          Method to update the "detached state" in the detached object to obtain the "detached state" from the detached object, or to reset it (to null).
 double replacingDoubleField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a double field.
 byte replacingFlags(javax.jdo.spi.PersistenceCapable pc)
          The StateManager uses this method to supply the value of jdoFlags to the associated PersistenceCapable instance.
 float replacingFloatField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a float field.
 int replacingIntField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a int field.
 long replacingLongField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a long field.
 java.lang.Object replacingObjectField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of an Object field.
 short replacingShortField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a short field.
 javax.jdo.spi.StateManager replacingStateManager(javax.jdo.spi.PersistenceCapable pc, javax.jdo.spi.StateManager sm)
          Replace the current value of jdoStateManager.
 java.lang.String replacingStringField(javax.jdo.spi.PersistenceCapable obj, int field)
          This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a String field.
 void resetDetachState()
          Convenience method to reset the detached state in the current object.
 void retrieve(boolean fgOnly)
          Method to retrieve the object.
 void retrieve(javax.jdo.FetchPlan fetchPlan)
          Method to retrieve the object.
 void retrieveDetachState(StateManagerImpl sm)
          Convenience method to retrieve the detach state from the passed State Manager's object
 void runReachability(java.util.Set reachables)
          Method to mark an object for reachability.
 void setBooleanField(javax.jdo.spi.PersistenceCapable pc, int field, boolean currentValue, boolean newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setByteField(javax.jdo.spi.PersistenceCapable pc, int field, byte currentValue, byte newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setCharField(javax.jdo.spi.PersistenceCapable pc, int field, char currentValue, char newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setDoubleField(javax.jdo.spi.PersistenceCapable pc, int field, double currentValue, double newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setFloatField(javax.jdo.spi.PersistenceCapable pc, int field, float currentValue, float newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setIntField(javax.jdo.spi.PersistenceCapable pc, int field, int currentValue, int newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setLongField(javax.jdo.spi.PersistenceCapable pc, int field, long currentValue, long newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setObjectField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.Object currentValue, java.lang.Object newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setPcObjectType(int embeddedType)
          Method to set this StateManager as managing an embedded/serialised object.
 void setPostStoreNewObjectId(java.lang.Object id)
          If the id is obtained after inserting the object into the database, set new a new id for persistent classes (for example, increment).
 void setShortField(javax.jdo.spi.PersistenceCapable pc, int field, short currentValue, short newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setStoringPC()
          Method to set the storing PC flag.
 void setStringField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.String currentValue, java.lang.String newValue)
          This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.
 void setTransactionalVersion(java.lang.Object version)
          Sets the value for the version column in a transaction not yet committed
 void setVersion(java.lang.Object version)
          Sets the value for the version column in the datastore
 void unsetStoringPC()
          Method to unset the storing PC flag.
 void updateFieldAfterInsert(javax.jdo.spi.PersistenceCapable pc, int fieldNumber)
          Marks the given field as being required to be updated when the specified object has been inserted.
 void validate()
          Validates whether the persistence capable instance exists in the datastore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.


myPC

protected javax.jdo.spi.PersistenceCapable myPC
The PersistenceCapable instance managed by this StateManager


PC

public static int PC
PC


EMBEDDED_PC

public static int EMBEDDED_PC
Embedded (or serialised) PC


EMBEDDED_COLLECTION_ELEMENT_PC

public static int EMBEDDED_COLLECTION_ELEMENT_PC
Embedded (or serialised) Collection Element PC


EMBEDDED_MAP_KEY_PC

public static int EMBEDDED_MAP_KEY_PC
Embedded (or serialised) Map Key PC


EMBEDDED_MAP_VALUE_PC

public static int EMBEDDED_MAP_VALUE_PC
Embedded (or serialised) Map Value PC

Constructor Detail

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        java.lang.Class pcClass,
                        java.lang.Object id)
Constructs a state manager to manage a hollow instance having the given object ID. This constructor is used for creating new instances of existing persistent objects (i.e. via PersistenceManager.getObjectById(Object, boolean, boolean)).

Parameters:
pm - the persistence manager controlling this state manager.
pcClass - the class of the new instance to be created.
id - the JDO identity of the object.

StateManagerImpl

public StateManagerImpl(javax.jdo.spi.PersistenceCapable pc,
                        PersistenceManager pm,
                        boolean copyPc)
Constructs a state manager to manage a PersistenceCapable instance that will be EMBEDDED/SERIALISED into another PersistenceCapable object. The instance will not be assigned an identity in the process since it is a SCO.

Parameters:
pc - The PersistenceCapable to manage (see copyPc also)
pm - The persistence manager controlling this state manager.
copyPc - Whether the SM should manage a copy of the passed PC or that one

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        java.lang.Class pcClass,
                        FieldValues fv)
Constructs a state manager to manage a hollow or pclean instance having the given FieldValues. This constructor is used for creating new instances of existing persistent objects using application identity. PersistenceManager.getObjectByAID(java.lang.Class, org.jpox.store.FieldValues, boolean, boolean)

Parameters:
pm - the persistence manager controlling this state manager.
pcClass - the class of the new instance to be created.
fv - the initial field values of the object.

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        java.lang.Class pcClass,
                        java.lang.Object id,
                        FieldValues fv)
Constructs a state manager to manage a recently populated hollow instance having the given object ID and the given field values. This constructor is used for creating new instances of persistent objects obtained e.g. via a Query or backed by a view (i.e. via PersistenceManager.getObjectById(Object,FieldValues)).

Parameters:
pm - the persistence manager controlling this state manager.
pcClass - the class of the new instance to be created.
id - the JDO identity of the object.
fv - the initial field values of the object.

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        javax.jdo.spi.PersistenceCapable pc,
                        FieldValues preInsertChanges)
Constructs a state manager to manage a transient instance that is becoming newly persistent. A new object ID for the instance is obtained from the store manager and the object is inserted in the data store.

This constructor is used for assigning state managers to existing instances that are transitioning to a persistent state (i.e. via PersistenceManager.makePersistent(Object)).

Parameters:
pm - the persistence manager controlling this state manager.
pc - the instance being make persistent.
preInsertChanges - Any changes to make before inserting

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        javax.jdo.spi.PersistenceCapable pc)
Constructs a state manager to manage a Transactional Transient instance. A new object ID for the instance is obtained from the store manager and the object is inserted in the data store.

This constructor is used for assigning state managers to Transient instances that are transitioning to a transient clean state (i.e. via PersistenceManager.makeTransactional(Object)).

Parameters:
pm - the persistence manager controlling this state manager.
pc - the instance being make persistent.

StateManagerImpl

public StateManagerImpl(javax.jdo.spi.PersistenceCapable pc,
                        AbstractClassMetaData cmd,
                        java.lang.Object id,
                        java.lang.Object version)
Constructor for creating SM instances to manage PersistenceCapable objects in detached state

Parameters:
pc - the detach object.
cmd - the AbstractClassMetaData
id - the JDO identity of the object.
version - the detached version
Since:
1.1

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        java.lang.Object id,
                        javax.jdo.spi.PersistenceCapable pc,
                        boolean[] loaded)
Constructor to create a StateManager for a PersistenceCapable object, assigning the specified id to the object. This is used when getting objects out of the L2 Cache, where they have no StateManager assigned, and returning them as associated with a particular PM.

Parameters:
pm - PersistenceManager managing this object
id - Id to assign to the PersistenceCapable object
pc - The PersistenceCapable object
loaded - The list of loaded fields (when put in the cache)
Method Detail

checkInheritance

public void checkInheritance(FieldValues fv)
Look to the database to determine which class this object is. This parameter is a hint. Set false, if it's already determined the correct pcClass for this pc "object" in a certain level in the hierarchy. Set to true and it will look to the database.

Parameters:
fv - the initial field values of the object.

loadFieldValues

public void loadFieldValues(FieldValues fv)
Convenience method to load the passed field values. Loads the fields using any required fetch plan and calls jdoPostLoad() as appropriate.

Parameters:
fv - Field Values to load (including any fetch plan to use when loading)

getL2CacheableObject

public CachedPC getL2CacheableObject()
Accessor for a L2-Cacheable form of this PersistenceCapable object.

Specified by:
getL2CacheableObject in interface StateManager
Returns:
The L2 cacheable object

getDirtyFieldNames

public java.lang.String[] getDirtyFieldNames()
Accessor for the names of the fields that are dirty.

Specified by:
getDirtyFieldNames in interface StateManager
Returns:
Names of the dirty fields

getLoadedFieldNames

public java.lang.String[] getLoadedFieldNames()
Accessor for the names of the fields that are loaded.

Specified by:
getLoadedFieldNames in interface StateManager
Returns:
Names of the loaded fields

makeDirty

public void makeDirty(int field)
Marks the given field dirty.

Specified by:
makeDirty in interface StateManager
Parameters:
field - The no of field to mark as dirty.

makeDirty

public void makeDirty(javax.jdo.spi.PersistenceCapable pc,
                      java.lang.String fieldName)
Mark the associated PersistenceCapable field dirty.

Specified by:
makeDirty in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
fieldName - the name of the field

getStoreManager

public StoreManager getStoreManager()
Accessor for the StoreManager used for this object.

Specified by:
getStoreManager in interface StateManager
Returns:
The StoreManager.

getClassMetaData

public AbstractClassMetaData getClassMetaData()
Accessor for the ClassMetaData for this object.

Specified by:
getClassMetaData in interface StateManager
Returns:
The ClassMetaData.

getMetaDataManager

public MetaDataManager getMetaDataManager()
Accessor for the MetaDataManager to use for this object. Simply a wrapper accessor method.

Specified by:
getMetaDataManager in interface StateManager
Returns:
The MetaDataManager.

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
Accessor for the PersistenceManager that owns this instance.

Specified by:
getPersistenceManager in interface javax.jdo.spi.StateManager
Parameters:
pc - The PersistenceCapable instance
Returns:
The PersistenceManager that owns this instance

getPersistenceManager

public PersistenceManager getPersistenceManager()
Accessor for the PersistenceManager for this object.

Specified by:
getPersistenceManager in interface StateManager
Returns:
The PersistenceManager.

getObject

public javax.jdo.spi.PersistenceCapable getObject()
Accessor for the Persistent Capable object.

Specified by:
getObject in interface StateManager
Returns:
The PersistentCapable object

isRestoreValues

public boolean isRestoreValues()
Accessor for the Restore Values flag

Returns:
Whether to restore values

getObjectId

public java.lang.Object getObjectId(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the JDO identity of the calling instance. According to the JDO specification, if the JDO identity is being changed in the current transaction, this method returns the JDO identify as of the beginning of the transaction.

Specified by:
getObjectId in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the JDO identity of the calling instance

getInternalObjectId

public java.lang.Object getInternalObjectId()
Accessor for the internal object id of the object we are managing.

Specified by:
getInternalObjectId in interface StateManager
Returns:
The internal object id

setPostStoreNewObjectId

public void setPostStoreNewObjectId(java.lang.Object id)
If the id is obtained after inserting the object into the database, set new a new id for persistent classes (for example, increment).

Specified by:
setPostStoreNewObjectId in interface StateManager
Parameters:
id - the id received from the datastore

getExternalObjectId

public java.lang.Object getExternalObjectId(javax.jdo.spi.PersistenceCapable pc)
Return an object id that the user can use.

Specified by:
getExternalObjectId in interface StateManager
Parameters:
pc - the PersistenceCapable object
Returns:
the object id

replacingStateManager

public javax.jdo.spi.StateManager replacingStateManager(javax.jdo.spi.PersistenceCapable pc,
                                                        javax.jdo.spi.StateManager sm)
Replace the current value of jdoStateManager.

This method is called by the PersistenceCapable whenever jdoReplaceStateManager is called and there is already an owning StateManager. This is a security precaution to ensure that the owning StateManager is the only source of any change to its reference in the PersistenceCapable.

Specified by:
replacingStateManager in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
sm - the proposed new value for the jdoStateManager
Returns:
the new value for the jdoStateManager

getTransactionalObjectId

public java.lang.Object getTransactionalObjectId(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the JDO identity of the calling instance. If the JDO identity is being changed in the current transaction, this method returns the current identity as changed in the transaction.

Specified by:
getTransactionalObjectId in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the JDO identity of the calling instance

isDirty

public boolean isDirty(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is dirty. Instances that have been modified, deleted, or newly made persistent in the current transaction return true.

Transient nontransactional instances return false (JDO spec), but the JPOX implementation does not currently support the transient transactional state.

Specified by:
isDirty in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance has been modified in current transaction.
See Also:
PersistenceCapable.jdoMakeDirty(String fieldName)

isTransactional

public boolean isTransactional(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is transactional. Instances that respect transaction boundaries return true. These instances include transient instances made transactional as a result of being the target of a makeTransactional method call; newly made persistent or deleted persistent instances; persistent instances read in data store transactions; and persistent instances modified in optimistic transactions.

Transient nontransactional instances return false.

Specified by:
isTransactional in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance is transactional.

isPersistent

public boolean isPersistent(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is persistent. Instances whose state is stored in the data store return true.

Transient instances return false.

Specified by:
isPersistent in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance is persistent.
See Also:
PersistenceManager.makePersistent(Object pc)

isNew

public boolean isNew(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object has been newly made persistent. Instances that have been made persistent in the current transaction return true.

Transient instances return false.

Specified by:
isNew in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance was made persistent in the current transaction.
See Also:
PersistenceManager.makePersistent(Object pc)

isDeleted

public boolean isDeleted(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object has been deleted. Instances that have been deleted in the current transaction return true.

Transient instances return false.

Specified by:
isDeleted in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance was deleted in the current transaction.
See Also:
PersistenceManager.deletePersistent(Object pc)

loadUnloadedFieldsInFetchPlan

public void loadUnloadedFieldsInFetchPlan()
Fetchs from the database all fields that are not currently loaded and that are in the current fetch group. Called by lifecycle transitions.

Specified by:
loadUnloadedFieldsInFetchPlan in interface StateManager
Since:
1.1

loadUnloadedFieldsInFetchPlan

public void loadUnloadedFieldsInFetchPlan(javax.jdo.FetchPlan fetchPlan)
Fetchs from the database all fields in the actual fetch plan. Called by life-cycle transitions.

Since:
1.1

isLoaded

public boolean isLoaded(javax.jdo.spi.PersistenceCapable pc,
                        int field)
Return true if the field is cached in the calling instance.

In the JPOX implementation of this method, isLoaded() will always return true. If the field is not loaded, it will be loaded as a side effect of the call to this method. If it is in the default fetch group, the default fetch group, including this field, will be loaded.

Specified by:
isLoaded in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the absolute field number
Returns:
always returns true (this implementation)

getBooleanField

public boolean getBooleanField(javax.jdo.spi.PersistenceCapable pc,
                               int field,
                               boolean currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getBooleanField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getByteField

public byte getByteField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         byte currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getByteField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getCharField

public char getCharField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         char currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getCharField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getDoubleField

public double getDoubleField(javax.jdo.spi.PersistenceCapable pc,
                             int field,
                             double currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getDoubleField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getFloatField

public float getFloatField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           float currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getFloatField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getIntField

public int getIntField(javax.jdo.spi.PersistenceCapable pc,
                       int field,
                       int currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getIntField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getLongField

public long getLongField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         long currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getLongField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getShortField

public short getShortField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           short currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getShortField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getStringField

public java.lang.String getStringField(javax.jdo.spi.PersistenceCapable pc,
                                       int field,
                                       java.lang.String currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getStringField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getObjectField

public java.lang.Object getObjectField(javax.jdo.spi.PersistenceCapable pc,
                                       int field,
                                       java.lang.Object currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). In this implementation of the StateManager, isLoaded() has a side effect of loading unloaded information and will always return true. As such, this method should never be called.

Specified by:
getObjectField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

setBooleanField

public void setBooleanField(javax.jdo.spi.PersistenceCapable pc,
                            int field,
                            boolean currentValue,
                            boolean newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setBooleanField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setByteField

public void setByteField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         byte currentValue,
                         byte newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setByteField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setCharField

public void setCharField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         char currentValue,
                         char newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setCharField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setDoubleField

public void setDoubleField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           double currentValue,
                           double newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setDoubleField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setFloatField

public void setFloatField(javax.jdo.spi.PersistenceCapable pc,
                          int field,
                          float currentValue,
                          float newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setFloatField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setIntField

public void setIntField(javax.jdo.spi.PersistenceCapable pc,
                        int field,
                        int currentValue,
                        int newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setIntField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setLongField

public void setLongField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         long currentValue,
                         long newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setLongField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setShortField

public void setShortField(javax.jdo.spi.PersistenceCapable pc,
                          int field,
                          short currentValue,
                          short newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setShortField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setStringField

public void setStringField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           java.lang.String currentValue,
                           java.lang.String newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setStringField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

setObjectField

public void setObjectField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           java.lang.Object currentValue,
                           java.lang.Object newValue)
This method is called by the associated PersistenceCapable when the corresponding mutator method (setXXX()) is called on the PersistenceCapable.

Specified by:
setObjectField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the new value for the field

providedBooleanField

public void providedBooleanField(javax.jdo.spi.PersistenceCapable pc,
                                 int field,
                                 boolean currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedBooleanField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedByteField

public void providedByteField(javax.jdo.spi.PersistenceCapable pc,
                              int field,
                              byte currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedByteField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedCharField

public void providedCharField(javax.jdo.spi.PersistenceCapable pc,
                              int field,
                              char currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedCharField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedDoubleField

public void providedDoubleField(javax.jdo.spi.PersistenceCapable pc,
                                int field,
                                double currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedDoubleField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedFloatField

public void providedFloatField(javax.jdo.spi.PersistenceCapable pc,
                               int field,
                               float currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedFloatField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedIntField

public void providedIntField(javax.jdo.spi.PersistenceCapable pc,
                             int field,
                             int currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedIntField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedLongField

public void providedLongField(javax.jdo.spi.PersistenceCapable pc,
                              int field,
                              long currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedLongField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedShortField

public void providedShortField(javax.jdo.spi.PersistenceCapable pc,
                               int field,
                               short currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedShortField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedStringField

public void providedStringField(javax.jdo.spi.PersistenceCapable pc,
                                int field,
                                java.lang.String currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedStringField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedObjectField

public void providedObjectField(javax.jdo.spi.PersistenceCapable pc,
                                int fieldNumber,
                                java.lang.Object currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. Its purpose is to provide the value of the specified field to the StateManager.

Specified by:
providedObjectField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
fieldNumber - the field number
currentValue - the current value of the field

replacingFlags

public byte replacingFlags(javax.jdo.spi.PersistenceCapable pc)
The StateManager uses this method to supply the value of jdoFlags to the associated PersistenceCapable instance.

Specified by:
replacingFlags in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
the value of jdoFlags to be stored in the PersistenceCapable instance

replacingBooleanField

public boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable pc,
                                     int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a boolean field.

Specified by:
replacingBooleanField in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingByteField

public byte replacingByteField(javax.jdo.spi.PersistenceCapable obj,
                               int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a byte field.

Specified by:
replacingByteField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingCharField

public char replacingCharField(javax.jdo.spi.PersistenceCapable obj,
                               int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a char field.

Specified by:
replacingCharField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingDoubleField

public double replacingDoubleField(javax.jdo.spi.PersistenceCapable obj,
                                   int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a double field.

Specified by:
replacingDoubleField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingFloatField

public float replacingFloatField(javax.jdo.spi.PersistenceCapable obj,
                                 int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a float field.

Specified by:
replacingFloatField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingIntField

public int replacingIntField(javax.jdo.spi.PersistenceCapable obj,
                             int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a int field.

Specified by:
replacingIntField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingLongField

public long replacingLongField(javax.jdo.spi.PersistenceCapable obj,
                               int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a long field.

Specified by:
replacingLongField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingShortField

public short replacingShortField(javax.jdo.spi.PersistenceCapable obj,
                                 int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a short field.

Specified by:
replacingShortField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingStringField

public java.lang.String replacingStringField(javax.jdo.spi.PersistenceCapable obj,
                                             int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of a String field.

Specified by:
replacingStringField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingObjectField

public java.lang.Object replacingObjectField(javax.jdo.spi.PersistenceCapable obj,
                                             int field)
This method is invoked by the PersistenceCapable object's jdoReplaceField() method to refresh the value of an Object field.

Specified by:
replacingObjectField in interface javax.jdo.spi.StateManager
Parameters:
obj - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

provideField

public java.lang.Object provideField(int fieldNumber)
Method to return the current value of a particular field.

Specified by:
provideField in interface StateManager
Parameters:
fieldNumber - Number of field
Returns:
The value of the field

replaceField

public void replaceField(int fieldNumber,
                         java.lang.Object value)
Method to change the value of a particular field.

Specified by:
replaceField in interface StateManager
Parameters:
fieldNumber - Number of field
value - New value

provideFields

public void provideFields(int[] fieldNumbers,
                          FieldManager fm)
Called from the StoreManager after StoreManager.update() is called to obtain updated values from the PersistenceCapable associated with this StateManager.

Specified by:
provideFields in interface StateManager
Parameters:
fieldNumbers - An array of field numbers to be updated by the Store
fm - The updated values are stored in this object. This object is only valid for the duration of this call.

replaceFields

public void replaceFields(int[] fieldNumbers,
                          FieldManager fm)
Called from the StoreManager to refresh data in the PersistenceCapable object associated with this StateManager.

Specified by:
replaceFields in interface StateManager
Parameters:
fieldNumbers - An array of field numbers to be refreshed by the Store
fm - The updated values are stored in this object. This object is only valid for the duration of this call.

replaceNonLoadedFields

public void replaceNonLoadedFields(int[] fieldNumbers,
                                   FieldManager fm)
Called from the StoreManager to refresh data in the PersistenceCapable object associated with this StateManager. Only not loaded fields are refreshed

Specified by:
replaceNonLoadedFields in interface StateManager
Parameters:
fieldNumbers - An array of field numbers to be refreshed by the Store
fm - The updated values are stored in this object. This object is only valid for the duration of this call.

isEmbedded

public boolean isEmbedded()
Convenience accessor for whether this StateManager manages an embedded/serialised object.

Returns:
Whether the managed object is embedded/serialised.

setPcObjectType

public void setPcObjectType(int embeddedType)
Method to set this StateManager as managing an embedded/serialised object.

Parameters:
embeddedType - The type of object being managed

addEmbeddedOwner

public void addEmbeddedOwner(javax.jdo.spi.StateManager ownerSM,
                             int ownerFieldNumber)
Method to register an owner StateManager with this embedded/serialised object.

Parameters:
ownerSM - The owning State Manager.
ownerFieldNumber - The field number in the owner that the embedded/serialised object is stored as

removeEmbeddedOwner

public void removeEmbeddedOwner(javax.jdo.spi.StateManager ownerSM,
                                int ownerFieldNumber)
Method to remove an owner StateManager from this embedded/serialised objects owners list.

Parameters:
ownerSM - The owner to remove
ownerFieldNumber - The field in the owner where this object is stored

newSCOInstance

public java.lang.Object newSCOInstance(int fieldNumber,
                                       java.lang.Object value,
                                       boolean forUpdate)
Method to store a new SCO field at the specified field number.

Specified by:
newSCOInstance in interface StateManager
Parameters:
fieldNumber - The field number
value - The value
forUpdate - Whether this SCO needs updating in the datastore
Returns:
the new SCO instance

replaceSCOField

public java.lang.Object replaceSCOField(int fieldNumber,
                                        java.lang.Object value)
Method to replace a second-class object field value.

Specified by:
replaceSCOField in interface StateManager
Parameters:
fieldNumber - Number of field
value - New value of the field
Returns:
The new SCO object representing the new value

newSCOEmptyInstance

public java.lang.Object newSCOEmptyInstance(int fieldNumber)
Method to create a new SCO proxy wraper object for a field. The wrapper will be empty. e.g this could be a SCO collection and will be a org.jpox.sco.{class} type with no elements initially.

Specified by:
newSCOEmptyInstance in interface StateManager
Parameters:
fieldNumber - Number of field
Returns:
The new (empty) SCO object

getVersion

public java.lang.Object getVersion(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the version of the calling instance.

Specified by:
getVersion in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the version of the calling instance
Since:
JDO 2.0

setTransactionalVersion

public void setTransactionalVersion(java.lang.Object version)
Sets the value for the version column in a transaction not yet committed

Specified by:
setTransactionalVersion in interface StateManager
Parameters:
version - The version

getTransactionalVersion

public java.lang.Object getTransactionalVersion(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the transactional version of the calling instance.

Specified by:
getTransactionalVersion in interface StateManager
Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the version of the calling instance
Since:
1.1.1

setVersion

public void setVersion(java.lang.Object version)
Sets the value for the version column in the datastore

Specified by:
setVersion in interface StateManager
Parameters:
version - The version

getHighestFieldNumber

public int getHighestFieldNumber()
Accessor for the highest field number in this class

Specified by:
getHighestFieldNumber in interface StateManager
Returns:
The highest field number

getLifecycleState

public LifeCycleState getLifecycleState()
Accessor for the LifeCycleState

Returns:
the LifeCycleState

runReachability

public void runReachability(java.util.Set reachables)
Method to mark an object for reachability. Provides the basis for "persistence-by-reachability", but run at commit time only. The reachability algorithm is also run at makePersistent, but directly via InsertRequest. The "reachables" list could be changed to store id's instead of StateManagers if preferred.

Specified by:
runReachability in interface StateManager
Parameters:
reachables - List of StateManagers currently logged as reachable

makePersistent

public void makePersistent()
Method to make the object persistent.

Specified by:
makePersistent in interface StateManager

isInserting

public boolean isInserting()
Tests whether this object is being inserted.

Specified by:
isInserting in interface StateManager
Returns:
true if this instance is inserting.

changeActivityState

public void changeActivityState(ActivityState activityState)
Change the activity state.

Specified by:
changeActivityState in interface StateManager
Parameters:
activityState - the new state

addInsertionNotifier

public void addInsertionNotifier(javax.jdo.spi.StateManager sm,
                                 ActivityState activityState)
Method to add a notifier that we must contact when we have finished our insertion.

Parameters:
sm - the state manager
activityState - the ActivityState (unused)

updateFieldAfterInsert

public void updateFieldAfterInsert(javax.jdo.spi.PersistenceCapable pc,
                                   int fieldNumber)
Marks the given field as being required to be updated when the specified object has been inserted.

Specified by:
updateFieldAfterInsert in interface StateManager
Parameters:
pc - The PersistenceCapable
fieldNumber - Number of the field.

makePersistentTransactionalTransient

public void makePersistentTransactionalTransient()
Makes Transactional Transient instances persistent

Specified by:
makePersistentTransactionalTransient in interface StateManager

makeTransactional

public void makeTransactional()
Method to change the object state to transactional.

Specified by:
makeTransactional in interface StateManager

makeNontransactional

public void makeNontransactional()
Method to change the object state to nontransactional.

Specified by:
makeNontransactional in interface StateManager

makeTransient

public void makeTransient(FetchPlanState state)
Method to change the object state to transient.

Specified by:
makeTransient in interface StateManager
Parameters:
state - Object containing the state of any fetchplan processing

detach

public void detach(FetchPlanState state)
Method to detach this object. This is used to detach an object at the "detachOnClose" of a PersistenceManager.

Specified by:
detach in interface StateManager
Parameters:
state - State for the detachment process

detachCopy

public java.lang.Object detachCopy(FetchPlanState state)
Method to make detached copy of this instance

Specified by:
detachCopy in interface StateManager
Parameters:
state - State for the detachment process
Returns:
the detached PersistenceCapable instance
Since:
1.1

attachCopy

public java.lang.Object attachCopy(javax.jdo.spi.PersistenceCapable detachedPC,
                                   boolean embedded)
Method to attach the detached PersistenceCapable instance

Specified by:
attachCopy in interface StateManager
Parameters:
detachedPC - the detached PersistenceCapable instance to be attached
embedded - Whether the object is stored embedded/serialised in another object
Returns:
The attached copy
Since:
1.1

deletePersistent

public void deletePersistent()
Method to delete the object from persistence.

Specified by:
deletePersistent in interface StateManager

nullifyFields

public void nullifyFields()
Nullify fields with reference to PersistenceCapable or SCO instances

Specified by:
nullifyFields in interface StateManager

validate

public void validate()
Validates whether the persistence capable instance exists in the datastore. If the instance does not exist in the datastore, this method will fail raising a javax.jdo.JDOObjectNotFoundException.

Specified by:
validate in interface StateManager

evict

public void evict()
Method to change the object state to evicted.

Specified by:
evict in interface StateManager

refresh

public void refresh()
Method to refresh the object.

Specified by:
refresh in interface StateManager

retrieve

public void retrieve(boolean fgOnly)
Method to retrieve the object.

Specified by:
retrieve in interface StateManager
Parameters:
fgOnly - Only load the current fetch group fields

retrieve

public void retrieve(javax.jdo.FetchPlan fetchPlan)
Method to retrieve the object.

Specified by:
retrieve in interface StateManager
Parameters:
fetchPlan - the fetch plan to load fields

postCommit

public void postCommit(javax.jdo.Transaction tx)
This method is invoked when a commit is performed in a Transaction involving the PersistenceCapable managed by this StateManager

Specified by:
postCommit in interface StateManager
Parameters:
tx - The Transaction

preRollback

public void preRollback(javax.jdo.Transaction tx)
This method is invoked when a rollback is performed in a Transaction involving the PersistenceCapable managed by this StateManager.

Specified by:
preRollback in interface StateManager
Parameters:
tx - The Transaction been rolled back

setStoringPC

public void setStoringPC()
Method to set the storing PC flag.


unsetStoringPC

public void unsetStoringPC()
Method to unset the storing PC flag.


preSerialize

public void preSerialize(javax.jdo.spi.PersistenceCapable pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance. This method is called by the generated jdoPreSerialize method prior to serialization of the instance.

Specified by:
preSerialize in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance

flush

public void flush()
Flushes any dirty fields to the data store.

Note that "dirty" in this case is not equated to being in the P_DIRTY state. The P_DIRTY state means that at least one field in the object has been written by the user during the current transaction, whereas for the purposes of this method, a field is "dirty" if it's been written by the user but not yet updated in the data store. The difference is, it's possible for an object's state to be P_DIRTY, yet have no "dirty" fields because flush() has been called at least once during the transaction.

Specified by:
flush in interface StateManager

disconnect

public void disconnect()
Disconnect the StateManager from the PersistenceManager and PC object.

Specified by:
disconnect in interface StateManager

registerTransactional

public void registerTransactional()
Registers the pc class in the cache


retrieveDetachState

public void retrieveDetachState(StateManagerImpl sm)
Convenience method to retrieve the detach state from the passed State Manager's object

Parameters:
sm - The State Manager

resetDetachState

public void resetDetachState()
Convenience method to reset the detached state in the current object.

Specified by:
resetDetachState in interface StateManager

replacingDetachedState

public java.lang.Object[] replacingDetachedState(javax.jdo.spi.Detachable pc,
                                                 java.lang.Object[] currentState)
Method to update the "detached state" in the detached object to obtain the "detached state" from the detached object, or to reset it (to null).

Specified by:
replacingDetachedState in interface javax.jdo.spi.StateManager
Parameters:
pc - The PersistenceCapable beind updated
currentState - The current state values
Returns:
The detached state to assign to the object

dump

public void dump(java.io.PrintWriter out)
Utility to dump the contents of the StateManager.

Specified by:
dump in interface StateManager
Parameters:
out - PrintWriter to dump to


Copyright © -2007 . All Rights Reserved.