public class SessionBroker extends DatabaseSessionImpl
Purpose: Provide a single view to a TopLink session that transparently accesses multple databases.
Responsibilities:
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING| Constructor and Description |
|---|
SessionBroker()
PUBLIC:
Create and return a session broker.
|
| Modifier and Type | Method and Description |
|---|---|
SessionBroker |
acquireClientSessionBroker()
PUBLIC:
Return a session broker that behaves as a client session broker.
|
SessionBroker |
acquireClientSessionBroker(java.util.Map<java.lang.String,ConnectionPolicy> connectionPolicies,
java.util.Map mapOfProperties)
PUBLIC:
Return a session broker that behaves as a client session broker.
|
Session |
acquireHistoricalSession(AsOfClause clause)
INTERNAL:
Acquires a special historical session for reading objects as of a past time.
|
UnitOfWorkImpl |
acquireUnitOfWork()
PUBLIC:
Return a unit of work for this session broker.
|
void |
addDescriptor(ClassDescriptor descriptor)
PUBLIC:
You cannot add a descriptor to a session broker, you must add it to its session.
|
void |
addDescriptors(Project project)
PUBLIC:
You cannot add a project to a session broker, you must add it to its session.
|
void |
addDescriptors(java.util.Vector descriptors)
PUBLIC:
You cannot add descriptors to a session broker, you must add them to its session.
|
void |
addSequence(Sequence sequence)
PUBLIC:
You cannot add a sequence to a session broker, you must add it to its session.
|
boolean |
containsQuery(java.lang.String queryName)
PUBLIC:
Return true if the pre-defined query is defined on the session.
|
java.util.Collection<Accessor> |
getAccessors(Call call,
AbstractRecord translationRow,
DatabaseQuery query)
INTERNAL:
Return the low-level database accessors.
|
AsOfClause |
getAsOfClause()
ADVANCED:
Answers the past time this session is as of.
|
AbstractSession |
getExecutionSession(DatabaseQuery query)
INTERNAL:
Gets the session which this query will be executed on.
|
SessionBroker |
getParent()
INTERNAL:
Gets the parent SessionBroker.
|
Platform |
getPlatform(java.lang.Class domainClass)
INTERNAL:
Return the platform for a particular class.
|
DatabaseQuery |
getQuery(java.lang.String name,
java.util.Vector arguments,
boolean shouldSearchParent)
PUBLIC:
Return the query from the session pre-defined queries with the given name and argument types.
|
Sequencing |
getSequencing()
PUBLIC:
Return the Sequencing object used by the session.
|
AbstractSession |
getSessionForClass(java.lang.Class domainClass)
INTERNAL:
Return the session to be used for the class.
|
AbstractSession |
getSessionForName(java.lang.String name)
INTERNAL:
Return the session by name.
|
java.util.Map<java.lang.String,AbstractSession> |
getSessionsByName()
INTERNAL:
Return sessions indexed by name.
|
int |
howManySequencingCallbacks()
INTERNAL:
Returns a number of member sessions that require sequencing callback.
|
void |
initializeDescriptors()
INTERNAL:
Allow each descriptor to initialize any dependencies on this session.
|
void |
initializeIdentityMapAccessor()
INTERNAL:
Set up the IdentityMapManager.
|
void |
initializeSequencing()
ADVANCED:
Creates sequencing object for the session broker.
|
java.lang.Object |
internalExecuteQuery(DatabaseQuery query,
AbstractRecord row)
INTERNAL:
Return the results from exeucting the database query.
|
boolean |
isBroker()
INTERNAL:
Returns true if the session is a session Broker.
|
boolean |
isClientSessionBroker()
PUBLIC:
Return if this session is a client session broker.
|
boolean |
isConnected()
PUBLIC:
Return if all sessions are still connected to the database.
|
boolean |
isSequencingCallbackRequired()
INTERNAL:
Indicates whether SequencingCallback is required.
|
boolean |
isServerSessionBroker()
PUBLIC:
Return if this session is a server session broker.
|
boolean |
isSessionBroker()
INTERNAL:
Return if this session is a session broker.
|
void |
login()
PUBLIC:
Connect to the database using the predefined login.
|
void |
login(java.lang.String userName,
java.lang.String password)
PUBLIC:
Connect to the database using the predefined login.
|
void |
loginAndDetectDatasource()
PUBLIC:
Connect to the database using the predefined login.
|
void |
logout()
PUBLIC:
Disconnect from all databases.
|
void |
postLogin()
INTERNAL:
Rise postLogin events for member sessions and the SessionBroker.
|
void |
registerSession(java.lang.String name,
AbstractSession session)
PUBLIC:
Register the session under its name.
|
void |
registerSession(java.lang.String name,
Session session)
PUBLIC:
Register the session under its name.
|
void |
release()
PUBLIC:
Release the session.
|
void |
releaseJTSConnection()
INTERNAL:
Called in the end of beforeCompletion of external transaction sychronization listener.
|
java.lang.Object |
retryQuery(DatabaseQuery query,
AbstractRecord row,
DatabaseException databaseException,
int retryCount,
AbstractSession executionSession)
INTERNAL:
A query execution failed due to an invalid query.
|
void |
setExternalTransactionController(ExternalTransactionController externalTransactionController)
INTERNAL:
Used for JTS integration internally by ServerPlatform.
|
void |
setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC:
set the integrityChecker.
|
void |
setLog(java.io.Writer log)
PUBLIC:
Set the message log.
|
void |
setProfiler(SessionProfiler profiler)
PUBLIC:
Set the profiler for the session.
|
void |
setSessionLog(SessionLog log)
PUBLIC:
Set the session log.
|
void |
setSessionsByName(java.util.Map sessionsByName)
INTERNAL:
Set sessions indexed by name.
|
void |
setShouldUseDescriptorAliases(boolean shouldUseDescriptorAliases)
PUBLIC:
Indicates whether descriptors should use aliasDescriptors map.
|
void |
setSynchronized(boolean synched)
INTERNAL:
Set isSynchronized flag to indicate that members of session broker are synchronized.
|
boolean |
shouldUseDescriptorAliases()
PUBLIC:
Indicates whether descriptors should use aliasDescriptors map.
|
void |
writesCompleted()
INTERNAL:
This method notifies the accessor that a particular sets of writes has
completed.
|
addDescriptors, addDescriptorsToSequencing, connect, disconnect, getConnectedTime, getDatabaseEventListener, getDatasourcePlatform, getPlatform, getSequencingControl, getServerPlatform, getTuner, initializeConnectedTime, initializeDescriptorIfSessionAlive, initializeDescriptors, initializeDescriptors, initializeDescriptors, initializeDescriptors, isDatabaseSession, isLoggedIn, isProtectedSession, login, setDatabaseEventListener, setDatasourceAndInitialize, setServerPlatform, setTuner, writeAllObjects, writeAllObjectsacquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addStaticMetamodelClass, basicExecuteCall, beginExternalTransaction, beginTransaction, checkAndRefreshInvalidObject, cleanUpEntityListenerInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, commitTransaction, compareObjects, compareObjectsDontMatch, config, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, copyObject, copyObject, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createEntityListenerInjectionManager, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, endOperationProfile, endOperationProfile, executeCall, executeDeferredEvents, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getAccessor, getAccessors, getActiveCommandThreads, getActiveSession, getActiveUnitOfWork, getAliasDescriptors, getAllQueries, getAttributeGroups, getBroker, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEntityListenerInjectionManager, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getRefreshMetadataListener, getRootSession, getSerializer, getSessionLog, getSessionTypeString, getStaticMetamodelClass, getTablePerTenantDescriptors, getTablePerTenantQueries, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasEventManager, hasExceptionHandler, hasExternalTransactionController, hasProperties, hasTablePerTenantDescriptors, hasTablePerTenantQueries, incrementProfile, incrementProfile, info, insertObject, isClassReadOnly, isClassReadOnly, isClientSession, isConcurrent, isConsideredInvalid, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isInTransaction, isIsolatedClientSession, isJPAQueriesProcessed, isLoggingOff, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSynchronized, isUnitOfWork, keyFromObject, keyFromObject, load, load, log, log, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, prepareDatabaseQuery, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, releaseConnectionAfterCall, releaseReadConnection, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryTransaction, rollbackTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEntityListenerInjectionManager, setEventManager, setExceptionHandler, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setRefreshMetadataListener, setSerializer, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setTolerateInvalidJPQL, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, toString, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeObjectequals, getClass, hashCode, notify, notifyAll, wait, wait, waitbeginTransaction, commitTransaction, deleteAllObjects, deleteObject, getCommandManager, insertObject, isInTransaction, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setCommandManager, setDatasourceLogin, setLogin, setShouldPropagateChanges, shouldPropagateChanges, updateObject, writeObjectacquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, copy, copy, copyObject, copyObject, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getActiveUnitOfWork, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExternalTransactionController, getId, getIdentityMapAccessor, getIntegrityChecker, getJPAQueries, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getPartitioningPolicy, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getSerializer, getSessionLog, handleException, handleSevere, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, isClientSession, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isUnitOfWork, keyFromObject, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setIsFinalizersEnabled, setLogLevel, setName, setPartitioningPolicy, setProperty, setQueryTimeoutDefault, setSerializer, shouldLog, shouldLogMessages, validateCachepublic SessionBroker()
public SessionBroker acquireClientSessionBroker()
public SessionBroker acquireClientSessionBroker(java.util.Map<java.lang.String,ConnectionPolicy> connectionPolicies, java.util.Map mapOfProperties)
connectionPolicies - maps session name to connectionPolicy to be used for this session;mapOfProperties - maps session name to properties to be used for this session.public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
acquireHistoricalSession in interface SessionacquireHistoricalSession in class AbstractSessionclause - Represents a valid snap shot time.ValidationException - if this
not a ClientSession, plain Session, or SessionBroker.AsOfClause,
Expression.asOf(org.eclipse.persistence.history.AsOfClause),
ObjectLevelReadQuery.setAsOfClause(org.eclipse.persistence.history.AsOfClause),
HistoryPolicypublic void releaseJTSConnection()
releaseJTSConnection in class DatabaseSessionImplpublic UnitOfWorkImpl acquireUnitOfWork()
acquireUnitOfWork in interface SessionacquireUnitOfWork in class AbstractSessionUnitOfWorkImplpublic void addDescriptor(ClassDescriptor descriptor)
addDescriptor in interface DatabaseSessionaddDescriptor in class DatabaseSessionImpl#addDescriptors(Vector),
DatabaseSessionImpl.addDescriptors(org.eclipse.persistence.sessions.Project)public void addDescriptors(java.util.Vector descriptors)
throws ValidationException
ValidationExceptionpublic void addDescriptors(Project project) throws ValidationException
addDescriptors in interface DatabaseSessionaddDescriptors in class DatabaseSessionImplValidationExceptionpublic void addSequence(Sequence sequence)
addSequence in interface DatabaseSessionaddSequence in class DatabaseSessionImpl#addSequences(Collection)public boolean containsQuery(java.lang.String queryName)
containsQuery in interface SessioncontainsQuery in class AbstractSessionpublic java.util.Collection<Accessor> getAccessors(Call call, AbstractRecord translationRow, DatabaseQuery query)
getAccessors in class AbstractSessionpublic AsOfClause getAsOfClause()
getAsOfClause in interface SessiongetAsOfClause in class AbstractSessionnull if no clause set, or this a regular session.AsOfClause,
acquireHistoricalSession(AsOfClause),
Expression.hasAsOfClause()public SessionBroker getParent()
getParent in class AbstractSessionpublic AbstractSession getExecutionSession(DatabaseQuery query)
Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.
Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.
getExecutionSession in class AbstractSessionquery - may store session name or reference class for brokers casepublic Platform getPlatform(java.lang.Class domainClass)
getPlatform in class DatabaseSessionImplpublic DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments, boolean shouldSearchParent)
getQuery in class AbstractSession#getQuery(String, arguments)public AbstractSession getSessionForClass(java.lang.Class domainClass) throws ValidationException
getSessionForClass in class AbstractSessionValidationExceptionpublic AbstractSession getSessionForName(java.lang.String name) throws ValidationException
getSessionForName in class AbstractSessionValidationExceptionpublic java.util.Map<java.lang.String,AbstractSession> getSessionsByName()
public void initializeDescriptors()
initializeDescriptors in class DatabaseSessionImplpublic void initializeIdentityMapAccessor()
initializeIdentityMapAccessor in class AbstractSessionpublic java.lang.Object internalExecuteQuery(DatabaseQuery query, AbstractRecord row) throws DatabaseException, QueryException
internalExecuteQuery in class AbstractSessionDatabaseExceptionQueryExceptionpublic boolean isBroker()
isBroker in class AbstractSessionpublic boolean isClientSessionBroker()
public boolean isConnected()
isConnected in interface SessionisConnected in class AbstractSessionpublic boolean isServerSessionBroker()
public boolean isSessionBroker()
isSessionBroker in interface SessionisSessionBroker in class AbstractSessionpublic void login()
throws DatabaseException
login in interface DatabaseSessionlogin in class DatabaseSessionImplDatabaseExceptionDatabaseSessionImpl.login(Login)public void loginAndDetectDatasource()
throws DatabaseException
loginAndDetectDatasource in class DatabaseSessionImplDatabaseExceptionpublic void login(java.lang.String userName,
java.lang.String password)
throws DatabaseException
login in interface DatabaseSessionlogin in class DatabaseSessionImplDatabaseExceptionpublic void logout()
throws DatabaseException
logout in interface DatabaseSessionlogout in class DatabaseSessionImplEclipseLinkException - if a transaction is active, you must rollback any active transaction before logout.DatabaseException - the database will also raise an error if their is an active transaction,
or a general error occurs.public void postLogin()
postLogin in class DatabaseSessionImplpublic void registerSession(java.lang.String name,
AbstractSession session)
public void registerSession(java.lang.String name,
Session session)
public void release()
release in interface Sessionrelease in class AbstractSessionpublic java.lang.Object retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
retryQuery in class DatabaseSessionImplpublic void setExternalTransactionController(ExternalTransactionController externalTransactionController)
setExternalTransactionController in interface DatabaseSessionsetExternalTransactionController in interface SessionsetExternalTransactionController in class AbstractSessionCustomServerPlatformpublic void setIntegrityChecker(IntegrityChecker integrityChecker)
setIntegrityChecker in interface SessionsetIntegrityChecker in class AbstractSessionpublic void setSessionLog(SessionLog log)
setSessionLog in interface SessionsetSessionLog in class AbstractSessionAbstractSession.logMessage(java.lang.String)public void setLog(java.io.Writer log)
setLog in interface SessionsetLog in class AbstractSessionAbstractSession.logMessage(java.lang.String)public void setProfiler(SessionProfiler profiler)
setProfiler in interface SessionsetProfiler in class AbstractSessionpublic void setSessionsByName(java.util.Map sessionsByName)
public void setSynchronized(boolean synched)
setSynchronized in class AbstractSessionpublic void writesCompleted()
writesCompleted in class AbstractSessionpublic void initializeSequencing()
initializeSequencing in class DatabaseSessionImplpublic Sequencing getSequencing()
getSequencing in class DatabaseSessionImplpublic int howManySequencingCallbacks()
public boolean isSequencingCallbackRequired()
isSequencingCallbackRequired in class DatabaseSessionImplpublic boolean shouldUseDescriptorAliases()
public void setShouldUseDescriptorAliases(boolean shouldUseDescriptorAliases)
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference