|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.abstractstore.AbstractStoreManager org.apache.openjpa.xmlstore.XMLStoreManager
public class XMLStoreManager
Store manager to a back-end consisting of XML files. This
implementation accesses data through the XMLStore
associated with
its XMLConfiguration
. Configuration instances are shared by all
store managers owned by all brokers created with the same factory.
AbstractStoreManager
Field Summary |
---|
Fields inherited from class org.apache.openjpa.abstractstore.AbstractStoreManager |
---|
ctx |
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 | |
---|---|
XMLStoreManager()
|
Method Summary | |
---|---|
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 pNew,
Collection pNewUpdated,
Collection pNewFlushedDeleted,
Collection pDirty,
Collection 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 |
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 . |
Methods inherited from class org.apache.openjpa.abstractstore.AbstractStoreManager |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLStoreManager()
Method Detail |
---|
protected Collection getUnsupportedOptions()
AbstractStoreManager
OpenJPAConfiguration.OPTION_OPTIMISTIC
OpenJPAConfiguration.OPTION_ID_DATASTORE
OpenJPAConfiguration.OPTION_INC_FLUSH
OpenJPAConfiguration.OPTION_VALUE_AUTOASSIGN
OpenJPAConfiguration.OPTION_VALUE_INCREMENT
OpenJPAConfiguration.OPTION_DATASTORE_CONNECTION
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 broker
public 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 broker
public 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 context
public 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 pNew, Collection pNewUpdated, Collection pNewFlushedDeleted, Collection pDirty, Collection 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)
,
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 returned data, extracting object IDs from the data, and
invoking
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 last 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |