Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.sessionbroker
Class SessionBroker

java.lang.Object
  extended by oracle.toplink.internal.sessions.AbstractSession
      extended by oracle.toplink.internal.sessions.DatabaseSessionImpl
          extended by oracle.toplink.sessionbroker.SessionBroker
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CommandProcessor, DatabaseSession, Session

public class SessionBroker
extends oracle.toplink.internal.sessions.DatabaseSessionImpl

Purpose: Provide a single view to a TopLink session that transparently accesses multple databases.

Responsibilities:

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface oracle.toplink.remotecommand.CommandProcessor
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Constructor Summary
SessionBroker()
          Create and return a session broker.
 
Method Summary
 SessionBroker acquireClientSessionBroker()
          Return a session broker that behaves as a client session broker.
 oracle.toplink.internal.sessions.UnitOfWorkImpl acquireUnitOfWork()
          Return a unit of work for this session broker.
 void addDescriptor(ClassDescriptor descriptor)
          You cannot add a descriptor to a session broker, you must add it to its session.
 void addDescriptors(Project project)
          You cannot add a project to a session broker, you must add it to its session.
 void addDescriptors(java.util.Vector descriptors)
          You cannot add descriptors to a session broker, you must add them to its session.
 boolean containsQuery(java.lang.String queryName)
          Return true if the pre-defined query is defined on the session.
 AsOfClause getAsOfClause()
          ADVANCED: Answers the past time this session is as of.
 DatabaseQuery getQuery(java.lang.String name)
          Return the query from the session pre-defined queries with the given name.
 DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments)
          Return the query from the session pre-defined queries with the given name and argument types.
 oracle.toplink.internal.sequencing.Sequencing getSequencing()
          Return the Sequencing object used by the session.
 void initializeSequencing()
          ADVANCED: Creates sequencing object for the session broker.
 boolean isClientSessionBroker()
          Return if this session is a client session broker.
 boolean isConnected()
          Return if all sessions are still connected to the database.
 boolean isServerSessionBroker()
          Return if this session is a server session broker.
 void login()
          Connect to the database using the predefined login.
 void login(java.lang.String userName, java.lang.String password)
          Connect to the database using the predefined login.
 void logout()
          Disconnect from all databases.
 void registerSession(java.lang.String name, oracle.toplink.internal.sessions.AbstractSession session)
          Register the session under its name.
 void registerSession(java.lang.String name, Session session)
          Register the session under its name.
 void release()
          Release the session.
 void releaseClientSessionBroker()
          Deprecated. Since OracleAS TopLink 10g (10.0.3). Use release().
 void setIntegrityChecker(IntegrityChecker integrityChecker)
          set the integrityChecker.
 void setLog(java.io.Writer log)
          Set the message log.
 void setProfiler(SessionProfiler profiler)
          Set the profiler for the session.
 void setSessionLog(SessionLog log)
          Set the session log.
 void setShouldLogMessages(boolean shouldLog)
          Deprecated.  
 
Methods inherited from class oracle.toplink.internal.sessions.DatabaseSessionImpl
getConnectedTime, getSequencingControl, getServerPlatform, initializeConnectedTime, login, loginAndDetectDatasource, setServerPlatform, writeAllObjects, writeAllObjects
 
Methods inherited from class oracle.toplink.internal.sessions.AbstractSession
addAlias, addQuery, beginTransaction, clearIntegrityChecker, clearProfile, commitTransaction, compareObjectsDontMatch, config, containsObjectInIdentityMap, containsObjectInIdentityMap, copyObject, copyObject, deleteAllObjects, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getActiveSession, getActiveUnitOfWork, getAllFromIdentityMap, getAllFromIdentityMap, getAllFromIdentityMap, getAllQueries, getCacheSynchronizationManager, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getDatasourceLogin, getDescriptor, getDescriptor, getDescriptorForAlias, getEjbqlPlaceHolderQueries, getEventManager, getExceptionHandler, getExternalTransactionController, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getIdentityMapAccessor, getIntegrityChecker, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getProfiler, getProject, getProperties, getProperty, getQueries, getSessionLog, getWriteLockValue, getWriteLockValue, handleException, handleSevere, hasCacheSynchronizationManager, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, info, initializeAllIdentityMaps, initializeIdentityMap, initializeIdentityMaps, insertObject, isClassReadOnly, isClientSession, isDistributedSession, isFinalizersEnabled, isInProfile, isInTransaction, isRemoteSession, isRemoteUnitOfWork, isServerSession, isUnitOfWork, keyFromObject, keyFromObject, log, log, log, log, log, log, log, log, log, log, log, logDebug, logDebug, logException, logMessage, logMessage, logMessages, logThrowable, printIdentityMap, printIdentityMaps, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, removeFromIdentityMap, removeFromIdentityMap, removeProperty, removeQuery, removeQuery, rollbackTransaction, setCacheSynchronizationManager, setCommandManager, setDatasourceLogin, setExceptionHandler, setExternalTransactionController, setIsFinalizersEnabled, setIsInProfile, setLogin, setLogin, setLogLevel, setName, setProperty, setSessionLog, setShouldPropagateChanges, setUseOldCommit, severe, shouldLog, shouldLogMessages, shouldPropagateChanges, toString, updateObject, updateWriteLockValue, updateWriteLockValue, usesExternalTransactionController, usesOldCommit, validateCache, verifyDelete, warning, writeObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.toplink.sessions.DatabaseSession
beginTransaction, commitTransaction, deleteAllObjects, deleteAllObjects, deleteObject, getCommandManager, insertObject, isInTransaction, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setCommandManager, setDatasourceLogin, setExternalTransactionController, setLogin, setShouldPropagateChanges, shouldPropagateChanges, updateObject, writeObject
 
