edu.ucsb.nceas.metacat.service
Class SessionService

java.lang.Object
  extended by edu.ucsb.nceas.metacat.shared.BaseService
      extended by edu.ucsb.nceas.metacat.service.SessionService

public class SessionService
extends BaseService


Field Summary
 
Fields inherited from class edu.ucsb.nceas.metacat.shared.BaseService
_serviceName
 
Method Summary
 void doRefresh()
           
static SessionService getInstance()
          Get the single instance of SessionService.
static SessionData getPublicSession()
          Get the public session from the session hash table.
static SessionData getRegisteredSession(java.lang.String sessionId)
          Get a registered session from the session hash table.
static boolean isSessionRegistered(java.lang.String sessionId)
          Check if a session is registered in the session hash table.
 boolean refreshable()
           
static void registerSession(SessionData sessionData)
          Register a session in the session hash table.
static void registerSession(java.lang.String sessionId, java.lang.String userName, java.lang.String[] groupNames, java.lang.String password, java.lang.String name)
          Register a session in the session hash table.
 void stop()
           
static void touchSession(java.lang.String sessionId)
          Keep a session active by updating its last accessed time.
static void unRegisterAllSessions()
          Unregister all sessions from the session hash table except the public session.
static void unRegisterSession(java.lang.String sessionId)
          Unregister a session from the session hash table.
static void validateSession(java.io.PrintWriter out, javax.servlet.http.HttpServletResponse response, java.lang.String sessionId)
          Check if a session is registered in the session hash table.
static boolean validateSession(java.lang.String sessionId)
          Check if a session is registered in the session hash table.
 
Methods inherited from class edu.ucsb.nceas.metacat.shared.BaseService
refresh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionService getInstance()
                                  throws ServiceException
Get the single instance of SessionService.

Returns:
the single instance of SessionService
Throws:
ServiceException

refreshable

public boolean refreshable()
Specified by:
refreshable in class BaseService

doRefresh

public void doRefresh()
               throws ServiceException
Specified by:
doRefresh in class BaseService
Throws:
ServiceException

stop

public void stop()
          throws ServiceException
Specified by:
stop in class BaseService
Throws:
ServiceException

registerSession

public static void registerSession(java.lang.String sessionId,
                                   java.lang.String userName,
                                   java.lang.String[] groupNames,
                                   java.lang.String password,
                                   java.lang.String name)
                            throws ServiceException
Register a session in the session hash table. This uses the parameters passed in to create a SessionData object.

Parameters:
sessionId - the ID of the session to register
userName - the user name of the session
groupNames - the group names for the session
password - the password for the session
Throws:
ServiceException

registerSession

public static void registerSession(SessionData sessionData)
                            throws ServiceException
Register a session in the session hash table.

Parameters:
sessionData - the session data object to add to the session hash
Throws:
ServiceException

unRegisterSession

public static void unRegisterSession(java.lang.String sessionId)
Unregister a session from the session hash table.

Parameters:
sessionId - the id of the session to remove.

unRegisterAllSessions

public static void unRegisterAllSessions()
Unregister all sessions from the session hash table except the public session.

Parameters:
sessionId - the id of the session to remove.

isSessionRegistered

public static boolean isSessionRegistered(java.lang.String sessionId)
Check if a session is registered in the session hash table.

Parameters:
sessionId - the id of the session to look for.

validateSession

public static void validateSession(java.io.PrintWriter out,
                                   javax.servlet.http.HttpServletResponse response,
                                   java.lang.String sessionId)
Check if a session is registered in the session hash table. Write results in XML format to output.

Parameters:
out - the output stream to write to.
sessionId - the id of the session to look for.

validateSession

public static boolean validateSession(java.lang.String sessionId)
Check if a session is registered in the session hash table. Return true if the session is valid and false otherwise.

Parameters:
sessionId - the id of the session to look for.

getRegisteredSession

public static SessionData getRegisteredSession(java.lang.String sessionId)
Get a registered session from the session hash table. TODO MCD need to time sessions out

Parameters:
sessionId - the id of the session to retrieve.

getPublicSession

public static SessionData getPublicSession()
Get the public session from the session hash table.


touchSession

public static void touchSession(java.lang.String sessionId)
Keep a session active by updating its last accessed time.

Parameters:
sessionId - the id of the session to update.


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.