javax.rad.server
Class SessionContext

java.lang.Object
  extended by javax.rad.server.SessionContext
Direct Known Subclasses:
AbstractSessionContext

public abstract class SessionContext
extends Object

A SessionContext contains all of the per-request state information related to the processing of a single server call. It is passed to, and potentially modified by, each phase of the request processing lifecycle.

A SessionContext instance remains active until its release() method is called. It's possible to have more than one SessionContexts, but only the last SessionContext is accessible as current instance.

While a SessionContext instance is active, it must not be referenced from any thread other than the one upon which the server executing this application utilizes for the processing of this call.


Constructor Summary
SessionContext()
           
 
Method Summary
protected abstract  void destroy()
          Destroyes any resources associated with this SessionContext instance.
static SessionContext getCurrentInstance()
          Gets the current/last instance of SessionContext.
static IConfiguration getCurrentServerConfig()
          Gets the IConfiguration from the current instance of SessionContext.
static ISession getCurrentSession()
          Gets the ISession from the current instance of SessionContext.
static IConfiguration getCurrentSessionConfig()
          Gets the IConfiguration from the current instance of SessionContext.
abstract  String getMethodName()
          Gets the name of the method which will be called.
 SessionContext getNextContext()
          Gets the next SessionContext, if available.
abstract  InjectObject getObject(String pName)
          Gets an already added inject object.
abstract  String getObjectName()
          Gets the name of the object from which a method will be called.
 SessionContext getPreviousContext()
          Gets the previous SessionContext, if available.
abstract  IConfiguration getServerConfig()
          Gets the server IConfiguration.
abstract  IConnection getServerConnection()
          Gets a connection to the server.
abstract  ISession getSession()
          Gets the ISession instance for this context.
abstract  IConfiguration getSessionConfig()
          Gets the IConfiguration for the session.
 boolean isReleased()
          Gets the release state of this SessionContext.
abstract  InjectObject putObject(InjectObject pObject)
          Puts an object to this SessionContext.
 InjectObject putObject(String pName, Object pObject)
          Puts an object with a specific name to this SessionContext.
 void release()
          Release any resources associated with this SessionContext instance.
abstract  InjectObject removeObject(InjectObject pObject)
          Removes an inject object from this SessionContext.
 InjectObject removeObject(String pName)
          Removes an inject object from this SessionContext.
protected  void setCurrentInstance(SessionContext pContext)
          Sets the current SessionContext instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionContext

public SessionContext()
Method Detail

destroy

protected abstract void destroy()
Destroyes any resources associated with this SessionContext instance.


getSession

public abstract ISession getSession()
Gets the ISession instance for this context.

Returns:
the ISession instance

getSessionConfig

public abstract IConfiguration getSessionConfig()
Gets the IConfiguration for the session.

Returns:
the IConfiguration

getServerConfig

public abstract IConfiguration getServerConfig()
Gets the server IConfiguration.

Returns:
the IConfiguration

getServerConnection

public abstract IConnection getServerConnection()
Gets a connection to the server.

Returns:
a "direct" server connection

getObjectName

public abstract String getObjectName()
Gets the name of the object from which a method will be called. A SessionContext will be initialized through a method call with or without object name. The method call without object name is known as action call.

Returns:
the name of the object which will be used or null if an action will be called
See Also:
getMethodName()

getMethodName

public abstract String getMethodName()
Gets the name of the method which will be called.

Returns:
the method name

putObject

public abstract InjectObject putObject(InjectObject pObject)
Puts an object to this SessionContext.

Parameters:
pObject - the inject object
Returns:
the old object or null if the object was not known

removeObject

public abstract InjectObject removeObject(InjectObject pObject)
Removes an inject object from this SessionContext.

Parameters:
pObject - the inject object
Returns:
the removed object or null if the object was not put

getObject

public abstract InjectObject getObject(String pName)
Gets an already added inject object.

Parameters:
pName - the object name
Returns:
the object or null if there is no object with the pName

release

public void release()
Release any resources associated with this SessionContext instance.

See Also:
isReleased()

getCurrentInstance

public static SessionContext getCurrentInstance()
Gets the current/last instance of SessionContext.

Returns:
the current instance

getCurrentSession

public static ISession getCurrentSession()
Gets the ISession from the current instance of SessionContext.

Returns:
the current ISession

getCurrentSessionConfig

public static IConfiguration getCurrentSessionConfig()
Gets the IConfiguration from the current instance of SessionContext.

Returns:
the current session IConfiguration

getCurrentServerConfig

public static IConfiguration getCurrentServerConfig()
Gets the IConfiguration from the current instance of SessionContext.

Returns:
the current server IConfiguration

isReleased

public boolean isReleased()
Gets the release state of this SessionContext.

Returns:
true if there is no current instance of SessionContext (means that the SessionContext is released); otherwise false

setCurrentInstance

protected void setCurrentInstance(SessionContext pContext)
Sets the current SessionContext instance. If there already is an instance, the instance will kept as previous SessionContext until the current instance will be released. To unset the current instance you should pass null as parameter for the current instance.

Parameters:
pContext - the current SessionContext or null to unset the current instance

putObject

public InjectObject putObject(String pName,
                              Object pObject)
Puts an object with a specific name to this SessionContext.

Parameters:
pName - the object name
pObject - the object or null to remove the object with pName
Returns:
the old object or null if the object was not put

removeObject

public InjectObject removeObject(String pName)
Removes an inject object from this SessionContext.

Parameters:
pName - the name of the inject object
Returns:
the removed object or null if the object was not put

getPreviousContext

public SessionContext getPreviousContext()
Gets the previous SessionContext, if available.

Returns:
the SessionContext which was created before this context was created or null if there is no previous created context

getNextContext

public SessionContext getNextContext()
Gets the next SessionContext, if available.

Returns:
the Sessioncontext which was created after this context was created or null if this context is the current context


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.