com.triactive.jdo.state
Class StateManagerImpl

java.lang.Object
  extended bycom.triactive.jdo.state.StateManagerImpl
All Implemented Interfaces:
javax.jdo.spi.StateManager, 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, javax.jdo.spi.PersistenceCapable pc)
          Constructs a state manager to manage an existing persistence-capable instance that is not persistent.
 
Method Summary
 void deletePersistent(boolean noStore)
          Deletes the instance.
 void dump(java.io.PrintWriter out)
           
 void evict()
           
 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).
 java.lang.Object getField(int field)
          Reads the current value of the specified field.
 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 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()
           
 boolean makePersistent()
          Makes the instance persistent.
 void makeTransactional()
           
 void makeTransient()
           
 void offerPrefetchedFields(int[] fieldNumbers, FieldManager fieldManager)
          Offers the specified pre-fetched fields to the state manager.
 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 field, 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.
 void provideFields(int[] fieldNumbers, FieldManager fm)
          Called to obtain current values from the PersistenceCapable associated with this StateManager.
 void refresh()
           
 void replaceFields(int[] fieldNumbers, FieldManager fm)
          Called to refresh data in the PersistenceCapable object associated with this StateManager.
 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.
 void retrieve(boolean DFGOnly)
           
 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 setField(int field, java.lang.Object currentValue, java.lang.Object newValue, boolean noStore)
          Updates the current value of the specified field.
 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.
 java.lang.String toString()
           
 void validate()
          Validates that the instance exists in the data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StateManagerImpl

public StateManagerImpl(PersistenceManager pm,
                        javax.jdo.spi.PersistenceCapable pc)
Constructs a state manager to manage an existing persistence-capable instance that is not persistent. All mutable SCO fields are wrapped in suitable wrapper objects and the PC instance transitions to a TransientClean state.

Parameters:
pm - The persistence manager controlling this state manager.
pc - The instance to be managed.

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 pm.getObjectById()).

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.
Method Detail

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

getPersistenceManager

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

getStoreManager

public StoreManager getStoreManager()
Specified by:
getStoreManager 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)

validate

public void validate()
Validates that the instance exists in the data store. Called by pm.getObjectById() when validate == true.

Specified by:
validate in interface StateManager

offerPrefetchedFields

public void offerPrefetchedFields(int[] fieldNumbers,
                                  FieldManager fieldManager)
Offers the specified pre-fetched fields to the state manager. If the instance is in a state that can benefit from newly available field values, the fields are replaced in the instance and a state change occurs as though the instance itself had read a field. Called by pm.getObjectById() when given prefetched fields.

Specified by:
offerPrefetchedFields 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)

getField

public java.lang.Object getField(int field)
Reads the current value of the specified field. This has the same effect on the state of the instance as if user code attempted to read the field.

Specified by:
getField in interface StateManager
Parameters:
field - The field number to read.
Returns:
The value of the field. Primitives are boxed in appropriate java.lang wrapper classes.

setField

public void setField(int field,
                     java.lang.Object currentValue,
                     java.lang.Object newValue,
                     boolean noStore)
Updates the current value of the specified field. This has the same effect on the state of the instance as if user code attempted to write the field.

Specified by:
setField in interface StateManager
Parameters:
field - The field number to write.
currentValue - The current value of the field. Used to determine whether or not the write is redundant. If necessary, the value can be obtained using getField(int).
newValue - The new value of the field. Primitives must be boxed in appropriate java.lang wrapper classes.

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 field,
                                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
field - the field number
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

provideFields

public void provideFields(int[] fieldNumbers,
                          FieldManager fm)
Called to obtain current 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 to refresh data in the PersistenceCapable object associated with this StateManager.

Unwrapped values for SCO fields are wrapped with an appropriate SCO wrapper object.

Specified by:
replaceFields in interface StateManager
Parameters:
fieldNumbers - An array of field numbers to be refreshed.
fm - Provides the updated values. This object is only used for the duration of the call.

makePersistent

public boolean makePersistent()
Makes the instance persistent. If the object is already persistent, this method does nothing. Otherwise, a new object ID for the instance is obtained from the store manager and the object is inserted in the data store.

Any failure will leave the instance in its previous life-cycle state.

Specified by:
makePersistent in interface StateManager
Returns:
true if the object was successfully made persistent, false if the object was already persistent.

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(boolean noStore)
Deletes the instance. If the object is already deleted, this method does nothing. Otherwise, the object is removed from the data store.

Any failure will leave the instance in its previous life-cycle state.

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

toString

public java.lang.String toString()

dump

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


Copyright 2001-2007 The TJDO Project All Rights Reserved.