ibspan.tss.agents.sha.mvc
Class ViewConstructor

java.lang.Object
  extended by jade.core.behaviours.Behaviour
      extended by jade.core.behaviours.CompositeBehaviour
          extended by jade.core.behaviours.SerialBehaviour
              extended by jade.core.behaviours.FSMBehaviour
                  extended by jade.proto.AchieveREInitiator
                      extended by ibspan.tss.agents.sha.mvc.ViewConstructor
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SimpleViewConstructor

public abstract class ViewConstructor
extends AchieveREInitiator

This behaviour provides a set of methods for constructing view of data in Model-View-Controller architecture by utilizing another agent providing view transforming service. This class should not be used directly, but extended by implementing AchieveREInitiator.prepareRequests(ACLMessage), AchieveREInitiator.handleInform(ACLMessage), handleFailure(ACLMessage) methods, which eventually leaves results of their action, either DataView or InternalSystemError by calling either putView(DataView) or {@link #putError(InternalSystemError), accordingly.

Author:
Maciej Gawinecki
See Also:
DataView, InternalSystemError, Serialized Form

Nested Class Summary
protected static interface Initiator.ProtocolSession
           
 
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
 
Field Summary
protected  String ALL_INITIATIONS_K
           
protected static String CHECK_IN_SEQ
           
protected static String CHECK_SESSIONS
           
protected static String DUMMY_FINAL
           
protected static String HANDLE_FAILURE
           
protected static String HANDLE_NOT_UNDERSTOOD
           
protected static String HANDLE_OUT_OF_SEQ
           
protected  String INITIATION_K
           
protected  SessionHandlingAgent myAgent
           
protected static String PREPARE_INITIATIONS
           
protected static String RECEIVE_REPLY
           
protected  String REPLY_K
           
protected  MsgReceiver replyReceiver
           
protected  MessageTemplate replyTemplate
           
protected static String SEND_INITIATIONS
           
protected  Map sessions
           
 
Fields inherited from class jade.proto.AchieveREInitiator
ALL_REQUESTS_KEY, ALL_RESPONSES_KEY, ALL_RESULT_NOTIFICATIONS_KEY, CHECK_AGAIN, HANDLE_AGREE, HANDLE_ALL_RESPONSES, HANDLE_ALL_RESULT_NOTIFICATIONS, HANDLE_INFORM, HANDLE_REFUSE, REPLY_KEY, REQUEST_KEY
 
Fields inherited from class jade.core.behaviours.FSMBehaviour
currentName, lastStates, previousName
 
Fields inherited from class jade.core.behaviours.CompositeBehaviour
currentExecuted
 
Fields inherited from class jade.core.behaviours.Behaviour
myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
 
Constructor Summary
ViewConstructor(Agent a, DataStore ds)
          Constructs ViewConstructor.
 
Method Summary
protected  void adjustReplyTemplate(ACLMessage arg0)
           
protected  String createConvId(Vector arg0)
           
protected  SHA_process_user_request getAction()
          Returns action concept extracted from current request.
protected  String getActionName()
          Returns the name of action resolved by action dispatcher for current request.
protected  DataModel getModel()
          Returns the model constructed by the ModelConstructor.
protected  UserRequest getUserRequest()
          Returns concept of current user request.
protected  void handleFailure(ACLMessage arg0)
           
protected  void handleNotUnderstood(ACLMessage arg0)
           
protected  void handleOutOfSequence(ACLMessage arg0)
           
 int onEnd()
           
 void onStart()
           
protected  void putError(InternalSystemError error)
          Puts the given error in the DataStore in case of constructing failure.
protected  void putView(DataView view)
          Puts the given view in the DataStore as the result of successful constructing.
 void registerHandleFailure(Behaviour arg0)
           
 void registerHandleNotUnderstood(Behaviour arg0)
           
 void registerHandleOutOfSequence(Behaviour arg0)
           
protected  void registerPrepareInitiations(Behaviour arg0)
           
 void reset()
           
 void reset(ACLMessage arg0)
           
protected  void sendInitiations(Vector arg0)
           
 void setAccessKeys(Object actKey, Object actionNameKey, Object resultKey)
          Sets the keys necessary for the work of this behaviour.
 void setDataStore(DataStore arg0)
           
 
Methods inherited from class jade.proto.AchieveREInitiator
checkInSequence, checkSessions, getSession, getToBeReset, handleAgree, handleAllResponses, handleAllResultNotifications, handleInform, handleRefuse, initializeDataStore, prepareInitiations, prepareRequests, registerHandleAgree, registerHandleAllResponses, registerHandleAllResultNotifications, registerHandleInform, registerHandleRefuse, registerPrepareRequests, reinit
 
Methods inherited from class jade.core.behaviours.FSMBehaviour
checkTermination, deregisterState, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, resetStates, scheduleFirst, scheduleNext
 
Methods inherited from class jade.core.behaviours.SerialBehaviour
handle
 
Methods inherited from class jade.core.behaviours.CompositeBehaviour
action, block, done, registerAsChild, resetChildren, restart, setAgent
 
Methods inherited from class jade.core.behaviours.Behaviour
actionWrapper, block, getBehaviourName, getDataStore, getExecutionState, getParent, isRunnable, root, setBehaviourName, setExecutionState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myAgent

protected SessionHandlingAgent myAgent

INITIATION_K

protected final String INITIATION_K

ALL_INITIATIONS_K

protected final String ALL_INITIATIONS_K

REPLY_K

protected final String REPLY_K

PREPARE_INITIATIONS

protected static final String PREPARE_INITIATIONS
See Also:
Constant Field Values

SEND_INITIATIONS

protected static final String SEND_INITIATIONS
See Also:
Constant Field Values

RECEIVE_REPLY

protected static final String RECEIVE_REPLY
See Also:
Constant Field Values

CHECK_IN_SEQ

protected static final String CHECK_IN_SEQ
See Also:
Constant Field Values

HANDLE_NOT_UNDERSTOOD

protected static final String HANDLE_NOT_UNDERSTOOD
See Also:
Constant Field Values

HANDLE_FAILURE

protected static final String HANDLE_FAILURE
See Also:
Constant Field Values

HANDLE_OUT_OF_SEQ

protected static final String HANDLE_OUT_OF_SEQ
See Also:
Constant Field Values

CHECK_SESSIONS

protected static final String CHECK_SESSIONS
See Also:
Constant Field Values

DUMMY_FINAL

protected static final String DUMMY_FINAL
See Also:
Constant Field Values

sessions

protected Map sessions

replyReceiver

protected MsgReceiver replyReceiver

replyTemplate

protected MessageTemplate replyTemplate
Constructor Detail

ViewConstructor

public ViewConstructor(Agent a,
                       DataStore ds)
Constructs ViewConstructor.

Parameters:
a - is the agent owning this behaviour.
ds - is the DataStore for this constructor.
Method Detail

setAccessKeys

public void setAccessKeys(Object actKey,
                          Object actionNameKey,
                          Object resultKey)
Sets the keys necessary for the work of this behaviour.

Parameters:
actKey - is the key in the DataStore where the Action concept extracted from current request can be found.
actionNameKey - is tThe key in the DataStore where the name of action resolved by action dispatcher - for current request - can be found.
resultKey - is the key in the DataStore where the results of work of this constructor will be put.

onEnd

public int onEnd()
Overrides:
onEnd in class FSMBehaviour

getModel

protected DataModel getModel()
Returns the model constructed by the ModelConstructor.

Returns:
constructred model.
See Also:
ModelConstructor

putView

protected void putView(DataView view)
Puts the given view in the DataStore as the result of successful constructing.

Parameters:
view - is the result view of construction.

putError

protected void putError(InternalSystemError error)
Puts the given error in the DataStore in case of constructing failure.

Parameters:
error - is the error encounter during constructing process.

getAction

protected SHA_process_user_request getAction()
Returns action concept extracted from current request.

Returns:
action.

getUserRequest

protected UserRequest getUserRequest()
Returns concept of current user request.

Returns:
user request.

getActionName

protected String getActionName()
Returns the name of action resolved by action dispatcher for current request.

Returns:
name of the action.

sendInitiations

protected void sendInitiations(Vector arg0)

handleNotUnderstood

protected void handleNotUnderstood(ACLMessage arg0)

handleFailure

protected void handleFailure(ACLMessage arg0)

handleOutOfSequence

protected void handleOutOfSequence(ACLMessage arg0)

registerPrepareInitiations

protected void registerPrepareInitiations(Behaviour arg0)

registerHandleNotUnderstood

public void registerHandleNotUnderstood(Behaviour arg0)

registerHandleFailure

public void registerHandleFailure(Behaviour arg0)

registerHandleOutOfSequence

public void registerHandleOutOfSequence(Behaviour arg0)

reset

public void reset()
Overrides:
reset in class FSMBehaviour

reset

public void reset(ACLMessage arg0)

onStart

public void onStart()
Overrides:
onStart in class Behaviour

setDataStore

public void setDataStore(DataStore arg0)
Overrides:
setDataStore in class Behaviour

createConvId

protected String createConvId(Vector arg0)

adjustReplyTemplate

protected void adjustReplyTemplate(ACLMessage arg0)