public class XMLStoreManager extends AbstractStoreManager
XMLStore
associated with
its XMLConfiguration
. Configuration instances are shared by all
store managers owned by all brokers created with the same factory.AbstractStoreManager
ctx
FORCE_LOAD_ALL, FORCE_LOAD_DFG, FORCE_LOAD_NONE, FORCE_LOAD_REFRESH, VERSION_DIFFERENT, VERSION_EARLIER, VERSION_LATER, VERSION_SAME
Constructor and Description |
---|
XMLStoreManager() |
Modifier and Type | Method and Description |
---|---|
void |
begin()
OpenJPA assumes that after this method is invoked, all data
accesses through this store manager will be part of a single
unit of work that can be rolled back.
|
void |
commit()
This is a no-op implementation.
|
ResultObjectProvider |
executeExtent(ClassMetaData meta,
boolean subclasses,
FetchConfiguration fetch)
Create a
ResultObjectProvider that can return all instances
of type , optionally including subclasses as defined
by subclasses . |
boolean |
exists(OpenJPAStateManager sm,
Object context)
Verify that the given instance exists in the data store; return false
if it does not.
|
protected Collection |
flush(Collection<OpenJPAStateManager> pNew,
Collection<OpenJPAStateManager> pNewUpdated,
Collection<OpenJPAStateManager> pNewFlushedDeleted,
Collection<OpenJPAStateManager> pDirty,
Collection<OpenJPAStateManager> pDeleted)
Responsible for writing modifications happened back to the data
store.
|
protected Collection |
getUnsupportedOptions()
Returns a set of option names that this store manager does
not support.
|
boolean |
initialize(OpenJPAStateManager sm,
PCState state,
FetchConfiguration fetch,
Object context)
This method is invoked when OpenJPA needs to load an object whose
identity is known but which has not yet been loaded from the data
store.
|
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 context)
This method is invoked when OpenJPA needs to load additional data
into an object that has already been at least partially loaded by
a previous
AbstractStoreManager.initialize(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.kernel.PCState, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object) invocation. |
protected OpenJPAConfiguration |
newConfiguration()
Return a new configuration instance for this runtime.
|
protected void |
open()
No-op implementation.
|
void |
rollback()
This is a no-op implementation.
|
boolean |
syncVersion(OpenJPAStateManager sm,
Object context)
Since this store manager does not provide optimistic locking
support, this method always returns
true . |
assignDataStoreId, assignField, assignObjectId, beforeStateChange, beginOptimistic, cancelAll, close, compareVersion, copyDataStoreId, flush, getClientConnection, getContext, getDataStoreIdSequence, getDataStoreIdType, getManagedType, getPlatform, getValueSequence, loadAll, newDataStoreId, newFetchConfiguration, newQuery, releaseConnection, retainConnection, rollbackOptimistic, setContext
protected Collection getUnsupportedOptions()
AbstractStoreManager
getUnsupportedOptions
in class AbstractStoreManager
protected OpenJPAConfiguration newConfiguration()
AbstractStoreManager
newConfiguration
in class AbstractStoreManager
protected void open()
AbstractStoreManager
open
in class AbstractStoreManager
public boolean exists(OpenJPAStateManager sm, Object context)
StoreManager
public boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object context)
AbstractStoreManager
sm
is a partially-set-up state manager for this
object. The ID and least-derived type information for the instance
to load can be obtained by invoking
sm.getObjectId()
and sm.getMetaData()
.
When implementing this method, load the data for this object from
the data store, determine the most-derived subclass of the newly-loaded
data, and then use the OpenJPAStateManager.initialize(java.lang.Class, org.apache.openjpa.kernel.PCState)
method to
populate sm
with a new instance of the appropriate type.
Once OpenJPAStateManager.initialize(java.lang.Class, org.apache.openjpa.kernel.PCState)
has been invoked, proceed to
load field data into sm
as in the AbstractStoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)
method, by
using OpenJPAStateManager.store(int, java.lang.Object)
(or the appropriate
OpenJPAStateManager.storetype
method) to put the
data into the object.initialize
in interface StoreManager
initialize
in class AbstractStoreManager
sm
- the instance to initializestate
- the lifecycle state to initialize the state manager withfetch
- configuration for how to load the instancecontext
- the current execution data, or null if not
given to the calling method of the brokerpublic boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object context)
AbstractStoreManager
AbstractStoreManager.initialize(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.kernel.PCState, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)
invocation.
Load data into sm
by using OpenJPAStateManager.store(int, java.lang.Object)
(or the appropriate
OpenJPAStateManager.storetype
method) to put the
data into the object.load
in interface StoreManager
load
in class AbstractStoreManager
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 configurationcontext
- the current execution data, or null if not
given to the calling method of the brokerpublic boolean syncVersion(OpenJPAStateManager sm, Object context)
AbstractStoreManager
true
.syncVersion
in interface StoreManager
syncVersion
in class AbstractStoreManager
sm
- the instance to checkcontext
- the current execution data, or null if not
given to the calling method of the contextpublic void begin()
AbstractStoreManager
begin
in interface StoreManager
begin
in class AbstractStoreManager
public void commit()
AbstractStoreManager
commit
in interface StoreManager
commit
in class AbstractStoreManager
public void rollback()
AbstractStoreManager
rollback
in interface StoreManager
rollback
in class AbstractStoreManager
protected Collection flush(Collection<OpenJPAStateManager> pNew, Collection<OpenJPAStateManager> pNewUpdated, Collection<OpenJPAStateManager> pNewFlushedDeleted, Collection<OpenJPAStateManager> pDirty, Collection<OpenJPAStateManager> pDeleted)
AbstractStoreManager
OpenJPAConfiguration.OPTION_INC_FLUSH
option in
AbstractStoreManager.getUnsupportedOptions()
, this will be called only once at the
end of a transaction. Otherwise, it may be called periodically
throughout the course of a transaction.
If this store manager supports optimistic transactions, datastore
version information should be updated during flush, and the state
manager's version indicator should be updated through the
OpenJPAStateManager.setNextVersion(java.lang.Object)
method.
This method will only be invoked if there are meaningful changes
to store. This differs from the behavior of StoreManager.flush(java.util.Collection<org.apache.openjpa.kernel.OpenJPAStateManager>)
,
which may be invoked with a collection of objects in states that
do not require any datastore action (for example, objects in the
transient-transactional state).flush
in class AbstractStoreManager
pNew
- Objects that should be added to the store,
and that have not previously been flushed.pNewUpdated
- New objects that have been modified since
they were initially flushed. These were
in persistentNew
in an earlier flush invocation.pNewFlushedDeleted
- New objects that have been deleted since
they were initially flushed. These were
in persistentNew
in an earlier flush invocation.pDirty
- Objects that were loaded from the data
store and have since been modified.pDeleted
- Objects that were loaded from the data
store and have since been deleted. These
may have been in a previous flush invocation's persistentDirty list.public ResultObjectProvider executeExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)
AbstractStoreManager
ResultObjectProvider
that can return all instances
of type
, optionally including subclasses as defined
by subclasses
.
The implementation of the result provider will typically execute
some sort of data store query to find all the applicable objects, loop
through the results, extracting object IDs from the data, and invoke
StoreContext.find(Object,FetchConfiguration,BitSet,Object,int)
on each OID. When invoking this method, the first argument is the OID.
The second is the given fetch configuration. The
third argument is a mask of fields to exclude from loading; it will
typically be null. The fourth argument is an object that will be passed
through to AbstractStoreManager.initialize(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.kernel.PCState, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)
or AbstractStoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)
, and typically will
contain the actual data to load. For example, for a JDBC-based store
manager, this might be the result set that is being iterated over. If
this argument is null
, then the AbstractStoreManager.initialize(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.kernel.PCState, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)
or
AbstractStoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)
method will have to issue another command to the data
store in order to fetch the data to be loaded.executeExtent
in interface StoreManager
executeExtent
in class AbstractStoreManager
public boolean isCached(List<Object> oids, BitSet edata)
StoreManager
Copyright © 2006–2019 Apache Software Foundation. All rights reserved.