com.sibvisions.rad.server
Class AbstractSessionContext.WrappedSession

java.lang.Object
  extended by com.sibvisions.rad.server.AbstractSessionContext.WrappedSession
All Implemented Interfaces:
ISession
Enclosing class:
AbstractSessionContext

protected static final class AbstractSessionContext.WrappedSession
extends Object
implements ISession

The WrappedSession allows restricted access to the AbstractSession.


Field Summary
protected  AbstractSession session
          the "hidden" session.
 
Constructor Summary
protected AbstractSessionContext.WrappedSession(AbstractSession pSession)
          Creates a new instance of WrappedSession for an ISession.
 
Method Summary
 Object call(String pObjectName, String pMethod, Object... pParams)
          Executes a method from an object in the life-cycle object.
 Object callAction(String pAction, Object... pParams)
          Executes an action from the life-cycle object.
 Object get(String pObjectName)
          Gets an object from the life-cycle object.
 long getAliveInterval()
          Gets the desired client-side communication interval for this session.
 String getApplicationName()
          Gets the associated application name of the session.
 IConfiguration getConfig()
          Gets the IConfiguration of the session.
 Object getId()
          Gets the session identifier.
 long getLastAccessTime()
          Gets the time of the last session access.
 long getLastAliveTime()
          Gets the time of the last communication of the session.
 String getLifeCycleName()
          Gets the name of the life-cycle object.
 int getMaxInactiveInterval()
          Returns the maximum time interval, in minutes, that this session will be active.
 String getPassword()
          Gets the sessions password.
 Hashtable<String,Object> getProperties()
          Gets all properties.
 Object getProperty(String pName)
          Gets the value of a property.
protected  IServer getServer()
          Gets the referenced server.
protected  IConfiguration getServerConfig()
          Gets the server configuration.
 long getStartTime()
          Gets the session start/create time.
 String getUserName()
          Gets the sessions user name.
 boolean isAlive(long pAccessTime)
          Checks if the session is alive.
 boolean isInactive(long pAccessTime)
          Checks if the session is inactive.
 Object put(String pObjectName, Object pObject)
          Puts an object to the life-cycle object.
 void setAliveInterval(long pAliveInterval)
          Sets the desired client-side communication interval for this session.
 void setMaxInactiveInterval(int pMaxInactiveInterval)
          Specifies the time, in minutes, between access before the session will be inactive.
 void setProperty(String pName, Object pValue)
          Sets the value of a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected final AbstractSession session
the "hidden" session.

Constructor Detail

AbstractSessionContext.WrappedSession

protected AbstractSessionContext.WrappedSession(AbstractSession pSession)
Creates a new instance of WrappedSession for an ISession.

Parameters:
pSession - an ISession implementation
Method Detail

getId

public Object getId()
Gets the session identifier.

Specified by:
getId in interface ISession
Returns:
session id

getLifeCycleName

public String getLifeCycleName()
Gets the name of the life-cycle object.

Specified by:
getLifeCycleName in interface ISession
Returns:
the name of the life-cycle object

getApplicationName

public String getApplicationName()
Gets the associated application name of the session.

Specified by:
getApplicationName in interface ISession
Returns:
service name

getUserName

public String getUserName()
Gets the sessions user name.

Specified by:
getUserName in interface ISession
Returns:
the user name

getPassword

public String getPassword()
Gets the sessions password.

Specified by:
getPassword in interface ISession
Returns:
the password

getProperty

public Object getProperty(String pName)
Gets the value of a property.

Specified by:
getProperty in interface ISession
Parameters:
pName - the property name
Returns:
the value of the property or null if the property is not available

getProperties

public Hashtable<String,Object> getProperties()
Gets all properties.

Specified by:
getProperties in interface ISession
Returns:
a Hashtable with property names and values

setProperty

public void setProperty(String pName,
                        Object pValue)
Sets the value of a property.

Specified by:
setProperty in interface ISession
Parameters:
pName - the property name
pValue - the value for the property or null to delete the property

getStartTime

