class DistributedJDBCStoreManager extends JDBCStoreManager implements DistributedStoreManager
JDBCStoreManager.ClientConnection, JDBCStoreManager.RefCountConnectionFORCE_LOAD_ALL, FORCE_LOAD_DFG, FORCE_LOAD_NONE, FORCE_LOAD_REFRESH, VERSION_DIFFERENT, VERSION_EARLIER, VERSION_LATER, VERSION_SAME| Constructor and Description |
|---|
DistributedJDBCStoreManager(DistributedJDBCConfiguration conf)
Constructs a set of child StoreManagers each connected to a physical
DataSource.
|
| Modifier and Type | Method and Description |
|---|---|
SliceStoreManager |
addSlice(Slice slice)
Adds the given slice with the given properties.
|
boolean |
assignField(OpenJPAStateManager sm,
int field,
boolean preFlush)
Assign a value to the given field.
|
boolean |
assignObjectId(OpenJPAStateManager sm,
boolean preFlush)
Assign an object id to the given new instance.
|
void |
beforeStateChange(OpenJPAStateManager sm,
PCState fromState,
PCState toState)
Notification that the given state manager is about to change its
lifecycle state.
|
void |
beginOptimistic()
Notification that an optimistic transaction has started.
|
boolean |
cancelAll()
Cancel all pending data store statements.
|
int |
compareVersion(OpenJPAStateManager sm,
Object v1,
Object v2)
Compare the two version objects.
|
protected JDBCStoreManager.RefCountConnection |
connectInternal()
Connect to the database.
|
Object |
copyDataStoreId(Object oid,
ClassMetaData meta)
Copy the given object id value.
|
ResultObjectProvider |
executeExtent(ClassMetaData meta,
boolean subclasses,
FetchConfiguration fetch)
Return a provider for all instances of the given candidate class,
optionally including subclasses.
|
boolean |
exists(OpenJPAStateManager sm,
Object edata)
Verify that the given instance exists in the data store; return false
if it does not.
|
protected SliceInfo |
findSliceNames(OpenJPAStateManager sm,
Object edata)
Decides the index of the StoreManager by first looking at the
implementation data.
|
Collection |
flush(Collection sms)
Flush the given StateManagers after binning them to respective physical
slices.
|
Object |
getClientConnection()
Return a connection to the data store suitable for client use.
|
DistributedJDBCConfiguration |
getConfiguration()
Return the configuration for this runtime.
|
Seq |
getDataStoreIdSequence(ClassMetaData forClass)
Return a sequence that generates datastore identity values for the
given class.
|
Class<?> |
getDataStoreIdType(ClassMetaData meta)
Return the class used by this StoreManager for datastore identity
values.
|
Class<?> |
getManagedType(Object oid)
Return the persistent class for the given data store identity value.
|
SliceStoreManager |
getSlice(int i) |
(package private) List<SliceStoreManager> |
getTargets(FetchConfiguration fetch)
Gets the list of slices mentioned as
hint of the given
fetch configuration. |
Seq |
getValueSequence(FieldMetaData forField)
Return a sequence that generates values for the given field.
|
boolean |
initialize(OpenJPAStateManager sm,
PCState state,
FetchConfiguration fetch,
Object edata)
Initialize the given state manager.
|
boolean |
load(OpenJPAStateManager sm,
BitSet fields,
FetchConfiguration fetch,
int lockLevel,
Object edata)
Load the given state manager.
|
Collection |
loadAll(Collection sms,
PCState state,
int load,
FetchConfiguration fetch,
Object edata)
Initialize, load, or validate the existance of all of the given
objects.
|
Object |
newDataStoreId(Object oidVal,
ClassMetaData meta)
Create a new unique datastore identity for the given type from
the given oid value (presumably pk, stringified oid, or oid instance).
|
FetchConfiguration |
newFetchConfiguration()
Return a fetch configuration suitable for this runtime.
|
StoreQuery |
newQuery(String language)
Construct a distributed query to be executed against all the slices.
|
(package private) boolean |
occurs(OpenJPAStateManager sm,
Collection<org.apache.openjpa.slice.jdbc.DistributedJDBCStoreManager.StateManagerSet> reminder) |
void |
setContext(StoreContext ctx)
Sets the context for this receiver and all its underlying slices.
|
boolean |
syncVersion(OpenJPAStateManager sm,
Object edata)
Update the version information in the given state manager to the
version stored in the data store.
|
begin, close, commit, find, getConnection, getContext, getDataSource, getDBDictionary, getFetchConfiguration, getLockManager, getNewConnection, getSQLFactory, getType, getVersion, initializeState, isCached, isEmptyResult, load, loadSubclasses, newDataStoreId, releaseConnection, retainConnection, rollback, rollbackOptimistic, select, setContext, setMappedByclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbegin, close, commit, isCached, releaseConnection, retainConnection, rollback, rollbackOptimisticpublic DistributedJDBCStoreManager(DistributedJDBCConfiguration conf)
public DistributedJDBCConfiguration getConfiguration()
JDBCStoregetConfiguration in interface JDBCStoregetConfiguration in class JDBCStoreManagerpublic SliceStoreManager getSlice(int i)
public SliceStoreManager addSlice(Slice slice)
DistributedStoreManageraddSlice in interface DistributedStoreManagerDistributedBroker#addSlice(String, Map),
DistributedBrokerFactory.addSlice(String, Map)protected SliceInfo findSliceNames(OpenJPAStateManager sm, Object edata)
public boolean assignField(OpenJPAStateManager sm, int field, boolean preFlush)
StoreManagerassignField in interface StoreManagerassignField in class JDBCStoreManagerpreFlush - whether this assignment is being requested by the
system as part of pre-flush activities, and can
be ignored if it is more efficient to assign within StoreManager.flush(java.util.Collection<org.apache.openjpa.kernel.OpenJPAStateManager>)ImplHelper.generateFieldValue(org.apache.openjpa.kernel.StoreContext, org.apache.openjpa.meta.FieldMetaData)public boolean assignObjectId(OpenJPAStateManager sm, boolean preFlush)
StoreManagerassignObjectId in interface StoreManagerassignObjectId in class JDBCStoreManagerpreFlush - whether this assignment is being requested by the
system as part of pre-flush activities, and can
be ignored if it is more efficient to assign within StoreManager.flush(java.util.Collection<org.apache.openjpa.kernel.OpenJPAStateManager>)ImplHelper.generateFieldValue(org.apache.openjpa.kernel.StoreContext, org.apache.openjpa.meta.FieldMetaData),
ImplHelper.generateIdentityValue(org.apache.openjpa.kernel.StoreContext, org.apache.openjpa.meta.ClassMetaData, int),
org.apache.openjpa.util.ApplicationIds#assign()public void beforeStateChange(OpenJPAStateManager sm, PCState fromState, PCState toState)
StoreManagerbeforeStateChange in interface StoreManagerbeforeStateChange in class JDBCStoreManagerpublic void beginOptimistic()
StoreManagerStoreManager.begin() method, which will still be called
when a true data store transaction should begin.beginOptimistic in interface StoreManagerbeginOptimistic in class JDBCStoreManagerpublic boolean cancelAll()
StoreManagercancelAll in interface StoreManagercancelAll in class JDBCStoreManagerpublic int compareVersion(OpenJPAStateManager sm, Object v1, Object v2)
StoreManagercompareVersion in interface StoreManagercompareVersion in class JDBCStoreManagersm - the state manager for the objectv1 - the first version object to comparev2 - the second version object to compareStoreManager.VERSION_LATER if v1
is later than v2StoreManager.VERSION_EARLIER if v1
is earlier than v2StoreManager.VERSION_SAME if v1
is the same as v2StoreManager.VERSION_DIFFERENT if v1
is different from v2, but the time
difference of the versions cannot be determinedpublic Object copyDataStoreId(Object oid, ClassMetaData meta)
StoreManagercopyDataStoreId in interface StoreManagercopyDataStoreId in class JDBCStoreManagerpublic ResultObjectProvider executeExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)
StoreManagerexecuteExtent in interface StoreManagerexecuteExtent in class JDBCStoreManagerpublic boolean exists(OpenJPAStateManager sm, Object edata)
StoreManagerexists in interface StoreManagerexists in class JDBCStoreManagerpublic Collection flush(Collection sms)
flush in interface StoreManagerflush in class JDBCStoreManagerorg.apache.openjpa.util.ApplicationIds#assign()boolean occurs(OpenJPAStateManager sm, Collection<org.apache.openjpa.slice.jdbc.DistributedJDBCStoreManager.StateManagerSet> reminder)
public Object getClientConnection()
StoreManagergetClientConnection in interface StoreManagergetClientConnection in class JDBCStoreManagerpublic Seq getDataStoreIdSequence(ClassMetaData forClass)
StoreManagergetDataStoreIdSequence in interface StoreManagergetDataStoreIdSequence in class JDBCStoreManagerpublic Class<?> getDataStoreIdType(ClassMetaData meta)
StoreManagergetDataStoreIdType in interface StoreManagergetDataStoreIdType in class JDBCStoreManagerpublic Class<?> getManagedType(Object oid)
StoreManagergetManagedType in interface StoreManagergetManagedType in class JDBCStoreManagerpublic Seq getValueSequence(FieldMetaData forField)
StoreManagergetValueSequence in interface StoreManagergetValueSequence in class JDBCStoreManagerpublic boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object edata)
StoreManagerOpenJPAStateManager.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 StoreManagerinitialize in class JDBCStoreManagersm - 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 brokerpublic boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object edata)
StoreManagerOpenJPAStateManager.setVersion(java.lang.Object) method.load in interface StoreManagerload in class JDBCStoreManagersm - 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 brokerpublic Collection loadAll(Collection sms, PCState state, int load, FetchConfiguration fetch, Object edata)
StoreManagerStoreContext.retrieveAll(java.util.Collection<java.lang.Object>, 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 StoreManagerloadAll in class JDBCStoreManagersms - 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 smsload - 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 brokerImplHelper.loadAll(java.util.Collection, org.apache.openjpa.kernel.StoreManager, org.apache.openjpa.kernel.PCState, int, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)public Object newDataStoreId(Object oidVal, ClassMetaData meta)
StoreManagernewDataStoreId in interface StoreManagernewDataStoreId in class JDBCStoreManagerpublic StoreQuery newQuery(String language)
newQuery in interface StoreManagernewQuery in class JDBCStoreManagerlanguage - the query languagepublic FetchConfiguration newFetchConfiguration()
StoreManagerFetchConfigurationImpl.newFetchConfiguration in interface StoreManagernewFetchConfiguration in class JDBCStoreManagerpublic void setContext(StoreContext ctx)
setContext in interface StoreManagersetContext in class JDBCStoreManagerpublic boolean syncVersion(OpenJPAStateManager sm, Object edata)
StoreManagersyncVersion in interface StoreManagersyncVersion in class JDBCStoreManagersm - the instance to checkedata - the current execution data, or null if not
given to the calling method of the contextprotected JDBCStoreManager.RefCountConnection connectInternal() throws SQLException
JDBCStoreManagerconnectInternal in class JDBCStoreManagerSQLExceptionList<SliceStoreManager> getTargets(FetchConfiguration fetch)
hint of the given
fetch configuration.Copyright © 2006–2013 Apache Software Foundation. All rights reserved.