com.sap.conn.jco.ext
Class DefaultSessionReferenceProvider

java.lang.Object
  extended by com.sap.conn.jco.ext.DefaultSessionReferenceProvider
All Implemented Interfaces:
SessionReferenceProvider

public class DefaultSessionReferenceProvider
extends java.lang.Object
implements SessionReferenceProvider

DefaultSessionReferenceProvider is a sample implementation of the SessionReferenceProvider supporting client sessions running in separate threads (all operation in a thread belongs to the same client session) and server sessions. JCo API allows stateful communication using JCoContext.begin() and JCoContext.end() API. At runtime the registered instance of a session reference provider is responsible to provide a unique ID for the current session, i.e. the session running in the current thread. It is expected that each environment provide a suitable session reference provider that able to identify the session. In most standalone scenarios different threads means different client sessions. Especially applications running in a single thread works mostly within a single client session. In such scenarios the DefaultSessionReferenceProvider used by the JCo runtime is sufficient.
Note: it is strongly recommended to register an own instance of the DefaultSessionReferenceProvider in environments that allow to deploy and to run various applications in order to prevent possible session hijacking. If no session reference provider is registered, JCo runtime uses internally an instance of DefaultSessionReferenceProvider. But it is still possible for a malicious application to register its own instance.


Constructor Summary
DefaultSessionReferenceProvider()
          Creates an instance of session reference provider supporting scope types
DefaultSessionReferenceProvider(boolean supportScopes)
          Creates an instance of session reference provider
 
Method Summary
 JCoSessionReference getCurrentSessionReference(java.lang.String scopeType)
          Return the session for the current thread.
 boolean isSessionAlive(java.lang.String sessionId)
          Returns true if the session with the given session ID is still alive
 void jcoServerSessionContinued(java.lang.String sessionID)
          Server session event when session is being continued
 void jcoServerSessionFinished(java.lang.String sessionID)
          Implementation for the JCoSessionReference interface used by the DefaultSessionReference
 void jcoServerSessionPassivated(java.lang.String sessionID)
          Server session event when session is being passivated
 JCoSessionReference jcoServerSessionStarted()
          Server session event on session start
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSessionReferenceProvider

public DefaultSessionReferenceProvider()
Creates an instance of session reference provider supporting scope types


DefaultSessionReferenceProvider

public DefaultSessionReferenceProvider(boolean supportScopes)
Creates an instance of session reference provider

Parameters:
supportScopes - flag indicating if scope types should be supported or not
Method Detail

getCurrentSessionReference

public JCoSessionReference getCurrentSessionReference(java.lang.String scopeType)
Return the session for the current thread.

Specified by:
getCurrentSessionReference in interface SessionReferenceProvider
Parameters:
scopeType - scope type
Returns:
a JCoSessionReference that identifies the current session, in which the method is invoked

isSessionAlive

public boolean isSessionAlive(java.lang.String sessionId)
Returns true if the session with the given session ID is still alive

Specified by:
isSessionAlive in interface SessionReferenceProvider
Parameters:
sessionId - the session ID to be check
Returns:
true if the session is alive false otherwise

jcoServerSessionStarted

public JCoSessionReference jcoServerSessionStarted()
Server session event on session start

Specified by:
jcoServerSessionStarted in interface SessionReferenceProvider
Returns:
session for the incoming server call

jcoServerSessionPassivated

public void jcoServerSessionPassivated(java.lang.String sessionID)
Server session event when session is being passivated

Specified by:
jcoServerSessionPassivated in interface SessionReferenceProvider
Parameters:
sessionID - of the session being passivated

jcoServerSessionContinued

public void jcoServerSessionContinued(java.lang.String sessionID)
Server session event when session is being continued

Specified by:
jcoServerSessionContinued in interface SessionReferenceProvider
Parameters:
sessionID - of the session being continued
See Also:
JCoServerContext.setStateful(boolean)

jcoServerSessionFinished

public void jcoServerSessionFinished(java.lang.String sessionID)
Implementation for the JCoSessionReference interface used by the DefaultSessionReference

Specified by:
jcoServerSessionFinished in interface SessionReferenceProvider
Parameters:
sessionID - sessionID of the finished JCoServer session


Copyright © 2008-2014 SAP AG. All Rights Reserved.