com.triactive.jdo.state
Class StateManagerImpl

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

public class StateManagerImpl
extends java.lang.Object
implements StateManager

This class implements the StateManager.

Author:
Mike Martin

Constructor Summary
StateManagerImpl(PersistenceManager pm, java.lang.Class pcClass, java.lang.Object id)
          Constructs a state manager to manage a new, 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 new populated instance having the given object ID and the given field values.
StateManagerImpl(PersistenceManager pm, javax.jdo.spi.PersistenceCapable pc, FieldValues preInsertChanges)
          Constructs a state manager to manage an existing persistence-capable instance that is becoming newly persistent.
 
Method Summary
(package private)  void clearFields()
           
(package private)  void clearSavedFields()
           
 void deletePersistent()
           
(package private)  void disconnect()
           
 void dump(java.io.PrintWriter out)
           
(package private)  void enlistInTransaction()
           
 void evict()
           
(package private)  void evictFromTransaction()
           
 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 (i.e., 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 (i.e., 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 (i.e., StateManager.isLoaded() fails).
 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 (i.e., StateManager.isLoaded() fails).
 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 (i.e., StateManager.isLoaded() fails).
 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 (i.e., StateManager.isLoaded() fails).
 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 (i.e., StateManager.isLoaded() fails).
 javax.jdo.spi.PersistenceCapable getObject()
           
 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 (i.e., StateManager.isLoaded() fails).
 java.lang.Object getObjectId()
           
 java.lang.Object getObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the JDO identity of the calling instance.
 PersistenceManager getPersistenceManager()
           
 javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
          Return 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 (i.e., StateManager.isLoaded() fails).
 StoreManager getStoreManager()
           
 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 (i.e., StateManager.isLoaded() fails).
 java.lang.Object getTransactionalObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the JDO identity 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 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 isTransactional(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is transactional.
 void loadDefaultFetchGroup()
          Loads all of the default fetch group fields into the instance.
(package private)  void loadDFGFields()
          Fetchs from the database all fields in the default fetch group not already loaded.
(package private)  void loadUnloadedFields()
          Fetchs from the database all fields not currently loaded.
 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()
           
 void makeTransactional()
           
 void makeTransient()
           
 java.lang.Object newSCOInstance(int fieldNumber, java.lang.Object value)
           
 void postCommit()
          This method is invoked when a commit is performed in a Transaction involving the PersistenceCapable managed by this StateManager
 void preRollback()
          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 i, 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)
           
 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()
           
(package private)  void refreshLoadedFields()
          Refreshes from the database all fields currently loaded.
 void replaceField(int fieldNumber, java.lang.Object value)
           
 void replaceFields(int[] fieldNumbers, FieldManager fm)
          Called from the StoreManager to refresh data in the PersistenceCapable object associated with this StateManager.
 void replaceSCOField(int fieldNumber, java.lang.Object 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.
 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.
(package private)  void restoreFields()
           
 void retrieve(boolean DFGOnly)
           
(package private)  void saveFields()
           
 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 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        java.lang.Class pcClass,
                        java.lang.Object id)
Constructs a state manager to manage a new, 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)).

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(PersistenceManager pm,
                        java.lang.Class pcClass,
                        java.lang.Object id,
                        FieldValues fv)
Constructs a state manager to manage a new populated 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 an existing persistence-capable 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.
Method Detail

enlistInTransaction

void enlistInTransaction()

evictFromTransaction

void evictFromTransaction()

saveFields

void saveFields()

restoreFields

void restoreFields()

clearFields

void clearFields()

clearSavedFields

void clearSavedFields()

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

getPersistenceManager

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

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

makeDirty

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

Specified by:
makeDirty in interface StateManager

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

getObjectId

public java.lang.Object getObjectId()
Specified by:
getObjectId in interface StateManager

getStoreManager

public StoreManager getStoreManager()
Specified by:
getStoreManager in interface StateManager

getPersistenceManager

public PersistenceManager getPersistenceManager()
Specified by:
getPersistenceManager in interface StateManager

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

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 TriActive 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 the 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)

loadDFGFields

void loadDFGFields()
Fetchs from the database all fields in the default fetch group not already loaded. Called by, or immediately after, life-cycle transitions.


loadUnloadedFields

void loadUnloadedFields()
Fetchs from the database all fields not currently loaded. Called by life-cycle transitions.


refreshLoadedFields

void refreshLoadedFields()
Refreshes from the database all fields currently loaded. Called by life-cycle transitions.


loadDefaultFetchGroup

public void loadDefaultFetchGroup()
Loads all of the default fetch group fields into the instance. Called by pm.getObjectById() when validate == true.

Specified by:
loadDefaultFetchGroup in interface StateManager

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

isLoaded

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

In the TriActive 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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 (i.e., 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

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 i,
                                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
currentValue - the current value of the field

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

getObject

public javax.jdo.spi.PersistenceCapable getObject()
Specified by:
getObject in interface StateManager

provideField

public java.lang.Object provideField(int fieldNumber)
Specified by:
provideField in interface StateManager

replaceField

public void replaceField(int fieldNumber,
                         java.lang.Object value)
Specified by:
replaceField in interface StateManager

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.

newSCOInstance

public java.lang.Object newSCOInstance(int fieldNumber,
                                       java.lang.Object value)
Specified by:
newSCOInstance in interface StateManager

replaceSCOField

public void replaceSCOField(int fieldNumber,
                            java.lang.Object value)
Specified by:
replaceSCOField in interface StateManager

makeTransactional

public void makeTransactional()
Specified by:
makeTransactional in interface StateManager

makeNontransactional

public void makeNontransactional()
Specified by:
makeNontransactional in interface StateManager

makeTransient

public void makeTransient()
Specified by:
makeTransient in interface StateManager

evict

public void evict()
Specified by:
evict in interface StateManager

refresh

public void refresh()
Specified by:
refresh in interface StateManager

retrieve

public void retrieve(boolean DFGOnly)
Specified by:
retrieve in interface StateManager

postCommit

public void postCommit()
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

preRollback

public void preRollback()
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

deletePersistent

public void deletePersistent()
Specified by:
deletePersistent in interface StateManager

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

void disconnect()

dump

public void dump(java.io.PrintWriter out)
Specified by:
dump in interface StateManager


Copyright © 2001 TriActive, Inc. All Rights Reserved.