Methods inherited from interface oracle.toplink.sessions.Session
addEjbqlPlaceHolderQuery, addQuery, clearIntegrityChecker, clearProfile, containsObjectInIdentityMap, containsObjectInIdentityMap, copyObject, copyObject, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getActiveUnitOfWork, getAllFromIdentityMap, getAllFromIdentityMap, getCacheSynchronizationManager, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDescriptor, getDescriptor, getDescriptorForAlias, getEjbqlPlaceHolderQueries, getEventManager, getExceptionHandler, getExternalTransactionController, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getIdentityMapAccessor, getIntegrityChecker, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getProfiler, getProject, getProperties, getProperty, getQueries, getSessionLog, getWriteLockValue, getWriteLockValue, handleException, handleSevere, hasCacheSynchronizationManager, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, initializeAllIdentityMaps, initializeIdentityMap, initializeIdentityMaps, isClientSession, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isUnitOfWork, keyFromObject, log, log, logDebug, logDebug, logException, logMessage, logMessage, logMessages, printIdentityMap, printIdentityMaps, putInIdentityMap, putInIdentityMap, putInIdentityMap, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshObject, removeFromIdentityMap, removeFromIdentityMap, removeProperty, removeQuery, setCacheSynchronizationManager, setExceptionHandler, setIsFinalizersEnabled, setLogLevel, setName, setProperty, setSessionLog, shouldLog, shouldLogMessages, updateWriteLockValue, updateWriteLockValue, usesExternalTransactionController, validateCache
 

Constructor Detail

SessionBroker

public SessionBroker()
Create and return a session broker. Because a session broker has multiple sessions it does not used a login.

Method Detail

acquireClientSessionBroker

public SessionBroker acquireClientSessionBroker()
Return a session broker that behaves as a client session broker. An aquire session broker is done under the covers on each session inside the session broker, and a new broker is returned. NOTE: when finished with the client broker, it should be releases. See releaseClientSessionBroker.


acquireUnitOfWork

public oracle.toplink.internal.sessions.UnitOfWorkImpl acquireUnitOfWork()
Return a unit of work for this session broker. Acquire a client session broker if is a server session broker.

Specified by:
acquireUnitOfWork in interface Session
Overrides:
acquireUnitOfWork in class oracle.toplink.internal.sessions.AbstractSession
See Also:
UnitOfWorkImpl

addDescriptor

public void addDescriptor(ClassDescriptor descriptor)
You cannot add a descriptor to a session broker, you must add it to its session.

Specified by:
addDescriptor in interface DatabaseSession
Overrides:
addDescriptor in class oracle.toplink.internal.sessions.DatabaseSessionImpl
See Also:
DatabaseSessionImpl.addDescriptors(Vector), DatabaseSessionImpl.addDescriptors(oracle.toplink.sessions.Project)

addDescriptors

public void addDescriptors(java.util.Vector descriptors)
                    throws ValidationException
You cannot add descriptors to a session broker, you must add them to its session.

Specified by:
addDescriptors in interface DatabaseSession
Overrides:
addDescriptors in class oracle.toplink.internal.sessions.DatabaseSessionImpl
Throws:
ValidationException

addDescriptors

public void addDescriptors(Project project)
                    throws ValidationException
You cannot add a project to a session broker, you must add it to its session.

Specified by:
addDescriptors in interface DatabaseSession
Overrides:
addDescriptors in class oracle.toplink.internal.sessions.DatabaseSessionImpl
Throws:
ValidationException

containsQuery

public boolean containsQuery(java.lang.String queryName)
Return true if the pre-defined query is defined on the session.

Specified by:
containsQuery in interface Session
Overrides:
containsQuery in class oracle.toplink.internal.sessions.AbstractSession

getAsOfClause

public AsOfClause getAsOfClause()
ADVANCED: Answers the past time this session is as of. Only meaningfull for special historical sessions.

Specified by:
getAsOfClause in interface Session
Overrides:
getAsOfClause in class oracle.toplink.internal.sessions.AbstractSession
Returns:
An immutable object representation of the past time. null if no clause set, or this a regular session.
See Also:
oracle.toplink.expressions.AsOfClause, #acquireSessionAsOf(java.lang.Number), #acquireSessionAsOf(java.util.Date), #hasAsOfClause

