|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpox.state.AbstractStateManager
public abstract class AbstractStateManager
Abstract representation of a StateManager. Provides some of the basic StateManager methods that do very little.
| Field Summary | |
|---|---|
protected AbstractClassMetaData |
cmd
the metadata for the class. |
protected FieldManager |
currFM
Current FieldManager. |
protected java.lang.Object |
currFMmonitor
monitor to synchronize execution when replacing/providing fields |
protected boolean |
dirty
Indicator for whether the persistable instance is dirty. |
protected boolean[] |
dirtyFields
indicators for which fields are currently dirty in the persistable instance. |
protected boolean[] |
loadedFields
indicators for which fields are currently loaded in the persistable instance. |
protected static Localiser |
LOCALISER
Localiser for messages. |
protected FetchPlan.FetchPlanForClass |
myFP
Fetch plan for the class of the managed object. |
protected java.lang.Object |
myID
The object identity in the datastore |
protected java.lang.Object |
myInternalID
The object identity in the JVM. |
protected LifeCycleState |
myLC
The actual LifeCycleState for the persistable instance |
protected ObjectManager |
myOM
the Object Manager for this StateManager |
protected javax.jdo.spi.PersistenceCapable |
myPC
The PersistenceCapable instance managed by this StateManager |
protected java.lang.Object |
myVersion
version field for optimistic transactions |
protected int |
pcObjectType
The type of the managed object (0 = PC, 1 = embedded PC, 2 = embedded element, 3 = embedded key, 4 = embedded value. |
protected boolean |
restoreValues
Whether to restore values at StateManager. |
protected java.lang.Object |
transactionalVersion
version field for optimistic transactions, after a insert/update but not yet committed. |
| Fields inherited from interface org.jpox.StateManager |
|---|
EMBEDDED_COLLECTION_ELEMENT_PC, EMBEDDED_MAP_KEY_PC, EMBEDDED_MAP_VALUE_PC, EMBEDDED_PC, PC |
| Constructor Summary | |
|---|---|
AbstractStateManager(ObjectManager om,
AbstractClassMetaData cmd)
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
clearDirtyFlags()
Method to clear all dirty flags on the object. |
protected void |
clearDirtyFlags(int[] fields)
Method to clear all dirty flags on the object. |
protected static void |
clearFlags(boolean[] flags)
Utility to clear the supplied flags. |
protected static void |
clearFlags(boolean[] flags,
int[] fields)
Utility to clear the supplied flags. |
protected abstract boolean |
disconnectClone(javax.jdo.spi.PersistenceCapable pc)
Method to disconnect any cloned persistence capable objects from their StateManager. |
protected static boolean |
equals(java.lang.Object o1,
java.lang.Object o2)
Compares two objects for equality, where one or both of the object references may be null. |
protected int[] |
getAllFieldNumbers()
returns field numbers of all fields. |
boolean |
getBooleanField(javax.jdo.spi.PersistenceCapable pc,
int field,
boolean currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
byte |
getByteField(javax.jdo.spi.PersistenceCapable pc,
int field,
byte currentValue)
This method is called by the associated PersistenceCapable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
protected CallbackHandler |
getCallbackHandler()
returns the handler for callback events. |
char |
getCharField(javax.jdo.spi.PersistenceCapable pc,
int field,
char currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
AbstractClassMetaData |
getClassMetaData()
Accessor for the ClassMetaData for this object. |
java.lang.String[] |
getDirtyFieldNames()
Accessor for the names of the fields that are dirty. |
int[] |
getDirtyFieldNumbers()
Accessor for the field numbers of all dirty fields. |
double |
getDoubleField(javax.jdo.spi.PersistenceCapable pc,
int field,
double currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
static int[] |
getFlagsSetTo(boolean[] flags,
boolean state)
Returns an array of integers containing the indices of all elements in flags that are in the state passed as argument. |
protected static int[] |
getFlagsSetTo(boolean[] flags,
int[] indices,
boolean state)
Returns an array of integers containing the indices of all elements in flags whose index occurs in indices and whose value is state. |
float |
getFloatField(javax.jdo.spi.PersistenceCapable pc,
int field,
float currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
int |
getHighestFieldNumber()
Accessor for the highest field number in this class |
java.lang.Object |
getInternalObjectId()
Accessor for the internal object id of the object we are managing. |
int |
getIntField(javax.jdo.spi.PersistenceCapable pc,
int field,
int currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
LifeCycleState |
getLifecycleState()
Accessor for the LifeCycleState |
java.lang.String[] |
getLoadedFieldNames()
Accessor for the names of the fields that are loaded. |
int[] |
getLoadedFieldNumbers()
Accessor for the field numbers of all loaded fields in this managed instance. |
long |
getLongField(javax.jdo.spi.PersistenceCapable pc,
int field,
long currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
MetaDataManager |
getMetaDataManager()
Accessor for the MetaDataManager to use for this object. |
protected int[] |
getNonPrimaryKeyFieldNumbers()
returns field numbers of all non-primary-key fields. |
protected boolean[] |
getNonPrimaryKeyFields()
returns indicators for which fields are non-primary key fields. |
java.lang.Object |
getObject()
Accessor for the Persistent Capable object. |
java.lang.Object |
getObjectField(javax.jdo.spi.PersistenceCapable pc,
int field,
java.lang.Object currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
ObjectManager |
getObjectManager()
Accessor for the ObjectManager for this object. |
int |
getPcObjectType()
Accessor for the PC object type (whether it is PC, embedded PC, etc). |
protected int[] |
getSecondClassMutableFieldNumbers()
returns field numbers of all second class mutable fields. |
protected boolean[] |
getSecondClassMutableFields()
returns indicators for which fields are second-class mutable. |
short |
getShortField(javax.jdo.spi.PersistenceCapable pc,
int field,
short currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
StoreManager |
getStoreManager()
Accessor for the StoreManager used for this object. |
java.lang.String |
getStringField(javax.jdo.spi.PersistenceCapable pc,
int field,
java.lang.String currentValue)
This method is called by the associated persistable if the value for the specified field is not cached (StateManager.isLoaded() fails). |
java.lang.Object |
getTransactionalVersion(java.lang.Object pc)
Return the object representing the transactional version of the calling instance. |
java.lang.Object |
getVersion(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the version of the calling instance. |
protected void |
initialiseFieldInformation()
Convenience method to initialise the field information. |
protected boolean |
isDefaultFetchGroupLoaded()
Accessor for whether the DFG fields are loaded. |
boolean |
isDeleted(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object has been deleted. |
boolean |
isDirty(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is dirty. |
boolean |
isEmbedded()
Convenience accessor for whether this StateManager manages an embedded/serialised object. |
protected boolean |
isFetchPlanLoaded()
Accessor for whether the current fetch plan fields are loaded. |
boolean |
isNew(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object has been newly made persistent. |
boolean |
isPersistent(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is persistent. |
boolean |
isRestoreValues()
Accessor for the Restore Values flag |
boolean |
isTransactional(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is transactional. |
protected static java.lang.Object |
peekField(java.lang.Object obj,
java.lang.String fieldName)
Utility to take a peek at a field in the persistable object. |
void |
providedBooleanField(javax.jdo.spi.PersistenceCapable pc,
int field,
boolean currentValue)
This method is called from the associated persistable 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 persistable when its PersistenceCapable.jdoProvideFields() method is invoked. |
void |
providedCharField(javax.jdo.spi.PersistenceCapable pc,
int field,
char currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. |
void |
providedDoubleField(javax.jdo.spi.PersistenceCapable pc,
int field,
double currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. |
void |
providedFloatField(javax.jdo.spi.PersistenceCapable pc,
int field,
float currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. |
void |
providedIntField(javax.jdo.spi.PersistenceCapable pc,
int field,
int currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. |
void |
providedLongField(javax.jdo.spi.PersistenceCapable pc,
int field,
long currentValue)
This method is called from the associated PersistenceCapable when its PersistenceCapable.jdoProvideFields() method is invoked. |
void |
providedObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
java.lang.Object currentValue)
This method is called from the associated persistable 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 persistable when its PersistenceCapable.jdoProvideFields() method is invoked. |
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. |
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 persistable 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 persistable 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 persistable 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 persistable object's jdoReplaceField() method to refresh the value of a short field. |
java.lang.String |
replacingStringField(javax.jdo.spi.PersistenceCapable obj,
int field)
This method is invoked by the persistable object's jdoReplaceField() method to refresh the value of a String field. |
void |
setPcObjectType(int embeddedType)
Method to set this StateManager as managing an embedded/serialised object. |
protected void |
setRestoreValues(boolean restore_values)
Mutator for the Restore Values flag |
void |
setTransactionalVersion(java.lang.Object version)
Sets the value for the version column in a transaction not yet committed |
void |
setVersion(java.lang.Object version)
Sets the value for the version column in the datastore |
java.lang.String |
toString()
Stringifier method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Localiser LOCALISER
protected ObjectManager myOM
protected javax.jdo.spi.PersistenceCapable myPC
protected AbstractClassMetaData cmd
protected java.lang.Object myInternalID
protected java.lang.Object myID
protected LifeCycleState myLC
protected java.lang.Object myVersion
protected java.lang.Object transactionalVersion
protected FetchPlan.FetchPlanForClass myFP
protected boolean dirty
protected boolean[] dirtyFields
protected boolean[] loadedFields
protected boolean restoreValues
protected FieldManager currFM
protected java.lang.Object currFMmonitor
protected int pcObjectType
| Constructor Detail |
|---|
public AbstractStateManager(ObjectManager om,
AbstractClassMetaData cmd)
om - ObjectManagercmd - the metadata for the class.| Method Detail |
|---|
protected void initialiseFieldInformation()
protected CallbackHandler getCallbackHandler()
protected boolean[] getSecondClassMutableFields()
protected boolean[] getNonPrimaryKeyFields()
protected int[] getAllFieldNumbers()
protected int[] getNonPrimaryKeyFieldNumbers()
protected int[] getSecondClassMutableFieldNumbers()
public StoreManager getStoreManager()
getStoreManager in interface StateManagerpublic AbstractClassMetaData getClassMetaData()
getClassMetaData in interface StateManagerpublic MetaDataManager getMetaDataManager()
getMetaDataManager in interface StateManagerpublic ObjectManager getObjectManager()
getObjectManager in interface StateManagerpublic java.lang.Object getObject()
getObject in interface StateManagerpublic LifeCycleState getLifecycleState()
public boolean isRestoreValues()
isRestoreValues in interface StateManagerprotected void setRestoreValues(boolean restore_values)
restore_values - Whether to restore valuespublic java.lang.Object getInternalObjectId()
getInternalObjectId in interface StateManagerprotected abstract boolean disconnectClone(javax.jdo.spi.PersistenceCapable pc)
pc - The persistable object
public boolean isDirty(javax.jdo.spi.PersistenceCapable pc)
Transient nontransactional instances return false (JDO spec), but the JPOX implementation does not currently support the transient transactional state.
pc - the calling persistable instance
PersistenceCapable.jdoMakeDirty(String fieldName)public boolean isTransactional(javax.jdo.spi.PersistenceCapable pc)
Transient nontransactional instances return false.
pc - the calling persistable instance
public boolean isPersistent(javax.jdo.spi.PersistenceCapable pc)
pc - the calling persistable instance
public boolean isNew(javax.jdo.spi.PersistenceCapable pc)
Transient instances return false.
isNew in interface StateManagerpc - the calling persistable instance
public boolean isDeleted(javax.jdo.spi.PersistenceCapable pc)
Transient instances return false.
isDeleted in interface StateManagerpc - the calling persistable instance
public java.lang.Object getVersion(javax.jdo.spi.PersistenceCapable pc)
getVersion in interface StateManagerpc - the calling persistable instance
public void setTransactionalVersion(java.lang.Object version)
setTransactionalVersion in interface StateManagerversion - The versionpublic java.lang.Object getTransactionalVersion(java.lang.Object pc)
getTransactionalVersion in interface StateManagerpc - the calling persistable instance
public void setVersion(java.lang.Object version)
setVersion in interface StateManagerversion - The versionpublic boolean isEmbedded()
isEmbedded in interface StateManagerpublic void setPcObjectType(int embeddedType)
setPcObjectType in interface StateManagerembeddedType - The type of object being managedpublic int getPcObjectType()
getPcObjectType in interface StateManagerpublic int getHighestFieldNumber()
getHighestFieldNumber in interface StateManagerprotected boolean isFetchPlanLoaded()
protected boolean isDefaultFetchGroupLoaded()
public int[] getDirtyFieldNumbers()
getDirtyFieldNumbers in interface StateManagerpublic int[] getLoadedFieldNumbers()
getLoadedFieldNumbers in interface StateManagerpublic java.lang.String[] getDirtyFieldNames()
getDirtyFieldNames in interface StateManagerpublic java.lang.String[] getLoadedFieldNames()
getLoadedFieldNames in interface StateManagerprotected void clearDirtyFlags()
protected void clearDirtyFlags(int[] fields)
fields - the fields to clear
public void providedBooleanField(javax.jdo.spi.PersistenceCapable pc,
int field,
boolean currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedByteField(javax.jdo.spi.PersistenceCapable pc,
int field,
byte currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedCharField(javax.jdo.spi.PersistenceCapable pc,
int field,
char currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedDoubleField(javax.jdo.spi.PersistenceCapable pc,
int field,
double currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedFloatField(javax.jdo.spi.PersistenceCapable pc,
int field,
float currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedIntField(javax.jdo.spi.PersistenceCapable pc,
int field,
int currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedLongField(javax.jdo.spi.PersistenceCapable pc,
int field,
long currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedShortField(javax.jdo.spi.PersistenceCapable pc,
int field,
short currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedStringField(javax.jdo.spi.PersistenceCapable pc,
int field,
java.lang.String currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public void providedObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
java.lang.Object currentValue)
pc - the calling PersistenceCapable instancefieldNumber - the field numbercurrentValue - the current value of the field
public boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable pc,
int field)
pc - the calling persistable instancefield - the field number
public byte replacingByteField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public char replacingCharField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public double replacingDoubleField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling PersistenceCapable instancefield - the field number
public float replacingFloatField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling PersistenceCapable instancefield - the field number
public int replacingIntField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public long replacingLongField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public short replacingShortField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public java.lang.String replacingStringField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public java.lang.Object replacingObjectField(javax.jdo.spi.PersistenceCapable obj,
int field)
obj - the calling persistable instancefield - the field number
public boolean getBooleanField(javax.jdo.spi.PersistenceCapable pc,
int field,
boolean currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public byte getByteField(javax.jdo.spi.PersistenceCapable pc,
int field,
byte currentValue)
pc - the calling PersistenceCapable instancefield - the field numbercurrentValue - the current value of the field
public char getCharField(javax.jdo.spi.PersistenceCapable pc,
int field,
char currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public double getDoubleField(javax.jdo.spi.PersistenceCapable pc,
int field,
double currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public float getFloatField(javax.jdo.spi.PersistenceCapable pc,
int field,
float currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public int getIntField(javax.jdo.spi.PersistenceCapable pc,
int field,
int currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public long getLongField(javax.jdo.spi.PersistenceCapable pc,
int field,
long currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public short getShortField(javax.jdo.spi.PersistenceCapable pc,
int field,
short currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public java.lang.String getStringField(javax.jdo.spi.PersistenceCapable pc,
int field,
java.lang.String currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
public java.lang.Object getObjectField(javax.jdo.spi.PersistenceCapable pc,
int field,
java.lang.Object currentValue)
pc - the calling persistable instancefield - the field numbercurrentValue - the current value of the field
protected static boolean equals(java.lang.Object o1,
java.lang.Object o2)
true if the objects are both null or
compare equal according to their equals() method,
false otherwise.protected static void clearFlags(boolean[] flags)
flags -
protected static void clearFlags(boolean[] flags,
int[] fields)
flags - fields - fields numbers where the flags will be cleared
public static int[] getFlagsSetTo(boolean[] flags,
boolean state)
flags - Array of flags (true or false)state - The state to search (true or false)
protected static int[] getFlagsSetTo(boolean[] flags,
int[] indices,
boolean state)
protected static java.lang.Object peekField(java.lang.Object obj,
java.lang.String fieldName)
obj - The persistable objectfieldName - The field to peek at
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||