org.apache.jdo.impl.state
Class StateManagerImpl

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

class StateManagerImpl
extends java.lang.Object
implements StateManagerInternal

This is the StoreManager independent implemetation of javax.jdo.spi.StateManager interface. Delegates state transition requests to LifeCycleState.

Version:
1.0.1
Author:
Marina Vatkina

Field Summary
private  boolean allowedChangeApplicationIdentity
           
private  javax.jdo.spi.PersistenceCapable beforeImage
          beforeImage represents state of an instance before any change or as of the call to makePersistent/deletePersistent
private  java.util.BitSet biFields
           
private static java.lang.String ChangeApplicationIdentityOption
           
private  java.lang.Object dependency
           
private  java.util.BitSet dirtyFields
           
private  java.lang.Object expectedProvider
           
private  int[] fieldArr
           
private  FieldManager fieldManager
           
private  javax.jdo.spi.PersistenceCapable flushedImage
          flushedImage represents state of an instance as of the last flush to the datastore.
private static StateFieldManager hollowFieldManager
          Helper StateFieldManager instance for resetting fields in a Hollow instance at commit/rollback.
private  boolean inAfterCompletion
           
private static RuntimeJavaModelFactory javaModelFactory
          RuntimeJavaModelFactory.
private  JDOClass jdoClass
           
private  byte jdoFlags
           
(package private) static javax.jdo.spi.JDOImplHelper jdoImplHelper
           
private  java.util.BitSet loadedFields
           
private static org.apache.commons.logging.Log logger
          Logger instance
private  java.lang.Object metaData
          Reference to JDO Model.
private static I18NHelper msg
          I18N message handler
private  LifeCycleState myLC
           
private  javax.jdo.spi.PersistenceCapable myPC
           
private  java.lang.Class myPCClass
           
private  PersistenceManagerInternal myPM
           
private  int numFields
           
private  StateFieldManager objectFieldManager
          Helper StateFieldManager instance for fetching Object fields values for reachability and SCO processing.
private  java.lang.Object objectId
           
private static ReachabilityHandler reachabilityHandler
           
private static SCOProcessor scoProcessor
           
private  boolean transitionTransient
           
private  javax.jdo.Transaction tx
           
private  java.lang.Object txObjectId
           
 
Fields inherited from interface org.apache.jdo.state.StateManagerInternal
FLUSHED_COMPLETE, FLUSHED_NONE, FLUSHED_PARTIAL
 
Constructor Summary
(package private) StateManagerImpl(java.lang.Object uoid, java.lang.Object ioid, PersistenceManagerInternal pm, java.lang.Class clazz)
          Constructs a new StateManagerImpl when requested from query processing.
(package private) StateManagerImpl(javax.jdo.spi.PersistenceCapable pc, PersistenceManagerInternal pm)
          Constructs a new StateManagerImpl to process future makePersistent request.
 
Method Summary
 void afterCompletion(boolean abort, boolean retainValues, boolean restoreValues)
          Transitions LifeCycleState on afterCompletion.
private  void assertSCOElementType(java.lang.Object o, int field)
          Assert element type of an SCO Collection or key and value types of an SCO Map.
protected  void clearFields()
          Clear fields on commit or rollback called by LifeCycle on commit or rollback transition.
private  void createAllBeforeImage()
          Create beforeImage for all fields - called by transition from TRANSIENT to P_NEW
protected  void createBeforeImage()
          Create a new beforeImage in an active optimistic transaction or an active datastore transaction with restoreValues flag set to true or for a transient-transactional instance.
private  void debug(java.lang.String msg)
          Tracing method
private  boolean debugging()
          Verifies if debugging is enabled.
 void deletePersistent()
          delete persistencecapable
protected  void deregister()
          Removes this StateManager from all the caches
protected  void disconnect()
          Disconnect StateManager and PC.
private  boolean disconnectClone(javax.jdo.spi.PersistenceCapable pc)
          Desconnects clone instance.
 void evictInstance()
          Transition to Hollow
private  void fetch(StoreManager srm)
          Fetches instance from the data store
private  void fetch(StoreManager srm, int[] fetchFields)
          Fetches specific fields in the instance from the data store
private  java.lang.Object fetchObjectField(int field)
          Returns current value from the Object type field.
 boolean flush(StoreManager srm)
          Causes the state manager to send itself to the store manager for insert, update, and so on as per its own state.
 boolean getBooleanField(javax.jdo.spi.PersistenceCapable pc, int field, boolean currentValue)
           
 byte getByteField(javax.jdo.spi.PersistenceCapable pc, int field, byte currentValue)
           
 char getCharField(javax.jdo.spi.PersistenceCapable pc, int field, char currentValue)
           
 java.lang.Object getDependency()
          Returns dependency object that contains dependency information specific to this instance of the StateManager
 double getDoubleField(javax.jdo.spi.PersistenceCapable pc, int field, double currentValue)
           
 java.lang.Object getExternalObjectId()
          Returns external representation of the object id that can be used by the client
 java.lang.String getFieldName(int field)
          Returns field name for the field number.
private  int[] getFieldNums(java.util.BitSet bs)
          Helper method to convert set bits in a BitSet to field numbers.
private  int[] getFields(int field)
          Helper method to define the list of fields to be loaded together with this field
 float getFloatField(javax.jdo.spi.PersistenceCapable pc, int field, float currentValue)
           
 java.lang.Object getInternalObjectId()
          Return the object representing the JDO identity of the associated instance
 int getIntField(javax.jdo.spi.PersistenceCapable pc, int field, int currentValue)
           
 long getLongField(javax.jdo.spi.PersistenceCapable pc, int field, long currentValue)
           
 javax.jdo.spi.PersistenceCapable getObject()
          Provides the object managed by this state manager.
 java.lang.Object getObjectField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.Object currentValue)
           
 java.lang.Object getObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the JDO identity of the calling instance.
 java.lang.Class getPCClass()
          Returns PC Class known to this StateManager.
 PersistenceManagerInternal getPersistenceManager()
          Return the PersistenceManager that owns this instance.
 javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
          Return the PersistenceManager that owns this instance as PersistenceManager wrapper.
 short getShortField(javax.jdo.spi.PersistenceCapable pc, int field, short currentValue)
           
 java.lang.String getStringField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.String currentValue)
           
private  java.lang.Object getTransactionalObjectId()
          Returns external representation of the transactional object id that can be used by the client
 java.lang.Object getTransactionalObjectId(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the JDO identity of the calling instance.
private  int[] getUnloaded(int[] newfields, java.util.BitSet set)
          Helper method to convert not loaded bits to field numbers.
 void handleReachability(boolean commit)
          Processes relationships for reachability algorithm and define the dependencies
private  void initializePC()
          Initialize PC Class information.
private  void initializePM(PersistenceManagerInternal pm)
          Initialize PersistenceManager related information.
private  void initializeSM(int newState)
          Initialize SM reference in PC and Oid
 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 isFlushed()
          Returns true if current state is flushed.
 boolean isLoaded(javax.jdo.spi.PersistenceCapable pc, int field)
          This implementation of isLoaded will always return true.
 boolean isNew()
          Tests whether this StateManager represents a instance made persistent object.
 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.
protected  boolean isSCOType(java.lang.Class type)
          Verifies that this class type is a supported SCO type.
 boolean isStored()
          Returns true if current state is present in the datastore.
 boolean isTransactional(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is transactional.
private  void loadField(int field)
          Load field value if necessary
private  void loadingField(java.lang.Object pc, int field)
          Preparation steps for replacingXXXField operation
protected  void loadUnloaded()
          Load all persistent fields as requested by the LifeCycle.
protected  void makeAutoPersistent()
          Transition to Auto-Persistent-New (persistence-by-reachability)
protected  void makeAutoPersistent(java.lang.Object[] o)
          Processes Array of referenced objects for possible auto-persistence (persistence-by-reachability).
 void makeDirty(int field)
          Mark the associated PersistenceCapable field dirty.
 void makeDirty(javax.jdo.spi.PersistenceCapable pc, java.lang.String fieldName)
          Mark the associated PersistenceCapable field dirty.
 void makeNontransactional()
          Transition to Nontransactional
 void makePersistent()
          Transition to Persistent-New
 void makeTransactional()
          Transition to Transactional
 void makeTransient()
          Transition to Transient
private  void markAllDirty()
          Mark all fields as loaded and dirty - called by transition from TRANSIENT to P_NEW and T_CLEAN
protected  void markAsFlushed()
          Called by LifeCycleState when transition persistent instance to the corresponding flushed state.
private  void markPKFieldsAsLoaded()
          Mark PK fields as loaded:
private  void notNeededByRI(java.lang.String s)
           
protected  void postLoad()
          If this class implements InstanceCallbacks, call the jdoPostLoad method.
protected  void preDelete()
           
private  void prepareSetField(javax.jdo.spi.PersistenceCapable pc, int field, FieldManager fieldManager)
          Preparation steps for setXXXField operation for non-Object type field.
private  void prepareSetField(javax.jdo.spi.PersistenceCapable pc, int field, FieldManager fieldManager, java.lang.Object currentValue, java.lang.Object newValue)
          Preparation steps for setXXXField operation for Object type field.
private  void prepareSetField1(javax.jdo.spi.PersistenceCapable pc, int field)
          Verification and load part of the preparation steps for setXXXField operation.
private  void prepareSetField2(int field, FieldManager fieldManager)
          Transtion write access and replace value step for setXXXField operation.
 void preSerialize(javax.jdo.spi.PersistenceCapable pc)
          Guarantee that the serializable transactional and persistent fields are loaded into the instance.
 void preStore()
          Calls preStore on the associated object if necessary.
private  void processReachability(boolean commit)
          Transition referenced fields to Persistent at commit (persistence-by-reachability)
 void providedBooleanField(javax.jdo.spi.PersistenceCapable pc, int field, boolean currentValue)
           
 void providedByteField(javax.jdo.spi.PersistenceCapable pc, int field, byte currentValue)
           
 void providedCharField(javax.jdo.spi.PersistenceCapable pc, int field, char currentValue)
           
 void providedDoubleField(javax.jdo.spi.PersistenceCapable pc, int field, double currentValue)
           
 void providedFloatField(javax.jdo.spi.PersistenceCapable pc, int field, float currentValue)
           
 void providedIntField(javax.jdo.spi.PersistenceCapable pc, int field, int currentValue)
           
 void providedLongField(javax.jdo.spi.PersistenceCapable pc, int field, long currentValue)
           
 void providedObjectField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.Object currentValue)
           
 void providedShortField(javax.jdo.spi.PersistenceCapable pc, int field, short currentValue)
           
 void providedStringField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.String currentValue)
           
 void provideField(int fieldNumber, FieldManager fieldManager, boolean identifying)
          Causes the values of the field indicated by the specified field number be given to the FieldManager.
 void provideFields(int[] fields, FieldManager fieldManager, boolean identifying)
          Causes the values of the fields indicated by the specified fields to be given to the FieldManager.
protected  void refresh()
          Refresh object inside of an active transaction as requested by the LifeCycle.
 void refreshInstance()
          Transition to Clean
protected  void registerNonTransactional()
          Adds this StateManager to non-transactional caches
protected  void registerTransactional()
          Adds this StateManager to all caches
 void reload()
          Fetches or refreshes pc instance.
 void replace(int[] fields, FieldManager fieldManager)
          Transition the lifecycle state as if the instance is retrieved from the datastore, but use the specified field values instead of loading them from the datastore.
 void replaceFields(int[] fields, FieldManager fieldManager)
          For replacing field values in a PC with the ones that is provided by the FieldManager.
private  void replaceSCO(SCO sco, int field)
          Replace field value with tracked SCO.
 void replaceSCOFields()
          Replaces field values that are regular SCO instances with tracked SCOs.
private  void replaceSCOWithClones(int[] fields)
          Replaces SCO instances with clones in the before image to preserve the state.
protected  void replaceUnloadedFields(int[] fields, FieldManager fieldManager)
          For replacing field values in a PC with one that is provided by the FieldManager.
 boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 byte replacingByteField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 char replacingCharField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 double replacingDoubleField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 byte replacingFlags(javax.jdo.spi.PersistenceCapable pc)
          The owning StateManager uses this method to supply the value of the flags to the PersistenceCapable instance.
 float replacingFloatField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 int replacingIntField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 long replacingLongField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 java.lang.Object replacingObjectField(javax.jdo.spi.PersistenceCapable pc, int field)
           
 short replacingShortField(javax.jdo.spi.PersistenceCapable pc, int 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 pc, int field)
           
protected  void reset()
          Reset all settings
private  void resetDirtyFields()
          Clear dirtyFields list on flush
protected  void resetOwner(java.util.Iterator it, int field, boolean set)
          Set owner on elements of an Iterator of SCO objects.
protected  void resetOwner(java.lang.Object[] o, int field, boolean set)
          Set owner on elements of an Array of SCO objects.
private  void resetOwner(java.lang.Object o, int field, boolean set)
          Set owner on referenced SCO objects.
private  void resetOwner(SCO sco, int field, boolean set)
          Set owner on referenced SCO objects.
private  void resetRef()
          Reset all references to null
protected  void restoreFields()
          Restore fields from beforeImage on commit or rollback called by LifeCycle on commit or rollback transition.
 void retrieve()
          Transition on retrieve request.
 void setBooleanField(javax.jdo.spi.PersistenceCapable pc, int field, boolean currentValue, boolean newValue)
           
 void setByteField(javax.jdo.spi.PersistenceCapable pc, int field, byte currentValue, byte newValue)
           
 void setCharField(javax.jdo.spi.PersistenceCapable pc, int field, char currentValue, char newValue)
           
 java.lang.Object setDependency(java.lang.Object dependency)
          Sets dependency object containing dependency information specific to this instance of the StateManager
 void setDoubleField(javax.jdo.spi.PersistenceCapable pc, int field, double currentValue, double newValue)
           
 void setFloatField(javax.jdo.spi.PersistenceCapable pc, int field, float currentValue, float newValue)
           
 void setIntField(javax.jdo.spi.PersistenceCapable pc, int field, int currentValue, int newValue)
           
 void setLongField(javax.jdo.spi.PersistenceCapable pc, int field, long currentValue, long newValue)
           
 void setObjectField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.Object currentValue, java.lang.Object newValue)
           
 void setObjectId(java.lang.Object objectId)
          Allows a client to change this state manager's object Id.
 void setPCClass(java.lang.Class pcClass)
          Allows StateManager to set the actual PC Class if it was not available at the constructor time and create a hollow instnce of that type.
private  void setSCOOwner(boolean set)
          Change owner of all SCO fields.
 void setShortField(javax.jdo.spi.PersistenceCapable pc, int field, short currentValue, short newValue)
           
 void setStringField(javax.jdo.spi.PersistenceCapable pc, int field, java.lang.String currentValue, java.lang.String newValue)
           
 void trackUpdates(int field, SCO sco)
          Makes newly added instances to an SCO Collection or SCO Map auto-persistent.
protected  void unsetBeforeImage()
          Reset beforeImage on refresh or flush
protected  void unsetSCOFields()
          Unsets owner of tracked SCO field values and marks fields as not loaded.
private  void updateBeforeImage(int[] fields)
          Update existing beforeImage in a transaction.
private  boolean verifyProvider(javax.jdo.spi.PersistenceCapable pc)
          Verifies field provider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPM

private PersistenceManagerInternal myPM

tx

private javax.jdo.Transaction tx

myPC

private javax.jdo.spi.PersistenceCapable myPC

myLC

private LifeCycleState myLC

jdoFlags

private byte jdoFlags

beforeImage

private javax.jdo.spi.PersistenceCapable beforeImage
beforeImage represents state of an instance before any change or as of the call to makePersistent/deletePersistent


flushedImage

private javax.jdo.spi.PersistenceCapable flushedImage
flushedImage represents state of an instance as of the last flush to the datastore.


hollowFieldManager

private static final StateFieldManager hollowFieldManager
Helper StateFieldManager instance for resetting fields in a Hollow instance at commit/rollback.


objectFieldManager

private StateFieldManager objectFieldManager
Helper StateFieldManager instance for fetching Object fields values for reachability and SCO processing.


metaData

private java.lang.Object metaData
Reference to JDO Model.


myPCClass

private java.lang.Class myPCClass

inAfterCompletion

private boolean inAfterCompletion

transitionTransient

private boolean transitionTransient

allowedChangeApplicationIdentity

private boolean allowedChangeApplicationIdentity

loadedFields

private java.util.BitSet loadedFields

dirtyFields

private java.util.BitSet dirtyFields

biFields

private java.util.BitSet biFields

fieldArr

private int[] fieldArr

objectId

private java.lang.Object objectId

txObjectId

private java.lang.Object txObjectId

dependency

private java.lang.Object dependency

fieldManager

private FieldManager fieldManager

