TROOlympiaSessionManager

Overview

The TROOlympiaSessionManager class is the session manager that uses the Olympia. It implements the IOlympiaSessionManagerEvents interface, so the Active property has to be set to true to launch the TROOlympiaSessionManager.

Location


 

constructor Create  override

Standard component constructor

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner: Owner

Active

(De)activates the instance as TROEventReceiver.

property Active: Boolean read write

ApplicationID

Uniquely identifies the running instance of the TROOlympiaSessionManager. Create sets its initial value.

property ApplicationID: TGUID read write

Assign  override

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

Channel

The channel used to access the Olympia Server.

property Channel: TROTransportChannel read write

CheckProperties  override

Validates the session manager properties.

procedure CheckProperties

CheckSessionIsExpired (TROSession): Boolean  overload    (declared in TROCustomSessionManager)

Checks state of given session.

function CheckSessionIsExpired(aSession: TROSession): Boolean

Parameters:

  • aSession: Given session.

CheckSessionIsExpired (TGUID): Boolean  overload    (declared in TROCustomSessionManager)

Checks state of given session or not.

function CheckSessionIsExpired(const aSessionID: TGUID): Boolean

Parameters:

  • aSessionID: Session ID

Clearing  protected    (declared in TROCustomSessionManager)

internal flag that is set when session are clearing

property Clearing: Boolean read

ClearSessions    (declared in TROCustomSessionManager)

Discards all sessions within the session manager, so that any new call from a client will start with a fresh session.

procedure ClearSessions(OnlyExpired: Boolean)

Parameters:

  • OnlyExpired: process only expired sessions or not.

CreateSession    (declared in TROCustomSessionManager)

Creates a new session with provided ID.

function CreateSession(const aSessionID: TGUID): TROSession

Parameters:

  • aSessionID: Session ID

CreateTimerByRequest  protected    (declared in TROCustomSessionManager)

Creates internal timer.

procedure CreateTimerByRequest

DeleteSession    (declared in TROCustomSessionManager)

Deletes the session with specified ID.

procedure DeleteSession(const aSessionID: TGUID; IsExpired: Boolean)

Parameters:

  • aSessionID: Session ID
  • IsExpired: current state of session

DeleteTemporarySession    (declared in TROCustomSessionManager)

Deletes the temporary session.

procedure DeleteTemporarySession(var Session: TROSession)

Parameters:

  • Session: given session.

DoClearSessions  protected override

Discards all sessions within the session manager, so that any new call from a client will start with a fresh session.

procedure DoClearSessions(OnlyExpired: Boolean)

Parameters:

  • OnlyExpired: process only expired sessions or not.

DoCreateSession  protected virtual    (declared in TROCustomSessionManager)

Creates a new session with provided ID.

function DoCreateSession(const aSessionID: TGUID): TROSession

Parameters:

  • aSessionID: Session ID

DoDeleteSession  protected override

Deletes the session with specified ID.

procedure DoDeleteSession(const aSessionID: TGUID; IsExpired: Boolean)

Parameters:

  • aSessionID: Session ID
  • IsExpired: current state of session

DoFindSession  protected override

Tries to use the IOlympiaSessionManager to retrieve an OlympiaUserSession and, if succeeded, converts it into a TROSession.

function DoFindSession(const aSessionID: TGUID; aUpdateTime: Boolean): TROSession

Parameters:

  • aSessionID: Sought session
  • aUpdateTime: Ignored

DoGetAllSessions  protected override

Call the IOlympiaSessionManager and returns its result as a TStringList.

procedure DoGetAllSessions(Dest: TStringList)

Parameters:

  • Dest: Result list

DoGetSessionCount  protected override

Returns the session count.

function DoGetSessionCount: Integer

DoNotifySessionsChangesListener  protected virtual    (declared in TROCustomSessionManager)

Notifies attached listeners about changes

procedure DoNotifySessionsChangesListener(const aSessionID: TGUID; aSessionAction: TROSessionsActions; Sender: TObject)

Parameters:

  • aSessionID: Session ID
  • aSessionAction: action
  • Sender: sender

DoReleaseSession  protected override

Adds aSession into the sessionlist (while the SessionManager.NewSession creates an aSession, but does not add it into sessionlist). Using this method, the user can create a session in the Service.Login and destroy it with the Service.DestroySession in the same method. Sessions will only be created if the Login Method was successful.

