Methods Summary |
---|
public void | addSession(oracle.toplink.essentials.sessions.Session session)INTERNAL:
add an named session to the hashtable.
session must have a name prior to setting into session Manager
getSessions().put(session.getName(), session);
|
public void | addSession(java.lang.String sessionName, oracle.toplink.essentials.sessions.Session session)ADVANCED:
add an named session to the hashtable.
session.setName(sessionName);
getSessions().put(sessionName, session);
|
private void | destroy(oracle.toplink.essentials.sessions.DatabaseSession session)
if (session.isConnected()) {
session.logout();
}
sessions.remove(session.getName());
session = null;
|
public void | destroyAllSessions()INTERNAL:
Destroy all sessions held onto by this manager.
Enumeration toRemoveSessions = getSessions().elements();
while (toRemoveSessions.hasMoreElements()) {
destroy((DatabaseSession)toRemoveSessions.nextElement());
}
|
public void | destroySession(java.lang.String sessionName)INTERNAL:
Destroy the session defined by sessionName on this manager.
DatabaseSession session = (DatabaseSession)getSessions().get(sessionName);
if (session != null) {
destroy(session);
} else {
logAndThrowException(SessionLog.WARNING, ValidationException.noSessionRegisteredForName(sessionName));
}
|
public oracle.toplink.essentials.sessions.Session | getDefaultSession()PUBLIC:
Return the default session.
if (defaultSession == null) {
defaultSession = getSession("default");
}
return defaultSession;
|
public static synchronized oracle.toplink.essentials.tools.sessionmanagement.SessionManager | getManager()PUBLIC:
Return the singleton session manager.
This allow global access to a set of named sessions.
if (manager == null) {
manager = new SessionManager();
}
return manager;
|
private java.lang.ClassLoader | getMyClassLoader()
ClassLoader classLoader = null;
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try{
return (ClassLoader)AccessController.doPrivileged(new PrivilegedGetClassLoaderForClass(this.getClass()));
} catch (PrivilegedActionException exc){
return null;
}
} else {
return PrivilegedAccessHelper.getClassLoaderForClass(this.getClass());
}
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSession(java.lang.String sessionName)PUBLIC:
Return the session by name.
Use the classLoader that loaded the SessionManager.
return getSession(sessionName, getMyClassLoader(), true, false, false);
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSession(java.lang.String sessionName, boolean shouldLoginSession)PUBLIC:
Return the session by name.
Use the classLoader that loaded the SessionManager.
Log the session in only if the user specifies to.
return getSession(sessionName, getMyClassLoader(), shouldLoginSession, false, false);
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSession(java.lang.String sessionName, boolean shouldLoginSession, boolean shouldRefreshSession)PUBLIC:
Return the session by name.
Use the classLoader that loaded the SessionManager.
Log the session in only if the user specifies to.
Refresh the session only if the user specifies to.
return getSession(sessionName, getMyClassLoader(), shouldLoginSession, shouldRefreshSession, false);
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSession(java.lang.String sessionName, java.lang.ClassLoader objectClassLoader)PUBLIC:
Return the session by name.
Provide the class loader for loading the project, the configuration file
and the deployed classes.
E.g. SessionManager.getManager().getSession("mySession", MySessionBean.getClassLoader());
This method will cause the class loader to be compared with the classloader
used to load the original session of this name, with this classloader. If
they are not the same then the session will be refreshed.
return getSession(sessionName, objectClassLoader, true, false, false);
|
public synchronized oracle.toplink.essentials.internal.sessions.AbstractSession | getSession(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 xmlLoader. Provide the class loader for loading the
project, the configuration file and the deployed classes. Pass in true for
shouldLoginSession if the session returned should be logged in before
returned otherwise false. Pass in true for shouldRefreshSession if the
XMLSessionConfigLoader should reparse the configuration file for new
sessions. False, will cause the XMLSessionConfigLoader not to parse the
file again.
This method will cause the class loader to be compared with the classloader
used to load the original session of this name, with this classloader. If
they are not the same then the session will be refreshed.
AbstractSession session = (AbstractSession)getSessions().get(sessionName);
if (shouldCheckClassLoader && (session != null) && !session.getDatasourcePlatform().getConversionManager().getLoader().equals(objectClassLoader)) {
//bug 3766808 if a different classloader is being used then a reload of the session should
//be completed otherwise failures may occur
shouldRefreshSession = true;
}
if ((session == null) || shouldRefreshSession) {
if (session != null) {
if (session.isDatabaseSession() && session.isConnected()) {
((DatabaseSession)session).logout();
}
getSessions().remove(sessionName);
}
}
if (session == null) {
logAndThrowException(SessionLog.WARNING, ValidationException.noSessionFound(sessionName, ""));
} else if (shouldLoginSession && !session.isConnected()) {
((DatabaseSession)session).login();
}
return session;
|
public java.util.Hashtable | getSessions()INTERNAL:
Return a hashtable on all sessions.
return sessions;
|
private void | logAndThrowException(int level, java.lang.RuntimeException exception)INTERNAL:
Log exceptions to the default log then throw them.
AbstractSessionLog.getLog().logThrowable(level, exception);
throw exception;
|
public void | setDefaultSession(oracle.toplink.essentials.sessions.Session defaultSession)PUBLIC:
Set the default session.
Other sessions are supported through the getSession by name API.
this.defaultSession = (AbstractSession)defaultSession;
addSession("default", defaultSession);
|
public static void | setManager(oracle.toplink.essentials.tools.sessionmanagement.SessionManager theManager)INTERNAL:
Set the singleton session manager.
This allows global access to a set of named sessions.
manager = theManager;
|
public void | setSessions(java.util.Hashtable sessions)INTERNAL:
Set a hashtable of all sessions
this.sessions = sessions;
|