Purpose: Provide a single view to a TopLink session that transparently accesses multple databases.
Responsibilities:
| Modifier and Type | Field and Description |
|---|---|
| protected SessionBroker | |
| protected Sequencing | |
| protected Map | |
| protected Map | |
| protected boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| parent | back to summary |
|---|---|
| protected SessionBroker parent | |
| sequencing | back to summary |
|---|---|
| protected Sequencing sequencing | |
| sessionNamesByClass | back to summary |
|---|---|
| protected Map<Class<?>, String> sessionNamesByClass | |
| sessionsByName | back to summary |
|---|---|
| protected Map<String, AbstractSession> sessionsByName | |
| shouldUseDescriptorAliases | back to summary |
|---|---|
| protected boolean shouldUseDescriptorAliases | |
| SessionBroker | back to summary |
|---|---|
| public SessionBroker() PUBLIC: Create and return a session broker. Because a session broker has multiple sessions it does not used a login. | |
| SessionBroker | back to summary |
|---|---|
| protected SessionBroker(Map<K, V> sessionNames) INTERNAL: Create and return a session broker. Used internally to set the Names by Class from the parent. Reduces garbage. | |
| acquireClientSessionBroker | back to summary |
|---|---|
| public SessionBroker acquireClientSessionBroker() PUBLIC: Return a session broker that behaves as a client session broker. An acquire 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 released. | |
| acquireClientSessionBroker | back to summary |
|---|---|
| public SessionBroker acquireClientSessionBroker(Map<String, ConnectionPolicy> connectionPolicies, Map<K, V> mapOfProperties) PUBLIC: Return a session broker that behaves as a client session broker. An acquire 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 released.
| |
| acquireHistoricalSession | back to summary |
|---|---|
| public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException Overrides org. Implements org. INTERNAL: Acquires a special historical session for reading objects as of a past time.
| |
| acquireUnitOfWork | back to summary |
|---|---|
| public UnitOfWorkImpl acquireUnitOfWork() Overrides org. Implements org. PUBLIC: Return a unit of work for this session broker. Acquire a client session broker if is a server session broker.
| |
| addDescriptor | back to summary |
|---|---|
| public void addDescriptor(ClassDescriptor descriptor) Overrides org. Implements org. PUBLIC: You cannot add a descriptor to a session broker, you must add it to its session.
| |
| addDescriptors | back to summary |
|---|---|
| public void addDescriptors(Vector<E> descriptors) throws ValidationException PUBLIC: You cannot add descriptors to a session broker, you must add them to its session. | |
| addDescriptors | back to summary |
|---|---|
| public void addDescriptors(Project project) throws ValidationException Overrides org. Implements org. PUBLIC: You cannot add a project to a session broker, you must add it to its session.
| |
| addSequence | back to summary |
|---|---|
| public void addSequence(Sequence sequence) Overrides org. Implements org. PUBLIC: You cannot add a sequence to a session broker, you must add it to its session.
| |
| basicBeginTransaction | back to summary |
|---|---|
| protected void basicBeginTransaction() throws DatabaseException Overrides org. INTERNAL: Begin the transaction on all child sessions.
| |
| basicCommitTransaction | back to summary |
|---|---|
| protected void basicCommitTransaction() throws DatabaseException Overrides org. INTERNAL: Commit the transaction on all child sessions. This assumes that the commit of the transaction will not fail because all of the modification has already taken place and no errors would have occurred.
| |
| basicRollbackTransaction | back to summary |
|---|---|
| protected void basicRollbackTransaction() throws DatabaseException Overrides org. INTERNAL: Rollback the transaction on all child sessions.
| |
| containsQuery | back to summary |
|---|---|
| public boolean containsQuery(String queryName) Overrides org. Implements org. PUBLIC: Return true if the pre-defined query is defined on the session.
| |
| copySessionBroker | back to summary |
|---|---|
| protected SessionBroker copySessionBroker() INTERNAL: Return a copy (not using clone) of a session broker. | |
| getAccessors | back to summary |
|---|---|
| public Collection Overrides org. INTERNAL: Return the low-level database accessors. The database accessor is used for direct database access. The right accessor for this broker will be returned.
| |
| getAsOfClause | back to summary |
|---|---|
| public AsOfClause getAsOfClause() Overrides org. Implements org. ADVANCED: Answers the past time this session is as of. Only meaningful for special historical sessions.
| |
| getExecutionSession | back to summary |
|---|---|
| public AbstractSession getExecutionSession(DatabaseQuery query) Overrides org. INTERNAL: Gets the session which this query will be executed on. Generally will be called immediately before the call is translated, which is immediately before session.executeCall. 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.
| |
| getParent | back to summary |
|---|---|
| public SessionBroker getParent() Overrides org. INTERNAL: Gets the parent SessionBroker.
| |
| getPlatform | back to summary |
|---|---|
| public Platform getPlatform(Class<?> domainClass) Overrides org. INTERNAL: Return the platform for a particular class.
| |
| getQuery | back to summary |
|---|---|
| public DatabaseQuery getQuery(String name, Vector<E> arguments, boolean shouldSearchParent) Overrides org. PUBLIC: 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. The search order is: for ClientSessionBroker: the broker; it's member ClientSessions (but not their parent ServerSessions); the parent SessionBroker. for ServerSession or DatabaseSession SessionBroker: the broker; it's member ServerSessions (or DatabaseSessions).
| |
| getSequencing | back to summary |
|---|---|
| public Sequencing getSequencing() Overrides org. PUBLIC: Return the Sequencing object used by the session.
| |
| getSequencingHome | back to summary |
|---|---|
| protected SequencingHome getSequencingHome() Overrides org. PROTECTED: Session broker doesn't have SequencingHome.
| |
| getSessionForClass | back to summary |
|---|---|
| public AbstractSession getSessionForClass(Class<?> domainClass) throws ValidationException Overrides org. INTERNAL: Return the session to be used for the class.
| |
| getSessionForName | back to summary |
|---|---|
| public AbstractSession getSessionForName(String name) throws ValidationException Overrides org. INTERNAL: Return the session by name.
| |
| getSessionForQuery | back to summary |
|---|---|
| protected AbstractSession getSessionForQuery(DatabaseQuery query) INTERNAL: Answers the session to be used for the given query. | |
| getSessionNamesByClass | back to summary |
|---|---|
| protected Map INTERNAL: Return sessions indexed by class, each class can only have one default session. | |
| getSessionsByName | back to summary |
|---|---|
| public Map INTERNAL: Return sessions indexed by name. | |
| howManySequencingCallbacks | back to summary |
|---|---|
| public int howManySequencingCallbacks() INTERNAL: Returns a number of member sessions that require sequencing callback. Always returns 0 if sequencing is not connected. | |
| initializeDescriptors | back to summary |
|---|---|
| public void initializeDescriptors() Overrides org. INTERNAL: Allow each descriptor to initialize any dependencies on this session. This is done in two passes to allow the inheritance to be resolved first. Normally the descriptors are added before login, then initialized on login. Should not be called on client SessoionBroker
| |
| initializeIdentityMapAccessor | back to summary |
|---|---|
| public void initializeIdentityMapAccessor() Overrides org. INTERNAL: Set up the IdentityMapManager. This method allows subclasses of Session to override the default IdentityMapManager functionality.
| |
| initializeSequencing | back to summary |
|---|---|
| public void initializeSequencing() Overrides org. 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.
| |
| internalExecuteQuery | back to summary |
|---|---|
| public Object internalExecuteQuery(DatabaseQuery query, AbstractRecord row) throws DatabaseException, QueryException Overrides org. INTERNAL: Return the results from exeucting the database query. the arguments should be a database row with raw data values. Find the correct child session to broker the query to, and return the result of the session executing the query.
| |
| isBroker | back to summary |
|---|---|
| public boolean isBroker() Overrides org. INTERNAL: Returns true if the session is a session Broker.
| |
| isClientSessionBroker | back to summary |
|---|---|
| public boolean isClientSessionBroker() PUBLIC: Return if this session is a client session broker. | |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() Overrides org. Implements org. PUBLIC: Return if all sessions are still connected to the database.
| |
| isSequencingCallbackRequired | back to summary |
|---|---|
| public boolean isSequencingCallbackRequired() Overrides org. INTERNAL: Indicates whether SequencingCallback is required. Always returns false if sequencing is not connected.
| |
| isServerSessionBroker | back to summary |
|---|---|
| public boolean isServerSessionBroker() PUBLIC: Return if this session is a server session broker. | |
| isSessionBroker | back to summary |
|---|---|
| public boolean isSessionBroker() Overrides org. Implements org. INTERNAL: Return if this session is a session broker.
| |
| login | back to summary |
|---|---|
| public void login() throws DatabaseException Overrides org. Implements org. 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.
| |
| login | back to summary |
|---|---|
| public void login(String userName, String password) throws DatabaseException Overrides org. Implements org. 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.
| |
| loginAndDetectDatasource | back to summary |
|---|---|
| public void loginAndDetectDatasource() throws DatabaseException Overrides org. PUBLIC: Connect to the database using the predefined login. During connection, attempt to auto detect the required database platform. This method can be used in systems where for ease of use developers have EclipseLink autodetect the platform. To be safe, however, the platform should be configured directly. The login must have been assigned when or after creating the session.
| |
| logout | back to summary |
|---|---|
| public void logout() throws DatabaseException Overrides org. Implements org. PUBLIC: Disconnect from all databases.
| |
| postLogin | back to summary |
|---|---|
| public void postLogin() Overrides org. INTERNAL: Rise postLogin events for member sessions and the SessionBroker.
| |
| registerSession | back to summary |
|---|---|
| public void registerSession(String name, AbstractSession session) PUBLIC: Register the session under its name. All of the session's descriptors must have already been registered. DatabaseSession/ServerSession should not be connected and descriptors should not be initialized. | |
| registerSession | back to summary |
|---|---|
| public void registerSession(String name, Session session) PUBLIC: Register the session under its name. All of the session's descriptors must have already been registered. DatabaseSession/ServerSession should not be connected and descriptors should not be initialized. | |
| release | back to summary |
|---|---|
| public void release() Overrides org. Implements org. PUBLIC: Release the session. This does nothing by default, but allows for other sessions such as the ClientSession to do something.
| |
| releaseJTSConnection | back to summary |
|---|---|
| public void releaseJTSConnection() Overrides org. INTERNAL: Called in the end of beforeCompletion of external transaction sychronization listener. Close the managed sql connection corresponding to the external transaction, if applicable releases accessor.
| |
| retryQuery | back to summary |
|---|---|
| public Object retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession) Overrides org. INTERNAL: A query execution failed due to an invalid query. Re-connect and retry the query.
| |
| setExternalTransactionController | back to summary |
|---|---|
| public void setExternalTransactionController(ExternalTransactionController externalTransactionController) Overrides org. Implements org. INTERNAL: Used for JTS integration internally by ServerPlatform.
| |
| setIntegrityChecker | back to summary |
|---|---|
| public void setIntegrityChecker(IntegrityChecker integrityChecker) Overrides org. Implements org. PUBLIC: set the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.
| |
| setLog | back to summary |
|---|---|
| public void setLog(Writer log) Overrides org. Implements org. PUBLIC: Set the message log.
| |
| setProfiler | back to summary |
|---|---|
| public void setProfiler(SessionProfiler profiler) Overrides org. Implements org. PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled.
| |
| setSessionLog | back to summary |
|---|---|
| public void setSessionLog(SessionLog log) Overrides org. Implements org. PUBLIC: Set the session log.
| |
| setSessionNameByClass | back to summary |
|---|---|
| protected void setSessionNameByClass(HashMap<K, V> sessionNameByClass) INTERNAL: Set sessions indexed by class, each class can only have one default session. | |
| setSessionsByName | back to summary |
|---|---|
| public void setSessionsByName(Map<K, V> sessionsByName) INTERNAL: Set sessions indexed by name. | |
| setShouldUseDescriptorAliases | back to summary |
|---|---|
| public void setShouldUseDescriptorAliases(boolean shouldUseDescriptorAliases) PUBLIC: Indicates whether descriptors should use aliasDescriptors map. If aliasDescriptors is used then descriptors' aliases should be unique. | |
| setSynchronized | back to summary |
|---|---|
| public void setSynchronized(boolean synched) Overrides org. INTERNAL: Set isSynchronized flag to indicate that members of session broker are synchronized. This method should only be called by setSynchronized method of UnitOfWork obtained from either DatabaseSession Broker or ClientSession Broker.
| |
| shouldUseDescriptorAliases | back to summary |
|---|---|
| public boolean shouldUseDescriptorAliases() PUBLIC: Indicates whether descriptors should use aliasDescriptors map. If aliasDescriptors is used then descriptors' aliases should be unique. | |
| writesCompleted | back to summary |
|---|---|
| public void writesCompleted() Overrides org. INTERNAL: This method notifies the accessor that a particular sets of writes has completed. This notification can be used for such thing as flushing the batch mechanism
| |