procedure DoReleaseSession(aSession: TROSession; NewSession: Boolean)

Parameters:

  • aSession: Session to process
  • NewSession: If true, the SessionManager.CreateSession will be used, otherwise the SessionManager.

DoTimerTick  protected virtual    (declared in TROCustomSessionManager)

Clears expired sessions.

procedure DoTimerTick(CurrentTickCount: Cardinal)

Parameters:

  • CurrentTickCount: ignored

EnableLightweightSessions

property EnableLightweightSessions: Boolean read write

EventReceiver  protected

Read-only access to the EventReceiver component.

property EventReceiver: TROEventReceiver read

FindSession    (declared in TROCustomSessionManager)

Finds session with the specified GUID

function FindSession(const aSessionID: TGUID; aUpdateTime: Boolean): TROSession

Parameters:

  • aSessionID: Session ID.
  • aUpdateTime: Update LastAccess of found session or not

GetAllSessions  overload    (declared in TROCustomSessionManager)

function GetAllSessions: TROSessionIDs

GetAllSessions (TStringList)  overload    (declared in TROCustomSessionManager)

Returns a string list containing the IDs of all currently active sessions. Depending on the session manager and on your application architecture, this list can be huge, especially when using a database based session list that is shared by a large server farm. Obtaining the full list of sessions can be a costly process.

procedure GetAllSessions(Dest: TStringList)

Parameters:

  • Dest: destination

GetSessionCount    (declared in TROCustomSessionManager)

Returns the session count.

function GetSessionCount: Integer

IsSessionPresent    (declared in TROCustomSessionManager)

function IsSessionPresent(const aSessionID: TGUID): Boolean

Parameters:

  • aSessionID:

KillTimer  protected    (declared in TROCustomSessionManager)

Kills internal timer

procedure KillTimer

LockForReading  protected    (declared in TROCustomSessionManager)

procedure LockForReading

LockForWriting  protected    (declared in TROCustomSessionManager)

procedure LockForWriting

MaxSessions    (declared in TROCustomSessionManager)

Specifies the maximum number of sessions that will be allowed. -1 (the default) indicates that no limit on number of sessions will be enforced. Allowing a server to run without enforcing any limit on the number of sessions might pose a security risk, as malicious clients could theoretically start an infinite number of sessions by performing repeated requests with changing Client IDs, until server memory is depleted. You should make sure to either set a limit, or tie session creation to user authentication, so that only valid client users can obtain a session(and possibly only one session per login).

property MaxSessions: Integer read write

Notification  protected override

Forwards notification messages to all owned components.

procedure Notification(AComponent: TComponent; Operation: TOperation)

Parameters:

  • AComponent: component
  • Operation: operation

OnBeforeDeleteSession    (declared in TROCustomSessionManager)

Fires before deleting session.

property OnBeforeDeleteSession: TDeleteSessionEvent read write
delegate: procedure OnBeforeDeleteSession(const aSessionID: TGUID; IsExpired: Boolean)

OnCustomCreateSession    (declared in TROCustomSessionManager)

Fires before the session is created. It allows to return existing session for given session ID

property OnCustomCreateSession: TROCustomSessionCreationEvent read write
delegate: procedure OnCustomCreateSession(const aSessionID: TGUID; var Session: TROSession)

OnException    (declared in TROCustomSessionManager)

Fires when an exception is occuring

property OnException: TROSessionExceptionEvent read write
delegate: procedure OnException(aSessionID: TGUID; anException: Exception; var aRetry: Boolean)

OnMaxSessionsReached    (declared in TROCustomSessionManager)

Fires when maximum count of allowed sessions is reached

property OnMaxSessionsReached: TROMaxSessionsReachedEvent read write
delegate: procedure OnMaxSessionsReached(var aFail: Boolean)

OnSessionCreated    (declared in TROCustomSessionManager)

Gets triggered after a new Session has been created. You can use it to perform initialization functions or fill the session with default values.

property OnSessionCreated: TSessionEvent read write
delegate: procedure OnSessionCreated(const aSession: TROSession)

OnSessionDeleted  protected

Hides the TROCustomSessionManager property as protected.

property OnSessionDeleted: TDeleteSessionEvent read write

RegisterSessionsChangesListener  protected virtual    (declared in TROCustomSessionManager)

Attaches a new IROSessionsChangesListener listener.

procedure RegisterSessionsChangesListener(aListener: IROSessionsChangesListener)

Parameters:

  • aListener: New listener

ReleaseSession    (declared in TROCustomSessionManager)

Releases the previously acquired session.

procedure ReleaseSession(var aSession: TROSession; NewSession: Boolean)

Parameters:

  • aSession: given session
  • NewSession: newly created session or not

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SessionCheckInterval  protected    (declared in TROCustomSessionManager)

Internal for checking session in minutes. default value is 15 minutes.

property SessionCheckInterval: Integer read write

SessionDuration  protected    (declared in TROCustomSessionManager)

The time, in minutes, that sessions will persist before timing out (default is 15 minutes).The timeout for each individual session will be reset every time the session is accessed; after SessionDuration minutes have passed without access to the session, it will be discarded. The exact handling of the timeout processing depends on the implementation of the specific session manager, which might check session timeouts at intervals. Therefore, sessions might live slightly longer then the specified timeout.

property SessionDuration: Integer read write

SessionManager  protected

Returns a new instance of the IOlympiaSessionManager.

property SessionManager: IOlympiaSessionManager read

SessionsExpired  protected

Calls DeleteSession to each item of aExpiredSessionIDs.

procedure SessionsExpired(const aExpiredSessionIDs: GuidArray)

Parameters:

  • aExpiredSessionIDs: list of expired ID

TestLastAccess  protected    (declared in TROCustomSessionManager)

function TestLastAccess(const aLastAccess: TDateTime): Boolean

Parameters:

  • aLastAccess:

UnlockForReading  protected    (declared in TROCustomSessionManager)

procedure UnlockForReading

UnlockForWriting  protected    (declared in TROCustomSessionManager)

procedure UnlockForWriting

UnRegisterSessionsChangesListener  protected virtual    (declared in TROCustomSessionManager)

Detaches a previously attached aListener.

procedure UnRegisterSessionsChangesListener(aListener: IROSessionsChangesListener)

Parameters:

  • aListener: Known listener

 

Active

(De)activates the instance as TROEventReceiver.

property Active: Boolean read write

ApplicationID

Uniquely identifies the running instance of the TROOlympiaSessionManager. Create sets its initial value.

property ApplicationID: TGUID read write

Channel

The channel used to access the Olympia Server.

property Channel: TROTransportChannel read write

Clearing  protected    (declared in TROCustomSessionManager)

internal flag that is set when session are clearing

property Clearing: Boolean read

EnableLightweightSessions

property EnableLightweightSessions: Boolean read write

EventReceiver  protected

Read-only access to the EventReceiver component.

property EventReceiver: TROEventReceiver read

MaxSessions    (declared in TROCustomSessionManager)

Specifies the maximum number of sessions that will be allowed. -1 (the default) indicates that no limit on number of sessions will be enforced. Allowing a server to run without enforcing any limit on the number of sessions might pose a security risk, as malicious clients could theoretically start an infinite number of sessions by performing repeated requests with changing Client IDs, until server memory is depleted. You should make sure to either set a limit, or tie session creation to user authentication, so that only valid client users can obtain a session(and possibly only one session per login).

property MaxSessions: Integer read write

OnSessionDeleted  protected

Hides the TROCustomSessionManager property as protected.

property OnSessionDeleted: TDeleteSessionEvent read write

SessionCheckInterval  protected    (declared in TROCustomSessionManager)

Internal for checking session in minutes. default value is 15 minutes.

property SessionCheckInterval: Integer read write

SessionDuration  protected    (declared in TROCustomSessionManager)

The time, in minutes, that sessions will persist before timing out (default is 15 minutes).The timeout for each individual session will be reset every time the session is accessed; after SessionDuration minutes have passed without access to the session, it will be discarded. The exact handling of the timeout processing depends on the implementation of the specific session manager, which might check session timeouts at intervals. Therefore, sessions might live slightly longer then the specified timeout.

property SessionDuration: Integer read write

SessionManager  protected

Returns a new instance of the IOlympiaSessionManager.

