org.apache.openjpa.kernel
Class DetachedStateManager

java.lang.Object
  extended by org.apache.openjpa.kernel.TransferFieldManager
      extended by org.apache.openjpa.kernel.AttachStrategy
          extended by org.apache.openjpa.kernel.DetachedStateManager
All Implemented Interfaces:
Serializable, FieldConsumer, FieldManager, FieldSupplier, StateManager, OpenJPAStateManager

public class DetachedStateManager
extends AttachStrategy
implements OpenJPAStateManager, Serializable

Internal state manager for detached instances. Does not fully implement OpenJPAStateManager contract to allow for serialization.

Author:
Steve Kim
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.openjpa.kernel.TransferFieldManager
dblval, field, longval, objval
 
Fields inherited from interface org.apache.openjpa.kernel.OpenJPAStateManager
SET_ATTACH, SET_REMOTE, SET_USER
 
Constructor Summary
DetachedStateManager(PersistenceCapable pc, OpenJPAStateManager sm, BitSet load, boolean access, boolean multithreaded)
          Constructor.
 
Method Summary
 void accessingField(int idx)
          Field access callback.
 boolean assignObjectId(boolean flush)
          Ask the store manager to assign a permanent oid to this new instance.
 Object attach(AttachManager manager, Object toAttach, ClassMetaData meta, PersistenceCapable into, OpenJPAStateManager owner, ValueMetaData ownerMeta, boolean explicit)
          Attach.
 boolean beforeRefresh(boolean all)
          Prepare the instance for refresh
 void dirty(int field)
          Mark the given field as dirty.
 void dirty(String field)
          Make named field dirty.
 Object fetch(int field)
          Return the externalized value of the field with the given index as an object.
 boolean fetchBoolean(int field)
          Return the external value of the given field.
 byte fetchByte(int field)
          Return the external value of the given field.
 char fetchChar(int field)
          Return the external value of the given field.
 double fetchDouble(int field)
          Return the external value of the given field.
 Object fetchField(int field, boolean transitions)
          Return the value of the field with the given index as an object.
 float fetchFloat(int field)
          Return the external value of the given field.
 Object fetchInitialField(int field)
          Return the value of the field at the specified index as of the beginning of the transaction.
 int fetchInt(int field)
          Return the external value of the given field.
 long fetchLong(int field)
          Return the external value of the given field.
 Object fetchObject(int field)
          Return the external value of the given field.
 Object fetchObjectId()
          Return the object id, assigning it if necessary.
 short fetchShort(int field)
          Return the external value of the given field.
 String fetchString(int field)
          Return the external value of the given field.
 StoreContext getContext()
          Return the managing context.
protected  Object getDetachedObjectId(AttachManager manager, Object toAttach)
          Return the identity of the given detached instance.
 BitSet getDirty()
          Return a read-only mask of the indexes of all dirty fields.
 BitSet getFlushed()
          Return a read-only mask of the indexes of all fields that have been flushed since they were last changed.
 Object getGenericContext()
          Persistence context.
 Object getId()
          Return the identifier for this state manager.
 Object getImplData()
          An object that concrete back ends can associate with each instance.
 Object getImplData(int field)
          Field-level impl data.
 Object getIntermediate(int field)
          Use intermediate field data to store intermediate information that might be available before the field is fully loaded.
 BitSet getLoaded()
          Return a read-only mask of the indexes of all loaded fields.
 Object getLock()
          The lock object set for this instance.
 Object getManagedInstance()
          Return the managed instance.
 ClassMetaData getMetaData()
          Get the metadata for this instance.
 Object getObjectId()
          Return the instance's object id.
 OpenJPAStateManager getOwner()
          Return the owning state if this is an embedded instance.
 int getOwnerIndex()
          Return the owning value's field index
 Object getPCPrimaryKey(Object oid, int field)
          Return the persistence-capable primary key object by extracting the identity value of the related instance stored in the given field from the given object id.
 PCState getPCState()
          Return the state that this object is in.
 PersistenceCapable getPersistenceCapable()
          Return the PersistenceCapable instance that provides access to the instance managed by this state manager.
 BitSet getUnloaded(FetchConfiguration fetch)
          Return a mutable mask of the unloaded fields that need loading based on the given fetch configuration.
 boolean getUseDSFForUnproxy()
          Should DetachedStateField be used by Proxies to determine when to remove $proxy wrappers during serialization.
 Object getVersion()
          Return the current version indicator for this instance.
