com.sap.mdm.session
Class SessionManager

java.lang.Object
  extended bycom.sap.mdm.session.AbstractManagerWithPasswordStorage
      extended bycom.sap.mdm.session.SessionManager

public class SessionManager
extends AbstractManagerWithPasswordStorage

This class is memory cache for MDM sessions. It supply users with convenient interface for creating, retrieving and destroying sessions of all supported types. This class is wrapper class for internal class InternalSessionManager that includes the actual implementation.


Method Summary
 String createSession(MdmSessionContext ctx, int sessionType, String password)
          Create and authenticate MDM session of the specified type.
 void destroyAllSessions()
          Deprecated.  
 void destroyAllSessions(boolean checkThreadCount)
          Deprecated.  
 void destroySession(MdmSessionContext ctx, int sessionType)
          Destroy session of the specified type that is managed by this SessionManaged instance.
 void destroySession(MdmSessionContext ctx, int sessionType, boolean checkThreadCount)
          Destroy session of the specified type that is managed by this SessionManaged instance.
 void destroySessions(MdmSessionContext ctx)
          Destroy sessions of all types that are related to the specified session context.
 void destroySessions(MdmSessionContext ctx, boolean checkThreadCount)
          Destroy sessions of all types that are related to the specified session context.
 void destroySessionsByApplication(String applicationName)
          Deprecated.  
 void destroySessionsByApplication(String applicationName, boolean checkThreadCount)
          Deprecated.  
 void destroySessionsByServer(String serverName)
          Deprecated.  
 void destroySessionsByServer(String serverName, boolean checkThreadCount)
          Deprecated.  
static SessionManager getInstance()
          Returns the single instance of SessionManager class
 String getSession(MdmSessionContext ctx, int sessionType)
          Get session ID for the specified session type
static void refreshInstance()
          Deprecated.  
 void releaseSession(MdmSessionContext ctx, int sessionType)
          Release session of the specified type that is managed by this SessionManaged instance.
 void releaseSession(MdmSessionContext ctx, int sessionType, boolean checkThreadCount)
          Release session of the specified type that is managed by this SessionManaged instance.
 void releaseSessions(MdmSessionContext ctx)
          Release sessions of all types that are related to the specified session context.
 void releaseSessions(MdmSessionContext ctx, boolean checkThreadCount)
          Release sessions of all types that are related to the specified session context.
 void setDestroyTimeOut(long destroyTimeOut)
          Deprecated.  
 void setPasswordStorage(String applicationId, MdmPasswordStorage passwordStorage)
          Sets password storage for the specified application If the application is supposed to use password storage then this method should be called once per application run session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionManager getInstance()
Returns the single instance of SessionManager class

Returns:
a SessionManager instance

refreshInstance

public static void refreshInstance()
Deprecated.  

Refresh instance of SessionManager


createSession

public String createSession(MdmSessionContext ctx,
                            int sessionType,
                            String password)
                     throws SessionException
Create and authenticate MDM session of the specified type. The password will be stored in the password storage if such storage was defined by method setPasswordStorage

Parameters:
ctx - session context
sessionType - session type
password -
Returns:
authenticated session ID
Throws:
SessionException - if there is mismatch between session context and session type or if can not create/authenticate session.
See Also:
for session type constants

getSession

public String getSession(MdmSessionContext ctx,
                         int sessionType)
                  throws SessionException
Get session ID for the specified session type

Parameters:
ctx - session context
sessionType - session type (1-ServerSession, 2-RepositorySession, 3-UserSession)
Returns:
session ID.
Throws:
SessionException - if there is mismatch between session context and session type or if can not create/authenticate session.
See Also:
for session type constants

releaseSession

public void releaseSession(MdmSessionContext ctx,
                           int sessionType)
                    throws SessionException
Release session of the specified type that is managed by this SessionManaged instance. Released session will be destroyed after the specified timeout passed with condition that this session was not reserved once more.

Parameters:
ctx - session context
sessionType - session type (1-ServerSession, 2-RepositorySession, 3-UserSession)
Throws:
SessionException - if there is mismatch between session context and session type
See Also:
for session type constants

releaseSessions

public void releaseSessions(MdmSessionContext ctx)
Release sessions of all types that are related to the specified session context. Released sessions will be destroyed after the specified timeout passed with condition that this session was not reserved once more.

Parameters:
ctx - session context

destroySession

