|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface StateManager
StateManager for persistable objects. Makes the assumption that a StateManager corresponds to ONE persistable object.
| Field Summary | |
|---|---|
static int |
EMBEDDED_COLLECTION_ELEMENT_PC
Embedded (or serialised) Collection Element PC |
static int |
EMBEDDED_MAP_KEY_PC
Embedded (or serialised) Map Key PC |
static int |
EMBEDDED_MAP_VALUE_PC
Embedded (or serialised) Map Value PC |
static int |
EMBEDDED_PC
Embedded (or serialised) PC |
static int |
PC
PC |
| Method Summary | |
|---|---|
void |
addEmbeddedOwner(StateManager ownerSM,
int ownerFieldNumber)
Method to register an owner StateManager with this embedded/serialised object. |
void |
attach(boolean embedded)
Method to attach the object managed by this StateManager. |
java.lang.Object |
attachCopy(java.lang.Object detachedPC,
boolean embedded)
Method to attach to this the detached persistable instance |
boolean |
becomingDeleted()
Whether this object is moving to a deleted state. |
CachedPC |
cache()
Method to return an L2 cacheable object representing the managed object. |
void |
changeActivityState(ActivityState activityState)
Update the acitvity state. |
void |
checkInheritance(FieldValues fv)
Look to the database to determine which class this object is. |
void |
checkManagedRelations()
Method to process all managed relations for this object. |
void |
clearFields()
Method to clear all fields of the object. |
void |
clearLoadedFlags()
Method to clear all loaded flags on the object. |
void |
clearManagedRelations()
Method to clear any state related to "managed relationships" stored for the object. |
void |
clearNonPrimaryKeyFields()
Method to clear all fields that are not part of the primary key of the object. |
void |
clearSavedFields()
Method to clear all saved fields on the object. |
void |
copyFieldsFromObject(javax.jdo.spi.PersistenceCapable pc,
int[] fieldNumbers)
Convenience method to update our object with the field values from the passed object. |
void |
deletePersistent()
Method to delete the object from persistence. |
void |
detach(FetchPlanState state)
Method to detach the PersistenceCapable object. |
java.lang.Object |
detachCopy(FetchPlanState state)
Method to make detached copy of this instance |
void |
disconnect()
Disconnect the StateManager from the PersistenceManager and PC object. |
void |
dump(java.io.PrintWriter out)
Diagnostic method to dump the current state to the provided PrintWriter. |
void |
enlistInTransaction()
|
void |
evict()
Method to change the object state to evicted. |
void |
evictFromTransaction()
|
void |
flush()
Method to flush all changes to the datastore. |
boolean |
getAllFieldsLoaded()
Returns whether all fields are loaded. |
java.lang.Object |
getAssociatedValue(java.lang.Object key)
Accessor for the value of an external field. |
AbstractClassMetaData |
getClassMetaData()
Accessor for the ClassMetaData for this object. |
java.lang.String[] |
getDirtyFieldNames()
Accessor for the names of all dirty fields. |
int[] |
getDirtyFieldNumbers()
Accessor for the field numbers of all dirty fields in this managed instance. |
boolean[] |
getDirtyFields()
Creates a copy of the internal dirtyFields array. |
StateManager[] |
getEmbeddedOwners()
Accessor for the overall owner StateManagers of the managed object when embedded. |
java.lang.Object |
getExternalObjectId(java.lang.Object obj)
return a copy from the object Id |
int |
getHighestFieldNumber()
Accessor for the highest field number |
java.lang.Object |
getInternalObjectId()
Accessor for the id of the object managed by this StateManager. |
java.lang.String[] |
getLoadedFieldNames()
Accessor for the names of all loaded fields. |
int[] |
getLoadedFieldNumbers()
Accessor for the field numbers of all loaded fields in this managed instance. |
boolean[] |
getLoadedFields()
Accessor for the fields |
MetaDataManager |
getMetaDataManager()
Accessor for the manager for MetaData. |
java.lang.Object |
getObject()
Accessor for the object managed by this StateManager. |
java.lang.Object |
getObjectId(javax.jdo.spi.PersistenceCapable pc)
Accessor for the object id. |
ObjectManager |
getObjectManager()
Returns the ObjectManager that owns the StateManager instance |
ObjectProvider |
getObjectProvider()
|
int |
getPcObjectType()
Accessor for the PC object type. |
java.lang.Object |
getReferencedPC()
Accessor for the referenced PC object when we are attaching or detaching. |
RelationshipManager |
getRelationshipManager()
Accessor for the relationship manager (if present). |
StoreManager |
getStoreManager()
Accessor for the manager for the store. |
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)
|
void |
initialiseForCachedPC(CachedPC cachedPC,
java.lang.Object id,
java.lang.Class pcClass)
Initialise to create a StateManager for a PersistenceCapable object, assigning the specified id to the object. |
void |
initialiseForDetached(java.lang.Object pc,
java.lang.Object id,
java.lang.Object version)
Initialises the StateManager to manage a PersistenceCapable object in detached state. |
void |
initialiseForEmbedded(java.lang.Object pc,
boolean copyPc)
Initialises a state manager to manage a PersistenceCapable instance that will be EMBEDDED/SERIALISED into another PersistenceCapable object. |
void |
initialiseForHollow(java.lang.Object id,
FieldValues fv,
java.lang.Class pcClass)
Initialises a state manager to manage a hollow instance having the given object ID and the given (optional) field values. |
void |
initialiseForHollowAppId(FieldValues fv,
java.lang.Class pcClass)
Initialises a state manager to manage a HOLLOW / P_CLEAN instance having the given FieldValues. |
void |
initialiseForHollowPreConstructed(java.lang.Object id,
java.lang.Object pc)
Initialises a state manager to manage the given hollow instance having the given object ID. |
void |
initialiseForPersistentClean(java.lang.Object id,
java.lang.Object pc)
Initialises a state manager to manage the passed persistent instance having the given object ID. |
void |
initialiseForPersistentNew(java.lang.Object pc,
FieldValues preInsertChanges)
Initialises a state manager to manage a transient instance that is becoming newly persistent. |
void |
initialiseForPNewToBeDeleted(java.lang.Object pc)
Initialises the StateManager to manage a PersistenceCapable object that is not persistent but that is about to be deleted. |
void |
initialiseForTransactionalTransient(java.lang.Object pc)
Initialises a state manager to manage a Transactional Transient instance. |
boolean |
isDeleted(javax.jdo.spi.PersistenceCapable pc)
Accessor for whether the managed object is deleted. |
boolean |
isDeleting()
Tests whether this object is in the process of being deleted. |
boolean |
isDetaching()
Tests whether this object is in the process of being detached. |
boolean |
isEmbedded()
Convenience accessor for whether this StateManager manages an embedded/serialised object. |
boolean |
isFieldLoaded(int fieldNumber)
Accessor for whether a field is currently loaded. |
boolean |
isInserting()
Tests whether this object is being inserted. |
boolean |
isLoaded(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber)
|
boolean |
isNew(javax.jdo.spi.PersistenceCapable pc)
Accessor for whether the managed object is new. |
boolean |
isRestoreValues()
Accessor for the Restore Values flag |
boolean |
isUpdatingFieldForPostInsert()
Convenience method to return if we are in the phase of performing postInsert updates due to related objects having been inserted and so allowing the field to be inserted. |
boolean |
isWaitingToBeFlushedToDatastore()
Tests whether this object is new yet waiting to be flushed to the datastore. |
void |
loadField(int fieldNumber)
Convenience method to load the specified field if not loaded. |
void |
loadFieldFromDatastore(int fieldNumber)
Convenience method to load a field from the datastore. |
void |
loadFieldsInFetchPlan(FetchPlanState state)
Method to load all unloaded fields in the FetchPlan. |
void |
loadFieldValues(FieldValues fv)
Convenience method to load the passed field values. |
void |
loadUnloadedFields()
Fetch from the database all fields that are not currently loaded regardless of whether they are in the current fetch group or not. |
void |
loadUnloadedFieldsInFetchPlan()
Fetchs from the database all fields that are not currently loaded and that are in the current fetch group. |
void |
loadUnloadedFieldsOfClassInFetchPlan(FetchPlan fetchPlan)
Loads all unloaded fields of the managed class that are in the current FetchPlan. |
void |
locate()
Locate this object in the datastore. |
void |
makeDirty(int fieldNumber)
Method to mark the specified (absolute) field number as dirty. |
void |
makeNontransactional()
Method to make the managed object nontransactional. |
void |
makePersistent()
Method to make the managed object persistent. |
void |
makePersistentTransactionalTransient()
Method to make Transactional Transient instances persistent |
void |
makeTransactional()
Method to make the managed object transactional. |
void |
makeTransient(FetchPlanState state)
Method to make the managed object transient. |
void |
markForInheritanceValidation()
Mark the state manager as needing to validate the inheritance of the managed object existence before loading fields. |
void |
nullifyFields()
Nullify fields with reference to PersistenceCapable or SCO instances |
void |
postCommit(Transaction tx)
Convenience interceptor to allow operations to be performed after the commit is performed but before returning control to the application. |
void |
preBegin(Transaction tx)
Convenience interceptor to allow operations to be performed before the begin is performed |
void |
preRollback(Transaction tx)
Convenience interceptor to allow operations to be performed before any rollback is performed. |
void |
processManagedRelations()
Method to process all managed relations for this object. |
java.lang.Object |
provideField(int fieldNumber)
Method to return the current value of the specified field. |
void |
provideFields(int[] fieldNumbers,
FieldManager fm)
Method to obtain updated field values from the passed FieldManager. |
void |
refresh()
Method to refresh the values of the currently loaded fields in the managed object. |
void |
refreshFieldsInFetchPlan()
Refreshes from the database all fields in fetch plan. |
void |
refreshLoadedFields()
Refreshes from the database all fields currently loaded. |
void |
registerTransactional()
Registers the pc class in the cache |
void |
replaceAllLoadedSCOFieldsWithValues()
Method to replace all loaded (wrapped) SCO fields with unwrapped values. |
void |
replaceAllLoadedSCOFieldsWithWrappers()
Method to replace all loaded SCO fields with wrappers. |
void |
replaceField(int fieldNumber,
java.lang.Object value,
boolean makeDirty)
Method to change the value of the specified field. |
void |
replaceFields(int[] fieldNumbers,
FieldManager fm)
Method to update the data in the object with the values from the passed FieldManager |
void |
replaceFields(int[] fieldNumbers,
FieldManager fm,
boolean replaceWhenDirty)
Method to update the data in the object with the values from the passed FieldManager |
void |
replaceFieldValue(int fieldNumber,
java.lang.Object newValue)
Convenience method to change the value of a field that is assumed loaded. |
void |
replaceManagedPC(javax.jdo.spi.PersistenceCapable pc)
Method to swap the managed object for the supplied object. |
void |
replaceNonLoadedFields(int[] fieldNumbers,
FieldManager fm)
Method to update the data in the object with the values from the passed FieldManager. |
void |
resetDetachState()
Convenience method to reset the detached state in the current object. |
void |
restoreFields()
Method to restore all fields of the object. |
void |
retrieve(boolean fgOnly)
Method to retrieve the fields for this object. |
void |
retrieve(FetchPlan fetchPlan)
Method to retrieve the object. |
void |
retrieveDetachState(StateManager sm)
Convenience method to retrieve the detach state from the passed State Manager's object |
void |
runReachability(java.util.Set reachables)
Method to run reachability from this StateManager. |
void |
saveFields()
Method to save all fields of the object. |
void |
setAssociatedValue(java.lang.Object key,
java.lang.Object value)
Method to set the value for an external field stored against this object. |
void |
setObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
java.lang.Object oldValue,
java.lang.Object newValue)
|
void |
setPcObjectType(int embeddedType)
Method to set this StateManager as managing an embedded/serialised object. |
void |
setPostStoreNewObjectId(java.lang.Object id)
Method to allow the setting of the id of the PC object. |
void |
setStoringPC()
Method to set the storing PC flag. |
void |
setTransactionalVersion(java.lang.Object optimisticTransactionalVersion)
Sets the value for the version column in a transaction not yet committed |
void |
setVersion(java.lang.Object version)
Sets the value for the version column in the datastore. |
void |
unloadField(java.lang.String fieldName)
Mark the specified field as not loaded so that it will be reloaded on next access. |
void |
unloadNonFetchPlanFields()
Method that will unload all fields that are not in the FetchPlan. |
void |
unsetStoringPC()
Method to unset the storing PC flag. |
java.lang.Object |
unwrapSCOField(int fieldNumber,
java.lang.Object value,
boolean replaceFieldIfChanged)
Method to unwrap a SCO field (if it is wrapped currently) and return the unwrapped value. |
void |
updateFieldAfterInsert(java.lang.Object pc,
int fieldNumber)
Marks the given field dirty for issuing an update after the insert. |
void |
validate()
Validates whether the persistence capable instance exists in the datastore. |
java.lang.Object |
wrapSCOField(int fieldNumber,
java.lang.Object value,
boolean forInsert,
boolean forUpdate,
boolean replaceFieldIfChanged)
Method to wrap a SCO field (if not wrapped currently) and return the wrapped value. |
| Field Detail |
|---|
static final int PC
static final int EMBEDDED_PC
static final int EMBEDDED_COLLECTION_ELEMENT_PC
static final int EMBEDDED_MAP_KEY_PC
static final int EMBEDDED_MAP_VALUE_PC
| Method Detail |
|---|
void initialiseForHollow(java.lang.Object id,
FieldValues fv,
java.lang.Class pcClass)
id - the identity of the object.fv - the initial field values of the object (optional)pcClass - Class of the object that this will manage the state for
void initialiseForHollowAppId(FieldValues fv,
java.lang.Class pcClass)
fv - the initial field values of the object.pcClass - Class of the object that this will manage the state for
void initialiseForHollowPreConstructed(java.lang.Object id,
java.lang.Object pc)
initialiseForHollow(java.lang.Object, org.datanucleus.store.FieldValues, java.lang.Class) method, this method does not create a new instance and instead
takes a pre-constructed instance.
id - the identity of the object.pc - the object to be managed.
void initialiseForPersistentClean(java.lang.Object id,
java.lang.Object pc)
id - the identity of the object.pc - The object to be managed
void initialiseForEmbedded(java.lang.Object pc,
boolean copyPc)
pc - The PersistenceCapable to manage (see copyPc also)copyPc - Whether the SM should manage a copy of the passed PC or that one
void initialiseForPersistentNew(java.lang.Object pc,
FieldValues preInsertChanges)
This constructor is used for assigning state managers to existing instances that are transitioning to a persistent state.
pc - the instance being make persistent.preInsertChanges - Any changes to make before insertingvoid initialiseForTransactionalTransient(java.lang.Object pc)
This constructor is used for assigning state managers to Transient instances that are transitioning to a transient clean state.
pc - the instance being make persistent.
void initialiseForDetached(java.lang.Object pc,
java.lang.Object id,
java.lang.Object version)
pc - the detach object.id - the identity of the object.version - the detached version
void initialiseForCachedPC(CachedPC cachedPC,
java.lang.Object id,
java.lang.Class pcClass)
cachedPC - Cache object for persistable object from L2 cacheid - Id to assign to the PersistenceCapable objectpcClass - Class of the object that this will manage the state forvoid initialiseForPNewToBeDeleted(java.lang.Object pc)
pc - the object to deletejava.lang.Object getObject()
java.lang.Object getInternalObjectId()
java.lang.Object getExternalObjectId(java.lang.Object obj)
obj - the persistable object
ObjectManager getObjectManager()
StoreManager getStoreManager()
MetaDataManager getMetaDataManager()
void makeDirty(int fieldNumber)
fieldNumber - The (absolute) field number of the fieldjava.lang.String[] getDirtyFieldNames()
java.lang.String[] getLoadedFieldNames()
void updateFieldAfterInsert(java.lang.Object pc,
int fieldNumber)
pc - The Persistable objectfieldNumber - The no of field to mark as dirty.void changeActivityState(ActivityState activityState)
activityState - the activity statevoid runReachability(java.util.Set reachables)
reachables - List of reachable StateManagers so farvoid makeTransactional()
void makeNontransactional()
void makeTransient(FetchPlanState state)
state - Object containing the state of any fetch plan processingvoid makePersistent()
void makePersistentTransactionalTransient()
void deletePersistent()
java.lang.Object attachCopy(java.lang.Object detachedPC,
boolean embedded)
detachedPC - the detached persistable instance to be attachedembedded - Whether it is embedded
void attach(boolean embedded)
embedded - Whether it is embeddedjava.lang.Object detachCopy(FetchPlanState state)
state - State for the detachment process
void detach(FetchPlanState state)
state - State for the detachment processCachedPC cache()
void validate()
void markForInheritanceValidation()
void evict()
void refresh()
void retrieve(boolean fgOnly)
fgOnly - Whether to retrieve just the current fetch plan fieldsvoid retrieve(FetchPlan fetchPlan)
fetchPlan - the fetch plan to load fieldsvoid preBegin(Transaction tx)
tx - The transactionvoid postCommit(Transaction tx)
tx - The transactionvoid preRollback(Transaction tx)
tx - The transactionvoid flush()
RelationshipManager getRelationshipManager()
void checkManagedRelations()
void processManagedRelations()
void clearManagedRelations()
java.lang.Object provideField(int fieldNumber)
fieldNumber - (absolute) field number of the field
void provideFields(int[] fieldNumbers,
FieldManager fm)
fieldNumbers - The numbers of the fieldsfm - The fieldManager
void replaceFieldValue(int fieldNumber,
java.lang.Object newValue)
fieldNumber - Number of fieldnewValue - The new value
void replaceField(int fieldNumber,
java.lang.Object value,
boolean makeDirty)
fieldNumber - (absolute) field number of the fieldvalue - The new value.makeDirty - Whether to make the field dirty when replacing it
void replaceFields(int[] fieldNumbers,
FieldManager fm,
boolean replaceWhenDirty)
fieldNumbers - (absolute) field numbers of the fields to updatefm - The FieldManagerreplaceWhenDirty - Whether to replace these fields if the field is dirty
void replaceFields(int[] fieldNumbers,
FieldManager fm)
fieldNumbers - (absolute) field numbers of the fields to updatefm - The FieldManager
void replaceNonLoadedFields(int[] fieldNumbers,
FieldManager fm)
fieldNumbers - (absolute) field numbers of the fields to updatefm - The FieldManagervoid replaceAllLoadedSCOFieldsWithWrappers()
void replaceAllLoadedSCOFieldsWithValues()
java.lang.Object wrapSCOField(int fieldNumber,
java.lang.Object value,
boolean forInsert,
boolean forUpdate,
boolean replaceFieldIfChanged)
fieldNumber - Number of the fieldvalue - The value to give itforInsert - Whether the creation of any wrapper should insert this value into the datastoreforUpdate - Whether the creation of any wrapper should update the datastore with this valuereplaceFieldIfChanged - Whether to replace the field in the object if wrapping the value
java.lang.Object unwrapSCOField(int fieldNumber,
java.lang.Object value,
boolean replaceFieldIfChanged)
fieldNumber - The field numbervalue - The value to unwrap for this fieldreplaceFieldIfChanged - Whether to replace the field value in the object if unwrapping the value
java.lang.Object getReferencedPC()
boolean isWaitingToBeFlushedToDatastore()
void setPostStoreNewObjectId(java.lang.Object id)
id - the id received from the datastore. May be an OID, or the key value for an OID, or an application id.void setVersion(java.lang.Object version)
version - The versionjava.lang.Object getTransactionalVersion(java.lang.Object pc)
pc - the calling persistable instance
void setTransactionalVersion(java.lang.Object optimisticTransactionalVersion)
optimisticTransactionalVersion - int getHighestFieldNumber()
AbstractClassMetaData getClassMetaData()
void nullifyFields()
void loadField(int fieldNumber)
fieldNumber - Absolute field numbervoid loadUnloadedFieldsInFetchPlan()
void loadFieldsInFetchPlan(FetchPlanState state)
state - The FetchPlan statevoid loadUnloadedFieldsOfClassInFetchPlan(FetchPlan fetchPlan)
fetchPlan - The FetchPlanvoid loadUnloadedFields()
void unloadNonFetchPlanFields()
void resetDetachState()
void disconnect()
void evictFromTransaction()
void enlistInTransaction()
void refreshLoadedFields()
void clearSavedFields()
void refreshFieldsInFetchPlan()
void clearNonPrimaryKeyFields()
void restoreFields()
void saveFields()
void clearFields()
void registerTransactional()
boolean isRestoreValues()
void clearLoadedFlags()
void addEmbeddedOwner(StateManager ownerSM,
int ownerFieldNumber)
ownerSM - The owning State Manager.ownerFieldNumber - The field number in the owner that the embedded/serialised object is stored asvoid loadFieldValues(FieldValues fv)
fv - Field Values to load (including any fetch plan to use when loading)void checkInheritance(FieldValues fv)
fv - the initial field values of the object.void retrieveDetachState(StateManager sm)
sm - The State Managervoid setPcObjectType(int embeddedType)
embeddedType - The type of object being managedint getPcObjectType()
StateManager[] getEmbeddedOwners()
void setStoringPC()
void unsetStoringPC()
boolean isEmbedded()
void setAssociatedValue(java.lang.Object key,
java.lang.Object value)
key - The key for this associated informationvalue - The value to storejava.lang.Object getAssociatedValue(java.lang.Object key)
key - The key for this associated information
void loadFieldFromDatastore(int fieldNumber)
fieldNumber - The field number.boolean isInserting()
boolean isDeleting()
boolean isDetaching()
boolean isUpdatingFieldForPostInsert()
boolean becomingDeleted()
void locate()
NucleusObjectNotFoundException - if the object doesnt exist.boolean getAllFieldsLoaded()
boolean[] getDirtyFields()
int[] getDirtyFieldNumbers()
int[] getLoadedFieldNumbers()
boolean[] getLoadedFields()
void unloadField(java.lang.String fieldName)
fieldName - Name of the fieldboolean isFieldLoaded(int fieldNumber)
fieldNumber - The (absolute) field number
void copyFieldsFromObject(javax.jdo.spi.PersistenceCapable pc,
int[] fieldNumbers)
pc - The object that we should copy fields fromvoid dump(java.io.PrintWriter out)
out - The PrintWriterboolean isDeleted(javax.jdo.spi.PersistenceCapable pc)
pc - The PC object
boolean isNew(javax.jdo.spi.PersistenceCapable pc)
pc - The PC object
java.lang.Object getObjectId(javax.jdo.spi.PersistenceCapable pc)
pc - The PC object
void replaceManagedPC(javax.jdo.spi.PersistenceCapable pc)
pc - The PersistenceCapable to usejava.lang.Object getVersion(javax.jdo.spi.PersistenceCapable pc)
boolean isLoaded(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber)
void setObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
java.lang.Object oldValue,
java.lang.Object newValue)
ObjectProvider getObjectProvider()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||