org.almendra.janet.cas.scheduling
Class CommandResponseEnvelope

java.lang.Object
  extended by org.almendra.janet.cas.scheduling.CommandEnvelope
      extended by org.almendra.janet.cas.scheduling.CommandResponseEnvelope
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IExecutable, ICommandHolder, IPrioritizedObject
Direct Known Subclasses:
CommandAckEnvelope, CommandCallbackEnvelope, CommandReplyEnvelope

public abstract class CommandResponseEnvelope
extends CommandEnvelope

Author:
Oliver
See Also:
Serialized Form

Field Summary
protected  boolean back
           
protected  boolean executed
           
protected  AgentPath replyToAgentPath
           
protected  java.io.Serializable response
           
protected  java.lang.String responseId
           
 
Fields inherited from class org.almendra.janet.cas.scheduling.CommandEnvelope
command, COMMAND_TYPE_BALANCING, COMMAND_TYPE_SHARING, currentAgent, currentScheduler, destinationAgent, executionFinished, executionStarted, history, id, isForeign, isIgnore, kind, logger, node, predefinedInterpreter, qualifiedCapabilityName, suspended, suspendedLock
 
Constructor Summary
CommandResponseEnvelope(AgentPath agentPath, ICommand command, Logger logger, java.lang.String responseId, java.lang.String nodeName)
          Creates a new CommandResponseEnvelope object.
 
Method Summary
protected abstract  void callHandler()
          CommandEnvelope has arrived at the initial sender agent.
 void callHandler(IAgent agent)
           
 void execute(IInterpreter interpreter)
           
 AgentPath getReplyToAgentPath()
           
protected abstract  java.lang.String getSpecificSuffix()
           
protected  java.lang.String getSuffix()
           
 boolean isBack()
           
 boolean isSynchronousResponse()
           
protected  void prepareSendBack()
           
protected  void sendBack()
           
 void setBack(boolean back)
           
 void setReplyItem(CommandHistoryItem item)
           
 void setReplyToAgentPath(AgentPath replyToAgentPath)
           
 void setResponse(java.io.Serializable responseObject)
           
 
Methods inherited from class org.almendra.janet.cas.scheduling.CommandEnvelope
aboutToBeSent, addHistoryItem, arrivedAt, clone, execute, getAccessor, getAgentDispatcher, getAgentPath, getAgentProxy, getAllForeignAgents, getApplicationEventRegistry, getApplicationName, getApplicationObjectSpace, getCapabilityName, getCapabilityPath, getClusterEventRegistry, getCommand, getCrossAgent, getCurrentAgent, getCurrentAgentProxy, getCurrentScheduler, getDestinationAgent, getDestinationAgentCapabilityPath, getDestinationAgentName, getForeignAgent, getGlobalId, getHistory, getKind, getLastHistoryItem, getLastOriginNodeName, getLocalAgentPath, getLocalCapabilityPath, getLocalizedDestinationAgentName, getLogger, getNewHistoryItem, getNode, getNodeAccessor, getNodeEventRegistry, getNodeName, getNodeNameObject, getNodeObjectSpace, getOriginAgentPath, getOriginDestinationAgentName, getOriginNodeName, getPredefinedInterpreter, getPriority, getQualifiedCapabilityName, getQualifiedDestinationAgentName, getResponseHistoryItem, invokeOnCommand, isEventHandlerCommand, isExecutionFinished, isExecutionStarted, isForeign, isIgnore, isLocal, isSuspended, isWorkloadCommand, log, reinsertIntoQueue, removeFromQueue, setArrivalTime, setCommand, setCreationTime, setCurrentAgent, setCurrentScheduler, setDestinationAgent, setEndExecutionTime, setExecutionFinished, setExecutionStarted, setHistoryItem, setIgnore, setKind, setLocalOrForeign, setLogger, setNewDestination, setNode, setPredefinedInterpreter, setSendTime, setStartExecutionTime, setSuspended, testSetSuspended, toLogString, toPrintString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

replyToAgentPath

protected AgentPath replyToAgentPath

response

protected java.io.Serializable response

executed

protected boolean executed

back

protected boolean back

responseId

protected java.lang.String responseId
Constructor Detail

CommandResponseEnvelope

public CommandResponseEnvelope(AgentPath agentPath,
                               ICommand command,
                               Logger logger,
                               java.lang.String responseId,
                               java.lang.String nodeName)
Creates a new CommandResponseEnvelope object.

Method Detail

setReplyItem

public void setReplyItem(CommandHistoryItem item)

sendBack

protected void sendBack()
Parameters:
replyObject -

prepareSendBack

protected void prepareSendBack()

execute

public void execute(IInterpreter interpreter)
Overrides:
execute in class CommandEnvelope

callHandler

protected abstract void callHandler()
CommandEnvelope has arrived at the initial sender agent. Invoke callback handler to handle the response.


setReplyToAgentPath

public void setReplyToAgentPath(AgentPath replyToAgentPath)
Parameters:
replyToAgentPath - The replyToAgentPath to set.

getReplyToAgentPath

public AgentPath getReplyToAgentPath()
Returns:
Returns the replyToAgentPath.

getSuffix

protected java.lang.String getSuffix()
Overrides:
getSuffix in class CommandEnvelope
Returns:

getSpecificSuffix

protected abstract java.lang.String getSpecificSuffix()

isBack

public boolean isBack()

setResponse

public void setResponse(java.io.Serializable responseObject)
                 throws InvalidMessageException
Overrides:
setResponse in class CommandEnvelope
Throws:
InvalidMessageException

isSynchronousResponse

public boolean isSynchronousResponse()
Overrides:
isSynchronousResponse in class CommandEnvelope

callHandler

public void callHandler(IAgent agent)
Parameters:
agent -

setBack

public void setBack(boolean back)
Parameters:
back - The back to set.