expectedProvider

private java.lang.Object expectedProvider

jdoClass

private JDOClass jdoClass

numFields

private int numFields

jdoImplHelper

static final javax.jdo.spi.JDOImplHelper jdoImplHelper

javaModelFactory

private static final RuntimeJavaModelFactory javaModelFactory
RuntimeJavaModelFactory.


reachabilityHandler

private static final ReachabilityHandler reachabilityHandler

scoProcessor

private static final SCOProcessor scoProcessor

ChangeApplicationIdentityOption

private static final java.lang.String ChangeApplicationIdentityOption
See Also:
Constant Field Values

msg

private static final I18NHelper msg
I18N message handler


logger

private static final org.apache.commons.logging.Log logger
Logger instance

Constructor Detail

StateManagerImpl

StateManagerImpl(javax.jdo.spi.PersistenceCapable pc,
                 PersistenceManagerInternal pm)
Constructs a new StateManagerImpl to process future makePersistent request.

Parameters:
pc - the reference to the associated PersistenceCapable instance
pm - the reference to the associated PersistenceManagerInternal instance

StateManagerImpl

StateManagerImpl(java.lang.Object uoid,
                 java.lang.Object ioid,
                 PersistenceManagerInternal pm,
                 java.lang.Class clazz)
Constructs a new StateManagerImpl when requested from query processing.

Parameters:
uoid - the reference to the user object ID
ioid - the reference to the internal object ID
pm - the reference to the associated PersistenceManagerInternal instance
clazz - Class of the PersistenceCapable instance
Method Detail

initializePC

private void initializePC()
Initialize PC Class information.


initializePM

private void initializePM(PersistenceManagerInternal pm)
Initialize PersistenceManager related information.

Parameters:
pm - the reference to the associated PersistenceManagerInternal instance

markPKFieldsAsLoaded

private void markPKFieldsAsLoaded()
Mark PK fields as loaded:


afterCompletion

public void afterCompletion(boolean abort,
                            boolean retainValues,
                            boolean restoreValues)
Transitions LifeCycleState on afterCompletion.

Specified by:
afterCompletion in interface StateManagerInternal
Parameters:
abort - true if rollback
retainValues - the flag that indicates how to proceed on commit.
restoreValues - the flag that indicates how to proceed on rollback.

makePersistent

public void makePersistent()
Transition to Persistent-New

Specified by:
makePersistent in interface StateManagerInternal

deletePersistent

public void deletePersistent()
delete persistencecapable

Specified by:
deletePersistent in interface StateManagerInternal

makeTransactional

public void makeTransactional()
Transition to Transactional

Specified by:
makeTransactional in interface StateManagerInternal

makeNontransactional

public void makeNontransactional()
Transition to Nontransactional

Specified by:
makeNontransactional in interface StateManagerInternal

makeTransient

public void makeTransient()
Transition to Transient

Specified by:
makeTransient in interface StateManagerInternal

evictInstance

public void evictInstance()
Transition to Hollow

Specified by:
evictInstance in interface StateManagerInternal

refreshInstance

public void refreshInstance()
Transition to Clean

Specified by:
refreshInstance in interface StateManagerInternal

retrieve

public void retrieve()
Transition on retrieve request. This fetches Hollow instance and transitions to the appropriate LifeCycle state.

Specified by:
retrieve in interface StateManagerInternal

replace

public void replace(int[] fields,
                    FieldManager fieldManager)
Transition the lifecycle state as if the instance is retrieved from the datastore, but use the specified field values instead of loading them from the datastore.

Specified by:
replace in interface StateManagerInternal
Parameters:
fields - Indicates which fields should be replaced in the PC.
fieldManager - FieldManager from which the field's value should be obtained.

reload

public void reload()
Fetches or refreshes pc instance. Called by PersistenceManager.getObjectById with validate flag set to true.

Specified by:
reload in interface StateManagerInternal

flush

public boolean flush(StoreManager srm)
Description copied from interface: StateManagerInternal
Causes the state manager to send itself to the store manager for insert, update, and so on as per its own state. It should flush itself only if it has no dependencies on other state manager.

Specified by:
flush in interface StateManagerInternal
Parameters:
srm - The StoreManager to which the instance should send itself.
Returns:
true if the state manager could flush itself, false if it has dependencies on other state managers and could not flush itself.
See Also:
StateManagerInternal.flush(StoreManager srm)

handleReachability

public void handleReachability(boolean commit)
Description copied from interface: StateManagerInternal
Processes relationships for reachability algorithm and define the dependencies

Specified by:
handleReachability in interface StateManagerInternal
Parameters:
commit - is true if method is called inside the flush, false otherwise
See Also:
StateManagerInternal.handleReachability( boolean flag)

replaceSCOFields

public void replaceSCOFields()
Replaces field values that are regular SCO instances with tracked SCOs.

Specified by:
replaceSCOFields in interface StateManagerInternal
See Also:
StateManagerInternal.replaceSCOFields()

unsetSCOFields

protected void unsetSCOFields()
Unsets owner of tracked SCO field values and marks fields as not loaded.


makeDirty

public void makeDirty(int field)
Description copied from interface: StateManagerInternal
Mark the associated PersistenceCapable field dirty.

The StateManager will make a copy of the field so it can be restored if needed later, and then mark the field as modified in the current transaction.

Specified by:
makeDirty in interface StateManagerInternal
Parameters:
field - the number of the field
See Also:
(int field)

trackUpdates

public void trackUpdates(int field,
                         SCO sco)
Makes newly added instances to an SCO Collection or SCO Map auto-persistent.

Specified by:
trackUpdates in interface StateManagerInternal
Parameters:
field - the number of the field
sco - Tracked SCO instance.
See Also:
(int field, SCO sco)

