|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.kernel.StateManagerImpl
public class StateManagerImpl
Implementation of the OpenJPAStateManager
interface for use
with this runtime. Each state manager manages the state of a single
persistence capable instance. The state manager is also responsible for
all communications about the instance to the StoreManager
.
The state manager uses the State pattern in both its interaction with
the governed instance and its interaction with the broker.
In its interactions with the persistence capable instance, it uses the
FieldManager
interface. Similarly, when interacting with the
broker, it uses the PCState
singleton that represents
the current lifecycle state of the instance.
Field Summary | |
---|---|
static int |
LOAD_ALL
|
static int |
LOAD_FGS
|
static int |
LOAD_SERIALIZE
|
Fields inherited from interface org.apache.openjpa.kernel.OpenJPAStateManager |
---|
SET_ATTACH, SET_REMOTE, SET_USER |
Constructor Summary | |
---|---|
protected |
StateManagerImpl(Object id,
ClassMetaData meta,
BrokerImpl broker)
Constructor; supply id, type metadata, and owning persistence manager. |
|
StateManagerImpl(StateManagerImpl sm)
Create a new StateManager instance based on the StateManager provided. |
|
StateManagerImpl(StateManagerImpl sm,
PCState newState)
Create a new StateManager instance, optionally overriding the state (FLUSHED, DELETED, etc) of the underlying PersistenceCapable instance). |
Method Summary | |
---|---|
void |
accessingField(int field)
Field access callback. |
(package private) void |
afterFlush(int reason)
Delegates to the current state. |
(package private) void |
afterRefresh()
Perform state transitions after refresh. |
(package private) void |
assertNotManagedObjectId(Object val)
Disallows setting an object id field to a managed instance. |
boolean |
assignObjectId(boolean flush)
Ask the store manager to assign a permanent oid to this new instance. |
(package private) boolean |
assignObjectId(boolean flush,
boolean preFlushing)
Ask store manager to assign our oid, optionally flushing and optionally recaching on the new oid. |
protected void |
beforeAccessField(int field)
Load the given field before access. |
(package private) void |
beforeFlush(int reason,
OpCallbacks call)
Delegates to the current state. |
(package private) void |
beforeRead(int field)
Notification that the object is about to be accessed. |
boolean |
beforeRefresh(boolean refreshAll)
Prepare the instance for refresh |
(package private) void |
cascadeDelete(OpCallbacks call)
Cascade deletes and dereference dependent fields. |
(package private) void |
cascadePersist(OpCallbacks call)
Called after an instance is persisted by a user through the broker. |
(package private) void |
clearFields()
Executes pre-clear callbacks, clears all managed fields, and calls the setLoaded(boolean) method with a value of false. |
(package private) void |
clearSavedFields()
Notification that the state will not need to be rolled back to that of the last call to saveFields(boolean) . |
(package private) void |
commit()
Delegates to the current state after checking the value of the RetainState flag. |
(package private) void |
delete()
Delegates to the current state. |
void |
dirty(int field)
Mark the given field as dirty. |
void |
dirty(String field)
Make named field dirty. |
void |
dirtyCheck()
Checks whether or not _pc is dirty. |
(package private) void |
eraseFlush()
Erase the fact that this instance has been flushed. |
(package private) void |
evict()
Delegates to the current state. |
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. |
boolean |
fetchBooleanField(int field)
Return the value of the given field. |
byte |
fetchByte(int field)
Return the external value of the given field. |
byte |
fetchByteField(int field)
Return the value of the given field. |
char |
fetchChar(int field)
Return the external value of the given field. |
char |
fetchCharField(int field)
Return the value of the given field. |
double |
fetchDouble(int field)
Return the external value of the given field. |
double |
fetchDoubleField(int field)
Return the 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. |
float |
fetchFloatField(int field)
Return the 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. |
int |
fetchIntField(int field)
Return the value of the given field. |
long |
fetchLong(int field)
Return the external value of the given field. |
long |
fetchLongField(int field)
Return the value of the given field. |
Object |
fetchObject(int field)
Return the external value of the given field. |
Object |
fetchObjectField(int field)
Return the 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. |
short |
fetchShortField(int field)
Return the value of the given field. |
String |
fetchString(int field)
Return the external value of the given field. |
String |
fetchStringField(int field)
Return the value of the given field. |
(package private) void |
gatherCascadeRefresh(OpCallbacks call)
Gather relations reachable from values using ValueMetaData.CASCADE_IMMEDIATE . |
(package private) BrokerImpl |
getBroker()
Managing broker. |
StoreContext |
getContext()
Return the managing context. |
boolean |
getDereferencedEmbedDependent()
|
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. |
(package private) Object |
getLoadVersion()
|
Object |
getLock()
The lock object set for this instance. |
Object |
getManagedInstance()
Return the managed instance. |
List<FieldMetaData> |
getMappedByIdFields()
|
ClassMetaData |
getMetaData()
Get the metadata for this instance. |
Object |
getObjectId()
Return the instance's object id. |
StateManagerImpl |
getObjectIdOwner()
|
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. |
SaveFieldManager |
getSaveFieldManager()
|
BitSet |
getUnloaded(FetchConfiguration fetch)
Return a mutable mask of the unloaded fields that need loading based on the given fetch configuration. |
Object |
getVersion()
Return the current version indicator for this instance. |
void |
initialize(Class cls,
PCState state)
Initialize the state manager with a new instance of the given persistence capable type and the proper lifecycle state. |
protected void |
initialize(PersistenceCapable pc,
PCState state)
Initialize with the given instance and 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 |
isIntercepting()
Whether or not data access in this instance is intercepted. |
(package private) boolean |
isLoading()
Whether this state manager is in the middle of a load. |
boolean |
isNew()
Whether the instance is newly-persisted in this transaction. |
boolean |
isPendingTransactional()
|
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 whether this instance needs a version check. |
boolean |
isVersionUpdateRequired()
Returns whether this instance needs a version update. |
void |
load(FetchConfiguration fetch)
Load fetch group fields. |
protected boolean |
load(FetchConfiguration fetch,
int loadMode,
BitSet exclude,
Object sdata,
boolean forWrite)
Load the state of this instance based on the given fetch configuration and load mode. |
protected void |
loadField(int field,
int lockLevel,
boolean forWrite,
boolean fgs)
Load the given field's fetch group; the field itself may already be loaded if it is being set by the user. |
(package private) boolean |
loadFields(BitSet fields,
FetchConfiguration fetch,
int lockLevel,
Object sdata)
Load the given field set from the data store into the instance. |
protected void |
lock()
Lock the state manager if the multithreaded option is set. |
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. |
(package private) void |
nonprovisional(boolean logical,
OpCallbacks call)
Delegates to the current state. |
(package private) void |
nontransactional()
Delegates to the current state. |
(package private) void |
persist()
Delegates to the current state. |
(package private) void |
preDelete()
Make callbacks for deletion. |
(package private) void |
preFlush(boolean logical,
OpCallbacks call)
Get ready for a flush. |
void |
providedBooleanField(PersistenceCapable pc,
int field,
boolean curVal)
Provide state callback. |
void |
providedByteField(PersistenceCapable pc,
int field,
byte curVal)
Provide state callback. |
void |
providedCharField(PersistenceCapable pc,
int field,
char curVal)
Provide state callback. |
void |
providedDoubleField(PersistenceCapable pc,
int field,
double curVal)
Provide state callback. |
void |
providedFloatField(PersistenceCapable pc,
int field,
float curVal)
Provide state callback. |
void |
providedIntField(PersistenceCapable pc,
int field,
int curVal)
Provide state callback. |
void |
providedLongField(PersistenceCapable pc,
int field,
long curVal)
Provide state callback. |
void |
providedObjectField(PersistenceCapable pc,
int field,
Object curVal)
Provide state callback. |
void |
providedShortField(PersistenceCapable pc,
int field,
short curVal)
Provide state callback. |
void |
providedStringField(PersistenceCapable pc,
int field,
String curVal)
Provide state callback. |
(package private) void |
provideField(PersistenceCapable pc,
FieldManager store,
int field)
Helper method to provide the given field number to the given field manager. |
void |
proxyDetachedDeserialized(int idx)
Proxy the given detached field after deserialization. |
(package private) void |
proxyFields(boolean reset,
boolean replaceNull)
Replaces all second class object fields with fresh proxied instances containing the same information as the originals. |
(package private) void |
readLocked(int readLockLevel,
int writeLockLevel)
Notification that we've been read-locked. |
(package private) PersistenceCapable |
readPC(ObjectInputStream in)
Converts the deserialized o to a PersistenceCapable
instance appropriate for storing in _pc . |
(package private) void |
release(boolean unproxy)
Delegates to the current state. |
(package private) void |
release(boolean unproxy,
boolean force)
|
void |
removed(int field,
Object removed,
boolean key)
Notification that an element has been removed from the given field. |
boolean |
replaceBooleanField(PersistenceCapable pc,
int field)
Replace state callback. |
byte |
replaceByteField(PersistenceCapable pc,
int field)
Replace state callback. |
char |
replaceCharField(PersistenceCapable pc,
int field)
Replace state callback. |
double |
replaceDoubleField(PersistenceCapable pc,
int field)
Replace state callback. |
(package private) void |
replaceField(PersistenceCapable pc,
FieldManager load,
int field)
Helper method to replace the given field number to the given field manager. |
byte |
replaceFlags()
|
float |
replaceFloatField(PersistenceCapable pc,
int field)
Replace state callback. |
int |
replaceIntField(PersistenceCapable pc,
int field)
Replace state callback. |
long |
replaceLongField(PersistenceCapable pc,
int field)
Replace state callback. |
Object |
replaceObjectField(PersistenceCapable pc,
int field)
Replace state callback. |
short |
replaceShortField(PersistenceCapable pc,
int field)
Replace state callback. |
StateManager |
replaceStateManager(StateManager sm)
Change state manager. |
String |
replaceStringField(PersistenceCapable pc,
int field)
Replace state callback. |
boolean |
requiresFetch(FieldMetaData fmd)
|
(package private) void |
restoreFields()
Rollback the state of the instance to the saved state from the last call to saveFields(boolean) , or to default values if never saved. |
(package private) void |
rollback()
Delegates to the current state after checking the value of the RetainState flag. |
(package private) void |
rollbackToSavepoint(SavepointFieldManager savepoint)
Rollback state of the managed instance to the given savepoint. |
(package private) void |
saveFields(boolean immediate)
Record that we should save any fields that change from this point forward. |
boolean |
serializing()
Callback to prepare instance for serialization. |
(package private) void |
setCheckVersion(boolean versionCheck)
Set whether this instance requires a version check on the next flush. |
(package private) void |
setDereferencedDependent(boolean deref,
boolean notify)
Mark this object as a dereferenced dependent object. |
(package private) void |
setDereferencedEmbedDependent(boolean deref)
|
(package private) void |
setDirty(boolean val)
Records that all instance fields are/are not dirty, and changes the flags of the instance accordingly. |
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. |
(package private) void |
setLoaded(boolean val)
Records that all instance fields are/are not loaded. |
(package private) void |
setLoading(boolean loading)
Whether this state manager is in the middle of a load initiated by outside code; for any internal methods that cause loading, the loading flag is set automatically. |
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 |
setOwner(Object oid)
|
(package private) void |
setOwner(StateManagerImpl owner,
ValueMetaData ownerMeta)
Set the owning state and field if this is an embedded instance. |
void |
setPc(PersistenceCapable pc)
|
void |
setRemote(int field,
Object value)
Set the given field to the given value. |
void |
settingBooleanField(PersistenceCapable pc,
int field,
boolean curVal,
boolean newVal,
int set)
Setting state callback. |
void |
settingByteField(PersistenceCapable pc,
int field,
byte curVal,
byte newVal,
int set)
Setting state callback. |
void |
settingCharField(PersistenceCapable pc,
int field,
char curVal,
char newVal,
int set)
Setting state callback. |
void |
settingDoubleField(PersistenceCapable pc,
int field,
double curVal,
double newVal,
int set)
Setting state callback. |
void |
settingFloatField(PersistenceCapable pc,
int field,
float curVal,
float newVal,
int set)
Setting state callback. |
void |
settingIntField(PersistenceCapable pc,
int field,
int curVal,
int newVal,
int set)
Setting state callback. |
void |
settingLongField(PersistenceCapable pc,
int field,
long curVal,
long newVal,
int set)
Setting state callback. |
void |
settingObjectField(PersistenceCapable pc,
int field,
Object curVal,
Object newVal,
int set)
Setting state callback. |
void |
settingShortField(PersistenceCapable pc,
int field,
short curVal,
short newVal,
int set)
Setting state callback. |
void |
settingStringField(PersistenceCapable pc,
int field,
String curVal,
String newVal,
int set)
Setting state callback. |
(package private) void |
setUpdateVersion(boolean versionUpdate)
Set whether this instance requires a version update on the next flush. |
void |
setVersion(Object version)
Set the version indicator for this instance, as loaded from the data store. |
void |
store(int field,
Object val)
Set the value of the field with the given index as from the external object value. |
void |
storeBoolean(int field,
boolean externalVal)
Set the given external value back into the given field. |
void |
storeBooleanField(int field,
boolean curVal)
Set the value of the given field. |
void |
storeByte(int field,
byte externalVal)
Set the given external value back into the given field. |
void |
storeByteField(int field,
byte curVal)
Set the value of the given field. |
void |
storeChar(int field,
char externalVal)
Set the given external value back into the given field. |
void |
storeCharField(int field,
char curVal)
Set the value of the given field. |
void |
storeDouble(int field,
double externalVal)
Set the given external value back into the given field. |
void |
storeDoubleField(int field,
double curVal)
Set the value of the given field. |
void |
storeField(int field,
Object val)
Set the value of the field with the given index as an object. |
void |
storeFloat(int field,
float externalVal)
Set the given external value back into the given field. |
void |
storeFloatField(int field,
float curVal)
Set the value of the given field. |
void |
storeInt(int field,
int externalVal)
Set the given external value back into the given field. |
void |
storeIntField(int field,
int curVal)
Set the value of the given field. |
void |
storeLong(int field,
long externalVal)
Set the given external value back into the given field. |
void |
storeLongField(int field,
long curVal)
Set the value of the given field. |
void |
storeObject(int field,
Object externalVal)
Set the given external value back into the given field. |
void |
storeObjectField(int field,
Object curVal)
Set the value of the given field. |
void |
storeShort(int field,
short externalVal)
Set the given external value back into the given field. |
void |
storeShortField(int field,
short curVal)
Set the value of the given field. |
void |
storeString(int field,
String externalVal)
Set the given external value back into the given field. |
void |
storeStringField(int field,
String curVal)
Set the value of the given field. |
(package private) void |
transactional()
Delegates to the current state. |
protected RuntimeException |
translate(RuntimeException re)
Translate the given exception based on the broker's implicit behavior. |
protected void |
unlock()
Unlock the state manager. |
(package private) void |
unproxyFields()
Unproxy all fields. |
boolean |
writeDetached(ObjectOutput out)
Write detached state object and detached state manager to the given stream. |
(package private) void |
writePC(ObjectOutputStream oos,
PersistenceCapable pc)
Write pc to oos , handling internal-form
serialization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOAD_FGS
public static final int LOAD_ALL
public static final int LOAD_SERIALIZE
Constructor Detail |
---|
protected StateManagerImpl(Object id, ClassMetaData meta, BrokerImpl broker)
public StateManagerImpl(StateManagerImpl sm)
sm
- A statemanager instance which will effectively be cloned.public StateManagerImpl(StateManagerImpl sm, PCState newState)
sm
- A statemanager instance which will effectively be cloned.newState
- The new state of the underlying persistence capable object.Method Detail |
---|
void setOwner(StateManagerImpl owner, ValueMetaData ownerMeta)
boolean isLoading()
void setLoading(boolean loading)
public void initialize(Class cls, PCState state)
OpenJPAStateManager
initialize
in interface OpenJPAStateManager
cls
- the type for which to create a new instancestate
- the initial state to which to set the instanceprotected void initialize(PersistenceCapable pc, PCState state)
public boolean isIntercepting()
ClassMetaData.isIntercepting()
in that it checks for
property access + subclassing in addition to the redefinition /
enhancement checks.
public void load(FetchConfiguration fetch)
OpenJPAStateManager
load
in interface OpenJPAStateManager
protected boolean load(FetchConfiguration fetch, int loadMode, BitSet exclude, Object sdata, boolean forWrite)
public Object getManagedInstance()
OpenJPAStateManager
getManagedInstance
in interface OpenJPAStateManager
public PersistenceCapable getPersistenceCapable()
OpenJPAStateManager
PersistenceCapable
instance that provides access to
the instance managed by this state manager. May be a proxy around
the actual managed instance.
getPersistenceCapable
in interface OpenJPAStateManager
public ClassMetaData getMetaData()
OpenJPAStateManager
getMetaData
in interface OpenJPAStateManager
public OpenJPAStateManager getOwner()
OpenJPAStateManager
getOwner
in interface OpenJPAStateManager
public int getOwnerIndex()
OpenJPAStateManager
getOwnerIndex
in interface OpenJPAStateManager
public void setOwner(Object oid)
public boolean isEmbedded()
OpenJPAStateManager
isEmbedded
in interface OpenJPAStateManager
public boolean isFlushed()
OpenJPAStateManager
isFlushed
in interface OpenJPAStateManager
public boolean isFlushedDirty()
OpenJPAStateManager
isFlushedDirty
in interface OpenJPAStateManager
public BitSet getLoaded()
OpenJPAStateManager
getLoaded
in interface OpenJPAStateManager
public BitSet getFlushed()
OpenJPAStateManager
getFlushed
in interface OpenJPAStateManager
public BitSet getDirty()
OpenJPAStateManager
getDirty
in interface OpenJPAStateManager
public BitSet getUnloaded(FetchConfiguration fetch)
OpenJPAStateManager
getUnloaded
in interface OpenJPAStateManager
public StoreContext getContext()
OpenJPAStateManager
getContext
in interface OpenJPAStateManager
BrokerImpl getBroker()
public Object getId()
OpenJPAStateManager
OpenJPAStateManager.getObjectId()
.
getId
in interface OpenJPAStateManager
public Object getObjectId()
OpenJPAStateManager
getObjectId
in interface OpenJPAStateManager
public void setObjectId(Object oid)
OpenJPAStateManager
storeXXXField
methods will automatically change the oid.
setObjectId
in interface OpenJPAStateManager
public StateManagerImpl getObjectIdOwner()
public boolean assignObjectId(boolean flush)
OpenJPAStateManager
assignObjectId
in interface OpenJPAStateManager
flush
- if true, flush if necessary to get a permanent oid; if
false, the oid may be left unassigned
boolean assignObjectId(boolean flush, boolean preFlushing)
public Object getLock()
OpenJPAStateManager
getLock
in interface OpenJPAStateManager
public void setLock(Object lock)
OpenJPAStateManager
setLock
in interface OpenJPAStateManager
public Object getVersion()
OpenJPAStateManager
getVersion
in interface StateManager
getVersion
in interface OpenJPAStateManager
public void setVersion(Object version)
OpenJPAStateManager
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.
setVersion
in interface OpenJPAStateManager
Object getLoadVersion()
public void setNextVersion(Object version)
OpenJPAStateManager
StoreManager
uses this method during flush.
setNextVersion
in interface OpenJPAStateManager
public PCState getPCState()
OpenJPAStateManager
getPCState
in interface OpenJPAStateManager
public Object getImplData()
OpenJPAStateManager
getImplData
in interface OpenJPAStateManager
public Object setImplData(Object data, boolean cacheable)
OpenJPAStateManager
setImplData
in interface OpenJPAStateManager
cacheable
- whether the impl data can be shared among instances
in different contexts if L2 caching is enabled
public boolean isImplDataCacheable()
OpenJPAStateManager
isImplDataCacheable
in interface OpenJPAStateManager
public Object getImplData(int field)
OpenJPAStateManager
getImplData
in interface OpenJPAStateManager
public Object setImplData(int field, Object data)
OpenJPAStateManager
FieldMetaData.usesImplData()
.
setImplData
in interface OpenJPAStateManager
public boolean isImplDataCacheable(int field)
OpenJPAStateManager
isImplDataCacheable
in interface OpenJPAStateManager
public Object getIntermediate(int field)
OpenJPAStateManager
getIntermediate
in interface OpenJPAStateManager
public void setIntermediate(int field, Object data)
OpenJPAStateManager
setIntermediate
in interface OpenJPAStateManager
public Object fetch(int field)
OpenJPAStateManager
OpenJPAStateManager.fetchField(int, boolean)
.
fetch
in interface OpenJPAStateManager
public Object fetchField(int field, boolean transitions)
OpenJPAStateManager
fetchField
in interface OpenJPAStateManager
transitions
- if true, this method will cause state transitions
to occur as if the field were accessed normallypublic void store(int field, Object val)
OpenJPAStateManager
OpenJPAStateManager.storeField(int, java.lang.Object)
.
store
in interface OpenJPAStateManager
public void storeField(int field, Object val)
OpenJPAStateManager
storeField
in interface OpenJPAStateManager
public void dirtyCheck()
Checks whether or not _pc
is dirty. In the cases where
field tracking is not happening (see below), this method will do a
state comparison to find whether _pc
is dirty, and will
update this instance with this information. In the cases where field
tracking is happening, this method is a no-op.
Fields are tracked for all classes that are run through the OpenJPA enhancer prior to or during deployment, and all classes (enhanced or unenhanced) in a Java 6 environment or newer.
In a Java 5 VM or older:
- instances of unenhanced classes that use
property access and obey the property access limitations are tracked
when the instances are loaded from the database by OpenJPA, and are
not tracked when the instances are created by application code.
- instances of unenhanced classes that use field access are
never tracked.
public Object fetchInitialField(int field)
OpenJPAStateManager
fetchInitialField
in interface OpenJPAStateManager
public void setRemote(int field, Object value)
OpenJPAStateManager
setRemote
in interface OpenJPAStateManager
void beforeRead(int field)
field
- the field number being read, or -1 if not a single
field readvoid beforeFlush(int reason, OpCallbacks call)
PCState.beforeFlush(org.apache.openjpa.kernel.StateManagerImpl, boolean, org.apache.openjpa.kernel.OpCallbacks)
void afterFlush(int reason)
PCState.flush(org.apache.openjpa.kernel.StateManagerImpl)
void commit()
PCState.commit(org.apache.openjpa.kernel.StateManagerImpl)
,
PCState.commitRetain(org.apache.openjpa.kernel.StateManagerImpl)
void rollback()
PCState.rollback(org.apache.openjpa.kernel.StateManagerImpl)
,
PCState.rollbackRestore(org.apache.openjpa.kernel.StateManagerImpl)
void rollbackToSavepoint(SavepointFieldManager savepoint)
void persist()
PCState.persist(org.apache.openjpa.kernel.StateManagerImpl)
,
Broker.persist(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void delete()
PCState.delete(org.apache.openjpa.kernel.StateManagerImpl)
,
Broker.delete(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void nontransactional()
PCState.nontransactional(org.apache.openjpa.kernel.StateManagerImpl)
,
StoreContext.nontransactional(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void transactional()
PCState.transactional(org.apache.openjpa.kernel.StateManagerImpl)
,
StoreContext.transactional(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
void nonprovisional(boolean logical, OpCallbacks call)
PCState.nonprovisional(org.apache.openjpa.kernel.StateManagerImpl, boolean, org.apache.openjpa.kernel.OpCallbacks)
void release(boolean unproxy)
PCState.release(org.apache.openjpa.kernel.StateManagerImpl)
,
Broker.release(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void release(boolean unproxy, boolean force)
void evict()
PCState.evict(org.apache.openjpa.kernel.StateManagerImpl)
,
Broker.evict(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void gatherCascadeRefresh(OpCallbacks call)
ValueMetaData.CASCADE_IMMEDIATE
.
public boolean beforeRefresh(boolean refreshAll)
OpenJPAStateManager
beforeRefresh
in interface OpenJPAStateManager
refreshAll
- true if this instance is one of a collection of
objects being refreshed
Broker.refresh(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void afterRefresh()
beforeRefresh(boolean)
returns true.
void setDereferencedDependent(boolean deref, boolean notify)
void setDereferencedEmbedDependent(boolean deref)
public boolean getDereferencedEmbedDependent()
void readLocked(int readLockLevel, int writeLockLevel)
public boolean serializing()
StateManager
serializing
in interface StateManager
public boolean writeDetached(ObjectOutput out) throws IOException
StateManager
writeDetached
in interface StateManager
IOException
public void proxyDetachedDeserialized(int idx)
StateManager
proxyDetachedDeserialized
in interface StateManager
public boolean isTransactional()
StateManager
isTransactional
in interface StateManager
public boolean isPendingTransactional()
public boolean isProvisional()
OpenJPAStateManager
isProvisional
in interface OpenJPAStateManager
public boolean isPersistent()
StateManager
isPersistent
in interface StateManager
public boolean isNew()
StateManager
isNew
in interface StateManager
public boolean isDeleted()
StateManager
isDeleted
in interface StateManager
public boolean isDirty()
StateManager
isDirty
in interface StateManager
public boolean isDetached()
StateManager
isDetached
in interface StateManager
public Object getGenericContext()
StateManager
getGenericContext
in interface StateManager
public Object fetchObjectId()
StateManager
fetchObjectId
in interface StateManager
public Object getPCPrimaryKey(Object oid, int field)
StateManager
getPCPrimaryKey
in interface StateManager
public byte replaceFlags()
public StateManager replaceStateManager(StateManager sm)
StateManager
replaceStateManager
in interface StateManager
public void accessingField(int field)
StateManager
accessingField
in interface StateManager
protected void beforeAccessField(int field)
public void dirty(String field)
StateManager
dirty
in interface StateManager
public void dirty(int field)
OpenJPAStateManager
dirty
in interface OpenJPAStateManager
public void removed(int field, Object removed, boolean key)
OpenJPAStateManager
removed
in interface OpenJPAStateManager
public Object newProxy(int field)
OpenJPAStateManager
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.
newProxy
in interface OpenJPAStateManager
public Object newFieldProxy(int field)
OpenJPAStateManager
OpenJPAStateManager.newProxy(int)
in that it returns a proxy for the
field's declared type, not its externalized type.
newFieldProxy
in interface OpenJPAStateManager
OpenJPAStateManager.newProxy(int)
public boolean isDefaultValue(int field)
OpenJPAStateManager
isDefaultValue
in interface OpenJPAStateManager
public void settingBooleanField(PersistenceCapable pc, int field, boolean curVal, boolean newVal, int set)
StateManager
settingBooleanField
in interface StateManager
public void settingByteField(PersistenceCapable pc, int field, byte curVal, byte newVal, int set)
StateManager
settingByteField
in interface StateManager
public void settingCharField(PersistenceCapable pc, int field, char curVal, char newVal, int set)
StateManager
settingCharField
in interface StateManager
public void settingDoubleField(PersistenceCapable pc, int field, double curVal, double newVal, int set)
StateManager
settingDoubleField
in interface StateManager
public void settingFloatField(PersistenceCapable pc, int field, float curVal, float newVal, int set)
StateManager
settingFloatField
in interface StateManager
public void settingIntField(PersistenceCapable pc, int field, int curVal, int newVal, int set)
StateManager
settingIntField
in interface StateManager
public void settingLongField(PersistenceCapable pc, int field, long curVal, long newVal, int set)
StateManager
settingLongField
in interface StateManager
public void settingObjectField(PersistenceCapable pc, int field, Object curVal, Object newVal, int set)
StateManager
settingObjectField
in interface StateManager
public void settingShortField(PersistenceCapable pc, int field, short curVal, short newVal, int set)
StateManager
settingShortField
in interface StateManager
public void settingStringField(PersistenceCapable pc, int field, String curVal, String newVal, int set)
StateManager
settingStringField
in interface StateManager
void assertNotManagedObjectId(Object val)
public void providedBooleanField(PersistenceCapable pc, int field, boolean curVal)
StateManager
providedBooleanField
in interface StateManager
public void providedByteField(PersistenceCapable pc, int field, byte curVal)
StateManager
providedByteField
in interface StateManager
public void providedCharField(PersistenceCapable pc, int field, char curVal)
StateManager
providedCharField
in interface StateManager
public void providedDoubleField(PersistenceCapable pc, int field, double curVal)
StateManager
providedDoubleField
in interface StateManager
public void providedFloatField(PersistenceCapable pc, int field, float curVal)
StateManager
providedFloatField
in interface StateManager
public void providedIntField(PersistenceCapable pc, int field, int curVal)
StateManager
providedIntField
in interface StateManager
public void providedLongField(PersistenceCapable pc, int field, long curVal)
StateManager
providedLongField
in interface StateManager
public void providedObjectField(PersistenceCapable pc, int field, Object curVal)
StateManager
providedObjectField
in interface StateManager
public void providedShortField(PersistenceCapable pc, int field, short curVal)
StateManager
providedShortField
in interface StateManager
public void providedStringField(PersistenceCapable pc, int field, String curVal)
StateManager
providedStringField
in interface StateManager
public boolean replaceBooleanField(PersistenceCapable pc, int field)
StateManager
replaceBooleanField
in interface StateManager
public byte replaceByteField(PersistenceCapable pc, int field)
StateManager
replaceByteField
in interface StateManager
public char replaceCharField(PersistenceCapable pc, int field)
StateManager
replaceCharField
in interface StateManager
public double replaceDoubleField(PersistenceCapable pc, int field)
StateManager
replaceDoubleField
in interface StateManager
public float replaceFloatField(PersistenceCapable pc, int field)
StateManager
replaceFloatField
in interface StateManager
public int replaceIntField(PersistenceCapable pc, int field)
StateManager
replaceIntField
in interface StateManager
public long replaceLongField(PersistenceCapable pc, int field)
StateManager
replaceLongField
in interface StateManager
public Object replaceObjectField(PersistenceCapable pc, int field)
StateManager
replaceObjectField
in interface StateManager
public short replaceShortField(PersistenceCapable pc, int field)
StateManager
replaceShortField
in interface StateManager
public String replaceStringField(PersistenceCapable pc, int field)
StateManager
replaceStringField
in interface StateManager
public boolean fetchBoolean(int field)
OpenJPAStateManager
fetchBoolean
in interface OpenJPAStateManager
public boolean fetchBooleanField(int field)
FieldSupplier
fetchBooleanField
in interface FieldSupplier
public byte fetchByte(int field)
OpenJPAStateManager
fetchByte
in interface OpenJPAStateManager
public byte fetchByteField(int field)
FieldSupplier
fetchByteField
in interface FieldSupplier
public char fetchChar(int field)
OpenJPAStateManager
fetchChar
in interface OpenJPAStateManager
public char fetchCharField(int field)
FieldSupplier
fetchCharField
in interface FieldSupplier
public double fetchDouble(int field)
OpenJPAStateManager
fetchDouble
in interface OpenJPAStateManager
public double fetchDoubleField(int field)
FieldSupplier
fetchDoubleField
in interface FieldSupplier
public float fetchFloat(int field)
OpenJPAStateManager
fetchFloat
in interface OpenJPAStateManager
public float fetchFloatField(int field)
FieldSupplier
fetchFloatField
in interface FieldSupplier
public int fetchInt(int field)
OpenJPAStateManager
fetchInt
in interface OpenJPAStateManager
public int fetchIntField(int field)
FieldSupplier
fetchIntField
in interface FieldSupplier
public long fetchLong(int field)
OpenJPAStateManager
fetchLong
in interface OpenJPAStateManager
public long fetchLongField(int field)
FieldSupplier
fetchLongField
in interface FieldSupplier
public Object fetchObject(int field)
OpenJPAStateManager
fetchObject
in interface OpenJPAStateManager
public Object fetchObjectField(int field)
FieldSupplier
fetchObjectField
in interface FieldSupplier
public short fetchShort(int field)
OpenJPAStateManager
fetchShort
in interface OpenJPAStateManager
public short fetchShortField(int field)
FieldSupplier
fetchShortField
in interface FieldSupplier
public String fetchString(int field)
OpenJPAStateManager
fetchString
in interface OpenJPAStateManager
public String fetchStringField(int field)
FieldSupplier
fetchStringField
in interface FieldSupplier
public void storeBoolean(int field, boolean externalVal)
OpenJPAStateManager
storeBoolean
in interface OpenJPAStateManager
public void storeBooleanField(int field, boolean curVal)
FieldConsumer
storeBooleanField
in interface FieldConsumer
public void storeByte(int field, byte externalVal)
OpenJPAStateManager
storeByte
in interface OpenJPAStateManager
public void storeByteField(int field, byte curVal)
FieldConsumer
storeByteField
in interface FieldConsumer
public void storeChar(int field, char externalVal)
OpenJPAStateManager
storeChar
in interface OpenJPAStateManager
public void storeCharField(int field, char curVal)
FieldConsumer
storeCharField
in interface FieldConsumer
public void storeDouble(int field, double externalVal)
OpenJPAStateManager
storeDouble
in interface OpenJPAStateManager
public void storeDoubleField(int field, double curVal)
FieldConsumer
storeDoubleField
in interface FieldConsumer
public void storeFloat(int field, float externalVal)
OpenJPAStateManager
storeFloat
in interface OpenJPAStateManager
public void storeFloatField(int field, float curVal)
FieldConsumer
storeFloatField
in interface FieldConsumer
public void storeInt(int field, int externalVal)
OpenJPAStateManager
storeInt
in interface OpenJPAStateManager
public void storeIntField(int field, int curVal)
FieldConsumer
storeIntField
in interface FieldConsumer
public void storeLong(int field, long externalVal)
OpenJPAStateManager
storeLong
in interface OpenJPAStateManager
public void storeLongField(int field, long curVal)
FieldConsumer
storeLongField
in interface FieldConsumer
public void storeObject(int field, Object externalVal)
OpenJPAStateManager
storeObject
in interface OpenJPAStateManager
public void storeObjectField(int field, Object curVal)
FieldConsumer
storeObjectField
in interface FieldConsumer
public void storeShort(int field, short externalVal)
OpenJPAStateManager
storeShort
in interface OpenJPAStateManager
public void storeShortField(int field, short curVal)
FieldConsumer
storeShortField
in interface FieldConsumer
public void storeString(int field, String externalVal)
OpenJPAStateManager
storeString
in interface OpenJPAStateManager
public void storeStringField(int field, String curVal)
FieldConsumer
storeStringField
in interface FieldConsumer
void eraseFlush()
void setLoaded(boolean val)
void setDirty(boolean val)
void clearFields()
setLoaded(boolean)
method with a value of false. Primary key fields
are not cleared.
void saveFields(boolean immediate)
void clearSavedFields()
saveFields(boolean)
.
public SaveFieldManager getSaveFieldManager()
void restoreFields()
saveFields(boolean)
, or to default values if never saved.
void proxyFields(boolean reset, boolean replaceNull)
void unproxyFields()
void preFlush(boolean logical, OpCallbacks call)
void preDelete()
void cascadeDelete(OpCallbacks call)
void cascadePersist(OpCallbacks call)
ValueMetaData.CASCADE_IMMEDIATE
.
boolean loadFields(BitSet fields, FetchConfiguration fetch, int lockLevel, Object sdata)
protected void loadField(int field, int lockLevel, boolean forWrite, boolean fgs)
void provideField(PersistenceCapable pc, FieldManager store, int field)
void replaceField(PersistenceCapable pc, FieldManager load, int field)
public boolean isVersionCheckRequired()
isVersionCheckRequired
in interface OpenJPAStateManager
void setCheckVersion(boolean versionCheck)
public boolean isVersionUpdateRequired()
isVersionUpdateRequired
in interface OpenJPAStateManager
void setUpdateVersion(boolean versionUpdate)
protected RuntimeException translate(RuntimeException re)
protected void lock()
protected void unlock()
void writePC(ObjectOutputStream oos, PersistenceCapable pc) throws IOException
pc
to oos
, handling internal-form
serialization. pc
must be of the same type that this
state manager manages.
IOException
PersistenceCapable readPC(ObjectInputStream in) throws ClassNotFoundException, IOException
o
to a PersistenceCapable
instance appropriate for storing in _pc
.
ClassNotFoundException
IOException
public List<FieldMetaData> getMappedByIdFields()
public boolean requiresFetch(FieldMetaData fmd)
public void setPc(PersistenceCapable pc)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |