org.almendra.janet.cas.scheduling
Class CommandEnvelope
java.lang.Object
org.almendra.janet.cas.scheduling.CommandEnvelope
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, IExecutable, ICommandHolder, IPrioritizedObject
- Direct Known Subclasses:
- CommandResponseEnvelope
public class CommandEnvelope
- extends java.lang.Object
- implements java.io.Serializable, java.lang.Cloneable, IPrioritizedObject, IExecutable, ICommandHolder
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
COMMAND_TYPE_BALANCING
public static final int COMMAND_TYPE_BALANCING
- See Also:
- Constant Field Values
COMMAND_TYPE_SHARING
public static final int COMMAND_TYPE_SHARING
- See Also:
- Constant Field Values
command
protected ICommand command
logger
protected transient Logger logger
history
protected CommandHistory history
id
protected UniqueId id
destinationAgent
protected AgentPath destinationAgent
currentAgent
protected transient IAgent currentAgent
node
protected transient Node node
predefinedInterpreter
protected transient IInterpreter predefinedInterpreter
isForeign
protected boolean isForeign
isIgnore
protected transient boolean isIgnore
suspended
protected transient volatile boolean suspended
suspendedLock
protected java.io.Serializable suspendedLock
executionStarted
protected transient boolean executionStarted
executionFinished
protected transient boolean executionFinished
currentScheduler
protected transient CommandScheduler currentScheduler
qualifiedCapabilityName
protected transient java.lang.String qualifiedCapabilityName
kind
protected int kind
CommandEnvelope
protected CommandEnvelope()
- Creates a new
CommandEnvelope
object.
CommandEnvelope
protected CommandEnvelope(CommandEnvelope env)
- Creates a new
CommandEnvelope
object.
CommandEnvelope
public CommandEnvelope(AgentPath agentPath,
ICommand command,
Logger logger,
java.lang.String nodeName)
setNewDestination
public void setNewDestination(AgentPath agentPath,
java.lang.String nodeName)
addHistoryItem
protected void addHistoryItem(CommandHistoryItem item,
java.lang.String nodeName)
- Parameters:
item
-
getCommand
public ICommand getCommand()
- Specified by:
getCommand
in interface ICommandHolder
- Returns:
getCurrentAgent
public IAgent getCurrentAgent()
- Return the agent that received this
CommandEnvelope
. This method must
not be public as the user could get unrestricted access to the node object. Such
access should only be granted to system commands that are executed by the system
agent. Such access has to be controlled by throwing an InsufficientPrivelegeException
if the owning agent is not the system agent.
- Returns:
- Returns the currentAgent.
getCurrentAgentProxy
public IAgentProxy getCurrentAgentProxy()
getApplicationObjectSpace
public IObjectSpace getApplicationObjectSpace()
- Returns:
getGlobalId
public UniqueId getGlobalId()
getHistory
public CommandHistory getHistory()
- Returns:
- Returns the history.
getResponseHistoryItem
public CommandHistoryItem getResponseHistoryItem(java.lang.String nodeName)
- Returns:
getNewHistoryItem
public CommandHistoryItem getNewHistoryItem(java.lang.String nodeName)
- Returns:
setArrivalTime
public void setArrivalTime()
setCreationTime
public void setCreationTime()
setCurrentAgent
public void setCurrentAgent(IAgent currentAgent)
- Parameters:
currentAgent
- The currentAgent to set.
setEndExecutionTime
public void setEndExecutionTime()
setSendTime
public void setSendTime()
setStartExecutionTime
public void setStartExecutionTime()
toLogString
public java.lang.String toLogString()
toPrintString
public java.lang.String toPrintString()
getSuffix
protected java.lang.String getSuffix()
- Returns:
getAgentDispatcher
public IAgentDispatcher getAgentDispatcher(java.lang.String qualifiedAgentPath)
throws NoSuchAgentException,
IllegalAgentAccessException
- Parameters:
string
-
- Returns:
-
- Throws:
NoSuchAgentException
IllegalAgentAccessException
getAccessor
public CommandAccessor getAccessor()
- Returns:
getOriginDestinationAgentName
public java.lang.String getOriginDestinationAgentName()
- Returns:
getLastHistoryItem
protected CommandHistoryItem getLastHistoryItem()
- Returns:
getNodeName
public java.lang.String getNodeName()
getNode
public Node getNode()
throws InsufficientPrivilegeException
- Throws:
InsufficientPrivilegeException
getNodeAccessor
public NodeAccessor getNodeAccessor()
getApplicationEventRegistry
public ILocalEventRegistry getApplicationEventRegistry()
getApplicationName
public java.lang.String getApplicationName()
getCapabilityName
public java.lang.String getCapabilityName()
- Returns:
- Returns the name.
getDestinationAgentName
public java.lang.String getDestinationAgentName()
- Returns:
- Returns the destinationAgentName.
getLocalizedDestinationAgentName
public java.lang.String getLocalizedDestinationAgentName()
getQualifiedDestinationAgentName
public java.lang.String getQualifiedDestinationAgentName()
- Returns:
- Returns the destinationAgentName.
execute
public void execute(IInterpreter interpreter)
- Parameters:
interpreter
-
execute
public void execute(java.lang.Object object)
- Specified by:
execute
in interface IExecutable
setResponse
public void setResponse(java.io.Serializable responseObject)
throws InvalidMessageException
- Parameters:
replyObject
-
- Throws:
InvalidMessageException
getPriority
public int getPriority()
- Specified by:
getPriority
in interface IPrioritizedObject
getLogger
public Logger getLogger()
- Returns:
- Returns the logger.
setLogger
public void setLogger(Logger logger)
- Parameters:
logger
- The logger to set.
log
public void log(java.lang.Exception ex)
- Parameters:
ex
-
aboutToBeSent
public void aboutToBeSent()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
setNode
public void setNode(Node node)
- Parameters:
node
- The node to set.
getNodeEventRegistry
public ILocalEventRegistry getNodeEventRegistry()
- Returns:
getNodeObjectSpace
public IObjectSpace getNodeObjectSpace()
- Returns:
isSynchronousResponse
public boolean isSynchronousResponse()
getAgentPath
public AgentPath getAgentPath()
- Returns:
getLocalAgentPath
public LocalAgentPath getLocalAgentPath()
getCrossAgent
public AgentProxy getCrossAgent(AgentPath path)
throws NoSuchAgentException,
IllegalAgentAccessException,
InsufficientPrivilegeException
- Throws:
NoSuchAgentException
IllegalAgentAccessException
InsufficientPrivilegeException
getAgentProxy
public IAgentProxy getAgentProxy()
- Returns:
getAllForeignAgents
public IAgentProxy getAllForeignAgents(java.lang.String capabilityName)
throws java.lang.IllegalArgumentException,
NoSuchAgentException,
IllegalAgentAccessException
- Parameters:
capabilityName
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException
getForeignAgent
public IAgentProxy getForeignAgent(java.lang.String nodeName,
java.lang.String capabilityName)
throws java.lang.IllegalArgumentException,
NoSuchAgentException,
IllegalAgentAccessException
- Parameters:
nodeName
- capabilityName
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException
getOriginNodeName
public java.lang.String getOriginNodeName()
getLastOriginNodeName
public java.lang.String getLastOriginNodeName()
getOriginAgentPath
public AgentPath getOriginAgentPath()
getPredefinedInterpreter
public IInterpreter getPredefinedInterpreter()
- Returns:
- Returns the predefinedInterpreter.
setPredefinedInterpreter
public void setPredefinedInterpreter(IInterpreter predefinedInterpreter)
- Parameters:
predefinedInterpreter
- The predefinedInterpreter to set.
setHistoryItem
public void setHistoryItem(AgentPath sourceDestinationAgentPath,
java.lang.String originNodeName,
ICommand command)
- Parameters:
sourceDestinationAgentPath
- originNodeName
- command2
-
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Overrides:
clone
in class java.lang.Object
- Throws:
java.lang.CloneNotSupportedException
getClusterEventRegistry
public ILocalClusterEventRegistry getClusterEventRegistry(java.lang.String name)
throws java.util.NoSuchElementException,
java.rmi.RemoteException
- Parameters:
name
-
- Returns:
-
- Throws:
java.util.NoSuchElementException
java.rmi.RemoteException
isEventHandlerCommand
public boolean isEventHandlerCommand()
- Returns:
getDestinationAgent
public AgentPath getDestinationAgent()
- Returns:
- Returns the destinationAgent.
isForeign
public boolean isForeign()
- Returns:
isLocal
public boolean isLocal()
- Returns:
setLocalOrForeign
public void setLocalOrForeign(Node nodeArg)
- Parameters:
node2
-
getQualifiedCapabilityName
public java.lang.String getQualifiedCapabilityName()
- Returns:
isExecutionFinished
public boolean isExecutionFinished()
- Returns:
- Returns the executionFinished.
setExecutionFinished
public void setExecutionFinished(boolean executionFinished)
- Parameters:
executionFinished
- The executionFinished to set.
isExecutionStarted
public boolean isExecutionStarted()
- Returns:
- Returns the executionStarted.
setExecutionStarted
public void setExecutionStarted(boolean executionStarted)
- Parameters:
executionStarted
- The executionStarted to set.
getCurrentScheduler
public CommandScheduler getCurrentScheduler()
- Returns:
- Returns the currentScheduler.
setCurrentScheduler
public void setCurrentScheduler(CommandScheduler currentScheduler)
- Parameters:
currentScheduler
- The currentScheduler to set.
isSuspended
public boolean isSuspended()
- Returns:
- Returns the suspended.
setSuspended
public void setSuspended(boolean suspended)
- Parameters:
suspended
- The suspended to set.
arrivedAt
public void arrivedAt(Node node)
setCommand
public void setCommand(ICommand command)
- Parameters:
command
- The command to set.
setDestinationAgent
public void setDestinationAgent(AgentPath destinationAgent)
- Parameters:
destinationAgent
- The destinationAgent to set.
getNodeNameObject
public NodeName getNodeNameObject()
- Returns:
getLocalCapabilityPath
public LocalCapabilityPath getLocalCapabilityPath()
- Returns:
removeFromQueue
public boolean removeFromQueue()
- Returns:
reinsertIntoQueue
public void reinsertIntoQueue()
getDestinationAgentCapabilityPath
public LocalCapabilityPath getDestinationAgentCapabilityPath()
getKind
public int getKind()
- Returns:
- Returns the kind.
setKind
public void setKind(int kind)
- Parameters:
kind
- The kind to set.
testSetSuspended
public boolean testSetSuspended()
invokeOnCommand
public Result invokeOnCommand(java.lang.String methodName)
throws java.lang.SecurityException,
java.lang.NoSuchMethodException,
java.lang.IllegalArgumentException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
- Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
getCapabilityPath
public java.lang.String getCapabilityPath()
- Returns:
isWorkloadCommand
public boolean isWorkloadCommand()
isIgnore
public boolean isIgnore()
- Returns:
setIgnore
public void setIgnore(boolean isIgnore)
- Parameters:
isIgnore
- The isIgnore to set.