getFieldName

public java.lang.String getFieldName(int field)
Description copied from interface: StateManagerInternal
Returns field name for the field number. Used for debugging.

Specified by:
getFieldName in interface StateManagerInternal
Parameters:
field - the number of the field
Returns:
field name as String
See Also:
(int field)

getPCClass

public java.lang.Class getPCClass()
Description copied from interface: StateManagerInternal
Returns PC Class known to this StateManager. Can be a candidate Class.

Specified by:
getPCClass in interface StateManagerInternal
Returns:
the Class type of the PC instance.
See Also:
()

setPCClass

public void setPCClass(java.lang.Class pcClass)
Description copied from interface: StateManagerInternal
Allows StateManager to set the actual PC Class if it was not available at the constructor time and create a hollow instnce of that type.

Specified by:
setPCClass in interface StateManagerInternal
Parameters:
pcClass - the Class type of the instance.
See Also:
(Class pcClass)

isNew

public boolean isNew()
Tests whether this StateManager represents a instance made persistent object.

Specified by:
isNew in interface StateManagerInternal
Returns:
true if this StateManager represents an instance made persistent in the current transaction.
See Also:
()

makeAutoPersistent

protected void makeAutoPersistent()
Transition to Auto-Persistent-New (persistence-by-reachability)


makeAutoPersistent

protected void makeAutoPersistent(java.lang.Object[] o)
Processes Array of referenced objects for possible auto-persistence (persistence-by-reachability).

Parameters:
o - Array of referenced objects

resetOwner

protected void resetOwner(java.lang.Object[] o,
                          int field,
                          boolean set)
Set owner on elements of an Array of SCO objects.

Parameters:
o - array of referenced objects.
field - the field number.
set - true if owner field should be set, false if unset.

resetOwner

protected void resetOwner(java.util.Iterator it,
                          int field,
                          boolean set)
Set owner on elements of an Iterator of SCO objects.

Parameters:
it - Iterator over referenced objects.
field - the field number.
set - true if owner field should be set, false if unset.

restoreFields

protected void restoreFields()
Restore fields from beforeImage on commit or rollback called by LifeCycle on commit or rollback transition.


clearFields

protected void clearFields()
Clear fields on commit or rollback called by LifeCycle on commit or rollback transition.


disconnect

protected void disconnect()
Disconnect StateManager and PC. Called by LifeCycle when transition to Transient.


reset

protected void reset()
Reset all settings


refresh

protected void refresh()
Refresh object inside of an active transaction as requested by the LifeCycle.


loadUnloaded

protected void loadUnloaded()
Load all persistent fields as requested by the LifeCycle.


registerTransactional

protected void registerTransactional()
Adds this StateManager to all caches


registerNonTransactional

protected void registerNonTransactional()
Adds this StateManager to non-transactional caches


deregister

protected void deregister()
Removes this StateManager from all the caches


preDelete

protected void preDelete()
See Also:
InstanceCallbacks.jdoPreDelete()

postLoad

protected void postLoad()
If this class implements InstanceCallbacks, call the jdoPostLoad method. This is done after the default fetch group values have been loaded from the store.


markAsFlushed

protected void markAsFlushed()
Called by LifeCycleState when transition persistent instance to the corresponding flushed state.


unsetBeforeImage

protected void unsetBeforeImage()
Reset beforeImage on refresh or flush


createBeforeImage

protected void createBeforeImage()
Create a new beforeImage in an active optimistic transaction or an active datastore transaction with restoreValues flag set to true or for a transient-transactional instance.


isSCOType

protected boolean isSCOType(java.lang.Class type)
Verifies that this class type is a supported SCO type.

Parameters:
type - Class type to check.
Returns:
true if this type is a supported SCO type.

replaceSCOWithClones

private void replaceSCOWithClones(int[] fields)
Replaces SCO instances with clones in the before image to preserve the state.

Parameters:
fields - array of field numbers to process.

fetchObjectField

private java.lang.Object fetchObjectField(int field)
Returns current value from the Object type field.

Parameters:
field - the field number
Returns:
current value as Object.

processReachability

private void processReachability(boolean commit)
Transition referenced fields to Persistent at commit (persistence-by-reachability)

Parameters:
commit - true if it is called during commit.

resetOwner

private void resetOwner(java.lang.Object o,
                        int field,
                        boolean set)
Set owner on referenced SCO objects.

Parameters:
o - referenced object.
field - the field number.
set - true if owner field should be set, false if unset.

resetOwner

private void resetOwner(SCO sco,
                        int field,
                        boolean set)
Set owner on referenced SCO objects.

Parameters:
sco - referenced SCO object.
field - the field number.
set - true if owner field should be set, false if unset.

loadField

private void loadField(int field)
Load field value if necessary

Parameters:
field - the field number

loadingField

private void loadingField(java.lang.Object pc,
                          int field)
Preparation steps for replacingXXXField operation

Parameters:
pc - the calling PersistenceCapable instance
field - the field number

prepareSetField

private void prepareSetField(javax.jdo.spi.PersistenceCapable pc,
                             int field,
                             FieldManager fieldManager)
Preparation steps for setXXXField operation for non-Object type field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
fieldManager - the FieldManager that handles double-dispatch

prepareSetField

private void prepareSetField(javax.jdo.spi.PersistenceCapable pc,
                             int field,
                             FieldManager fieldManager,
                             java.lang.Object currentValue,
                             java.lang.Object newValue)
Preparation steps for setXXXField operation for Object type field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
fieldManager - the FieldManager that handles double-dispatch
currentValue - current value of the field.
newValue - the new value of the field.

prepareSetField1

private void prepareSetField1(javax.jdo.spi.PersistenceCapable pc,
                              int field)
