gui.transact
Class Transaction

java.lang.Object
  extended by java.util.Observable
      extended by gui.transact.Transaction

public class Transaction
extends java.util.Observable

This class models a transaction (i.e. a communication with the speech/dialogue server) . This class contains the "context" of the state machine. A Transaction object records which instance of TrState is the current state and a history of the states. Subclasses of TrState use a Transition object to communicate changes in the state back to the Transaction.


Field Summary
private  ApplicationState appState
           
private  SpeechHandler calRecHandler
           
private static java.lang.String CMD_REMOVE_CONTEXT
           
private  CalendarConfiguration config
           
(package private)  ClientCom dialClient
           
private  DialogueServerHandler dialServHandler
           
static java.util.logging.Logger logger
           
private  Dialogue observableDialog
           
private static java.lang.String OK_RESPONSE_REMOVE_CONTEXT
           
private  TrState state
           
private  boolean visitedReadyState
           
private  java.util.Vector<TrState> visitedStates
           
 
Constructor Summary
Transaction(CalendarConfiguration config, ApplicationState appState, Dialogue observableDialog)
           
 
Method Summary
protected  void addVisitedState(TrState visitedState)
           
(package private)  ApplicationState getAppState()
           
(package private)  SpeechHandler getCalRecHandler()
           
(package private)  CalendarConfiguration getConfig()
           
protected  ClientCom getDialClient()
           
(package private)  DialogueServerHandler getDialServHandler()
           
(package private)  Dialogue getObservableDialog()
           
protected  java.util.Vector<TrState> getVisitedStates()
           
(package private)  boolean isVisitedReadyState()
           
 void nextStep()
          When the tasks for this state were executed already, then the user can ask for the next state.
 void removeVisitedStates()
          Removes all visited states, except TRInitGlobalProcesses state
 void runTasks()
          Executes the tasks for the current state.
 void sendRemoveContextCmdToDialogueServer()
          Invokes the dialogue server
(package private)  java.lang.String sendRequestToDialogueServer(java.lang.String msg4DialogueServer)
          Sends a message to the dialogue server.
protected  void setDialClient(ClientCom dialClient)
           
 void setState(TrState state)
          Changes the current state and notifies observers of Transaction.
(package private)  void setVisitedReadyState(boolean visitedReadyState)
           
 java.lang.String status()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger

CMD_REMOVE_CONTEXT

private static final java.lang.String CMD_REMOVE_CONTEXT
See Also:
Constant Field Values

OK_RESPONSE_REMOVE_CONTEXT

private static final java.lang.String OK_RESPONSE_REMOVE_CONTEXT
See Also:
Constant Field Values

state

private TrState state

visitedStates

private java.util.Vector<TrState> visitedStates

visitedReadyState

private boolean visitedReadyState

config

private CalendarConfiguration config

appState

private ApplicationState appState

observableDialog

private Dialogue observableDialog

calRecHandler

private SpeechHandler calRecHandler

dialServHandler

private DialogueServerHandler dialServHandler

dialClient

ClientCom dialClient
Constructor Detail

Transaction

public Transaction(CalendarConfiguration config,
                   ApplicationState appState,
                   Dialogue observableDialog)
Method Detail

isVisitedReadyState

boolean isVisitedReadyState()

setVisitedReadyState

void setVisitedReadyState(boolean visitedReadyState)

getVisitedStates

protected java.util.Vector<TrState> getVisitedStates()

addVisitedState

protected void addVisitedState(TrState visitedState)

getObservableDialog

Dialogue getObservableDialog()

getConfig

CalendarConfiguration getConfig()

getAppState

ApplicationState getAppState()

getCalRecHandler

SpeechHandler getCalRecHandler()

getDialServHandler

DialogueServerHandler getDialServHandler()

nextStep

public void nextStep()
When the tasks for this state were executed already, then the user can ask for the next state. This "nextStep()" method elicits different behaviours, depending on the state of the transaction.


runTasks

public void runTasks()
Executes the tasks for the current state.


setState

public void setState(TrState state)
Changes the current state and notifies observers of Transaction.


status

public java.lang.String status()
Returns:
a textual description of the transaction's state

removeVisitedStates

public void removeVisitedStates()
Removes all visited states, except TRInitGlobalProcesses state


getDialClient

protected ClientCom getDialClient()

setDialClient

protected void setDialClient(ClientCom dialClient)

sendRequestToDialogueServer

java.lang.String sendRequestToDialogueServer(java.lang.String msg4DialogueServer)
Sends a message to the dialogue server.

Parameters:
msg4DialogueServer - message to be send to the dialogue server. e.g., msg4DialogueServer contains the N-best list previously received from the regServer.
Returns:
reply from the dialogue server

sendRemoveContextCmdToDialogueServer

public void sendRemoveContextCmdToDialogueServer()
Invokes the dialogue server

Parameters:
msg4DialogueServer - message to be send to the dialogue server