public abstract class LifeCycleEventHandler extends java.lang.Object implements EventHandler
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:
The order in which these events fire on tear down is as follows:
DEFAULT_TIMEOUT
Constructor and Description |
---|
LifeCycleEventHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticateUser(AuthenticateUserEvent event)
Called to authenticate a client connecting to the VHI server.
|
void |
clientSessionCreated(ClientSessionCreatedEvent event)
Called when a client session is created.
|
void |
clientSessionDestroyed(ClientSessionDestroyedEvent event)
Called when a client session is destroyed.
|
void |
hostSessionCreated(HostSessionCreatedEvent event)
Called when a host session is created.
|
void |
hostSessionDestroyed(HostSessionDestroyedEvent event)
Called when a host session is destroyed.
|
void |
modelLoaded(ModelLoadedEvent event)
Called when a model is loaded.
|
void |
modelUnloaded(ModelUnloadedEvent event)
Called when a model is unloaded.
|
public void modelLoaded(ModelLoadedEvent event) throws ApptrieveException
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.
event
- the event instanceApptrieveException
public void modelUnloaded(ModelUnloadedEvent event) throws ApptrieveException
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.
event
- the event instanceApptrieveException
public void hostSessionCreated(HostSessionCreatedEvent event) throws ApptrieveException
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
ModelEventHandler.executeLogin(com.wrq.vhi.script.api.ExecuteLoginEvent)
.
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.
event
- the event instanceApptrieveException
public void hostSessionDestroyed(HostSessionDestroyedEvent event) throws ApptrieveException
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
ModelEventHandler.executeLogout(com.wrq.vhi.script.api.ExecuteLogoutEvent)
.
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.
event
- the event instanceApptrieveException
public boolean authenticateUser(AuthenticateUserEvent event) throws ApptrieveException
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.
event
- the event instanceApptrieveException
public void clientSessionCreated(ClientSessionCreatedEvent event) throws ApptrieveException
ModelEventHandler.clientConnected(com.wrq.vhi.script.api.ClientConnectedEvent)
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.
event
- the event instanceApptrieveException
public void clientSessionDestroyed(ClientSessionDestroyedEvent event) throws ApptrieveException
ModelEventHandler.clientDisconnected(com.wrq.vhi.script.api.ClientDisconnectedEvent)
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.
event
- the event instanceApptrieveException