Verification and load part of the preparation steps for setXXXField operation.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number

prepareSetField2

private void prepareSetField2(int field,
                              FieldManager fieldManager)
Transtion write access and replace value step for setXXXField operation.

Parameters:
field - the field number
fieldManager - the FieldManager that handles double-dispatch

updateBeforeImage

private void updateBeforeImage(int[] fields)
Update existing beforeImage in a transaction.


replaceSCO

private void replaceSCO(SCO sco,
                        int field)
Replace field value with tracked SCO.

Parameters:
sco - tracked SCO instance to be replaced.
field - the field number.

setSCOOwner

private void setSCOOwner(boolean set)
Change owner of all SCO fields.

Parameters:
set - true if owner should be set, false if references to this SCO instance will be nullified and owner to be set to null.

assertSCOElementType

private void assertSCOElementType(java.lang.Object o,
                                  int field)
Assert element type of an SCO Collection or key and value types of an SCO Map.

Parameters:
o - Object to be tested.
field - the corresponding field number.
Throws:
javax.jdo.JDOUserException - if assertion fails.

getTransactionalObjectId

private java.lang.Object getTransactionalObjectId()
Returns external representation of the transactional object id that can be used by the client


createAllBeforeImage

private void createAllBeforeImage()
Create beforeImage for all fields - called by transition from TRANSIENT to P_NEW


markAllDirty

private void markAllDirty()
Mark all fields as loaded and dirty - called by transition from TRANSIENT to P_NEW and T_CLEAN


initializeSM

private void initializeSM(int newState)
Initialize SM reference in PC and Oid


resetDirtyFields

private void resetDirtyFields()
Clear dirtyFields list on flush


resetRef

private void resetRef()
Reset all references to null


disconnectClone

private boolean disconnectClone(javax.jdo.spi.PersistenceCapable pc)
Desconnects clone instance.

Returns:
true if it was clone.

verifyProvider

private boolean verifyProvider(javax.jdo.spi.PersistenceCapable pc)
Verifies field provider

Throws:
javax.jdo.JDOUserException - if provider is not the one expected.

fetch

private void fetch(StoreManager srm)
Fetches instance from the data store


fetch

private void fetch(StoreManager srm,
                   int[] fetchFields)
Fetches specific fields in the instance from the data store


getFields

private int[] getFields(int field)
Helper method to define the list of fields to be loaded together with this field


getUnloaded

private int[] getUnloaded(int[] newfields,
                          java.util.BitSet set)
Helper method to convert not loaded bits to field numbers.


getFieldNums

private int[] getFieldNums(java.util.BitSet bs)
Helper method to convert set bits in a BitSet to field numbers.


replacingFlags

public byte replacingFlags(javax.jdo.spi.PersistenceCapable pc)
The owning StateManager uses this method to supply the value of the flags to the 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

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 itself.

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

getPersistenceManager

public PersistenceManagerInternal getPersistenceManager()
Return the PersistenceManager that owns this instance. Called from internal methods. No validation performed.

Specified by:
getPersistenceManager in interface StateManagerInternal
Returns:
the PersistenceManager that owns this instance

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
Return the PersistenceManager that owns this instance as PersistenceManager wrapper. If called by PersistenceManagerImpl, it will perform validation during this call.

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(javax.jdo.spi.PersistenceCapable pc,
                      java.lang.String fieldName)
Mark the associated PersistenceCapable field dirty.

The StateManager will make a copy of the field so it can be restored if needed later, and then mark the field as modified in the current transaction.

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(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 identity 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

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 instances return false.

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

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 or user-written writeObject 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)
This implementation of isLoaded will always return true. So the getXXXField methods do not ever need to be implemented.

Specified by:
isLoaded in interface javax.jdo.spi.StateManager
Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
true

getBooleanField

public boolean getBooleanField(javax.jdo.spi.PersistenceCapable pc,
                               int field,
                               boolean currentValue)
Specified by:
getBooleanField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getBooleanField( PersistenceCapable pc, int field, boolean currentValue)

getCharField

public char getCharField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         char currentValue)
Specified by:
getCharField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getCharField(PersistenceCapable pc, int field, char currentValue)

getByteField

public byte getByteField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         byte currentValue)
Specified by:
getByteField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getByteField( PersistenceCapable pc, int field, byte currentValue)

getShortField

public short getShortField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           short currentValue)
Specified by:
getShortField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getShortField( PersistenceCapable pc, int field, short currentValue)

getIntField

public int getIntField(javax.jdo.spi.PersistenceCapable pc,
                       int field,
                       int currentValue)
Specified by:
getIntField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getIntField( PersistenceCapable pc, int field, int currentValue)

getLongField

public long getLongField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         long currentValue)
Specified by:
getLongField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getLongField( PersistenceCapable pc, int field, long currentValue)

getFloatField

public float getFloatField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           float currentValue)
Specified by:
getFloatField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getFloatField( PersistenceCapable pc, int field, float currentValue)

getDoubleField

public double getDoubleField(javax.jdo.spi.PersistenceCapable pc,
                             int field,
                             double currentValue)
Specified by:
getDoubleField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getDoubleField( PersistenceCapable pc, int field, double currentValue)

getStringField

public java.lang.String getStringField(javax.jdo.spi.PersistenceCapable pc,
                                       int field,
                                       java.lang.String currentValue)
Specified by:
getStringField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getStringField( PersistenceCapable pc, int field, String currentValue)

getObjectField

public java.lang.Object getObjectField(javax.jdo.spi.PersistenceCapable pc,
                                       int field,
                                       java.lang.Object currentValue)
Specified by:
getObjectField in interface javax.jdo.spi.StateManager
See Also:
StateManager.getObjectField( PersistenceCapable pc, int field, Object currentValue)

