org.jpox
Interface StateManager

All Superinterfaces:
javax.jdo.spi.StateManager
All Known Implementing Classes:
StateManagerImpl

public interface StateManager
extends javax.jdo.spi.StateManager

Extension to SUN's JDO StateManager class. This makes the assumption that a StateManager corresponds to ONE PersistenceCapable object. As a result of this assumption various methods are added to the basic JDO definition.

Version:
$Revision: 1.32 $

Method Summary
 java.lang.Object attachCopy(javax.jdo.spi.PersistenceCapable detachedPC, boolean embedded)
          Method to attach to this the detached PersistenceCapable instance
 void changeActivityState(ActivityState activityState)
          Update the acitvity state.
 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 evict()
          Method to change the object state to evicted.
 void flush()
          Method to flush all changes to the datastore.
 AbstractClassMetaData getClassMetaData()
          Accessor for the ClassMetaData for this object.
 java.lang.String[] getDirtyFieldNames()
          Accessor for the names of all dirty fields.
 java.lang.Object getExternalObjectId(javax.jdo.spi.PersistenceCapable pc)
          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.
 CachedPC getL2CacheableObject()
          Accessor for an L2 cacheable form of this object.
 java.lang.String[] getLoadedFieldNames()
          Accessor for the names of all loaded fields.
 MetaDataManager getMetaDataManager()
          Accessor for the manager for MetaData.
 javax.jdo.spi.PersistenceCapable getObject()
          Accessor for the object managed by this StateManager.
 PersistenceManager getPersistenceManager()
          Returns the PersistenceManager that owns the StateManager instance
 StoreManager getStoreManager()
          Accessor for the manager for the store.
 java.lang.Object getTransactionalVersion(javax.jdo.spi.PersistenceCapable pc)
          Return the object representing the transactional version of the calling instance.
 boolean isInserting()
          Tests whether this object is being inserted.
 void loadUnloadedFieldsInFetchPlan()
          Fetchs from the database all fields that are not currently loaded and that are in the current fetch group.
 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.
 java.lang.Object newSCOEmptyInstance(int fieldNumber)
          Method to return an empty SCO wrapper for the specified field.
 java.lang.Object newSCOInstance(int fieldNumber, java.lang.Object value, boolean forUpdate)
          Method to create a new SCO wrapper for a second class field.
 void nullifyFields()
          Nullify fields with reference to PersistenceCapable or SCO instances
 void postCommit(javax.jdo.Transaction tx)
          Convenience interceptor to allow operations to be performed after the commit is performed but before returning control to the application.
 void preRollback(javax.jdo.Transaction tx)
          Convenience interceptor to allow operations to be performed before any rollback is performed.
 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 replaceField(int fieldNumber, java.lang.Object value)
          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 replaceNonLoadedFields(int[] fieldNumbers, FieldManager fm)
          Method to update the data in the object with the values from the passed FieldManager.
 java.lang.Object replaceSCOField(int fieldNumber, java.lang.Object value)
          Wrap a field value with a SCO instance
 void resetDetachState()
          Convenience method to reset the detached state in the current object.
 void retrieve(boolean fgOnly)
          Method to retrieve the fields for this object.
 void retrieve(javax.jdo.FetchPlan fetchPlan)
          Method to retrieve the object.
 void runReachability(java.util.Set reachables)
          Method to run reachability from this StateManager.
 void setPostStoreNewObjectId(java.lang.Object id)
          If the id is obtained after inserting the object into the database, set new a new id for persistent classes (for example, increment).
 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 updateFieldAfterInsert(javax.jdo.spi.PersistenceCapable 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.
 
Methods inherited from interface javax.jdo.spi.StateManager
getBooleanField, getByteField, getCharField, getDoubleField, getFloatField, getIntField, getLongField, getObjectField, getObjectId, getPersistenceManager, getShortField, getStringField, getTransactionalObjectId, getVersion, isDeleted, isDirty, isLoaded, isNew, isPersistent, isTransactional, makeDirty, preSerialize, providedBooleanField, providedByteField, providedCharField, providedDoubleField, providedFloatField, providedIntField, providedLongField, providedObjectField, providedShortField, providedStringField, replacingBooleanField, replacingByteField, replacingCharField, replacingDetachedState, replacingDoubleField, replacingFlags, replacingFloatField, replacingIntField, replacingLongField, replacingObjectField, replacingShortField, replacingStateManager, replacingStringField, setBooleanField, setByteField, setCharField, setDoubleField, setFloatField, setIntField, setLongField, setObjectField, setShortField, setStringField
 

Method Detail

getObject

public javax.jdo.spi.PersistenceCapable getObject()
Accessor for the object managed by this StateManager.

Returns:
The object

getInternalObjectId

public java.lang.Object getInternalObjectId()
Accessor for the id of the object managed by this StateManager.

Returns:
The identity of the object

getExternalObjectId

public java.lang.Object getExternalObjectId(javax.jdo.spi.PersistenceCapable pc)
return a copy from the object Id

Parameters:
pc - the PersistenceCapable object
Returns:
the object id

getPersistenceManager

public PersistenceManager getPersistenceManager()
Returns the PersistenceManager that owns the StateManager instance

Returns:
PersistenceManager

getStoreManager

public StoreManager getStoreManager()
Accessor for the manager for the store.

Returns:
Store Manager

getMetaDataManager

public MetaDataManager getMetaDataManager()
Accessor for the manager for MetaData.

Returns:
MetaData manager

makeDirty

public void makeDirty(int fieldNumber)
Method to mark the specified (absolute) field number as dirty.

Parameters:
fieldNumber - The (absolute) field number of the field

getDirtyFieldNames

public java.lang.String[] getDirtyFieldNames()
Accessor for the names of all dirty fields.

Returns:
Names of all dirty fields

getLoadedFieldNames

public java.lang.String[] getLoadedFieldNames()
Accessor for the names of all loaded fields.

Returns:
Names of all loaded fields

updateFieldAfterInsert

public void updateFieldAfterInsert(javax.jdo.spi.PersistenceCapable pc,
                                   int fieldNumber)
Marks the given field dirty for issuing an update after the insert.

Parameters:
pc - The Persistence Capable object
fieldNumber - The no of field to mark as dirty.

changeActivityState

public void changeActivityState(ActivityState activityState)
Update the acitvity state.

Parameters:
activityState - the activity state

runReachability

public void runReachability(java.util.Set reachables)
Method to run reachability from this StateManager.

Parameters:
reachables - List of reachable StateManagers so far

makeTransactional

public void makeTransactional()
Method to make the managed object transactional.


makeNontransactional

public void makeNontransactional()
Method to make the managed object nontransactional.


makeTransient

public void makeTransient(FetchPlanState state)
Method to make the managed object transient.

Parameters:
state - Object containing the state of any fetch plan processing

makePersistent

public void makePersistent()
Method to make the managed object persistent.


makePersistentTransactionalTransient

public void makePersistentTransactionalTransient()
Method to make Transactional Transient instances persistent


deletePersistent

public void deletePersistent()
Method to delete the object from persistence.


attachCopy

public java.lang.Object attachCopy(javax.jdo.spi.PersistenceCapable detachedPC,
                                   boolean embedded)
Method to attach to this the detached PersistenceCapable instance

Parameters:
detachedPC - the detached PersistenceCapable instance to be attached
embedded - Whether it is embedded
Returns:
The attached copy
Since:
1.1

detachCopy

public java.lang.Object detachCopy(FetchPlanState state)
Method to make detached copy of this instance

Parameters:
state - State for the detachment process
Returns:
the detached PersistenceCapable instance
Since:
1.1

detach

public void detach(FetchPlanState state)
Method to detach the PersistenceCapable object.

Parameters:
state - State for the detachment process

validate

public void validate()
Validates whether the persistence capable instance exists in the datastore. If the instance does not exist in the datastore, this method will fail raising a javax.jdo.JDOObjectNotFoundException.


evict

public void evict()
Method to change the object state to evicted.


refresh

public void refresh()
Method to refresh the values of the currently loaded fields in the managed object.


retrieve

public void retrieve(boolean fgOnly)
Method to retrieve the fields for this object.

Parameters:
fgOnly - Whether to retrieve just the current fetch plan fields

retrieve

public void retrieve(javax.jdo.FetchPlan fetchPlan)
Method to retrieve the object.

Parameters:
fetchPlan - the fetch plan to load fields

postCommit

public void postCommit(javax.jdo.Transaction tx)
Convenience interceptor to allow operations to be performed after the commit is performed but before returning control to the application.

Parameters:
tx - The transaction

preRollback

public void preRollback(javax.jdo.Transaction tx)
Convenience interceptor to allow operations to be performed before any rollback is performed.

Parameters:
tx - The transaction

flush

public void flush()
Method to flush all changes to the datastore.


provideField

public java.lang.Object provideField(int fieldNumber)
Method to return the current value of the specified field.

Parameters:
fieldNumber - (absolute) field number of the field
Returns:
The current value

provideFields

public void provideFields(int[] fieldNumbers,
                          FieldManager fm)
Method to obtain updated field values from the passed FieldManager.

Parameters:
fieldNumbers - The numbers of the fields
fm - The fieldManager

replaceField

public void replaceField(int fieldNumber,
                         java.lang.Object value)
Method to change the value of the specified field.

Parameters:
fieldNumber - (absolute) field number of the field
value - The new value.

replaceFields

public void replaceFields(int[] fieldNumbers,
                          FieldManager fm)
Method to update the data in the object with the values from the passed FieldManager

Parameters:
fieldNumbers - (absolute) field numbers of the fields to update
fm - The FieldManager

replaceNonLoadedFields

public void replaceNonLoadedFields(int[] fieldNumbers,
                                   FieldManager fm)
Method to update the data in the object with the values from the passed FieldManager. Only non loaded fields are updated

Parameters:
fieldNumbers - (absolute) field numbers of the fields to update
fm - The FieldManager

newSCOInstance

public java.lang.Object newSCOInstance(int fieldNumber,
                                       java.lang.Object value,
                                       boolean forUpdate)
Method to create a new SCO wrapper for a second class field.

Parameters:
fieldNumber - Number of the field
value - The value to give it
forUpdate - Whether it needs updating in the datastore
Returns:
The SCO wrapper

replaceSCOField

public java.lang.Object replaceSCOField(int fieldNumber,
                                        java.lang.Object value)
Wrap a field value with a SCO instance

Parameters:
fieldNumber -
value - the value to be wrapped
Returns:
the new SCO instance

newSCOEmptyInstance

public java.lang.Object newSCOEmptyInstance(int fieldNumber)
Method to return an empty SCO wrapper for the specified field.

Parameters:
fieldNumber - (absolute) field number of the SCO field to wrap
Returns:
The (empty) SCO wrapper

isInserting

public boolean isInserting()
Tests whether this object is being inserted.

Returns:
true if this instance is inserting.

setPostStoreNewObjectId

public void setPostStoreNewObjectId(java.lang.Object id)
If the id is obtained after inserting the object into the database, set new a new id for persistent classes (for example, increment).

Parameters:
id - the id received from the datastore

setVersion

public void setVersion(java.lang.Object version)
Sets the value for the version column in the datastore. Update the transactional version too

Parameters:
version - The version

getTransactionalVersion

public java.lang.Object getTransactionalVersion(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the transactional version of the calling instance.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the version of the calling instance
Since:
1.1.1

setTransactionalVersion

public void setTransactionalVersion(java.lang.Object optimisticTransactionalVersion)
Sets the value for the version column in a transaction not yet committed

Parameters:
optimisticTransactionalVersion -

getHighestFieldNumber

public int getHighestFieldNumber()
Accessor for the highest field number

Returns:
Highest field number

getL2CacheableObject

public CachedPC getL2CacheableObject()
Accessor for an L2 cacheable form of this object.

Returns:
The L2 cacheable object

dump

public void dump(java.io.PrintWriter out)
Diagnostic method to dump the current state to the provided PrintWriter.

Parameters:
out - The PrintWriter

getClassMetaData

public AbstractClassMetaData getClassMetaData()
Accessor for the ClassMetaData for this object.

Returns:
The ClassMetaData.

nullifyFields

public void nullifyFields()
Nullify fields with reference to PersistenceCapable or SCO instances


loadUnloadedFieldsInFetchPlan

public void loadUnloadedFieldsInFetchPlan()
Fetchs from the database all fields that are not currently loaded and that are in the current fetch group. Called by lifecycle transitions.

Since:
1.1

resetDetachState

public void resetDetachState()
Convenience method to reset the detached state in the current object.


disconnect

public void disconnect()
Disconnect the StateManager from the PersistenceManager and PC object.



Copyright © -2007 . All Rights Reserved.