ibspan.tss.agents.sha.mvc
Class Controller

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 ibspan.tss.agents.sha.mvc.Controller
All Implemented Interfaces:
Serializable

public class Controller
extends FSMBehaviour

This behaviour plays the role of controller in Model-View-Controller architecture. Invokes ModelConstructor which constructs DataModel object according to the user request and then calles ViewConstructor, which transforms this model into ibspan.tss.messaging.ontology.ViewModel object. If any of this action failed, then message with InternalSystemError concept will be put as result notification; otherwise the constructed DataView is put as a result. The developer is provided with methods for registering both: ModelConstructor and ViewConstructor. Registration provides also both constructors with keys to access the following data in local DataStore: action and actionName (extracted from request by ActionDispatcherWithSessionTracking) and the key (CONSTRUCTED_RESULT_KEY) for exchanging model and view among constructors and controller, too.

Author:
Maciej Gawinecki
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
 
Field Summary
 String CONSTRUCTED_RESULT_KEY
           
static int FAILURE_OF_CONSTRUCT
           
static int SUCCESS_OF_CONSTRUCT
           
 
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
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
 
Constructor Summary
Controller(Agent a, DataStore ds, Object requestKey, Object notificationKey, Object actKey, Object actionNameKey)
          Constructs Controller.
 
Method Summary
 void registerModelConstructor(ModelConstructor mc)
          Registers the given Model Constructor in this Controller.
 void registerViewConstructor(ViewConstructor vc)
          Registers the given View Constructor in this Controller.
 
Methods inherited from class jade.core.behaviours.FSMBehaviour
checkTermination, deregisterState, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, onEnd, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, reset, 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, onStart, root, setBehaviourName, setDataStore, setExecutionState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTRUCTED_RESULT_KEY

public final String CONSTRUCTED_RESULT_KEY

SUCCESS_OF_CONSTRUCT

public static final int SUCCESS_OF_CONSTRUCT
See Also:
Constant Field Values

FAILURE_OF_CONSTRUCT

public static final int FAILURE_OF_CONSTRUCT
See Also:
Constant Field Values
Constructor Detail

Controller

public Controller(Agent a,
                  DataStore ds,
                  Object requestKey,
                  Object notificationKey,
                  Object actKey,
                  Object actionNameKey)
Constructs Controller.

Parameters:
a - is the agent this behaviour belongs to.
ds - data store
actKey - key for accessing action of user request from local DataStore
actionNameKey - key for accessing action name of user request from local DataStore
requestKey - key for accessing user request ACL message from local DataStore
notificationKey - key in local Data Store, where result of Controller behaviour should be put at
Method Detail

registerModelConstructor

public void registerModelConstructor(ModelConstructor mc)
Registers the given Model Constructor in this Controller. It also provided the constructor with access keys to exchange data via local DataStore.

Parameters:
mc - model constructor

registerViewConstructor

public void registerViewConstructor(ViewConstructor vc)
Registers the given View Constructor in this Controller. It also provided the constructor with access keys to exchange data via local DataStore.

Parameters:
vc - view constructor