Class LifeCycleEventHandler
Abstract base class for a lifecycle event handler.
Implements
Inherited Members
Namespace: Attachmate.Verastream.HostIntegrator.ScriptAPI
Assembly: Attachmate.Verastream.HostIntegrator.ScriptAPI.dll
Syntax
public abstract class LifeCycleEventHandler : MarshalByRefObject, IEventHandler
Remarks
Abstract base class for a lifecycle event handler. All classes that
extend this class appear as lifecycle event handlers in the VHI design
tool.
Except for the authenticate client event, the lifecycle events correspond
to the build up and tear down of objects within VHI. Their primary purpose is
to allow for the initialization and cleanup of the model and client shared
state. None of the events have access to the terminal screen. If
initialization or cleanup of the terminal is needed, see
ModelEventHandler.
The order in which these events fire on build up is as follows:
- Model loaded
- Host session created
- Authenticate client
- Client session created
The order in which these events fire on tear down is as follows:
- Client session destroyed
- Host session destroyed
- Model unloaded
Methods
AuthenticateUser(IAuthenticateUserEvent)
Called to authenticate a client connecting to the VHI server.
Declaration
public virtual bool AuthenticateUser(IAuthenticateUserEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IAuthenticateUserEvent | vsEvent | The event instance. |
Returns
Type | Description |
---|---|
bool | True to allow the connection or false to reject it. |
Remarks
Called to authenticate a client connecting to the VHI server. This occurs after a client has been authenticated and authorized by VHI security. The VHI design tool simulates a client connecting when a model is loaded and when the jar files are rebuilt. This event always fires before a client session is created. The VHI server will reject the client's connection request if false is returned or an exception is thrown. The design tool will simply report the rejection or exception.
Exceptions
Type | Condition |
---|---|
ApptrieveException | Throws a ApptrieveException if there is any error. |
ClientSessionCreated(IClientSessionCreatedEvent)
Called when a client session is created.
Declaration
public virtual void ClientSessionCreated(IClientSessionCreatedEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IClientSessionCreatedEvent | vsEvent | The event instance. |
Remarks
Called when a client session is created. This occurs after a client
has been granted access to a host session but before a client is
allowed to make any requests. The VHI design tool simulates a client
connecting when a model is loaded and when the jar files are rebuilt.
This event always fires before the ClientConnected(IClientConnectedEvent)
event.
This event is the first opportunity to initialize the client
session shared state.
If an exception is thrown from this event the VHI server will log the error and fail the client connection. The design tool will simply report the exception and move on.
Exceptions
Type | Condition |
---|---|
ApptrieveException | Throws a ApptrieveException if there is any error. |
ClientSessionDestroyed(IClientSessionDestroyedEvent)
Called when a client session is destroyed.
Declaration
public virtual void ClientSessionDestroyed(IClientSessionDestroyedEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IClientSessionDestroyedEvent | vsEvent | The event instance. |
Remarks
Called when a client session is destroyed. This occurs after a client
has disconnected. The VHI design tool simulates a client disconnecting
when a model is closed and when the jar files are rebuilt. This event
always fires after the ClientDisconnected(IClientDisconnectedEvent)
event.
This event is the last opportunity to do any needed cleanup of the
client session shared state.
If an exception is thrown from this event the VHI server will log
the error and move on. The design tool will report the exception and
move on.
Exceptions
Type | Condition |
---|---|
ApptrieveException | Throws a ApptrieveException if there is any error. |
HostSessionCreated(IHostSessionCreatedEvent)
Called when a host session is created.
Declaration
public virtual void HostSessionCreated(IHostSessionCreatedEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IHostSessionCreatedEvent | vsEvent | The event instance. |
Remarks
Called when a host session is created. For the VHI server this occurs
when a session pool is created or augmented and when a dedicated session
is created for a client in response to connectToModel(). For the VHI
design tool this occurs when a model is loaded and when the jar files
are rebuilt.
This event is the first opportunity to initialize the model
shared state with any host session specific information. The host
session ID can be used to construct a unique key for storing
such information.
This event does not have access to the host session's terminal. If
initialization of the terminal is needed, see
ExecuteLogin(IExecuteLoginEvent).
If an exception is thrown from this event the VHI server will log
the error and fail the host session creation. If the host session is
being created in response to a connectToModel() request, the connection
will fail. The design tool will simply report the exception and move on.
HostSessionDestroyed(IHostSessionDestroyedEvent)
Called when a host session is destroyed.
Declaration
public virtual void HostSessionDestroyed(IHostSessionDestroyedEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IHostSessionDestroyedEvent | vsEvent | The event instance. |
Remarks
Called when a host session is destroyed. For the VHI server this occurs
when a session pool is destroyed or decreased in size and when a
dedicated session obtained via connecToModel() is released by its
client. For the VHI design tool this occurs when a model is closed and
when the jar files are rebuilt.
This event is the last opportunity to do any cleanup of host
session specific information stored in the model shared state.
This event does not have access to the host session's terminal. If
cleanup of the terminal is needed, see
ExecuteLogout(IExecuteLogoutEvent)
If an exception is thrown from this event the VHI server will log
the error and move on. The design tool will report the exception and
move on.
Exceptions
Type | Condition |
---|---|
ApptrieveException | Throws a ApptrieveException if there is any error. |
InitializeLifetimeService()
Tell the .NET Framework remoting system that instances of this type have an infinite lifetime.
Declaration
public override object InitializeLifetimeService()
Returns
Type | Description |
---|---|
object | A null value. |
Overrides
ModelLoaded(IModelLoadedEvent)
Called when a model is loaded.
Declaration
public virtual void ModelLoaded(IModelLoadedEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IModelLoadedEvent | vsEvent | The event instance. |
Remarks
Called when a model is loaded. For the VHI server this occurs when the
server starts and when a model is deployed. For the VHI design tool this
occurs when a model is opened or when the jar files are rebuilt.
This event will fire once per version of a model before any
associated host sessions are created. It is the first opportunity to
initialize the model shared state.
If an exception is thrown from this event the VHI server will log the
error and fail to load the model. This means that clients will be unable
to connect to the model or any session pools based on the model. The
design tool will simply report the exception and move on.
Exceptions
Type | Condition |
---|---|
ApptrieveException | Throws a Attachmate.Verastream.HostIntegrator.ScriptAPI.ApptrieveException if there is any error. |
ModelUnloaded(IModelUnloadedEvent)
Called when a model is unloaded.
Declaration
public virtual void ModelUnloaded(IModelUnloadedEvent vsEvent)
Parameters
Type | Name | Description |
---|---|---|
IModelUnloadedEvent | vsEvent | The event instance. |
Remarks
Called when a model is unloaded. For the VHI server this occurs when
the server is shutdown or when a model is undeployed. For the VHI design
tool this occurs when a model is closed and when the jar files are
rebuilt.
This event will fire once per version of a model only after all
associated host sessions have been destroyed. It is the last opportunity
to do any cleanup of the model shared state.
If an exception is thrown from this event the VHI server will log
the error and move on. The design tool will report the exception and
move on.
Exceptions
Type | Condition |
---|---|
ApptrieveException | Throws a ApptrieveException if there is any error. |