|
EclipseLink 1.0_1.0M2 API Reference - Incubation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDatabaseSessionImpl
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 Sequencing |
sequencing
|
protected java.util.Map |
sessionNamesByClass
|
protected java.util.Map |
sessionsByName
|
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. |
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 |
afterTransaction(boolean committed,
boolean isExternalTransaction)
INTERNAL: Called after transaction is completed (committed or rolled back) |
protected void |
basicBeginTransaction()
INTERNAL: Begin the transaction on all child sessions. |
protected void |
basicCommitTransaction(AbstractSession callingSession)
INTERNAL: Allow calling session to be passed. |
protected void |
basicRollbackTransaction(AbstractSession callingSession)
INTERNAL: Allow calling session to be passed. |
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. |
Accessor |
getAccessor(java.lang.Class domainClass)
INTERNAL: Return the lowlevel database accessor. |
Accessor |
getAccessor(java.lang.String sessionName)
INTERNAL: Return the lowlevel database accessor. |
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. |
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. |
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. |
Sequencing |
getSequencing()
PUBLIC: Return the Sequencing object used by the session. |
protected SequencingHome |
getSequencingHome()
PROTECTED: Session broker doesn't have SequencingHome. |
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. |
protected 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. |
void |
initializeDescriptors()
INTERNAL: Allow each descriptor to initialize any dependancies 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. |
void |
internalRegisterSession(java.lang.String name,
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 |
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,
AbstractSession session)
PUBLIC: Register the session under its name. |
void |
release()
PUBLIC: Release the session. |
void |
releaseClientSessionBroker()
Deprecated. Since OracleAS TopLink 10g (10.0.3). Use release(). |
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 |
writesCompleted()
INTERNAL: This method notifies the accessor that a particular sets of writes has completed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map sessionNamesByClass
protected java.util.Map sessionsByName
protected Sequencing sequencing
Constructor Detail |
---|
public SessionBroker()
protected SessionBroker(java.util.Map sessionNames)
Method Detail |
---|
public SessionBroker acquireClientSessionBroker()
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
ValidationException
public void afterTransaction(boolean committed, boolean isExternalTransaction)
public UnitOfWorkImpl acquireUnitOfWork()
UnitOfWorkImpl
public void addDescriptor(ClassDescriptor descriptor)
public void addDescriptors(java.util.Vector descriptors) throws ValidationException
ValidationException
public void addDescriptors(Project project) throws ValidationException
ValidationException
protected void basicBeginTransaction() throws DatabaseException
DatabaseException
protected void basicCommitTransaction(AbstractSession callingSession) throws DatabaseException
DatabaseException
protected void basicRollbackTransaction(AbstractSession callingSession) throws DatabaseException
DatabaseException
public boolean containsQuery(java.lang.String queryName)
protected SessionBroker copySessionBroker()
public Accessor getAccessor(java.lang.Class domainClass)
public Accessor getAccessor(java.lang.String sessionName)
public AsOfClause getAsOfClause()
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 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.
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 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.
query
- may store session name or reference class for brokers case
public Platform getPlatform(java.lang.Class domainClass)
public DatabaseQuery getQuery(java.lang.String name)
public DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments)
public AbstractSession getSessionForClass(java.lang.Class domainClass) throws ValidationException
ValidationException
public AbstractSession getSessionForName(java.lang.String name) throws ValidationException
ValidationException
protected AbstractSession getSessionForQuery(DatabaseQuery query)
protected java.util.Map getSessionNamesByClass()
public java.util.Map getSessionsByName()
public void initializeDescriptors()
public void initializeIdentityMapAccessor()
public java.lang.Object internalExecuteQuery(DatabaseQuery query, AbstractRecord row) throws DatabaseException, QueryException
DatabaseException
QueryException
public boolean isBroker()
public boolean isClientSessionBroker()
public boolean isConnected()
public boolean isServerSessionBroker()
public boolean isSessionBroker()
public void login() throws DatabaseException
DatabaseException
public void login(java.lang.String userName, java.lang.String password) throws DatabaseException
DatabaseException
public void logout() throws DatabaseException
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, AbstractSession session)
public void internalRegisterSession(java.lang.String name, AbstractSession session)
public void release()
public void releaseClientSessionBroker()
public void setIntegrityChecker(IntegrityChecker integrityChecker)
public void setSessionLog(SessionLog log)
#logMessages()
public void setLog(java.io.Writer log)
#logMessages()
public void setProfiler(SessionProfiler profiler)
protected void setSessionNameByClass(java.util.HashMap sessionNameByClass)
public void setSessionsByName(java.util.Map sessionsByName)
public void writesCompleted()
public void initializeSequencing()
protected SequencingHome getSequencingHome()
public Sequencing getSequencing()
|
EclipseLink 1.0_1.0M2 API Reference - Incubation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |