com.wrq.vhi.script.api
Interface Event

All Known Subinterfaces:
ApplyFilterEvent, AttributeEvent, AuthenticateUserEvent, ClientConnectedEvent, ClientDisconnectedEvent, ClientSessionCreatedEvent, ClientSessionDestroyedEvent, EntityArrivalEvent, EntityDepartureEvent, EntityEvent, EntityMoveCursorEvent, ErrorReportedEvent, ExecuteLoginEvent, ExecuteLogoutEvent, ExecuteOperationEvent, ExecuteProcedureEvent, FieldEvent, FormatErrorEvent, GetCurrentHostRecordEvent, GetRecordTypeEvent, HostSessionCreatedEvent, HostSessionDestroyedEvent, HostSessionEvent, InsertRecordEvent, IsTerminatedEvent, LifeCycleEvent, ModelCursorEvent, ModelEvent, ModelLoadedEvent, ModelMoveCursorBackwardEvent, ModelMoveCursorEvent, ModelMoveCursorForwardEvent, ModelUnloadedEvent, ParseRecordEvent, ParseScreenEvent, ProcessStringEvent, ReadAttributeEvent, ReadFieldEvent, RecordEvent, RecordSetEvent, UnrecognizedScreenEvent, UpdateRecordEvent, WriteAttributeEvent, WriteAttributesEvent, WriteFieldEvent

public interface Event

Base interface for script events.


Method Summary
 void checkForTimeout()
          Checks if the event or a parent event has timed out.
 ErrorMessage createErrorMessage(int errorCode)
          Creates a VHI defined error message without parameters.
 ErrorMessage createErrorMessage(int errorCode, java.lang.Object[] params)
          Creates a VHI defined error message with parameters.
 RemoteHostSession createHostSession()
          Creates a new RemoteHostSession object that can be used to connect to a different model.
 ErrorMessage createUserErrorMessage(java.lang.String message)
          Creates a user-defined error message.
 java.util.List getEventStack()
          Gets the stack of currently executing events.
 java.lang.String getHandlerProperty(java.lang.String name)
          Gets the value of the given handler property.
 Logger getLogger()
          Gets the logging interface used to make entries in the VHI log file.
 boolean isDesignEnvironment()
          Determines whether or not an event is being fired in a design environment.
 

Method Detail

getLogger

Logger getLogger()
Gets the logging interface used to make entries in the VHI log file. The Logger interface must only be used within the event that obtained it. No reference to the interface should exist upon returning from the event.

Returns:
the logging interface

checkForTimeout

void checkForTimeout()
                     throws EventTimeoutException
Checks if the event or a parent event has timed out. If a timeout has not occurred, this method does nothing. If a timeout has occurred, however, this method throws an EventTimeoutException exception.

Throws:
EventTimeoutException - if the event or a parent event has timed out

getEventStack

java.util.List getEventStack()
Gets the stack of currently executing events. The first event in the list is the outer most event, while the last event in the list is this event.

Returns:
an immutable list of EventInfo objects

getHandlerProperty

java.lang.String getHandlerProperty(java.lang.String name)
Gets the value of the given handler property. If the property is not found, null is returned.

Parameters:
name - property name
Returns:
the value of the property or null

isDesignEnvironment

boolean isDesignEnvironment()
Determines whether or not an event is being fired in a design environment.

Returns:
true if the event is being fired by the VHI Design Tool and false if it is being fired by the VHI Server.

createHostSession

RemoteHostSession createHostSession()
Creates a new RemoteHostSession object that can be used to connect to a different model. This object is NOT associated with the event's host session. Instead, a connection to a different model can be made via one of the various connect methods on RemoteHostSession. The RemoteHostSession interface is not thread safe, so care must be taken in using it outside of the event that created it. To avoid threading issues altogether, it should only be used within the host session that created it.

Returns:
a new remote host session connector

createUserErrorMessage

ErrorMessage createUserErrorMessage(java.lang.String message)
Creates a user-defined error message. One or more error messages can be used to create an ApptrieveException.

Parameters:
message -
Returns:
the resulting ErrorMessage object

createErrorMessage

ErrorMessage createErrorMessage(int errorCode)
Creates a VHI defined error message without parameters. One or more error messages can be used to create an ApptrieveException.

Parameters:
errorCode - the VHI error code
Returns:
the resulting ErrorMessage object
Throws:
java.lang.IllegalArgumentException - if the errorCode is invalid

createErrorMessage

ErrorMessage createErrorMessage(int errorCode,
                                java.lang.Object[] params)
Creates a VHI defined error message with parameters. One or more error messages can be used to create an ApptrieveException.

Parameters:
errorCode - the VHI defined error code
params - the error message parameter values
Returns:
the resulting ErrorMessage object
Throws:
java.lang.IllegalArgumentException - if the errorCode is invalid or the number of parameters for the error is incorrect