getQuery

public DatabaseQuery getQuery(java.lang.String name)
Return the query from the session pre-defined queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.

Specified by:
getQuery in interface Session
Overrides:
getQuery in class oracle.toplink.internal.sessions.AbstractSession

getQuery

public DatabaseQuery getQuery(java.lang.String name,
                              java.util.Vector arguments)
Return the query from the session pre-defined queries with the given name and argument types. This allows for common queries to be pre-defined, reused and executed by name. This method should be used if the Session has multiple queries with the same name but different arguments.

Specified by:
getQuery in interface Session
Overrides:
getQuery in class oracle.toplink.internal.sessions.AbstractSession
See Also:
AbstractSession.getQuery(String)

isClientSessionBroker

public boolean isClientSessionBroker()
Return if this session is a client session broker.


isConnected

public boolean isConnected()
Return if all sessions are still connected to the database.

Specified by:
isConnected in interface Session
Overrides:
isConnected in class oracle.toplink.internal.sessions.AbstractSession

isServerSessionBroker

public boolean isServerSessionBroker()
Return if this session is a server session broker.


login

public void login()
           throws DatabaseException
Connect to the database using the predefined login. This connects all of the child sessions and expects that they are in a valid state to be connected.

Specified by:
login in interface DatabaseSession
Overrides:
login in class oracle.toplink.internal.sessions.DatabaseSessionImpl
Throws:
DatabaseException
See Also:
DatabaseSessionImpl.login(Login)

login

public void login(java.lang.String userName,
                  java.lang.String password)
           throws DatabaseException
Connect to the database using the predefined login. This connects all of the child sessions and expects that they are in a valid state to be connected.

Specified by:
login in interface DatabaseSession
Overrides:
login in class oracle.toplink.internal.sessions.DatabaseSessionImpl
Throws:
DatabaseException

logout

public void logout()
            throws DatabaseException
Disconnect from all databases.

Specified by:
logout in interface DatabaseSession
Overrides:
logout in class oracle.toplink.internal.sessions.DatabaseSessionImpl
Throws:
TopLinkException - 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.

registerSession

public void registerSession(java.lang.String name,
                            oracle.toplink.internal.sessions.AbstractSession session)
Register the session under its name. All of the session's descriptors must have already been registered. The session should not be connected and descriptors should not be initialized.


registerSession

public void registerSession(java.lang.String name,
                            Session session)
Register the session under its name. All of the session's descriptors must have already been registered. The session should not be connected and descriptors should not be initialized.


release

public void release()
Release the session. This does nothing by default, but allows for other sessions such as the ClientSession to do something.

Specified by:
release in interface Session
Overrides:
release in class oracle.toplink.internal.sessions.AbstractSession

releaseClientSessionBroker

public void releaseClientSessionBroker()
Deprecated. Since OracleAS TopLink 10g (10.0.3). Use release().

Called on a client Session Broker. Releases all the client sessions held in this broker. Should be used in conjunction with acquireClientSessionBroker()


setIntegrityChecker

public void setIntegrityChecker(IntegrityChecker integrityChecker)
set the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.

Specified by:
setIntegrityChecker in interface Session
Overrides:
setIntegrityChecker in class oracle.toplink.internal.sessions.AbstractSession

setSessionLog

public void setSessionLog(SessionLog log)
Set the session log.

Specified by:
setSessionLog in interface Session
Overrides:
setSessionLog in class oracle.toplink.internal.sessions.AbstractSession
See Also:
AbstractSession.logMessages()

setLog

public void setLog(java.io.Writer log)
Set the message log.

Specified by:
setLog in interface Session
Overrides:
setLog in class oracle.toplink.internal.sessions.AbstractSession
See Also:
AbstractSession.logMessages()

setProfiler

public void setProfiler(SessionProfiler profiler)
Set the profiler for the session. This allows for performance operations to be profiled.

Specified by:
setProfiler in interface Session
Overrides:
setProfiler in class oracle.toplink.internal.sessions.AbstractSession

setShouldLogMessages

public void setShouldLogMessages(boolean shouldLog)
Deprecated. 

Obsolete: Replaced by setLogLevel(int level, String category)

Specified by:
setShouldLogMessages in interface Session
Overrides:
setShouldLogMessages in class oracle.toplink.internal.sessions.AbstractSession
See Also:
#setLogLevel(int level, String category)

initializeSequencing

public void initializeSequencing()
ADVANCED: Creates sequencing object for the session broker. Typically there is no need for the user to call this method - it is called by login() and acquireClientSessionBroker.

Overrides:
initializeSequencing in class oracle.toplink.internal.sessions.DatabaseSessionImpl

getSequencing

public oracle.toplink.internal.sequencing.Sequencing getSequencing()
Return the Sequencing object used by the session.

Overrides:
getSequencing in class oracle.toplink.internal.sessions.DatabaseSessionImpl

Copyright © 1998, 2010, Oracle. All Rights Reserved.