notNeededByRI

private void notNeededByRI(java.lang.String s)

setBooleanField

public void setBooleanField(javax.jdo.spi.PersistenceCapable pc,
                            int field,
                            boolean currentValue,
                            boolean newValue)
Specified by:
setBooleanField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setBooleanField( PersistenceCapable pc, int field, boolean currentValue, boolean newValue)

setCharField

public void setCharField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         char currentValue,
                         char newValue)
Specified by:
setCharField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setCharField( PersistenceCapable pc, int field, char currentValue, char newValue)

setByteField

public void setByteField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         byte currentValue,
                         byte newValue)
Specified by:
setByteField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setByteField( PersistenceCapable pc, int field, byte currentValue, byte newValue)

setShortField

public void setShortField(javax.jdo.spi.PersistenceCapable pc,
                          int field,
                          short currentValue,
                          short newValue)
Specified by:
setShortField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setShortField( PersistenceCapable pc, int field, short currentValue, short newValue)

setIntField

public void setIntField(javax.jdo.spi.PersistenceCapable pc,
                        int field,
                        int currentValue,
                        int newValue)
Specified by:
setIntField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setIntField( PersistenceCapable pc, int field, int currentValue, int newValue)

setLongField

public void setLongField(javax.jdo.spi.PersistenceCapable pc,
                         int field,
                         long currentValue,
                         long newValue)
Specified by:
setLongField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setLongField( PersistenceCapable pc, int field, long currentValue, long newValue)

setFloatField

public void setFloatField(javax.jdo.spi.PersistenceCapable pc,
                          int field,
                          float currentValue,
                          float newValue)
Specified by:
setFloatField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setFloatField( PersistenceCapable pc, int field, float currentValue, float newValue)

setDoubleField

public void setDoubleField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           double currentValue,
                           double newValue)
Specified by:
setDoubleField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setDoubleField( PersistenceCapable pc, int field, double currentValue, double newValue)

setStringField

public void setStringField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           java.lang.String currentValue,
                           java.lang.String newValue)
Specified by:
setStringField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setStringField( PersistenceCapable pc, int field, String currentValue, String newValue)

setObjectField

public void setObjectField(javax.jdo.spi.PersistenceCapable pc,
                           int field,
                           java.lang.Object currentValue,
                           java.lang.Object newValue)
Specified by:
setObjectField in interface javax.jdo.spi.StateManager
See Also:
StateManager.setObjectField( PersistenceCapable pc, int field, Object currentValue, Object newValue)

providedBooleanField

public void providedBooleanField(javax.jdo.spi.PersistenceCapable pc,
                                 int field,
                                 boolean currentValue)
Specified by:
providedBooleanField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedBooleanField( PersistenceCapable pc, int field, boolean currentValue)

providedCharField

public void providedCharField(javax.jdo.spi.PersistenceCapable pc,
                              int field,
                              char currentValue)
Specified by:
providedCharField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedCharField( PersistenceCapable pc, int field, char currentValue)

providedByteField

public void providedByteField(javax.jdo.spi.PersistenceCapable pc,
                              int field,
                              byte currentValue)
Specified by:
providedByteField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedByteField( PersistenceCapable pc, int field, byte currentValue)

providedShortField

public void providedShortField(javax.jdo.spi.PersistenceCapable pc,
                               int field,
                               short currentValue)
Specified by:
providedShortField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedShortField( PersistenceCapable pc, int field, short currentValue)

providedIntField

public void providedIntField(javax.jdo.spi.PersistenceCapable pc,
                             int field,
                             int currentValue)
Specified by:
providedIntField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedIntField( PersistenceCapable pc, int field, int currentValue)

providedLongField

public void providedLongField(javax.jdo.spi.PersistenceCapable pc,
                              int field,
                              long currentValue)
Specified by:
providedLongField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedLongField( PersistenceCapable pc, int field, long currentValue)

providedFloatField

public void providedFloatField(javax.jdo.spi.PersistenceCapable pc,
                               int field,
                               float currentValue)
Specified by:
providedFloatField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedFloatField( PersistenceCapable pc, int field, float currentValue)

providedDoubleField

public void providedDoubleField(javax.jdo.spi.PersistenceCapable pc,
                                int field,
                                double currentValue)
Specified by:
providedDoubleField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedDoubleField( PersistenceCapable pc, int field, double currentValue)

providedStringField

public void providedStringField(javax.jdo.spi.PersistenceCapable pc,
                                int field,
                                java.lang.String currentValue)
Specified by:
providedStringField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedStringField( PersistenceCapable pc, int field, String currentValue)

providedObjectField

public void providedObjectField(javax.jdo.spi.PersistenceCapable pc,
                                int field,
                                java.lang.Object currentValue)
Specified by:
providedObjectField in interface javax.jdo.spi.StateManager
See Also:
StateManager.providedObjectField( PersistenceCapable pc, int field, Object currentValue)

replacingBooleanField

public boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable pc,
                                     int field)
Specified by:
replacingBooleanField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingBooleanField( PersistenceCapable pc, int field)

replacingCharField

public char replacingCharField(javax.jdo.spi.PersistenceCapable pc,
                               int field)
Specified by:
replacingCharField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingCharField( PersistenceCapable pc, int field)

replacingByteField

public byte replacingByteField(javax.jdo.spi.PersistenceCapable pc,
                               int field)
Specified by:
replacingByteField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingByteField( PersistenceCapable pc, int field)

replacingShortField

public short replacingShortField(javax.jdo.spi.PersistenceCapable pc,
                                 int field)
Specified by:
replacingShortField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingShortField( PersistenceCapable pc, int field)

replacingIntField

public int replacingIntField(javax.jdo.spi.PersistenceCapable pc,
                             int field)
