|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.kernel.DelegatingStoreManager org.apache.openjpa.datacache.DataCacheStoreManager
public class DataCacheStoreManager
StoreManager proxy that delegates to a data cache when possible.
Field Summary |
---|
Fields inherited from interface org.apache.openjpa.kernel.StoreManager |
---|
FORCE_LOAD_ALL, FORCE_LOAD_DFG, FORCE_LOAD_NONE, FORCE_LOAD_REFRESH, VERSION_DIFFERENT, VERSION_EARLIER, VERSION_LATER, VERSION_SAME |
Constructor Summary | |
---|---|
DataCacheStoreManager(StoreManager sm)
Constructor. |
Method Summary | |
---|---|
void |
begin()
Begin a data store transaction. |
void |
commit()
Commit the current data store transaction. |
boolean |
exists(OpenJPAStateManager sm,
Object edata)
Verify that the given instance exists in the data store; return false if it does not. |
Collection<Exception> |
flush(Collection<OpenJPAStateManager> states)
Flush the given state manager collection to the datastore, returning a collection of exceptions encountered during flushing. |
boolean |
initialize(OpenJPAStateManager sm,
PCState state,
FetchConfiguration fetch,
Object edata)
Initialize the given state manager. |
boolean |
isCached(List<Object> oids,
BitSet edata)
Verify that the given instance exists in the data store in memory; return false if it does not. |
boolean |
load(OpenJPAStateManager sm,
BitSet fields,
FetchConfiguration fetch,
int lockLevel,
Object edata)
Load the given state manager. |
Collection<Object> |
loadAll(Collection<OpenJPAStateManager> sms,
PCState state,
int load,
FetchConfiguration fetch,
Object edata)
Initialize, load, or validate the existance of all of the given objects. |
void |
rollback()
Rollback the current data store transaction. |
void |
setContext(StoreContext ctx)
Set a reference to the corresponding context. |
boolean |
syncVersion(OpenJPAStateManager sm,
Object edata)
Update the version information in the given state manager to the version stored in the data store. |
Methods inherited from class org.apache.openjpa.kernel.DelegatingStoreManager |
---|
assignField, assignObjectId, beforeStateChange, beginOptimistic, cancelAll, close, compareVersion, copyDataStoreId, equals, executeExtent, getClientConnection, getDataStoreIdSequence, getDataStoreIdType, getDelegate, getInnermostDelegate, getManagedType, getValueSequence, hashCode, newDataStoreId, newFetchConfiguration, newQuery, releaseConnection, retainConnection, rollbackOptimistic |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataCacheStoreManager(StoreManager sm)
sm
- the store manager to delegate toMethod Detail |
---|
public void setContext(StoreContext ctx)
StoreManager
setContext
in interface StoreManager
setContext
in class DelegatingStoreManager
public void begin()
StoreManager
begin
in interface StoreManager
begin
in class DelegatingStoreManager
public void commit()
StoreManager
commit
in interface StoreManager
commit
in class DelegatingStoreManager
public void rollback()
StoreManager
rollback
in interface StoreManager
rollback
in class DelegatingStoreManager
public boolean exists(OpenJPAStateManager sm, Object edata)
StoreManager
exists
in interface StoreManager
exists
in class DelegatingStoreManager
public boolean isCached(List<Object> oids, BitSet edata)
StoreManager
isCached
in interface StoreManager
isCached
in class DelegatingStoreManager
public boolean syncVersion(OpenJPAStateManager sm, Object edata)
StoreManager
syncVersion
in interface StoreManager
syncVersion
in class DelegatingStoreManager
sm
- the instance to checkedata
- the current execution data, or null if not
given to the calling method of the context
public boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object edata)
StoreManager
OpenJPAStateManager.initialize(java.lang.Class, org.apache.openjpa.kernel.PCState)
method with
a new instance of the correct type constructed with the
PCRegistry.newInstance(Class,
org.apache.openjpa.enhance.StateManager, boolean)
method
(this will reset the state manager's metadata if the actual type was a
subclass). After instance initialization, load any the fields for the
given fetch configuration that can be efficiently retrieved. If any of
the configured fields are not loaded in this method, they will be
loaded with a subsequent call to StoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)
. If this method is
called during a data store transaction, the instance's database record
should be locked. Version information can be loaded if desired through
the OpenJPAStateManager.setVersion(java.lang.Object)
method.
initialize
in interface StoreManager
initialize
in class DelegatingStoreManager
sm
- the instance to initializestate
- the lifecycle state to initialize the state manager withfetch
- configuration for how to load the instanceedata
- the current execution data, or null if not
given to the calling method of the broker
public boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object edata)
StoreManager
OpenJPAStateManager.setVersion(java.lang.Object)
method.
load
in interface StoreManager
load
in class DelegatingStoreManager
sm
- the instance to loadfields
- set of fields to load; all field indexes in this
set must be loaded; this set is mutablefetch
- the fetch configuration to use when loading
related objectslockLevel
- attempt to load simple fields at this lock level;
relations should be loaded at the read lock level
of the fetch configurationedata
- the current execution data, or null if not
given to the calling method of the broker
public Collection<Object> loadAll(Collection<OpenJPAStateManager> sms, PCState state, int load, FetchConfiguration fetch, Object edata)
StoreManager
StoreContext.retrieveAll(java.util.Collection, boolean, org.apache.openjpa.kernel.OpCallbacks)
. It gives
the store manager an opportunity to efficiently batch-load data for
several objects. Each of the given state managers will be in one of
three states, each requiring a different action:
stateManager.getO () == null
: An
uninitialized state manager. Perform the same actions as in
StoreManager.initialize(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.kernel.PCState, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)
.
load != FORCE_LOAD_NONE || stateManager.getPCState ()
== PCState.HOLLOW
: A hollow state manager, or one whose
fields must be loaded because this is a refresh or retrieve action.
Peform the same actions as in StoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)
, choosing the fields
to load based on the fetch configuration, or loading all fields
if load == FORCE_LOAD_ALL
. Any required fields left
unloaded will cause a subsequent invocation of StoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)
on
the individual object in question.load == FORCE_LOAD_NONE &&
stateManager.getPCState () != PCState.HOLLOW
: A non-hollow
state manager. Perform the same actions as in StoreManager.exists(org.apache.openjpa.kernel.OpenJPAStateManager, java.lang.Object)
,
and load additional state if desired. Non-hollow objects will only
be included outside of refresh invocations if a user calls
findAll
with the validate
parameter set to true
.
loadAll
in interface StoreManager
loadAll
in class DelegatingStoreManager
sms
- the state manager instances to loadstate
- the lifecycle state to initialize uninitialized
state managers with; may be null if no uninitialized
instances are included in sms
load
- one of the FORCE_LOAD_* constants describing the
fields to force-load if this is a refresh or retrieve actionfetch
- the current fetch configuration to use when loading
related objectsedata
- the current execution data, or null if not
given to the calling method of the broker
ImplHelper.loadAll(java.util.Collection, org.apache.openjpa.kernel.StoreManager, org.apache.openjpa.kernel.PCState, int, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)
public Collection<Exception> flush(Collection<OpenJPAStateManager> states)
StoreManager
OpenJPAStateManager.setObjectId(java.lang.Object)
. New
instances with value-strategy fields that have not been assigned yet
should have their fields set. Datastore version information should be
updated during flush, and the state manager's version indicator
updated through the OpenJPAStateManager.setNextVersion(java.lang.Object)
method.
The current version will roll over to this next version upon successful
commit.
flush
in interface StoreManager
flush
in class DelegatingStoreManager
org.apache.openjpa.util.ApplicationIds#assign()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |