public class SessionManager
extends java.lang.Object
Purpose: Global session location.
Description: This allows for a global session local which can be accessed globally from other classes. This is needed for EJB data stores as they must have a globally accessible place to access the session. This can be by EJB session beans, BMP beans and CMP beans as well as Servlets and other three-tier services.
Responsibilities:
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.persistence.internal.sessions.AbstractSession |
defaultSession |
protected static SessionManager |
manager |
protected java.util.concurrent.ConcurrentMap<java.lang.String,Session> |
sessions |
protected static boolean |
shouldPerformDTDValidation |
protected static boolean |
shouldUseSchemaValidation
Allow for usage of schema validation to be configurable.
|
Constructor and Description |
---|
SessionManager()
PUBLIC:
The default constructor to create a new session manager.
|
Modifier and Type | Method and Description |
---|---|
void |
addSession(Session session)
INTERNAL:
Add an named session to the hashtable.
|
void |
addSession(java.lang.String sessionName,
Session session)
ADVANCED:
add an named session to the hashtable.
|
void |
destroy()
PUBLIC:
Destroy current session manager instance.
|
void |
destroyAllSessions()
INTERNAL:
Destroy all sessions held onto by this manager.
|
void |
destroySession(java.lang.String sessionName)
INTERNAL:
Destroy the session defined by sessionName on this manager.
|
static java.util.Collection<SessionManager> |
getAllManagers()
ADVANCED:
Return all session managers.
|
Session |
getDefaultSession()
PUBLIC:
Return the default session.
|
org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs |
getInternalMWConfigObjects(java.lang.String resourceName,
java.lang.ClassLoader objectClassLoader)
INTERNAL:
This method is to be used to load config objects for the Mapping Workbench
only.
|
org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs |
getInternalMWConfigObjects(java.lang.String resourceName,
java.lang.ClassLoader objectClassLoader,
boolean validate)
INTERNAL:
This method is to be used to load config objects for the Mapping Workbench
only.
|
static SessionManager |
getManager()
PUBLIC:
Return the session manager for current context.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName)
PUBLIC:
Return the session by name.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName,
boolean shouldLoginSession)
PUBLIC:
Return the session by name.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName,
boolean shouldLoginSession,
boolean shouldRefreshSession)
PUBLIC:
Return the session by name.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName,
java.lang.ClassLoader objectClassLoader)
PUBLIC:
Return the session by name.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName,
java.lang.Object objectBean)
PUBLIC:
Return the session by name, using the classloader of the Object specified.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName,
java.lang.String filename)
PUBLIC:
Return the session by name, in the file specified.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(java.lang.String sessionName,
java.lang.String filename,
java.lang.ClassLoader classLoader)
PUBLIC:
Return the session by name, in the file specified, using the class loader to find the resource.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(XMLSessionConfigLoader loader)
PUBLIC:
Return the session by name, loading the configuration from the file
specified in the loader, using the loading options provided on the loader.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(XMLSessionConfigLoader loader,
java.lang.String sessionName,
java.lang.ClassLoader objectClassLoader)
PUBLIC:
Return the session by name, loading the configuration from the file
specified in the XMLSessionConfigLoader.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(XMLSessionConfigLoader loader,
java.lang.String sessionName,
java.lang.ClassLoader objectClassLoader,
boolean shouldLoginSession,
boolean shouldRefreshSession)
PUBLIC:
Return the session by name, loading the configuration from the file
specified in the loader.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession(XMLSessionConfigLoader loader,
java.lang.String sessionName,
java.lang.ClassLoader objectClassLoader,
boolean shouldLoginSession,
boolean shouldRefreshSession,
boolean shouldCheckClassLoader)
PUBLIC:
Return the session by name, loading the configuration from the file
specified in the loader.
|
java.util.concurrent.ConcurrentMap<java.lang.String,Session> |
getSessions()
INTERNAL:
Return a hashtable on all sessions.
|
protected static SessionManager |
initializeManager()
INTERNAL:
Initialize the singleton session manager.
|
void |
setDefaultSession(Session defaultSession)
PUBLIC:
Set the default session.
|
static void |
setManager(SessionManager theManager)
INTERNAL:
Set the singleton session manager.
|
void |
setSessions(java.util.concurrent.ConcurrentMap sessions)
INTERNAL:
Set a hashtable of all sessions
|
static void |
setShouldUseSchemaValidation(boolean useSchemaValidation)
PUBLIC:
Set if schema validation will be used when parsing the 10g (10.1.3) sessions XML.
|
static boolean |
shouldUseSchemaValidation()
PUBLIC:
Return if schema validation will be used when parsing the 10g (10.1.3) sessions XML.
|
protected static boolean shouldUseSchemaValidation
protected static volatile SessionManager manager
protected org.eclipse.persistence.internal.sessions.AbstractSession defaultSession
protected java.util.concurrent.ConcurrentMap<java.lang.String,Session> sessions
protected static boolean shouldPerformDTDValidation
public SessionManager()
public static boolean shouldUseSchemaValidation()
true
if schema validation will be used when parsing
the 10g (10.1.3) sessions XML, false
otherwisepublic static void setShouldUseSchemaValidation(boolean useSchemaValidation)
useSchemaValidation
- true
if schema validation should be used when parsing
the 10g (10.1.3) sessions XML, false
otherwisepublic void addSession(Session session)
session
- session to be added to the session managerpublic void addSession(java.lang.String sessionName, Session session)
sessionName
- session namesession
- session to be added to the session managerpublic Session getDefaultSession()
public void destroy()
public void destroySession(java.lang.String sessionName)
sessionName
- name of the session to be destroyedpublic void destroyAllSessions()
public org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs getInternalMWConfigObjects(java.lang.String resourceName, java.lang.ClassLoader objectClassLoader)
resourceName
- resource to loadobjectClassLoader
- ClassLoader used to load the resourcepublic org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs getInternalMWConfigObjects(java.lang.String resourceName, java.lang.ClassLoader objectClassLoader, boolean validate)
resourceName
- resource to loadobjectClassLoader
- ClassLoader used to load the resourcevalidate
- whether to validate the resource passed inpublic static SessionManager getManager()
public static java.util.Collection<SessionManager> getAllManagers()
protected static SessionManager initializeManager()
public org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName)
sessionName
- session namepublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName, boolean shouldLoginSession)
sessionName
- session nameshouldLoginSession
- whether the session should be logged inpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName, boolean shouldLoginSession, boolean shouldRefreshSession)
sessionName
- session nameshouldLoginSession
- whether the session should be logged inshouldRefreshSession
- whether the session should be refreshedpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName, java.lang.Object objectBean)
sessionName
- session nameobjectBean
- object to get the ClassLoader frompublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName, java.lang.String filename)
sessionName
- session namefilename
- file name containing session definitionpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName, java.lang.String filename, java.lang.ClassLoader classLoader)
sessionName
- session namefilename
- file name containing session definitionclassLoader
- ClassLoader used to load the original sessionpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(java.lang.String sessionName, java.lang.ClassLoader objectClassLoader)
sessionName
- session nameobjectClassLoader
- ClassLoader used to load the original sessionpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(XMLSessionConfigLoader loader, java.lang.String sessionName, java.lang.ClassLoader objectClassLoader)
loader
- XMLSessionConfigLoader
containing session configurationsessionName
- session nameobjectClassLoader
- ClassLoader used to load the original sessionpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(XMLSessionConfigLoader loader, java.lang.String sessionName, java.lang.ClassLoader objectClassLoader, boolean shouldLoginSession, boolean shouldRefreshSession)
loader
- XMLSessionConfigLoader
containing session configurationsessionName
- session nameobjectClassLoader
- ClassLoader used to load the original sessionshouldLoginSession
- whether the session should be logged inshouldRefreshSession
- whether the session should be refreshedpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(XMLSessionConfigLoader loader, java.lang.String sessionName, java.lang.ClassLoader objectClassLoader, boolean shouldLoginSession, boolean shouldRefreshSession, boolean shouldCheckClassLoader)
loader
- XMLSessionConfigLoader
containing session configurationsessionName
- session nameobjectClassLoader
- ClassLoader used to load the original sessionshouldLoginSession
- whether the session should be logged inshouldRefreshSession
- whether the session should be refreshedshouldCheckClassLoader
- whether to compare class loaders used to load given sessionpublic org.eclipse.persistence.internal.sessions.AbstractSession getSession(XMLSessionConfigLoader loader)
loader
- XMLSessionConfigLoader
containing session configurationpublic void setSessions(java.util.concurrent.ConcurrentMap sessions)
sessions
- sessions for this session managerpublic java.util.concurrent.ConcurrentMap<java.lang.String,Session> getSessions()
public void setDefaultSession(Session defaultSession)
defaultSession
- default sessionpublic static void setManager(SessionManager theManager)
theManager
- session manager for current context