org.apache.openjpa.kernel
Class ROPStoreManager

java.lang.Object
  extended by org.apache.openjpa.kernel.DelegatingStoreManager
      extended by org.apache.openjpa.kernel.ROPStoreManager
All Implemented Interfaces:
StoreManager, Closeable

 class ROPStoreManager
extends DelegatingStoreManager

Wraps the native store manager to handle calls using custom PCResultObjectProviders.

Author:
Abe White

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
ROPStoreManager(StoreManager delegate)
           
 
Method Summary
 boolean exists(OpenJPAStateManager sm, Object context)
          Verify that the given instance exists in the data store; return false if it does not.
 boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object context)
          Initialize the given state manager.
 boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object context)
          Load the given state manager.
 boolean syncVersion(OpenJPAStateManager sm, Object context)
          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, begin, beginOptimistic, cancelAll, close, commit, compareVersion, copyDataStoreId, equals, executeExtent, flush, getClientConnection, getDataStoreIdSequence, getDataStoreIdType, getDelegate, getInnermostDelegate, getManagedType, getValueSequence, hashCode, isCached, loadAll, newDataStoreId, newFetchConfiguration, newQuery, releaseConnection, retainConnection, rollback, rollbackOptimistic, setContext
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ROPStoreManager

public ROPStoreManager(StoreManager delegate)
Method Detail

exists

public boolean exists(OpenJPAStateManager sm,
                      Object context)
Description copied from interface: StoreManager
Verify that the given instance exists in the data store; return false if it does not.

Specified by:
exists in interface StoreManager
Overrides:
exists in class DelegatingStoreManager

initialize

public boolean initialize(OpenJPAStateManager sm,
                          PCState state,
                          FetchConfiguration fetch,
                          Object context)
Description copied from interface: StoreManager
Initialize the given state manager. The object id of the state manager will be set, and the state manager's metadata be set to the class of the instance to load, or possibly one of its superclasses. Initialization involves first calling the 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.

Specified by:
initialize in interface StoreManager
Overrides:
initialize in class DelegatingStoreManager
Parameters:
sm - the instance to initialize
state - the lifecycle state to initialize the state manager with
fetch - configuration for how to load the instance
context - the current execution data, or null if not given to the calling method of the broker
Returns:
true if the matching instance exists in the data store, false otherwise

syncVersion

public boolean syncVersion(OpenJPAStateManager sm,
                           Object context)
Description copied from interface: StoreManager
Update the version information in the given state manager to the version stored in the data store.

Specified by:
syncVersion in interface StoreManager
Overrides:
syncVersion in class DelegatingStoreManager
Parameters:
sm - the instance to check
context - the current execution data, or null if not given to the calling method of the context
Returns:
true if the instance still exists in the datastore and is up-to-date, false otherwise

load

public boolean load(OpenJPAStateManager sm,
                    BitSet fields,
                    FetchConfiguration fetch,
                    int lockLevel,
                    Object context)
Description copied from interface: StoreManager
Load the given state manager. Note that any collection or map types loaded into the state manager will be proxied with the correct type; therefore the store manager does not have to load the same concrete collection/map types as the instance declares. However, array types must be consistent with the array type stored by the persistence capable instance. If this method is called during a data store transaction, the instance should be locked. If the given state manager does not have its version set already, version information can be loaded if desired through the OpenJPAStateManager.setVersion(java.lang.Object) method.

Specified by:
load in interface StoreManager
Overrides:
load in class DelegatingStoreManager
Parameters:
sm - the instance to load
fields - set of fields to load; all field indexes in this set must be loaded; this set is mutable
fetch - the fetch configuration to use when loading related objects
lockLevel - attempt to load simple fields at this lock level; relations should be loaded at the read lock level of the fetch configuration
context - the current execution data, or null if not given to the calling method of the broker
Returns:
false if the object no longer exists in the database, true otherwise


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