public long getStartTime()
Gets the session start/create time.

Specified by:
getStartTime in interface ISession
Returns:
start time in millis

getLastAccessTime

public long getLastAccessTime()
Gets the time of the last session access.

Specified by:
getLastAccessTime in interface ISession
Returns:
access time in millis

getLastAliveTime

public long getLastAliveTime()
Gets the time of the last communication of the session.

Specified by:
getLastAliveTime in interface ISession
Returns:
the last communication/alive time

setAliveInterval

public void setAliveInterval(long pAliveInterval)
Sets the desired client-side communication interval for this session.

Specified by:
setAliveInterval in interface ISession
Parameters:
pAliveInterval - the alive interval (client-side)

getAliveInterval

public long getAliveInterval()
Gets the desired client-side communication interval for this session.

Specified by:
getAliveInterval in interface ISession
Returns:
the alive interval (client-side)

isAlive

public boolean isAlive(long pAccessTime)
Checks if the session is alive. That means the client sends alive messages. The session is not alive if the client doesn't send alive messages.

Specified by:
isAlive in interface ISession
Parameters:
pAccessTime - current access time
Returns:
true if the session is alive
See Also:
ISession.getLastAliveTime(), ISession.getAliveInterval()

setMaxInactiveInterval

public void setMaxInactiveInterval(int pMaxInactiveInterval)
Specifies the time, in minutes, between access before the session will be inactive. A zero or negative time indicates the session should never be inactive.

Specified by:
setMaxInactiveInterval in interface ISession
Parameters:
pMaxInactiveInterval - time in minutes

getMaxInactiveInterval

public int getMaxInactiveInterval()
Returns the maximum time interval, in minutes, that this session will be active. After this interval, the session is inactive. The maximum time interval can be set with the setMaxInactiveInterval method. A zero or negative time indicates the session should never be inactive.

Specified by:
getMaxInactiveInterval in interface ISession
Returns:
time in minutes
See Also:
ISession.setMaxInactiveInterval(int)

isInactive

public boolean isInactive(long pAccessTime)
Checks if the session is inactive.

Specified by:
isInactive in interface ISession
Parameters:
pAccessTime - current access time
Returns:
true if the session is inactive
See Also:
ISession.getMaxInactiveInterval(), ISession.getLastAccessTime()

call

public Object call(String pObjectName,
                   String pMethod,
                   Object... pParams)
            throws Throwable
Executes a method from an object in the life-cycle object.

Specified by:
call in interface ISession
Parameters:
pObjectName - list of already mapped server object name/alias
pMethod - method name which should be called
pParams - parameters for the method call
Returns:
result of method call or null if it's an asynchronous method call
Throws:
Throwable - if the object identified by pObjectName was found but can not be created
SecurityException - if the method call is not allowed

callAction

public Object callAction(String pAction,
                         Object... pParams)
                  throws Throwable
Executes an action from the life-cycle object.

Specified by:
callAction in interface ISession
Parameters:
pAction - action which should be called
pParams - the parameters for the action call
Returns:
result from the action call
Throws:
Throwable - communication error, security checks, invalid action, ...

get

public Object get(String pObjectName)
           throws Throwable
Gets an object from the life-cycle object.

Specified by:
get in interface ISession
Parameters:
pObjectName - the object name
Returns:
the object
Throws:
Throwable - if the object was not found or an error occured during object creation

put

public Object put(String pObjectName,
                  Object pObject)
           throws Throwable
Puts an object to the life-cycle object.

Specified by:
put in interface ISession
Parameters:
pObjectName - the object name
pObject - the object
Returns:
the object if an object was already specified
Throws:
Throwable - if an unknown error occurs while putting the object

getConfig

public IConfiguration getConfig()
Gets the IConfiguration of the session.

Specified by:
getConfig in interface ISession
Returns:
the sessions configuration

getServerConfig

protected IConfiguration getServerConfig()
Gets the server configuration.

Returns:
the server configuration

getServer

protected IServer getServer()
Gets the referenced server.

Returns:
the server


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.