Specified by:
replacingIntField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingIntField( PersistenceCapable pc, int field)

replacingLongField

public long replacingLongField(javax.jdo.spi.PersistenceCapable pc,
                               int field)
Specified by:
replacingLongField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingLongField( PersistenceCapable pc, int field)

replacingFloatField

public float replacingFloatField(javax.jdo.spi.PersistenceCapable pc,
                                 int field)
Specified by:
replacingFloatField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingFloatField( PersistenceCapable pc, int field)

replacingDoubleField

public double replacingDoubleField(javax.jdo.spi.PersistenceCapable pc,
                                   int field)
Specified by:
replacingDoubleField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingDoubleField( PersistenceCapable pc, int field)

replacingStringField

public java.lang.String replacingStringField(javax.jdo.spi.PersistenceCapable pc,
                                             int field)
Specified by:
replacingStringField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingStringField( PersistenceCapable pc, int field)

replacingObjectField

public java.lang.Object replacingObjectField(javax.jdo.spi.PersistenceCapable pc,
                                             int field)
Specified by:
replacingObjectField in interface javax.jdo.spi.StateManager
See Also:
StateManager.replacingObjectField( PersistenceCapable pc, int field)

isStored

public boolean isStored()
Returns true if current state is present in the datastore.

Specified by:
isStored in interface StateManagerInternal

isFlushed

public boolean isFlushed()
Returns true if current state is flushed.

Specified by:
isFlushed in interface StateManagerInternal

setDependency

public java.lang.Object setDependency(java.lang.Object dependency)
Description copied from interface: StateManagerInternal
Sets dependency object containing dependency information specific to this instance of the StateManager

Specified by:
setDependency in interface StateManagerInternal
Parameters:
dependency - new dependency object
See Also:
StateManagerInternal.setDependency( Object dependency)

getDependency

public java.lang.Object getDependency()
Description copied from interface: StateManagerInternal
Returns dependency object that contains dependency information specific to this instance of the StateManager

Specified by:
getDependency in interface StateManagerInternal
See Also:
StateManagerInternal.getDependency()

getObject

public javax.jdo.spi.PersistenceCapable getObject()
Description copied from interface: StateManagerInternal
Provides the object managed by this state manager.

Specified by:
getObject in interface StateManagerInternal
Returns:
The object managed by this state manager.
See Also:
StateManagerInternal.getObject()

setObjectId

public void setObjectId(java.lang.Object objectId)
Description copied from interface: StateManagerInternal
Allows a client to change this state manager's object Id. For example, with datastore identity, allows one object id to be used before the object has been stored (i.e. a "provisional" id), and another once the object has been put into the datbase.

Specified by:
setObjectId in interface StateManagerInternal
See Also:
StateManagerInternal.setObjectId(Object objectId)

getInternalObjectId

public java.lang.Object getInternalObjectId()
Return the object representing the JDO identity of the associated instance

Specified by:
getInternalObjectId in interface StateManagerInternal
Returns:
the object representing the JDO identity of the associated instance.

getExternalObjectId

public java.lang.Object getExternalObjectId()
Returns external representation of the object id that can be used by the client

Specified by:
getExternalObjectId in interface StateManagerInternal
Returns:
external representation of the object id associated with this statemanager.

provideField

public void provideField(int fieldNumber,
                         FieldManager fieldManager,
                         boolean identifying)
Description copied from interface: StateManagerInternal
Causes the values of the field indicated by the specified field number be given to the FieldManager.

Specified by:
provideField in interface StateManagerInternal
Parameters:
fieldNumber - Indicates which field should be provided to the fieldManager.
fieldManager - FieldManager to which the field should be given.
identifying - If true, provides values from the before or flushed image, as determined by this StateManager's state; if false provides values from the current image.
See Also:
StateManagerInternal.provideField( int fieldNumber, FieldManager fieldManager, boolean identifying)

provideFields

public void provideFields(int[] fields,
                          FieldManager fieldManager,
                          boolean identifying)
Description copied from interface: StateManagerInternal
Causes the values of the fields indicated by the specified fields to be given to the FieldManager.

Specified by:
provideFields in interface StateManagerInternal
Parameters:
fields - Indicates which fields should be provided to the fieldManager.
fieldManager - FieldManager to which the field should be given.
identifying - If true, provides values from the before or flushed image, as determined by this StateManager's state; if false provides values from the current image.
See Also:
StateManagerInternal.provideFields(int[] fields, FieldManager fieldManager, boolean identifying)

replaceFields

public void replaceFields(int[] fields,
                          FieldManager fieldManager)
Description copied from interface: StateManagerInternal
For replacing field values in a PC with the ones that is provided by the FieldManager.

Specified by:
replaceFields in interface StateManagerInternal
Parameters:
fields - Indicates which fields should be replaced in the PC.
fieldManager - FieldManager from which the field values should be obtained.
See Also:
StateManagerInternal.replaceFields(int[] fields, FieldManager fieldManager)

replaceUnloadedFields

protected void replaceUnloadedFields(int[] fields,
                                     FieldManager fieldManager)
For replacing field values in a PC with one that is provided by the FieldManager. This method does not replace fields that are already loaded, even if their field number are included in the specified field number array.

Parameters:
fields - Indicates which fields should be replaced in the PC.
fieldManager - FieldManager from which the field values should be obtained.

preStore

public void preStore()
Description copied from interface: StateManagerInternal
Calls preStore on the associated object if necessary.

Specified by:
preStore in interface StateManagerInternal

debug

private void debug(java.lang.String msg)
Tracing method

Parameters:
msg - String to display

debugging

private boolean debugging()
Verifies if debugging is enabled.

Returns:
true if debugging is enabled.