protected static boolean ignoreLoaded(FieldMetaData fmd)
          Ignore if the field is not dirty but loaded
 void initialize(Class forType, PCState state)
          Initialize the state manager with a new instance of the given persistence capable type and the proper lifecycle state.
 boolean isDefaultValue(int field)
          Return true if the given field has a default value.
 boolean isDeleted()
          Whether the instance is deleted in this transaction.
 boolean isDetached()
          Whether the instance is detached (i.e.
 boolean isDirty()
          Whether the instance has been modified in this transaction.
 boolean isEmbedded()
          Return true if this instance has an owner, meaning it is an embedded value.
 boolean isFlushed()
          Return whether this object has been flushed to the datastore in this transaction.
 boolean isFlushedDirty()
          Return whether this object has been flushed, then dirtied again.
 boolean isImplDataCacheable()
          Whether the instance-level impl data can be shared among instances in different contexts if L2 caching is enabled.
 boolean isImplDataCacheable(int field)
          Whether the field's impl data is loaded and can be shared among instances in different contexts if L2 caching is enabled.
 boolean isNew()
          Whether the instance is newly-persisted in this transaction.
 boolean isPersistent()
          Whether the instance is persistent.
 boolean isProvisional()
          Return whether this object is provisionally persistent.
 boolean isTransactional()
          Whether the instance is transactional.
 boolean isVersionCheckRequired()
          Returns true if this state needs to issue a version check at flush time.
 boolean isVersionUpdateRequired()
          Returns true if this state needs to issue a version update, possibly as a result of being locked.
 void load(FetchConfiguration fetch)
          Load fetch group fields.
 void lock()
           
 Object newFieldProxy(int field)
          Create a new hollow proxy instance for the given field.
 Object newProxy(int field)
          Create a new hollow proxy instance for the given field.
 void providedBooleanField(PersistenceCapable pc, int idx, boolean cur)
          Provide state callback.
 void providedByteField(PersistenceCapable pc, int idx, byte cur)
          Provide state callback.
 void providedCharField(PersistenceCapable pc, int idx, char cur)
          Provide state callback.
 void providedDoubleField(PersistenceCapable pc, int idx, double cur)
          Provide state callback.
 void providedFloatField(PersistenceCapable pc, int idx, float cur)
          Provide state callback.
 void providedIntField(PersistenceCapable pc, int idx, int cur)
          Provide state callback.
 void providedLongField(PersistenceCapable pc, int idx, long cur)
          Provide state callback.
 void providedObjectField(PersistenceCapable pc, int idx, Object cur)
          Provide state callback.
 void providedShortField(PersistenceCapable pc, int idx, short cur)
          Provide state callback.
 void providedStringField(PersistenceCapable pc, int idx, String cur)
          Provide state callback.
(package private)  void provideField(int field)
           
protected  void provideField(Object toAttach, StateManagerImpl sm, int field)
          Provide the given field into this field manager.
 void proxyDetachedDeserialized(int idx)
          Proxy the given detached field after deserialization.
 void removed(int field, Object removed, boolean key)
          Notification that an element has been removed from the given field.
 boolean replaceBooleanField(PersistenceCapable pc, int idx)
          Replace state callback.
 byte replaceByteField(PersistenceCapable pc, int idx)
          Replace state callback.
 char replaceCharField(PersistenceCapable pc, int idx)
          Replace state callback.
 double replaceDoubleField(PersistenceCapable pc, int idx)
          Replace state callback.
 float replaceFloatField(PersistenceCapable pc, int idx)
          Replace state callback.
 int replaceIntField(PersistenceCapable pc, int idx)
          Replace state callback.
 long replaceLongField(PersistenceCapable pc, int idx)
          Replace state callback.
 Object replaceObjectField(PersistenceCapable pc, int idx)
          Replace state callback.
 short replaceShortField(PersistenceCapable pc, int idx)
          Replace state callback.
 StateManager replaceStateManager(StateManager sm)
          Change state manager.
 String replaceStringField(PersistenceCapable pc, int idx)
          Replace state callback.
 boolean serializing()
          Callback to prepare instance for serialization.
 Object setImplData(int field, Object data)
          Field-level impl data.
 Object setImplData(Object data, boolean cacheable)
          An object that concrete back ends can associate with each instance.
 void setIntermediate(int field, Object data)
          Use intermediate field data to store intermediate information that might be available before the field is fully loaded.
 void setLock(Object lock)
          The lock object set for this instance.
 void setNextVersion(Object version)
          Set the next version indicator in the datastore pending a successful flush.
 void setObjectId(Object oid)
          Set the object id for the managed instance.
 void setRemote(int field, Object value)
          Set the given field to the given value.
 void settingBooleanField(PersistenceCapable pc, int idx, boolean cur, boolean next, int set)
          Setting state callback.
 void settingByteField(PersistenceCapable pc, int idx, byte cur, byte next, int set)
          Setting state callback.
 void settingCharField(PersistenceCapable pc, int idx, char cur, char next, int set)
          Setting state callback.
 void settingDoubleField(PersistenceCapable pc, int idx, double cur, double next, int set)
          Setting state callback.
 void settingFloatField(PersistenceCapable pc, int idx, float cur, float next, int set)
          Setting state callback.
 void settingIntField(PersistenceCapable pc, int idx, int cur, int next, int set)
          Setting state callback.
 void settingLongField(PersistenceCapable pc, int idx, long cur, long next, int set)
          Setting state callback.
 void settingObjectField(PersistenceCapable pc, int idx, Object cur, Object next, int set)
          Setting state callback.
 void settingShortField(PersistenceCapable pc, int idx, short cur, short next, int set)
          Setting state callback.
 void settingStringField(PersistenceCapable pc, int idx, String cur, String next, int set)
          Setting state callback.
 void setVersion(Object version)
          Set the version indicator for this instance, as loaded from the data store.
 void store(int field, Object extVal)
          Set the value of the field with the given index as from the external object value.
 void storeBoolean(int field, boolean extVal)
          Set the given external value back into the given field.
 void storeByte(int field, byte extVal)
          Set the given external value back into the given field.
 void storeChar(int field, char extVal)
          Set the given external value back into the given field.
 void storeDouble(int field, double extVal)
          Set the given external value back into the given field.
 void storeField(int field, Object value)
          Set the value of the field with the given index as an object.
 void storeFloat(int field, float extVal)
          Set the given external value back into the given field.
 void storeInt(int field, int extVal)
          Set the given external value back into the given field.
 void storeLong(int field, long extVal)
          Set the given external value back into the given field.
 void storeObject(int field, Object extVal)
          Set the given external value back into the given field.
 void storeShort(int field, short extVal)
          Set the given external value back into the given field.
 void storeString(int field, String extVal)
          Set the given external value back into the given field.
 void unlock()
           
 boolean writeDetached(ObjectOutput out)
          Write detached state object and detached state manager to the given stream.
 
Methods inherited from class org.apache.openjpa.kernel.AttachStrategy
attachCollection, attachField, attachMap, getReference, persist
 
Methods inherited from class org.apache.openjpa.kernel.TransferFieldManager
clear, fetchBooleanField, fetchByteField, fetchCharField, fetchDoubleField, fetchFloatField, fetchIntField, fetchLongField, fetchObjectField, fetchShortField, fetchStringField, storeBooleanField, storeByteField, storeCharField, storeDoubleField, storeFloatField, storeIntField, storeLongField, storeObjectField, storeShortField, storeStringField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.enhance.FieldConsumer
storeBooleanField, storeByteField, storeCharField, storeDoubleField, storeFloatField, storeIntField, storeLongField, storeObjectField, storeShortField, storeStringField
 
Methods inherited from interface org.apache.openjpa.enhance.FieldSupplier
fetchBooleanField, fetchByteField, fetchCharField, fetchDoubleField, fetchFloatField, fetchIntField, fetchLongField, fetchObjectField, fetchShortField, fetchStringField
 

Constructor Detail

DetachedStateManager

public DetachedStateManager(PersistenceCapable pc,
                            OpenJPAStateManager sm,
                            BitSet load,
                            boolean access,
                            boolean multithreaded)
Constructor.

Parameters:
pc - the managed instance
sm - the instance's state manager
load - the set of detached field indexes
access - whether to allow access to unloaded fields
multithreaded - whether the instance will be used concurrently by multiple threads
Method Detail

attach

public Object attach(AttachManager manager,
                     Object toAttach,
                     ClassMetaData meta,
                     PersistenceCapable into,
                     OpenJPAStateManager owner,
                     ValueMetaData ownerMeta,
                     boolean explicit)
Description copied from class: AttachStrategy
Attach.

Specified by:
attach in class AttachStrategy
Parameters:
manager - manager holding cache of attached instances
toAttach - detached instance
meta - metadata for the instance being attached
into - instance we're attaching into
owner - state manager for into
ownerMeta - field we traversed to find toAttach
explicit - whether to make new instances explicitly persistent

getDetachedObjectId

protected Object getDetachedObjectId(AttachManager manager,
                                     Object toAttach)
Description copied from class: AttachStrategy
Return the identity of the given detached instance.

Specified by:
getDetachedObjectId in class AttachStrategy

provideField

void provideField(int field)

provideField

protected void provideField(Object toAttach,
                            StateManagerImpl sm,
                            int field)
Description copied from class: AttachStrategy
Provide the given field into this field manager.

Specified by:
provideField in class AttachStrategy

ignoreLoaded

protected static boolean ignoreLoaded(FieldMetaData fmd)
Ignore if the field is not dirty but loaded


getGenericContext

public Object getGenericContext()
Description copied from interface: StateManager
Persistence context.

Specified by:
getGenericContext in interface StateManager

getPCPrimaryKey

public Object getPCPrimaryKey(Object oid,
                              int field)
Description copied from interface: StateManager
Return the persistence-capable primary key object by extracting the identity value of the related instance stored in the given field from the given object id.

Specified by:
getPCPrimaryKey in interface StateManager

replaceStateManager

public StateManager replaceStateManager(StateManager sm)
Description copied from interface: StateManager
Change state manager.

Specified by:
replaceStateManager in interface StateManager

getVersion

public Object getVersion()
Description copied from interface: OpenJPAStateManager
Return the current version indicator for this instance.

Specified by:
getVersion in interface StateManager
Specified by:
getVersion in interface OpenJPAStateManager

setVersion

public void setVersion(Object version)
Description copied from interface: OpenJPAStateManager
Set the version indicator for this instance, as loaded from the data store. This method is used by the StoreManager when loading instance data. On rollback, the version will be rolled back to this value. Version objects should be serializable and should not require vendor-specific classes, because they are transferred to detached objects.

Specified by:
setVersion in interface OpenJPAStateManager

isDirty

public boolean isDirty()
Description copied from interface: StateManager
Whether the instance has been modified in this transaction.

Specified by:
isDirty in interface StateManager

isTransactional

public boolean isTransactional()
Description copied from interface: StateManager
Whether the instance is transactional.

Specified by:
isTransactional in interface StateManager

isPersistent

public boolean isPersistent()
Description copied from interface: StateManager
Whether the instance is persistent.

Specified by:
isPersistent in interface StateManager

isNew

public boolean isNew()
Description copied from interface: StateManager
Whether the instance is newly-persisted in this transaction.

Specified by:
isNew in interface StateManager

isDeleted

public boolean isDeleted()
Description copied from interface: StateManager
Whether the instance is deleted in this transaction.

Specified by:
isDeleted in interface StateManager

isDetached

public boolean isDetached()
Description copied from interface: StateManager
Whether the instance is detached (i.e. this manager is a detached state manager)

Specified by:
isDetached in interface StateManager

isVersionUpdateRequired

public boolean isVersionUpdateRequired()
Description copied from interface: OpenJPAStateManager
Returns true if this state needs to issue a version update, possibly as a result of being locked.

Specified by:
isVersionUpdateRequired in interface OpenJPAStateManager

isVersionCheckRequired

public boolean isVersionCheckRequired()
Description copied from interface: OpenJPAStateManager
Returns true if this state needs to issue a version check at flush time.

Specified by:
isVersionCheckRequired in interface OpenJPAStateManager

dirty

public void dirty(String field)
Description copied from interface: StateManager
Make named field dirty.

Specified by:
dirty in interface StateManager

fetchObjectId

public Object fetchObjectId()
Description copied from interface: StateManager
Return the object id, assigning it if necessary.

Specified by:
fetchObjectId in interface StateManager

accessingField

public void accessingField(int idx)
Description copied from interface: StateManager
Field access callback.

Specified by:
accessingField in interface StateManager

serializing

public boolean serializing()
Description copied from interface: StateManager
Callback to prepare instance for serialization.

Specified by:
serializing in interface StateManager
Returns:
true to null detached state after serialize

writeDetached

public boolean writeDetached(ObjectOutput out)
                      throws IOException
Description copied from interface: StateManager
Write detached state object and detached state manager to the given stream.

Specified by:
writeDetached in interface StateManager
Returns:
true if managed fields also written to stream
Throws:
IOException

proxyDetachedDeserialized

public void proxyDetachedDeserialized(int idx)
Description copied from interface: StateManager
Proxy the given detached field after deserialization.

Specified by:
proxyDetachedDeserialized in interface StateManager

settingBooleanField

public void settingBooleanField(PersistenceCapable pc,
                                int idx,
                                boolean cur,
                                boolean next,
                                int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingBooleanField in interface StateManager

settingCharField

public void settingCharField(PersistenceCapable pc,
                             int idx,
                             char cur,
                             char next,
                             int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingCharField in interface StateManager

settingByteField

public void settingByteField(PersistenceCapable pc,
                             int idx,
                             byte cur,
                             byte next,
                             int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingByteField in interface StateManager

settingShortField

public void settingShortField(PersistenceCapable pc,
                              int idx,
                              short cur,
                              short next,
                              int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingShortField in interface StateManager

settingIntField

public void settingIntField(PersistenceCapable pc,
                            int idx,
                            int cur,
                            int next,
                            int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingIntField in interface StateManager

settingLongField

public void settingLongField(PersistenceCapable pc,
                             int idx,
                             long cur,
                             long next,
                             int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingLongField in interface StateManager

settingFloatField

public void settingFloatField(PersistenceCapable pc,
                              int idx,
                              float cur,
                              float next,
                              int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingFloatField in interface StateManager

settingDoubleField

public void settingDoubleField(PersistenceCapable pc,
                               int idx,
                               double cur,
                               double next,
                               int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingDoubleField in interface StateManager

settingStringField

public void settingStringField(PersistenceCapable pc,
                               int idx,
                               String cur,
                               String next,
                               int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingStringField in interface StateManager

settingObjectField

public void settingObjectField(PersistenceCapable pc,
                               int idx,
                               Object cur,
                               Object next,
                               int set)
Description copied from interface: StateManager
Setting state callback.

Specified by:
settingObjectField in interface StateManager

providedBooleanField

public void providedBooleanField(PersistenceCapable pc,
                                 int idx,
                                 boolean cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedBooleanField in interface StateManager

providedCharField

public void providedCharField(PersistenceCapable pc,
                              int idx,
                              char cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedCharField in interface StateManager

providedByteField

public void providedByteField(PersistenceCapable pc,
                              int idx,
                              byte cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedByteField in interface StateManager

providedShortField

public void providedShortField(PersistenceCapable pc,
                               int idx,
                               short cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedShortField in interface StateManager

providedIntField

public void providedIntField(PersistenceCapable pc,
                             int idx,
                             int cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedIntField in interface StateManager

providedLongField

public void providedLongField(PersistenceCapable pc,
                              int idx,
                              long cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedLongField in interface StateManager

providedFloatField

public void providedFloatField(PersistenceCapable pc,
                               int idx,
                               float cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedFloatField in interface StateManager

providedDoubleField

public void providedDoubleField(PersistenceCapable pc,
                                int idx,
                                double cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedDoubleField in interface StateManager

providedStringField

public void providedStringField(PersistenceCapable pc,
                                int idx,
                                String cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedStringField in interface StateManager

providedObjectField

public void providedObjectField(PersistenceCapable pc,
                                int idx,
                                Object cur)
Description copied from interface: StateManager
Provide state callback.

Specified by:
providedObjectField in interface StateManager

replaceBooleanField

public boolean replaceBooleanField(PersistenceCapable pc,
                                   int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceBooleanField in interface StateManager

replaceCharField

public char replaceCharField(PersistenceCapable pc,
                             int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceCharField in interface StateManager

replaceByteField

public byte replaceByteField(PersistenceCapable pc,
                             int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceByteField in interface StateManager

replaceShortField

public short replaceShortField(PersistenceCapable pc,
                               int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceShortField in interface StateManager

replaceIntField

public int replaceIntField(PersistenceCapable pc,
                           int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceIntField in interface StateManager

replaceLongField

public long replaceLongField(PersistenceCapable pc,
                             int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceLongField in interface StateManager

replaceFloatField

public float replaceFloatField(PersistenceCapable pc,
                               int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceFloatField in interface StateManager

replaceDoubleField

public double replaceDoubleField(PersistenceCapable pc,
                                 int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceDoubleField in interface StateManager

replaceStringField

public String replaceStringField(PersistenceCapable pc,
                                 int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceStringField in interface StateManager

replaceObjectField

public Object replaceObjectField(PersistenceCapable pc,
                                 int idx)
Description copied from interface: StateManager
Replace state callback.

Specified by:
replaceObjectField in interface StateManager

initialize

public void initialize(Class forType,
                       PCState state)
Description copied from interface: OpenJPAStateManager
Initialize the state manager with a new instance of the given persistence capable type and the proper lifecycle state. Invoking this method may change the object id and metadata for the state manager, as the concrete type specified in the parameter may be a subclass of the expected type.

Specified by:
initialize in interface OpenJPAStateManager
Parameters:
forType - the type for which to create a new instance
state - the initial state to which to set the instance

load

public void load(FetchConfiguration fetch)
Description copied from interface: OpenJPAStateManager
Load fetch group fields.

Specified by:
load in interface OpenJPAStateManager

getManagedInstance

public Object getManagedInstance()
Description copied from interface: OpenJPAStateManager
Return the managed instance.

Specified by:
getManagedInstance in interface OpenJPAStateManager

getPersistenceCapable

public PersistenceCapable getPersistenceCapable()
Description copied from interface: OpenJPAStateManager
Return the PersistenceCapable instance that provides access to the instance managed by this state manager. May be a proxy around the actual managed instance.

Specified by:
getPersistenceCapable in interface OpenJPAStateManager

getMetaData

public ClassMetaData getMetaData()
Description copied from interface: OpenJPAStateManager
Get the metadata for this instance.

Specified by:
getMetaData in interface OpenJPAStateManager

getOwner

public OpenJPAStateManager getOwner()
Description copied from interface: OpenJPAStateManager
Return the owning state if this is an embedded instance.

Specified by:
getOwner in interface OpenJPAStateManager

getOwnerIndex

public int getOwnerIndex()
Description copied from interface: OpenJPAStateManager
Return the owning value's field index

Specified by:
getOwnerIndex in interface OpenJPAStateManager

isEmbedded

public boolean isEmbedded()
Description copied from interface: OpenJPAStateManager
Return true if this instance has an owner, meaning it is an embedded value.

Specified by:
isEmbedded in interface OpenJPAStateManager

isFlushed

public boolean isFlushed()
Description copied from interface: OpenJPAStateManager
Return whether this object has been flushed to the datastore in this transaction.

Specified by:
isFlushed in interface OpenJPAStateManager

isFlushedDirty

public boolean isFlushedDirty()
Description copied from interface: OpenJPAStateManager
Return whether this object has been flushed, then dirtied again.

Specified by:
isFlushedDirty in interface OpenJPAStateManager

isProvisional

public boolean isProvisional()
Description copied from interface: OpenJPAStateManager
Return whether this object is provisionally persistent.

Specified by:
isProvisional in interface OpenJPAStateManager

getLoaded

public BitSet getLoaded()
Description copied from interface: OpenJPAStateManager
Return a read-only mask of the indexes of all loaded fields.

Specified by:
getLoaded in interface OpenJPAStateManager

getDirty

public BitSet getDirty()
Description copied from interface: OpenJPAStateManager
Return a read-only mask of the indexes of all dirty fields.

Specified by:
getDirty in interface OpenJPAStateManager

getUseDSFForUnproxy

public boolean getUseDSFForUnproxy()
Should DetachedStateField be used by Proxies to determine when to remove $proxy wrappers during serialization.

Since:
2.0.0

getFlushed

public BitSet getFlushed()
Description copied from interface: OpenJPAStateManager
Return a read-only mask of the indexes of all fields that have been flushed since they were last changed.

Specified by:
getFlushed in interface OpenJPAStateManager

getUnloaded

public BitSet getUnloaded(FetchConfiguration fetch)
Description copied from interface: OpenJPAStateManager
Return a mutable mask of the unloaded fields that need loading based on the given fetch configuration. Pass in null to retrieve all unloaded fields.

Specified by:
getUnloaded in interface OpenJPAStateManager

newProxy

public Object newProxy(int field)
Description copied from interface: OpenJPAStateManager
Create a new hollow proxy instance for the given field. In cases where the field externalizes to an SCO but is declared something else, the returned object may not implement Proxy. In all other cases, this method delegates to the system ProxyManager with the correct field information. The returned proxy's owner is unset so that modifications to the proxy will not be tracked while its state is initialized. Calling OpenJPAStateManager.storeField(int, java.lang.Object) or OpenJPAStateManager.store(int, java.lang.Object) will set the proxy's owner automatically.

Specified by:
newProxy in interface OpenJPAStateManager

newFieldProxy

public Object newFieldProxy(int field)
Description copied from interface: OpenJPAStateManager
Create a new hollow proxy instance for the given field. This method differs from OpenJPAStateManager.newProxy(int) in that it returns a proxy for the field's declared type, not its externalized type.

Specified by:
newFieldProxy in interface OpenJPAStateManager
See Also:
OpenJPAStateManager.newProxy(int)

isDefaultValue

public boolean isDefaultValue(int field)
Description copied from interface: OpenJPAStateManager
Return true if the given field has a default value.

Specified by:
isDefaultValue in interface OpenJPAStateManager

getContext

public StoreContext getContext()
Description copied from interface: OpenJPAStateManager
Return the managing context.

Specified by:
getContext in interface OpenJPAStateManager

getPCState

public PCState getPCState()
Description copied from interface: OpenJPAStateManager
Return the state that this object is in.

Specified by:
getPCState in interface OpenJPAStateManager

getObjectId

public Object getObjectId()
Description copied from interface: OpenJPAStateManager
Return the instance's object id. This method will return null if no oid has been assigned. Oids are assigned to newly-persisted instances when the user first asks for it, or on flush.

Specified by:
getObjectId in interface OpenJPAStateManager

setObjectId

public void setObjectId(Object oid)
Description copied from interface: OpenJPAStateManager
Set the object id for the managed instance. Some back ends may not be able to assign a permanent oid until flush. Do not call this method on application identity instances; changing the primary key fields of application identity objects through the storeXXXField methods will automatically change the oid.

Specified by:
setObjectId in interface OpenJPAStateManager

assignObjectId

public boolean assignObjectId(boolean flush)
Description copied from interface: OpenJPAStateManager
Ask the store manager to assign a permanent oid to this new instance.

Specified by:
assignObjectId in interface OpenJPAStateManager
Parameters:
flush - if true, flush if necessary to get a permanent oid; if false, the oid may be left unassigned
Returns:
true if an oid assigned, false otherwise

getId

public Object getId()
Description copied from interface: OpenJPAStateManager
Return the identifier for this state manager. This may return a temporary identifier for new unflushed instances that have not been assigned an object id, or for non-persistent or embedded instances. For all other instances this method is the same as OpenJPAStateManager.getObjectId().

Specified by:
getId in interface OpenJPAStateManager

getLock

public Object getLock()
Description copied from interface: OpenJPAStateManager
The lock object set for this instance. This object is generally managed by the system lock manager.

Specified by:
getLock in interface OpenJPAStateManager

setLock

public void setLock(Object lock)
Description copied from interface: OpenJPAStateManager
The lock object set for this instance. This object is generally managed by the system lock manager.

Specified by:
setLock in interface OpenJPAStateManager

setNextVersion

public void setNextVersion(Object version)
Description copied from interface: OpenJPAStateManager
Set the next version indicator in the datastore pending a successful flush. The StoreManager uses this method during flush.

Specified by:
setNextVersion in interface OpenJPAStateManager

getImplData

public Object getImplData()
Description copied from interface: OpenJPAStateManager
An object that concrete back ends can associate with each instance. This object is not used or modified in any way by the generic persistence layer.

Specified by:
getImplData in interface OpenJPAStateManager

setImplData

public Object setImplData(Object data,
                          boolean cacheable)
Description copied from interface: OpenJPAStateManager
An object that concrete back ends can associate with each instance. This object is not used or modified in any way by the generic persistence layer.

Specified by:
setImplData in interface OpenJPAStateManager
cacheable - whether the impl data can be shared among instances in different contexts if L2 caching is enabled
Returns:
the previous impl data value, if any

isImplDataCacheable

public boolean isImplDataCacheable()
Description copied from interface: OpenJPAStateManager
Whether the instance-level impl data can be shared among instances in different contexts if L2 caching is enabled.

Specified by:
isImplDataCacheable in interface OpenJPAStateManager

getImplData

public Object getImplData(int field)
Description copied from interface: OpenJPAStateManager
Field-level impl data. Field-level data only applies to loaded fields, and is cleared when the field is cleared.

Specified by:
getImplData in interface OpenJPAStateManager

setImplData

public Object setImplData(int field,
                          Object data)
Description copied from interface: OpenJPAStateManager
Field-level impl data. Field-level data only applies to loaded fields, and is cleared when the field is cleared. Whether the data is cached across instances depends on the corresponding field metadata's response to FieldMetaData.usesImplData().

Specified by:
setImplData in interface OpenJPAStateManager
Returns:
the previous impl data value, if any

isImplDataCacheable

public boolean isImplDataCacheable(int field)
Description copied from interface: OpenJPAStateManager
Whether the field's impl data is loaded and can be shared among instances in different contexts if L2 caching is enabled.

Specified by:
isImplDataCacheable in interface OpenJPAStateManager

getIntermediate

public Object getIntermediate(int field)
Description copied from interface: OpenJPAStateManager
Use intermediate field data to store intermediate information that might be available before the field is fully loaded. The system will automatically clear this data when the field gets loaded. This data should be cacheable; the datastore cache will attempt to cache it if the field value is not available.

Specified by:
getIntermediate in interface OpenJPAStateManager

setIntermediate

public void setIntermediate(int field,
                            Object data)
Description copied from interface: OpenJPAStateManager
Use intermediate field data to store intermediate information that might be available before the field is fully loaded. The system will automatically clear this data when the field gets loaded. This data should be cacheable; the datastore cache will attempt to cache it if the field value is not available.

Specified by:
setIntermediate in interface OpenJPAStateManager

removed

public void removed(int field,
                    Object removed,
                    boolean key)
Description copied from interface: OpenJPAStateManager
Notification that an element has been removed from the given field.

Specified by:
removed in interface OpenJPAStateManager

beforeRefresh

public boolean beforeRefresh(boolean all)
Description copied from interface: OpenJPAStateManager
Prepare the instance for refresh

Specified by:
beforeRefresh in interface OpenJPAStateManager
Parameters:
all - true if this instance is one of a collection of objects being refreshed
Returns:
true if the object needs a refresh, false otherwise
See Also:
Broker.refresh(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)

dirty

public void dirty(int field)
Description copied from interface: OpenJPAStateManager
Mark the given field as dirty.

Specified by:
dirty in interface OpenJPAStateManager

storeBoolean

public void storeBoolean(int field,
                         boolean extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeBoolean in interface OpenJPAStateManager

storeByte

public void storeByte(int field,
                      byte extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeByte in interface OpenJPAStateManager

storeChar

public void storeChar(int field,
                      char extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeChar in interface OpenJPAStateManager

storeInt

public void storeInt(int field,
                     int extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeInt in interface OpenJPAStateManager

storeShort

public void storeShort(int field,
                       short extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeShort in interface OpenJPAStateManager

storeLong

public void storeLong(int field,
                      long extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeLong in interface OpenJPAStateManager

storeFloat

public void storeFloat(int field,
                       float extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeFloat in interface OpenJPAStateManager

storeDouble

public void storeDouble(int field,
                        double extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeDouble in interface OpenJPAStateManager

storeString

public void storeString(int field,
                        String extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeString in interface OpenJPAStateManager

storeObject

public void storeObject(int field,
                        Object extVal)
Description copied from interface: OpenJPAStateManager
Set the given external value back into the given field.

Specified by:
storeObject in interface OpenJPAStateManager

store

public void store(int field,
                  Object extVal)
Description copied from interface: OpenJPAStateManager
Set the value of the field with the given index as from the external object value. If there is no externalizer, this is equivalent to OpenJPAStateManager.storeField(int, java.lang.Object).

Specified by:
store in interface OpenJPAStateManager

storeField

public void storeField(int field,
                       Object value)
Description copied from interface: OpenJPAStateManager
Set the value of the field with the given index as an object.

Specified by:
storeField in interface OpenJPAStateManager

fetchBoolean

public boolean fetchBoolean(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchBoolean in interface OpenJPAStateManager

fetchByte

public byte fetchByte(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchByte in interface OpenJPAStateManager

fetchChar

public char fetchChar(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchChar in interface OpenJPAStateManager

fetchShort

public short fetchShort(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchShort in interface OpenJPAStateManager

fetchInt

public int fetchInt(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchInt in interface OpenJPAStateManager

fetchLong

public long fetchLong(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchLong in interface OpenJPAStateManager

fetchFloat

public float fetchFloat(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchFloat in interface OpenJPAStateManager

fetchDouble

public double fetchDouble(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchDouble in interface OpenJPAStateManager

fetchString

public String fetchString(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchString in interface OpenJPAStateManager

fetchObject

public Object fetchObject(int field)
Description copied from interface: OpenJPAStateManager
Return the external value of the given field.

Specified by:
fetchObject in interface OpenJPAStateManager

fetch

public Object fetch(int field)
Description copied from interface: OpenJPAStateManager
Return the externalized value of the field with the given index as an object. If there is no externalizer, this is equivalent to OpenJPAStateManager.fetchField(int, boolean).

Specified by:
fetch in interface OpenJPAStateManager

fetchField

public Object fetchField(int field,
                         boolean transitions)
Description copied from interface: OpenJPAStateManager
Return the value of the field with the given index as an object.

Specified by:
fetchField in interface OpenJPAStateManager
transitions - if true, this method will cause state transitions to occur as if the field were accessed normally

fetchInitialField

public Object fetchInitialField(int field)
Description copied from interface: OpenJPAStateManager
Return the value of the field at the specified index as of the beginning of the transaction.

Specified by:
fetchInitialField in interface OpenJPAStateManager

setRemote

public void setRemote(int field,
                      Object value)
Description copied from interface: OpenJPAStateManager
Set the given field to the given value. Make the field dirty as if user code set it. Do not delete dependent objects in the field's current value. This method is invoked by the remote package to synch a server-side state manager with remote changes. We do not need to delete dependent instances because they will have been deleted when the field changed on the client side, and those client-side deletes will be transmitted independently.

Specified by:
setRemote in interface OpenJPAStateManager

lock

public void lock()

unlock

public void unlock()


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.