public void destroySession(MdmSessionContext ctx,
                           int sessionType)
                    throws SessionException
Destroy session of the specified type that is managed by this SessionManaged instance.

Parameters:
ctx - server session context
sessionType - session type (1-ServerSession, 2-RepositorySession, 3-UserSession)
Throws:
SessionException - if there is mismatch between session context and session type or if session can not be destroyed
See Also:
for session type constants

destroySessions

public void destroySessions(MdmSessionContext ctx)
                     throws SessionException
Destroy sessions of all types that are related to the specified session context.

Parameters:
ctx - server session context
Throws:
SessionException - if one of the sessions can not be destroyed

destroySessionsByServer

public void destroySessionsByServer(String serverName)
                             throws SessionException
Deprecated.  

Destroy all sessions established for the specified MDM server.

Parameters:
serverName - the server name
Throws:
SessionException - if one of the sessions can not be destroyed

destroySessionsByApplication

public void destroySessionsByApplication(String applicationName)
                                  throws SessionException
Deprecated.  

Destroy all sessions established for the specified application.

Parameters:
applicationName - the application ID
Throws:
SessionException - if one of the sessions can not be destroyed

destroyAllSessions

public void destroyAllSessions()
                        throws SessionException
Deprecated.  

Destroy all sessions.

Throws:
SessionException - if one of the sessions can not be destroyed

setDestroyTimeOut

public void setDestroyTimeOut(long destroyTimeOut)
Deprecated.  

Sets destroy timeout

Parameters:
destroyTimeOut - destroy timeout in milliseconds. Set -1 if sessions never should be destroyed

setPasswordStorage

public void setPasswordStorage(String applicationId,
                               MdmPasswordStorage passwordStorage)
Sets password storage for the specified application If the application is supposed to use password storage then this method should be called once per application run session.

Overrides:
setPasswordStorage in class AbstractManagerWithPasswordStorage
Parameters:
applicationId - application unique ID
passwordStorage -

destroySessions

public void destroySessions(MdmSessionContext ctx,
                            boolean checkThreadCount)
                     throws SessionException
Destroy sessions of all types that are related to the specified session context.

Parameters:
ctx - server session context
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread
Throws:
SessionException - if one of the sessions can not be destroyed

destroySession

public void destroySession(MdmSessionContext ctx,
                           int sessionType,
                           boolean checkThreadCount)
                    throws SessionException
Destroy session of the specified type that is managed by this SessionManaged instance.

Parameters:
ctx - server session context
sessionType - session type (1-ServerSession, 2-RepositorySession, 3-UserSession)
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread
Throws:
SessionException - if there is mismatch between session context and session type or if session can not be destroyed
See Also:
for session type constants

destroySessionsByApplication

public void destroySessionsByApplication(String applicationName,
                                         boolean checkThreadCount)
                                  throws SessionException
Deprecated.  

Destroy all sessions established for the specified application.

Parameters:
applicationName - the application ID
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread
Throws:
SessionException - if one of the sessions can not be destroyed

destroySessionsByServer

public void destroySessionsByServer(String serverName,
                                    boolean checkThreadCount)
                             throws SessionException
Deprecated.  

Destroy all sessions established for the specified MDM server.

Parameters:
serverName - the server name
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread
Throws:
SessionException - if one of the sessions can not be destroyed

releaseSession

public void releaseSession(MdmSessionContext ctx,
                           int sessionType,
                           boolean checkThreadCount)
                    throws SessionException
Release session of the specified type that is managed by this SessionManaged instance. Released session will be destroyed after the specified timeout passed with condition that this session was not reserved once more.

Parameters:
ctx - session context
sessionType - session type (1-ServerSession, 2-RepositorySession, 3-UserSession)
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread
Throws:
SessionException - if there is mismatch between session context and session type
See Also:
for session type constants

releaseSessions

public void releaseSessions(MdmSessionContext ctx,
                            boolean checkThreadCount)
Release sessions of all types that are related to the specified session context. Released sessions will be destroyed after the specified timeout passed with condition that this session was not reserved once more.

Parameters:
ctx - session context
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread

destroyAllSessions

public void destroyAllSessions(boolean checkThreadCount)
                        throws SessionException
Deprecated.  

Destroy all sessions.

Parameters:
checkThreadCount - boolean, if true, the session will not be destroyed in case it is in use by other thread
Throws:
SessionException - if one of the sessions can not be destroyed


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.