property SessionManager: IOlympiaSessionManager read

 

constructor Create  override

Standard component constructor

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner: Owner

Assign  override

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

CheckProperties  override

Validates the session manager properties.

procedure CheckProperties

CheckSessionIsExpired (TROSession): Boolean  overload    (declared in TROCustomSessionManager)

Checks state of given session.

function CheckSessionIsExpired(aSession: TROSession): Boolean

Parameters:

  • aSession: Given session.

CheckSessionIsExpired (TGUID): Boolean  overload    (declared in TROCustomSessionManager)

Checks state of given session or not.

function CheckSessionIsExpired(const aSessionID: TGUID): Boolean

Parameters:

  • aSessionID: Session ID

ClearSessions    (declared in TROCustomSessionManager)

Discards all sessions within the session manager, so that any new call from a client will start with a fresh session.

procedure ClearSessions(OnlyExpired: Boolean)

Parameters:

  • OnlyExpired: process only expired sessions or not.

CreateSession    (declared in TROCustomSessionManager)

Creates a new session with provided ID.

function CreateSession(const aSessionID: TGUID): TROSession

Parameters:

  • aSessionID: Session ID

CreateTimerByRequest  protected    (declared in TROCustomSessionManager)

Creates internal timer.

procedure CreateTimerByRequest

DeleteSession    (declared in TROCustomSessionManager)

Deletes the session with specified ID.

procedure DeleteSession(const aSessionID: TGUID; IsExpired: Boolean)

Parameters:

  • aSessionID: Session ID
  • IsExpired: current state of session

DeleteTemporarySession    (declared in TROCustomSessionManager)

Deletes the temporary session.

procedure DeleteTemporarySession(var Session: TROSession)

Parameters:

  • Session: given session.

DoClearSessions  protected override

Discards all sessions within the session manager, so that any new call from a client will start with a fresh session.

procedure DoClearSessions(OnlyExpired: Boolean)

Parameters:

  • OnlyExpired: process only expired sessions or not.

DoCreateSession  protected virtual    (declared in TROCustomSessionManager)

Creates a new session with provided ID.

function DoCreateSession(const aSessionID: TGUID): TROSession

Parameters:

  • aSessionID: Session ID

DoDeleteSession  protected override

Deletes the session with specified ID.

procedure DoDeleteSession(const aSessionID: TGUID; IsExpired: Boolean)

Parameters:

  • aSessionID: Session ID
  • IsExpired: current state of session

DoFindSession  protected override

Tries to use the IOlympiaSessionManager to retrieve an OlympiaUserSession and, if succeeded, converts it into a TROSession.

function DoFindSession(const aSessionID: TGUID; aUpdateTime: Boolean): TROSession

Parameters:

  • aSessionID: Sought session
  • aUpdateTime: Ignored

DoGetAllSessions  protected override

Call the IOlympiaSessionManager and returns its result as a TStringList.

procedure DoGetAllSessions(Dest: TStringList)

Parameters:

  • Dest: Result list

DoGetSessionCount  protected override

Returns the session count.

function DoGetSessionCount: Integer

DoNotifySessionsChangesListener  protected virtual    (declared in TROCustomSessionManager)

Notifies attached listeners about changes

procedure DoNotifySessionsChangesListener(const aSessionID: TGUID; aSessionAction: TROSessionsActions; Sender: TObject)

Parameters:

  • aSessionID: Session ID
  • aSessionAction: action
  • Sender: sender

DoReleaseSession  protected override

Adds aSession into the sessionlist (while the SessionManager.NewSession creates an aSession, but does not add it into sessionlist). Using this method, the user can create a session in the Service.Login and destroy it with the Service.DestroySession in the same method. Sessions will only be created if the Login Method was successful.

procedure DoReleaseSession(aSession: TROSession; NewSession: Boolean)

Parameters:

  • aSession: Session to process
  • NewSession: If true, the SessionManager.CreateSession will be used, otherwise the SessionManager.

DoTimerTick  protected virtual    (declared in TROCustomSessionManager)

Clears expired sessions.

procedure DoTimerTick(CurrentTickCount: Cardinal)

Parameters:

  • CurrentTickCount: ignored

FindSession    (declared in TROCustomSessionManager)

Finds session with the specified GUID

function FindSession(const aSessionID: TGUID; aUpdateTime: Boolean): TROSession

Parameters:

  • aSessionID: Session ID.
  • aUpdateTime: Update LastAccess of found session or not

GetAllSessions  overload    (declared in TROCustomSessionManager)

function GetAllSessions: TROSessionIDs

GetAllSessions (TStringList)  overload    (declared in TROCustomSessionManager)

Returns a string list containing the IDs of all currently active sessions. Depending on the session manager and on your application architecture, this list can be huge, especially when using a database based session list that is shared by a large server farm. Obtaining the full list of sessions can be a costly process.

procedure GetAllSessions(Dest: TStringList)

Parameters:

  • Dest: destination

GetSessionCount    (declared in TROCustomSessionManager)

Returns the session count.

function GetSessionCount: Integer

IsSessionPresent    (declared in TROCustomSessionManager)

function IsSessionPresent(const aSessionID: TGUID): Boolean

Parameters:

  • aSessionID:

KillTimer  protected    (declared in TROCustomSessionManager)

Kills internal timer

procedure KillTimer

LockForReading  protected    (declared in TROCustomSessionManager)

procedure LockForReading

LockForWriting  protected    (declared in TROCustomSessionManager)

procedure LockForWriting

Notification  protected override

Forwards notification messages to all owned components.

procedure Notification(AComponent: TComponent; Operation: TOperation)

Parameters:

  • AComponent: component
  • Operation: operation

RegisterSessionsChangesListener  protected virtual    (declared in TROCustomSessionManager)

Attaches a new IROSessionsChangesListener listener.

procedure RegisterSessionsChangesListener(aListener: IROSessionsChangesListener)

Parameters:

  • aListener: New listener

ReleaseSession    (declared in TROCustomSessionManager)

Releases the previously acquired session.

procedure ReleaseSession(var aSession: TROSession; NewSession: Boolean)

Parameters:

  • aSession: given session
  • NewSession: newly created session or not

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SessionsExpired  protected

Calls DeleteSession to each item of aExpiredSessionIDs.

procedure SessionsExpired(const aExpiredSessionIDs: GuidArray)

Parameters:

  • aExpiredSessionIDs: list of expired ID

TestLastAccess  protected    (declared in TROCustomSessionManager)

function TestLastAccess(const aLastAccess: TDateTime): Boolean

Parameters:

  • aLastAccess:

UnlockForReading  protected    (declared in TROCustomSessionManager)

procedure UnlockForReading

UnlockForWriting  protected    (declared in TROCustomSessionManager)

procedure UnlockForWriting

UnRegisterSessionsChangesListener  protected virtual    (declared in TROCustomSessionManager)

Detaches a previously attached aListener.

procedure UnRegisterSessionsChangesListener(aListener: IROSessionsChangesListener)

Parameters:

  • aListener: Known listener

 

OnBeforeDeleteSession    (declared in TROCustomSessionManager)

Fires before deleting session.

property OnBeforeDeleteSession: TDeleteSessionEvent read write
delegate: procedure OnBeforeDeleteSession(const aSessionID: TGUID; IsExpired: Boolean)

OnCustomCreateSession    (declared in TROCustomSessionManager)

Fires before the session is created. It allows to return existing session for given session ID

property OnCustomCreateSession: TROCustomSessionCreationEvent read write
delegate: procedure OnCustomCreateSession(const aSessionID: TGUID; var Session: TROSession)

OnException    (declared in TROCustomSessionManager)

Fires when an exception is occuring

property OnException: TROSessionExceptionEvent read write
delegate: procedure OnException(aSessionID: TGUID; anException: Exception; var aRetry: Boolean)

OnMaxSessionsReached    (declared in TROCustomSessionManager)

Fires when maximum count of allowed sessions is reached

property OnMaxSessionsReached: TROMaxSessionsReachedEvent read write
delegate: procedure OnMaxSessionsReached(var aFail: Boolean)

OnSessionCreated    (declared in TROCustomSessionManager)

Gets triggered after a new Session has been created. You can use it to perform initialization functions or fill the session with default values.

property OnSessionCreated: TSessionEvent read write
delegate: procedure OnSessionCreated(const aSession: TROSession)

 

  • IOlympiaSessionManagerEvents