|
EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.internal.sessions.AbstractSession org.eclipse.persistence.internal.sessions.DatabaseSessionImpl org.eclipse.persistence.sessions.broker.SessionBroker
public class SessionBroker
Purpose: Provide a single view to a TopLink session that transparently accesses multple databases.
Responsibilities:
Field Summary | |
---|---|
protected SessionBroker |
parent
|
protected org.eclipse.persistence.internal.sequencing.Sequencing |
sequencing
|
protected java.util.Map |
sessionNamesByClass
|
protected java.util.Map |
sessionsByName
|
Fields inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl |
---|
isLoggedIn |
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractSession |
---|
accessor, activeCommandThreads, broker, commandManager, commitManager, defaultReferenceMode, eventManager, exceptionHandler, externalTransactionController, identityMapAccessor, integrityChecker, isFinalizersEnabled, isInBroker, isInProfile, isLoggingOff, isSynchronized, jpaQueries, lastDescriptorAccessed, logSessionString, name, numberOfActiveUnitsOfWork, pessimisticLockTimeoutDefault, platform, profiler, project, properties, queries, sessionLog, shouldPropagateChanges, transactionMutex, wasJTSTransactionInternallyStarted |
Fields inherited from interface org.eclipse.persistence.sessions.coordination.CommandProcessor |
---|
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING |
Constructor Summary | |
---|---|
|
SessionBroker()
PUBLIC: Create and return a session broker. |
protected |
SessionBroker(java.util.Map sessionNames)
INTERNAL: Create and return a session broker. |
Method Summary | |
---|---|
SessionBroker |
acquireClientSessionBroker()
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. |
org.eclipse.persistence.internal.sessions.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. |
protected void |
basicBeginTransaction()
INTERNAL: Begin the transaction on all child sessions. |
protected void |
basicCommitTransaction()
INTERNAL: Commit the transaction on all child sessions. |
protected void |
basicRollbackTransaction()
INTERNAL: Rollback the transaction on all child sessions. |
boolean |
containsQuery(java.lang.String queryName)
PUBLIC: Return true if the pre-defined query is defined on the session. |
protected SessionBroker |
copySessionBroker()
INTERNAL: Return a copy (not using clone) of a session broker. |
org.eclipse.persistence.internal.databaseaccess.Accessor |
getAccessor(java.lang.Class domainClass)
INTERNAL: Return the lowlevel database accessor. |
org.eclipse.persistence.internal.databaseaccess.Accessor |
getAccessor(java.lang.String sessionName)
INTERNAL: Return the lowlevel database accessor. |
AsOfClause |
getAsOfClause()
ADVANCED: Answers the past time this session is as of. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getExecutionSession(DatabaseQuery query)
INTERNAL: Gets the session which this query will be executed on. |
SessionBroker |
getParent()
INTERNAL: Gets the parent SessionBroker. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getParentIdentityMapSession(DatabaseQuery query,
boolean canReturnSelf,
boolean terminalOnly)
INTERNAL: Gets the next link in the chain of sessions followed by a query's check early return, the chain of sessions with identity maps all the way up to the root session. |
org.eclipse.persistence.internal.databaseaccess.Platform |
getPlatform(java.lang.Class domainClass)
INTERNAL: Return the platform for a particular class. |
DatabaseQuery |
getQuery(java.lang.String name)
PUBLIC: Return the query from the session pre-defined queries with the given name. |
DatabaseQuery |
getQuery(java.lang.String name,
java.util.Vector arguments)
PUBLIC: Return the query from the session pre-defined queries with the given name and argument types. |
org.eclipse.persistence.internal.sequencing.Sequencing |
getSequencing()
PUBLIC: Return the Sequencing object used by the session. |
protected org.eclipse.persistence.internal.sequencing.SequencingHome |
getSequencingHome()
PROTECTED: Session broker doesn't have SequencingHome. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getSessionForClass(java.lang.Class domainClass)
INTERNAL: Return the session to be used for the class. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getSessionForName(java.lang.String name)
INTERNAL: Return the session by name. |
protected org.eclipse.persistence.internal.sessions.AbstractSession |
getSessionForQuery(DatabaseQuery query)
INTERNAL: Answers the session to be used for the given query. |
protected java.util.Map |
getSessionNamesByClass()
INTERNAL: Return sessions indexed by class, each class can only have one default session. |
java.util.Map |
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,
org.eclipse.persistence.internal.sessions.AbstractRecord row)
INTERNAL: Return the results from exeucting the database query. |
void |
internalRegisterSession(java.lang.String name,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Register the session under its name. |
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 |
logout()
PUBLIC: Disconnect from all databases. |
void |
registerSession(java.lang.String name,
org.eclipse.persistence.internal.sessions.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. |
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. |
protected void |
setSessionNameByClass(java.util.HashMap sessionNameByClass)
INTERNAL: Set sessions indexed by class, each class can only have one default session. |
void |
setSessionsByName(java.util.Map sessionsByName)
INTERNAL: Set sessions indexed by name. |
void |
setSynchronized(boolean synched)
INTERNAL: Set isSynchronized flag to indicate that members of session broker are synchronized. |
void |
writesCompleted()
INTERNAL: This method notifies the accessor that a particular sets of writes has completed. |
Methods inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl |
---|
addDescriptors, connect, disconnect, finalize, getConnectedTime, getDatasourcePlatform, getPlatform, getReadLogin, getSequencingControl, getServerPlatform, initializeConnectedTime, initializeDescriptorIfSessionAlive, initializeDescriptors, initializeDescriptors, isDatabaseSession, isLoggedIn, login, loginAndDetectDatasource, postConnectDatasource, preConnectDatasource, setSequencingHome, setServerPlatform, writeAllObjects, writeAllObjects |
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractSession |
---|
acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addQuery, addQuery, basicBeginTransaction, beginExternalTransaction, beginTransaction, checkHierarchyForDescriptor, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, commitTransaction, compareObjects, compareObjectsDontMatch, config, copyDescriptorNamedQueries, copyObject, copyObject, copyReadOnlyClasses, deleteAllObjects, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, endOperationProfile, endOperationProfile, executeCall, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getAccessor, getActiveCommandThreads, getActiveSession, getActiveUnitOfWork, getAliasDescriptors, getAllQueries, getBroker, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getIdentityMapAccessor, getIdentityMapAccessorInstance, getIntegrityChecker, getJPAQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getPessimisticLockTimeoutDefault, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getRootSession, getSessionLog, getSessionTypeString, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, hasProperties, incrementProfile, info, insertObject, isClassReadOnly, isClassReadOnly, isClientSession, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isInTransaction, isIsolatedClientSession, isLoggingOff, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSynchronized, isUnitOfWork, keyFromObject, keyFromObject, log, log, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postConnectExternalConnection, preDisconnectExternalConnection, prepareDatabaseQuery, processCommand, processJPAQueries, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, releaseReadConnection, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, rollbackExternalTransaction, rollbackTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEventManager, setExceptionHandler, setExternalTransactionController, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setLogin, setLogin, setLogLevel, setName, setNumberOfActiveUnitsOfWork, setPessimisticLockTimeoutDefault, setProject, setProperties, setProperty, setQueries, setShouldPropagateChanges, setTransactionMutex, setWasJTSTransactionInternallyStarted, severe, shouldLog, shouldLogMessages, shouldLogMessages, shouldPropagateChanges, startOperationProfile, startOperationProfile, toString, unwrapObject, updateObject, updateProfile, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.persistence.sessions.DatabaseSession |
---|
beginTransaction, commitTransaction, deleteAllObjects, deleteObject, getCommandManager, insertObject, isInTransaction, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setCommandManager, setDatasourceLogin, setExternalTransactionController, setLogin, setShouldPropagateChanges, shouldPropagateChanges, updateObject, writeObject |
Field Detail |
---|
protected SessionBroker parent
protected java.util.Map sessionNamesByClass
protected java.util.Map sessionsByName
protected org.eclipse.persistence.internal.sequencing.Sequencing sequencing
Constructor Detail |
---|
public SessionBroker()
protected SessionBroker(java.util.Map sessionNames)
Method Detail |
---|
public SessionBroker acquireClientSessionBroker()
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
acquireHistoricalSession
in interface Session
acquireHistoricalSession
in class org.eclipse.persistence.internal.sessions.AbstractSession
clause
- 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)
,
HistoryPolicy
public void releaseJTSConnection()
releaseJTSConnection
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
public org.eclipse.persistence.internal.sessions.UnitOfWorkImpl acquireUnitOfWork()
acquireUnitOfWork
in interface Session
acquireUnitOfWork
in class org.eclipse.persistence.internal.sessions.AbstractSession
UnitOfWorkImpl
public void addDescriptor(ClassDescriptor descriptor)
addDescriptor
in interface DatabaseSession
addDescriptor
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
DatabaseSession.addDescriptors(Collection)
,
DatabaseSession.addDescriptors(Project)
public void addDescriptors(java.util.Vector descriptors) throws ValidationException
ValidationException
public void addDescriptors(Project project) throws ValidationException
addDescriptors
in interface DatabaseSession
addDescriptors
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
ValidationException
protected void basicBeginTransaction() throws DatabaseException
basicBeginTransaction
in class org.eclipse.persistence.internal.sessions.AbstractSession
DatabaseException
protected void basicCommitTransaction() throws DatabaseException
basicCommitTransaction
in class org.eclipse.persistence.internal.sessions.AbstractSession
DatabaseException
protected void basicRollbackTransaction() throws DatabaseException
basicRollbackTransaction
in class org.eclipse.persistence.internal.sessions.AbstractSession
DatabaseException
public boolean containsQuery(java.lang.String queryName)
containsQuery
in interface Session
containsQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
protected SessionBroker copySessionBroker()
public org.eclipse.persistence.internal.databaseaccess.Accessor getAccessor(java.lang.Class domainClass)
getAccessor
in class org.eclipse.persistence.internal.sessions.AbstractSession
public org.eclipse.persistence.internal.databaseaccess.Accessor getAccessor(java.lang.String sessionName)
getAccessor
in class org.eclipse.persistence.internal.sessions.AbstractSession
public AsOfClause getAsOfClause()
getAsOfClause
in interface Session
getAsOfClause
in class org.eclipse.persistence.internal.sessions.AbstractSession
null
if no clause set, or this a regular session.org.eclipse.persistence.expressions.AsOfClause
,
#acquireSessionAsOf(java.lang.Number)
,
#acquireSessionAsOf(java.util.Date)
,
#hasAsOfClause
public SessionBroker getParent()
getParent
in class org.eclipse.persistence.internal.sessions.AbstractSession
public org.eclipse.persistence.internal.sessions.AbstractSession getParentIdentityMapSession(DatabaseQuery query, boolean canReturnSelf, boolean terminalOnly)
Used for session broker which delegates to registered sessions, or UnitOfWork which checks parent identity map also.
getParentIdentityMapSession
in class org.eclipse.persistence.internal.sessions.AbstractSession
canReturnSelf
- true when method calls itself. If the path
starting at this
is acceptable. Sometimes true if want to
move to the first valid session, i.e. executing on ClientSession when really
should be on ServerSession.terminalOnly
- return the session we will execute the call on, not
the next step towards it.
public org.eclipse.persistence.internal.sessions.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 org.eclipse.persistence.internal.sessions.AbstractSession
query
- may store session name or reference class for brokers case
public org.eclipse.persistence.internal.databaseaccess.Platform getPlatform(java.lang.Class domainClass)
getPlatform
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
public DatabaseQuery getQuery(java.lang.String name)
getQuery
in interface Session
getQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
public DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments)
getQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
public org.eclipse.persistence.internal.sessions.AbstractSession getSessionForClass(java.lang.Class domainClass) throws ValidationException
getSessionForClass
in class org.eclipse.persistence.internal.sessions.AbstractSession
ValidationException
public org.eclipse.persistence.internal.sessions.AbstractSession getSessionForName(java.lang.String name) throws ValidationException
ValidationException
protected org.eclipse.persistence.internal.sessions.AbstractSession getSessionForQuery(DatabaseQuery query)
protected java.util.Map getSessionNamesByClass()
public java.util.Map getSessionsByName()
public void initializeDescriptors()
initializeDescriptors
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
public void initializeIdentityMapAccessor()
initializeIdentityMapAccessor
in class org.eclipse.persistence.internal.sessions.AbstractSession
public java.lang.Object internalExecuteQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row) throws DatabaseException, QueryException
internalExecuteQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
DatabaseException
QueryException
public boolean isBroker()
isBroker
in class org.eclipse.persistence.internal.sessions.AbstractSession
public boolean isClientSessionBroker()
public boolean isConnected()
isConnected
in interface Session
isConnected
in class org.eclipse.persistence.internal.sessions.AbstractSession
public boolean isServerSessionBroker()
public boolean isSessionBroker()
isSessionBroker
in interface Session
isSessionBroker
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void login() throws DatabaseException
login
in interface DatabaseSession
login
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
DatabaseException
DatabaseSession.login(Login)
public void login(java.lang.String userName, java.lang.String password) throws DatabaseException
login
in interface DatabaseSession
login
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
DatabaseException
public void logout() throws DatabaseException
logout
in interface DatabaseSession
logout
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
EclipseLinkException
- 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 registerSession(java.lang.String name, org.eclipse.persistence.internal.sessions.AbstractSession session)
public void registerSession(java.lang.String name, Session session)
public void internalRegisterSession(java.lang.String name, org.eclipse.persistence.internal.sessions.AbstractSession session)
public void release()
release
in interface Session
release
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void setIntegrityChecker(IntegrityChecker integrityChecker)
setIntegrityChecker
in interface Session
setIntegrityChecker
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void setSessionLog(SessionLog log)
setSessionLog
in interface Session
setSessionLog
in class org.eclipse.persistence.internal.sessions.AbstractSession
#logMessages()
public void setLog(java.io.Writer log)
setLog
in interface Session
setLog
in class org.eclipse.persistence.internal.sessions.AbstractSession
#logMessages()
public void setProfiler(SessionProfiler profiler)
setProfiler
in interface Session
setProfiler
in class org.eclipse.persistence.internal.sessions.AbstractSession
protected void setSessionNameByClass(java.util.HashMap sessionNameByClass)
public void setSessionsByName(java.util.Map sessionsByName)
public void setSynchronized(boolean synched)
setSynchronized
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void writesCompleted()
writesCompleted
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void initializeSequencing()
initializeSequencing
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
protected org.eclipse.persistence.internal.sequencing.SequencingHome getSequencingHome()
getSequencingHome
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
public org.eclipse.persistence.internal.sequencing.Sequencing getSequencing()
getSequencing
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
public int howManySequencingCallbacks()
public boolean isSequencingCallbackRequired()
isSequencingCallbackRequired
in class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
|
EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |