oracle.toplink.sessionbroker
Class SessionBroker

java.lang.Object
  |
  +--oracle.toplink.publicinterface.Session
        |
        +--oracle.toplink.publicinterface.DatabaseSession
              |
              +--oracle.toplink.sessionbroker.SessionBroker
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
SessionBrokerPlaceHolder

public class SessionBroker
extends DatabaseSession

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

Responsibilities:

See Also:
Serialized Form

Fields inherited from class oracle.toplink.publicinterface.DatabaseSession
deploymentLogin, projectClassName, projectPath
 
Fields inherited from class oracle.toplink.publicinterface.Session
isInBroker, Logging
 
Constructor Summary
SessionBroker()
          PUBLIC: Create and return a session broker.
 
Method Summary
TypeMethod
 SessionBroker acquireClientSessionBroker()
          PUBLIC: Return a session broker that behaves as a client session broker.
 UnitOfWork acquireUnitOfWork()
          PUBLIC: Return a unit of work for this session broker.
 void addDescriptor(Descriptor 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.
 boolean containsQuery(java.lang.String queryName)
          PUBLIC: Return true if the pre-defined query is defined on the session.
 DatabaseQuery getQuery(java.lang.String name)
          PUBLIC: Return the query from the session pre-defined queries with the given name.
 java.util.Vector getSessionNames()
          Return the list of sessions associated with this SessionBroker
 void initializeAllIdentityMaps()
          PUBLIC:: Reset the entire object cache.
 void initializeIdentityMaps()
          PUBLIC:: Reset the entire local object caches.
 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 isServerSessionBroker()
          PUBLIC: Return if this session is a server 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, Session session)
          PUBLIC: Register the session under its name.
 void registerSession(java.lang.String name, Session session)
          PUBLIC: Register the session under its name.
 void releaseClientSessionBroker()
          PUBLIC: Called on a client Session Broker.
 void setIntegrityChecker(IntegrityChecker integrityChecker)
          PUBLIC: set the integrityChecker.
 void setLog(java.io.Writer log)
          PUBLIC: Set the writer to which an accessor writes logged messages.
 void setProfiler(SessionProfiler profiler)
          PUBLIC: Set the profiler for the session.
 void setSessionNames(java.util.Vector sessionNames)
          Set the list of session names associated with this SessionBroker
 void setShouldLogMessages(boolean shouldLog)
          PUBLIC: Log all messages including executed SQL commands to the default output.
 
Methods inherited from class oracle.toplink.publicinterface.DatabaseSession
None
 
Methods inherited from class oracle.toplink.publicinterface.Session
None
 
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, insertObject, isInTransaction, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setExternalTransactionController, setLogin, updateObject, writeObject
 
Methods inherited from interface oracle.toplink.sessions.Session
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, getDescriptor, getDescriptor, getEventManager, getExceptionHandler, getExternalTransactionController, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getIntegrityChecker, getLog, getLogin, getName, getNextSequenceNumberValue, getProfiler, getProject, getProperties, getProperty, getQueries, getSessionLog, getWriteLockValue, getWriteLockValue, handleException, hasCacheSynchronizationManager, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, initializeIdentityMap, isClientSession, isDistributedSession, isInProfile, isProxySession, isRemoteSession, isServerSession, isUnitOfWork, keyFromObject, log, logDebug, logException, logMessage, logMessages, printIdentityMap, printIdentityMaps, putInIdentityMap, putInIdentityMap, putInIdentityMap, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshObject, release, removeFromIdentityMap, removeFromIdentityMap, removeProperty, removeQuery, setCacheSynchronizationManager, setExceptionHandler, setName, setProperty, setSessionLog, shouldLogMessages, updateWriteLockValue, updateWriteLockValue, usesExternalTransactionController, validateCache
 

Constructor Detail

SessionBroker

public SessionBroker()
PUBLIC: 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()
PUBLIC: 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.

getSessionNames

public java.util.Vector getSessionNames()
Return the list of sessions associated with this SessionBroker
Returns:
java.util.Vector

setSessionNames

public void setSessionNames(java.util.Vector sessionNames)
Set the list of session names associated with this SessionBroker
Parameters:
java.util.Vector -  

acquireUnitOfWork

public UnitOfWork acquireUnitOfWork()
PUBLIC: Return a unit of work for this session broker. Acquire a client session broker if is a server session broker.
Overrides:
acquireUnitOfWork in class Session
See Also:

addDescriptor

public void addDescriptor(Descriptor descriptor)
PUBLIC: You cannot add a descriptor to a session broker, you must add it to its session.
Overrides:
addDescriptor in class DatabaseSession
Following copied from class: oracle.toplink.publicinterface.DatabaseSession
See Also:

addDescriptors

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

addDescriptors

public void addDescriptors(Project project)
                    throws ValidationException
PUBLIC: You cannot add a project to a session broker, you must add it to its session.
Overrides:
addDescriptors in class DatabaseSession

containsQuery

public boolean containsQuery(java.lang.String queryName)
PUBLIC: Return true if the pre-defined query is defined on the session.
Overrides:
containsQuery in class Session

getQuery

public DatabaseQuery getQuery(java.lang.String name)
PUBLIC: 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.
Overrides:
getQuery in class Session

initializeAllIdentityMaps

public void initializeAllIdentityMaps()
PUBLIC:: Reset the entire object cache. This method blows away both this session's and its parents caches, including the server cache or any other cache. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.
Overrides:
initializeAllIdentityMaps in class Session

initializeIdentityMaps

public void initializeIdentityMaps()
PUBLIC:: Reset the entire local object caches. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.
Overrides:
initializeIdentityMaps in class Session

isClientSessionBroker

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

isConnected

public boolean isConnected()
PUBLIC: Return if all sessions are still connected to the database.
Overrides:
isConnected in class Session

isServerSessionBroker

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

login

public void login()
           throws DatabaseException
PUBLIC: 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.
Overrides:
login in class DatabaseSession
Following copied from class: oracle.toplink.publicinterface.DatabaseSession
See Also:

login

public void login(java.lang.String userName,
                  java.lang.String password)
           throws DatabaseException
PUBLIC: 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.
Overrides:
login in class DatabaseSession

logout

public void logout()
            throws DatabaseException
PUBLIC: Disconnect from all databases.
Overrides:
logout in class DatabaseSession
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,
                            Session session)
PUBLIC: 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)
PUBLIC: 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.

releaseClientSessionBroker

public void releaseClientSessionBroker()
PUBLIC: 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)
PUBLIC: set the integrityChecker. IntegrityChecker holds all the Descriptor Exceptions.
Overrides:
setIntegrityChecker in class Session

setLog

public void setLog(java.io.Writer log)
PUBLIC: Set the writer to which an accessor writes logged messages. If not set, this reference defaults to System.out. To enable loging logMessages is used.
Overrides:
setLog in class Session
See Also:
Session.logMessages()

setProfiler

public void setProfiler(SessionProfiler profiler)
PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled.
Overrides:
setProfiler in class Session

setShouldLogMessages

public void setShouldLogMessages(boolean shouldLog)
PUBLIC: Log all messages including executed SQL commands to the default output. Currently, default output is the system out stream. Output can be set to any writer. Dispatch to all sessions.
Overrides:
setShouldLogMessages in class Session
Following copied from class: oracle.toplink.publicinterface.Session
See Also: