|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.server.AbstractSession
public abstract class AbstractSession
A Session
is a server side session which will be started
when an IConnection
connects to a remote server.
The session persists for a specified time period, across more than one request
from the IConnection
.
ISession
Field Summary | |
---|---|
protected ChangedHashtable<java.lang.String,java.lang.Object> |
chtExternalProperties
the properties got via constructor. |
protected ChangedHashtable<java.lang.String,java.lang.Object> |
chtProperties
the client and server properties. |
protected ILogger |
log
the log instance. |
Method Summary | |
---|---|
protected void |
addCallBackResult(ResultObject pResult)
Adds the result of an asynchronous call to the cache. |
java.lang.Object |
call(java.lang.String pObjectName,
java.lang.String pMethod,
java.lang.Object... pParams)
Executes a method from an object in the life-cycle object. |
java.lang.Object |
callAction(java.lang.String pAction,
java.lang.Object... pParams)
Executes an action from the life-cycle object. |
protected void |
checkAccess()
Checks if it is allowed to create the session. |
protected java.lang.Object |
executeWithSessionContext(SessionContext pContext,
com.sibvisions.rad.server.Call pCall)
Executes a remote method call. |
java.lang.Object |
get(java.lang.String pObjectName)
Gets an object from the life-cycle object. |
abstract IAccessController |
getAccessController()
Gets the IAccessController for checking the access to server side objects
and calls. |
long |
getAliveInterval()
Gets the desired client-side communication interval for this session. |
java.lang.String |
getApplicationName()
Gets the associated application name of the session. |
protected abstract ApplicationZone |
getApplicationZone()
Gets the application zone for which the session was created. |
java.lang.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. |
java.lang.String |
getLifeCycleName()
Gets the name of the life-cycle object. |
int |
getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that this session will be active. |
InjectObject |
getObject(java.lang.String pName)
Gets an object from the cache. |
java.lang.String |
getPassword()
Gets the sessions password. |
ChangedHashtable<java.lang.String,java.lang.Object> |
getProperties()
Gets a reference to the internal properties. |
java.lang.Object |
getProperty(java.lang.String pName)
Gets the value of a property. |
protected DefaultSessionManager |
getSessionManager()
Gets the session manager for this session. |
long |
getStartTime()
Gets the session start/create time. |
java.lang.String |
getUserName()
Gets the sessions user name. |
protected void |
initMaxAliveInterval(ChangedHashtable<java.lang.String,java.lang.Object> pProperties,
Zone pZone)
Initializes the max alive interval. |
protected void |
initMaxInactiveInterval(ChangedHashtable<java.lang.String,java.lang.Object> pProperties,
Zone pZone,
java.lang.String pScope,
int pDefault)
Initializes the max inactive interval. |
boolean |
isAlive(long pAccessTime)
Checks if the session is alive. |
protected boolean |
isExecuting()
Returns whether the session is execution at least one command. |
boolean |
isInactive(long pAccessTime)
Checks if the session is inactive. |
boolean |
isLocked()
Gets whether the session is locked. |
protected boolean |
isMaxAliveIntervalExceeded(long pAccessTime)
Gets whether the alive interval is exceeded. |
void |
lock()
Sets the session locked. |
protected Record |
openRecord(java.lang.String pCommand,
java.lang.Object... pParameter)
Opens a record. |
java.lang.Object |
put(java.lang.String pObjectName,
java.lang.Object pObject)
Puts an object to the life-cycle object. |
InjectObject |
putObject(InjectObject pObject)
Puts an object to the cache. |
InjectObject |
removeObject(InjectObject pObject)
Removes an object from the cache. |
void |
setAliveInterval(long pAliveInterval)
Sets the desired client-side communication interval for this session. |
protected void |
setExecuting(boolean pExecuting)
Sets that the session is executiong a command. |
void |
setLastAccessTime(long pLastAccessTime)
Sets the time of the last session access. |
void |
setLastAliveTime(long pLastAliveTime)
Sets the time of the last communication of the session. |
void |
setMaxInactiveInterval(int pMaxInactiveInterval)
Specifies the time, in seconds, before the session will be inactive. |
abstract void |
setNewPassword(java.lang.String pOldPassword,
java.lang.String pNewPassword)
Sets the new password for the current session. |
void |
setPassword(java.lang.String pPassword)
Sets the session password. |
protected void |
setProperties(java.util.List<java.lang.Object[]> pProperties)
Sets multiple properties. |
void |
setProperty(java.lang.String pName,
java.lang.Object pValue)
Sets a property. |
protected void |
setPropertyIntern(java.lang.String pName,
java.lang.Object pValue)
Sets internal members with property values. |
void |
setUserName(java.lang.String pUserName)
Sets the sessions user name. |
void |
unlock()
Unlocks the session. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.rad.server.ISession |
---|
getConfig |
Field Detail |
---|
protected ILogger log
protected ChangedHashtable<java.lang.String,java.lang.Object> chtProperties
protected ChangedHashtable<java.lang.String,java.lang.Object> chtExternalProperties
Method Detail |
---|
protected abstract ApplicationZone getApplicationZone()
public abstract IAccessController getAccessController()
IAccessController
for checking the access to server side objects
and calls.
null
if no inspector is availablepublic abstract void setNewPassword(java.lang.String pOldPassword, java.lang.String pNewPassword) throws java.lang.Exception
pOldPassword
- the old passwordpNewPassword
- the new password
java.lang.Exception
- if the password can not be changedpublic java.lang.Object getId()
getId
in interface ISession
public java.lang.String getLifeCycleName()
getLifeCycleName
in interface ISession
public final java.lang.String getApplicationName()
getApplicationName
in interface ISession
public final java.lang.String getUserName()
getUserName
in interface ISession
public final java.lang.String getPassword()
getPassword
in interface ISession
public java.lang.Object getProperty(java.lang.String pName)
getProperty
in interface ISession
pName
- the property name
null
if the property is not availablepublic long getStartTime()
getStartTime
in interface ISession
public long getLastAccessTime()
getLastAccessTime
in interface ISession
public void setMaxInactiveInterval(int pMaxInactiveInterval)
setMaxInactiveInterval
in interface ISession
pMaxInactiveInterval
- time in secondspublic int getMaxInactiveInterval()
setMaxInactiveInterval
method. A zero or negative time indicates the session should never be inactive.
getMaxInactiveInterval
in interface ISession
ISession.setMaxInactiveInterval(int)
public boolean isInactive(long pAccessTime)
isInactive
in interface ISession
pAccessTime
- current access time
true
if the session is inactiveISession.getMaxInactiveInterval()
,
ISession.getLastAccessTime()
public long getLastAliveTime()
getLastAliveTime
in interface ISession
public void setAliveInterval(long pAliveInterval)
setAliveInterval
in interface ISession
pAliveInterval
- the alive interval (client-side)public long getAliveInterval()
getAliveInterval
in interface ISession
public boolean isAlive(long pAccessTime)
isAlive
in interface ISession
pAccessTime
- current access time
true
if the session is aliveISession.getLastAliveTime()
,
ISession.getAliveInterval()
public java.lang.Object call(java.lang.String pObjectName, java.lang.String pMethod, java.lang.Object... pParams) throws java.lang.Throwable
call
in interface ISession
pObjectName
- list of already mapped server object name/aliaspMethod
- method name which should be calledpParams
- parameters for the method call
java.lang.Throwable
- if the object identified by pObjectName
was found but can not be created
java.lang.SecurityException
- if the method call is not allowedpublic java.lang.Object callAction(java.lang.String pAction, java.lang.Object... pParams) throws java.lang.Throwable
callAction
in interface ISession
pAction
- action which should be calledpParams
- the parameters for the action call
java.lang.Throwable
- communication error, security checks, invalid action, ...public java.lang.Object get(java.lang.String pObjectName) throws java.lang.Throwable
get
in interface ISession
pObjectName
- the object name
java.lang.Throwable
- if the object was not found or an error occured during object creationpublic java.lang.Object put(java.lang.String pObjectName, java.lang.Object pObject) throws java.lang.Throwable
put
in interface ISession
pObjectName
- the object namepObject
- the object
java.lang.Throwable
- if an unknown error occurs while putting the objectpublic final void setUserName(java.lang.String pUserName)
pUserName
- the user namepublic final void setPassword(java.lang.String pPassword)
pPassword
- the passwordpublic void setLastAccessTime(long pLastAccessTime)
pLastAccessTime
- access time in millispublic void setLastAliveTime(long pLastAliveTime)
pLastAliveTime
- the last communication/alive timeprotected java.lang.Object executeWithSessionContext(SessionContext pContext, com.sibvisions.rad.server.Call pCall) throws java.lang.Throwable
pContext
- the current session contextpCall
- the call information
java.lang.Throwable
- if an exception occurs during call
java.lang.SecurityException
- if the call is not allowedprotected void addCallBackResult(ResultObject pResult)
pResult
- the result of an asynchronous callpublic void setProperty(java.lang.String pName, java.lang.Object pValue)
setProperty
in interface ISession
pName
- the property namepValue
- the value of the property or null
to delete the propertyprotected void setProperties(java.util.List<java.lang.Object[]> pProperties)
pProperties
- the key/value paris as list of Object[]
protected final void setPropertyIntern(java.lang.String pName, java.lang.Object pValue)
pName
- the property namepValue
- the property valuepublic ChangedHashtable<java.lang.String,java.lang.Object> getProperties()
getProperties
in interface ISession
protected DefaultSessionManager getSessionManager()
public InjectObject putObject(InjectObject pObject)
pObject
- the object to inject
null
if there was no object with the same object name addedpublic InjectObject removeObject(InjectObject pObject)
pObject
- the object to remove
null
if an object with the same object name was not foundpublic InjectObject getObject(java.lang.String pName)
pName
- the name of the object
null
if an object with the given name was not foundprotected boolean isExecuting()
true
if the session is executing a command, otherwise false
protected boolean isMaxAliveIntervalExceeded(long pAccessTime)
pAccessTime
- the access time
true
if alive timeout is exceeded, false
otherwiseprotected void setExecuting(boolean pExecuting)
pExecuting
- true
to increase the execution counter; false
to
decrease the execution counterprotected void checkAccess()
protected Record openRecord(java.lang.String pCommand, java.lang.Object... pParameter)
pCommand
- the commandpParameter
- additional parameter
null
if record couldn't be createdprotected void initMaxInactiveInterval(ChangedHashtable<java.lang.String,java.lang.Object> pProperties, Zone pZone, java.lang.String pScope, int pDefault) throws java.lang.Exception
pProperties
- the session propertiespZone
- the zone to usepScope
- the scope (master/subsession)pDefault
- the default timeout if not configured
java.lang.Exception
- if reading configuration failedprotected void initMaxAliveInterval(ChangedHashtable<java.lang.String,java.lang.Object> pProperties, Zone pZone) throws java.lang.Exception
pProperties
- the session propertiespZone
- the zone to use
java.lang.Exception
- if reading configuration failedpublic void lock()
unlock()
ed.
unlock()
public void unlock()
lock()
public boolean isLocked()
true
if this session is locked, false
otherwiselock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |