com.cometway.om
Class SessionManager

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.ak.ServiceAgent
              extended by com.cometway.om.SessionManager
All Implemented Interfaces:
AgentInterface, SessionManagerInterface, HasStateMachineModel

public class SessionManager
extends ServiceAgent
implements SessionManagerInterface

Reference implementation of the SessionManagerInterface.


Field Summary
protected  IObjectManager om
           
protected  PropsType sessionType
           
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
SessionManager()
           
 
Method Summary
 java.lang.String createSession()
          Creates a new session and returns its sessionID.
 boolean destroySession(java.lang.String sessionID)
          Destroys the specified session and returns true; false if the session did not exist.
static SessionManagerInterface getSessionManager()
          Returns the session manager registered as session_manager.
static SessionManagerInterface getSessionManager(java.lang.String serviceName)
          Returns the session manager registered as the specified serviceName.
 Props getSessionProps(java.lang.String sessionID)
          Returns the Props for the specified session; false if the session does not exist.
 void initProps()
          Initializes this agent's properties by providing default values for each of the following missing properties: session_type (default: session) service_name (default: session_manager) om_service_name (default: object_manager)
 void start()
          Obtains a reference to the object manager specified by the om_service_name property, which it uses to serve session information using the SessionManagerInterface.
 void stop()
          Unregisters this agent from the service manager, and invalidate's its reference to the object manager.
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sessionType

protected PropsType sessionType

om

protected IObjectManager om
Constructor Detail

SessionManager

public SessionManager()
Method Detail

initProps

public void initProps()
Initializes this agent's properties by providing default values for each of the following missing properties:

Specified by:
initProps in interface AgentInterface
Overrides:
initProps in class Agent

start

public void start()
Obtains a reference to the object manager specified by the om_service_name property, which it uses to serve session information using the SessionManagerInterface. After looking up the object manager, the agent registers itself using the name specified by the service_name property.

Specified by:
start in interface AgentInterface
Overrides:
start in class ServiceAgent

stop

public void stop()
Unregisters this agent from the service manager, and invalidate's its reference to the object manager.

Specified by:
stop in interface AgentInterface
Overrides:
stop in class ServiceAgent

createSession

public java.lang.String createSession()
Creates a new session and returns its sessionID.

Specified by:
createSession in interface SessionManagerInterface

destroySession

public boolean destroySession(java.lang.String sessionID)
Destroys the specified session and returns true; false if the session did not exist.

Specified by:
destroySession in interface SessionManagerInterface

getSessionProps

public Props getSessionProps(java.lang.String sessionID)
Returns the Props for the specified session; false if the session does not exist.

Specified by:
getSessionProps in interface SessionManagerInterface

getSessionManager

public static SessionManagerInterface getSessionManager()
Returns the session manager registered as session_manager.


getSessionManager

public static SessionManagerInterface getSessionManager(java.lang.String serviceName)
Returns the session manager registered as the specified serviceName.