|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.persistence.internal.sessions.AbstractSession
org.eclipse.persistence.sessions.server.ClientSession
public class ClientSession
Purpose: Acts as a client to the server session.
Description: This session is brokered by the server session for use in three-tiered applications. It is used to store the context of the connection, i.e. the login to be used for this client. This allows each client connected to the server to contain its own user login.
Responsibilities:
This class is an implementation of Session
.
Please refer to that class for a full API. The public interface should be used.
Server
,
Session
,
UnitOfWork
,
Serialized FormField Summary | |
---|---|
protected ConnectionPolicy |
connectionPolicy
|
protected boolean |
isActive
|
protected ServerSession |
parent
|
protected org.eclipse.persistence.internal.sequencing.Sequencing |
sequencing
|
protected java.util.Map<java.lang.String,org.eclipse.persistence.internal.databaseaccess.Accessor> |
writeConnections
|
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractSession |
---|
accessors, activeCommandThreads, attributeGroups, broker, commandManager, commitManager, defaultReferenceMode, deferredEvents, descriptors, eventManager, exceptionHandler, externalTransactionController, identityMapAccessor, integrityChecker, isExecutingEvents, isFinalizersEnabled, isInBroker, isInProfile, isLoggingOff, isSynchronized, jpaQueries, lastDescriptorAccessed, logSessionString, metadatalistener, multitenantContextProperties, name, numberOfActiveUnitsOfWork, objectsLockedForClone, partitioningPolicy, pessimisticLockTimeoutDefault, platform, profiler, project, properties, queries, queryTimeoutDefault, sessionLog, shouldCheckWriteLock, shouldPropagateChanges, staticMetamodelClasses, tablePerTenantDescriptors, transactionMutex, wasJTSTransactionInternallyStarted |
Fields inherited from interface org.eclipse.persistence.sessions.coordination.CommandProcessor |
---|
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING |
Constructor Summary | |
---|---|
protected |
ClientSession(Project project)
|
|
ClientSession(ServerSession parent,
ConnectionPolicy connectionPolicy)
INTERNAL: Create and return a new client session. |
|
ClientSession(ServerSession parent,
ConnectionPolicy connectionPolicy,
java.util.Map properties)
|
Method Summary | |
---|---|
org.eclipse.persistence.internal.databaseaccess.Accessor |
addWriteConnection(java.lang.String poolName,
org.eclipse.persistence.internal.databaseaccess.Accessor writeConnection)
INTERNAL: Add the connection to the client session. |
void |
basicCommitTransaction()
INTERNAL: This is internal to the unit of work and should not be called otherwise. |
void |
basicRollbackTransaction()
INTERNAL: This is internal to the unit of work and should not be called otherwise. |
void |
connect(org.eclipse.persistence.internal.databaseaccess.Accessor accessor)
INTERNAL: Connect the session only (this must be the write connection as the read is shared). |
boolean |
containsQuery(java.lang.String queryName)
INTERNAL: Was PUBLIC: customer will be redirected to Session . |
void |
disconnect(org.eclipse.persistence.internal.databaseaccess.Accessor accessor)
INTERNAL: Disconnect the accessor only (this must be the write connection as the read is shared). |
java.lang.Object |
executeCall(Call call,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
DatabaseQuery query)
INTERNAL: Execute the call on the correct connection accessor. |
org.eclipse.persistence.internal.databaseaccess.Accessor |
getAccessor()
INTERNAL: This should normally not be used, getAccessors() should be used to support partitioning. |
java.util.Collection<org.eclipse.persistence.internal.databaseaccess.Accessor> |
getAccessors()
INTERNAL: Return the write connections if in a transaction. |
CommandManager |
getCommandManager()
INTERNAL: Return the manager that allows this processor to receive or propagate commands from/to TopLink cluster |
ConnectionPolicy |
getConnectionPolicy()
ADVANCED: This method will return the connection policy that was used during the acquisition of this client session. |
java.util.Map<java.lang.Class,ClassDescriptor> |
getDescriptors()
ADVANCED: Return all registered descriptors. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getExecutionSession(DatabaseQuery query)
INTERNAL: Gets the session which this query will be executed on. |
ServerSession |
getParent()
INTERNAL: Return the parent. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getParentIdentityMapSession(ClassDescriptor descriptor,
boolean canReturnSelf,
boolean terminalOnly)
INTERNAL: Returns the appropriate IdentityMap session for this descriptor. |
java.lang.Object |
getProperty(java.lang.String name)
Search for and return the user defined property from this client session, if it not found then search for the property from parent. |
DatabaseQuery |
getQuery(java.lang.String name)
INTERNAL: Was PUBLIC: customer will be redirected to Session . |
DatabaseQuery |
getQuery(java.lang.String name,
java.util.Vector args)
INTERNAL: |
org.eclipse.persistence.internal.sequencing.Sequencing |
getSequencing()
INTERNAL: Return the Sequencing object used by the session. |
ServerPlatform |
getServerPlatform()
INTERNAL: Marked internal as this is not customer API but helper methods for accessing the server platform from within other sessions types (i.e. not DatabaseSession) |
java.lang.String |
getSessionTypeString()
INTERNAL: Returns the type of session, its class. |
org.eclipse.persistence.internal.databaseaccess.Accessor |
getWriteConnection()
INTERNAL: Return the connection to be used for database modification. |
java.util.Map<java.lang.String,org.eclipse.persistence.internal.databaseaccess.Accessor> |
getWriteConnections()
INTERNAL: Return the map of write connections. |
boolean |
hasWriteConnection()
INTERNAL: Return if this session has been connected. |
void |
initializeIdentityMapAccessor()
INTERNAL: Set up the IdentityMapManager. |
void |
initializeSequencing()
INTERNAL: was ADVANCED: Creates sequencing object for the session. |
boolean |
isActive()
INTERNAL: Was PUBLIC: customer will be redirected to Session . |
boolean |
isClientSession()
INTERNAL: Return if this session is a client session. |
boolean |
isConnected()
INTERNAL: Was PUBLIC: customer will be redirected to Session . |
boolean |
isExclusiveConnectionRequired()
INTERNAL: This method is called in case externalConnectionPooling is used. |
void |
release()
INTERNAL: Was PUBLIC: customer will be redirected to Session . |
void |
releaseJTSConnection()
INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener. |
void |
releaseReadConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection)
INTERNAL: Release the cursor query's connection. |
protected void |
releaseWriteConnection()
INTERNAL: This is internal to the unit of work and should not be called otherwise. |
java.lang.Object |
retryQuery(DatabaseQuery query,
org.eclipse.persistence.internal.sessions.AbstractRecord row,
DatabaseException databaseException,
int retryCount,
org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: A query execution failed due to an invalid query. |
DatabaseException |
retryTransaction(org.eclipse.persistence.internal.databaseaccess.Accessor writeConnection,
DatabaseException databaseException,
int retryCount,
org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: A begin transaction failed. |
void |
setConnectionPolicy(ConnectionPolicy connectionPolicy)
INTERNAL: Set the connection policy. |
protected void |
setIsActive(boolean isActive)
INTERNAL: Set if the client session is active (has not been released). |
protected void |
setParent(ServerSession parent)
INTERNAL: Set the parent. |
void |
setWriteConnection(org.eclipse.persistence.internal.databaseaccess.Accessor writeConnection)
INTERNAL: Set the connection to be used for database modification. |
void |
setWriteConnections(java.util.Map<java.lang.String,org.eclipse.persistence.internal.databaseaccess.Accessor> writeConnections)
INTERNAL: Set the connection to be used for database modification. |
boolean |
shouldPropagateChanges()
INTERNAL: Return whether changes should be propagated to TopLink cluster. |
java.lang.String |
toString()
INTERNAL: Print the connection status with the session. |
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractSession |
---|
acquireHistoricalSession, acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addMultitenantContextProperty, addQuery, addQuery, addStaticMetamodelClass, addTablePerTenantDescriptor, basicBeginTransaction, basicBeginTransaction, basicExecuteCall, beginExternalTransaction, beginTransaction, checkAndRefreshInvalidObject, checkHierarchyForDescriptor, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, commitTransaction, compareObjects, compareObjectsDontMatch, config, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, copyObject, copyObject, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, endOperationProfile, endOperationProfile, executeDeferredEvents, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getAccessors, getActiveCommandThreads, getActiveSession, getActiveUnitOfWork, getAliasDescriptors, getAllQueries, getAsOfClause, getAttributeGroups, getBroker, getCacheKeyFromTargetSessionForMerge, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommitManager, getDatasourceLogin, getDatasourcePlatform, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getIntegrityChecker, getJPAQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPlatform, getPlatform, getProfiler, getProject, getProperties, getQueries, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getRefreshMetadataListener, getRootSession, getSessionForClass, getSessionForName, getSessionLog, getStaticMetamodelClass, getTablePerTenantDescriptors, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasEventManager, hasExceptionHandler, hasExternalTransactionController, hasProperties, hasTablePerTenantDescriptors, incrementProfile, incrementProfile, info, insertObject, internalExecuteQuery, isBroker, isClassReadOnly, isClassReadOnly, isConsideredInvalid, isDatabaseSession, isDistributedSession, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isInTransaction, isIsolatedClientSession, isLoggingOff, isProtectedSession, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, isSynchronized, isUnitOfWork, keyFromObject, keyFromObject, load, log, log, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, prepareDatabaseQuery, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, rollbackExternalTransaction, rollbackTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEventManager, setExceptionHandler, setExternalTransactionController, setIntegrityChecker, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setLog, setLogin, setLogin, setLogLevel, setName, setNumberOfActiveUnitsOfWork, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setProfiler, setProject, setProperties, setProperty, setQueries, setQueryTimeoutDefault, setRefreshMetadataListener, setSessionLog, setShouldPropagateChanges, setSynchronized, setTransactionMutex, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, startOperationProfile, startOperationProfile, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject, writesCompleted |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ServerSession parent
protected ConnectionPolicy connectionPolicy
protected java.util.Map<java.lang.String,org.eclipse.persistence.internal.databaseaccess.Accessor> writeConnections
protected boolean isActive
protected org.eclipse.persistence.internal.sequencing.Sequencing sequencing
Constructor Detail |
---|
public ClientSession(ServerSession parent, ConnectionPolicy connectionPolicy)
public ClientSession(ServerSession parent, ConnectionPolicy connectionPolicy, java.util.Map properties)
protected ClientSession(Project project)
Method Detail |
---|
public void releaseJTSConnection()
releaseJTSConnection
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void basicCommitTransaction()
basicCommitTransaction
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void basicRollbackTransaction()
basicRollbackTransaction
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void connect(org.eclipse.persistence.internal.databaseaccess.Accessor accessor) throws DatabaseException
DatabaseException
public boolean containsQuery(java.lang.String queryName)
Session
.
Return true if the pre-defined query is defined on the session.
containsQuery
in interface Session
containsQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void disconnect(org.eclipse.persistence.internal.databaseaccess.Accessor accessor) throws DatabaseException
DatabaseException
public java.lang.Object executeCall(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException
executeCall
in class org.eclipse.persistence.internal.sessions.AbstractSession
DatabaseException
public java.util.Collection<org.eclipse.persistence.internal.databaseaccess.Accessor> getAccessors()
getAccessors
in class org.eclipse.persistence.internal.sessions.AbstractSession
public org.eclipse.persistence.internal.databaseaccess.Accessor getAccessor()
getAccessor
in class org.eclipse.persistence.internal.sessions.AbstractSession
public ConnectionPolicy getConnectionPolicy()
public java.util.Map<java.lang.Class,ClassDescriptor> getDescriptors()
getDescriptors
in interface Session
getDescriptors
in class org.eclipse.persistence.internal.sessions.AbstractSession
public org.eclipse.persistence.internal.sessions.AbstractSession getParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly)
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 last session in the chain where the Enitity is stored.
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface Session
getProperty
in class org.eclipse.persistence.internal.sessions.AbstractSession
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 ServerSession getParent()
getParent
in class org.eclipse.persistence.internal.sessions.AbstractSession
public DatabaseQuery getQuery(java.lang.String name)
Session
.
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.
getQuery
in interface Session
getQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
public DatabaseQuery getQuery(java.lang.String name, java.util.Vector args)
getQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void initializeSequencing()
public org.eclipse.persistence.internal.sequencing.Sequencing getSequencing()
getSequencing
in class org.eclipse.persistence.internal.sessions.AbstractSession
public ServerPlatform getServerPlatform()
getServerPlatform
in interface Session
getServerPlatform
in class org.eclipse.persistence.internal.sessions.AbstractSession
public java.lang.String getSessionTypeString()
Override to hide from the user when they are using an internal subclass of a known class.
A user does not need to know that their UnitOfWork is a non-deferred UnitOfWork, or that their ClientSession is an IsolatedClientSession.
getSessionTypeString
in class org.eclipse.persistence.internal.sessions.AbstractSession
public java.util.Map<java.lang.String,org.eclipse.persistence.internal.databaseaccess.Accessor> getWriteConnections()
public org.eclipse.persistence.internal.databaseaccess.Accessor getWriteConnection()
public boolean hasWriteConnection()
public void initializeIdentityMapAccessor()
initializeIdentityMapAccessor
in class org.eclipse.persistence.internal.sessions.AbstractSession
public boolean isActive()
Session
.
Return if the client session is active (has not been released).
public boolean isClientSession()
isClientSession
in interface Session
isClientSession
in class org.eclipse.persistence.internal.sessions.AbstractSession
public boolean isConnected()
Session
.
Return if this session has been connected to the database.
isConnected
in interface Session
isConnected
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void release() throws DatabaseException
Session
.
Release the client session.
This releases the client session back to it server.
Normally this will logout of the client session's connection,
and allow the client session to garbage collect.
release
in interface Session
release
in class org.eclipse.persistence.internal.sessions.AbstractSession
DatabaseException
public java.lang.Object retryQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row, DatabaseException databaseException, int retryCount, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
retryQuery
in class org.eclipse.persistence.internal.sessions.AbstractSession
protected void releaseWriteConnection()
public void setConnectionPolicy(ConnectionPolicy connectionPolicy)
protected void setIsActive(boolean isActive)
protected void setParent(ServerSession parent)
public org.eclipse.persistence.internal.databaseaccess.Accessor addWriteConnection(java.lang.String poolName, org.eclipse.persistence.internal.databaseaccess.Accessor writeConnection)
public DatabaseException retryTransaction(org.eclipse.persistence.internal.databaseaccess.Accessor writeConnection, DatabaseException databaseException, int retryCount, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
retryTransaction
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void setWriteConnections(java.util.Map<java.lang.String,org.eclipse.persistence.internal.databaseaccess.Accessor> writeConnections)
public void setWriteConnection(org.eclipse.persistence.internal.databaseaccess.Accessor writeConnection)
public java.lang.String toString()
toString
in class org.eclipse.persistence.internal.sessions.AbstractSession
public CommandManager getCommandManager()
getCommandManager
in interface CommandProcessor
getCommandManager
in class org.eclipse.persistence.internal.sessions.AbstractSession
CommandManager
public boolean shouldPropagateChanges()
shouldPropagateChanges
in class org.eclipse.persistence.internal.sessions.AbstractSession
public void releaseReadConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection)
releaseReadConnection
in class org.eclipse.persistence.internal.sessions.AbstractSession
public boolean isExclusiveConnectionRequired()
isExclusiveConnectionRequired
in class org.eclipse.persistence.internal.sessions.AbstractSession
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |