org.almendra.janet.cas.agents
Class AbstractAgent
java.lang.Object
org.almendra.janet.cas.agents.AbstractAgent
- All Implemented Interfaces:
- INamedObject, IUniqueGlobalIdObject, ILoggable, IAgent, ICommandAcceptor
- Direct Known Subclasses:
- Agent, SystemAgent
public abstract class AbstractAgent
- extends java.lang.Object
- implements IAgent, ILoggable, IUniqueGlobalIdObject
- Author:
- Oliver
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG_EVENT_STARTED_AGENT
public static final java.lang.String LOG_EVENT_STARTED_AGENT
- See Also:
- Constant Field Values
LOG_EVENT_STOPPED_AGENT
public static final java.lang.String LOG_EVENT_STOPPED_AGENT
- See Also:
- Constant Field Values
node
protected Node node
name
protected java.lang.String name
logger
protected Logger logger
capability
protected Capability capability
id
protected UniqueId id
AbstractAgent
protected AbstractAgent()
AbstractAgent
protected AbstractAgent(Node node,
Logger logger,
java.lang.String name)
checkCapabilities
protected java.lang.String checkCapabilities(java.util.Set capabilities)
init
protected void init()
accept
public void accept(CommandEnvelope commandEnvelope)
- Specified by:
accept
in interface IAgent
- Specified by:
accept
in interface ICommandAcceptor
setCommandEnvelope
public static void setCommandEnvelope(CommandEnvelope commandEnvelope,
IAgent agent,
Logger logger,
Node node)
getScheduler
protected abstract CommandScheduler getScheduler()
getName
public java.lang.String getName()
- Description copied from interface:
INamedObject
- All objects that have a user-defined name must implement this method.
- Specified by:
getName
in interface INamedObject
- Returns:
- name
setName
public void setName(java.lang.String name)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException
- Parameters:
string
-
- Throws:
java.lang.IllegalArgumentException
java.lang.NullPointerException
registeredLogEvents
public java.util.List registeredLogEvents()
- Description copied from interface:
ILoggable
- Return list of events that may occur for an object.
- Specified by:
registeredLogEvents
in interface ILoggable
- Returns:
getUniqueId
public UniqueId getUniqueId()
setLogger
public void setLogger(Logger logger)
- Parameters:
logger
-
setNode
protected void setNode(Node node)
- Parameters:
node
-
getGlobalId
public UniqueId getGlobalId()
- Description copied from interface:
IUniqueGlobalIdObject
- Return the globally unique id
- Specified by:
getGlobalId
in interface IUniqueGlobalIdObject
- Returns:
schedulerStopped
protected abstract void schedulerStopped()
logStarted
protected void logStarted()
logStopped
protected void logStopped()
getNode
public Node getNode()
throws InsufficientPrivilegeException
- Specified by:
getNode
in interface IAgent
- Returns:
-
- Throws:
InsufficientPrivilegeException
getApplication
public AbstractApplication getApplication()
- Specified by:
getApplication
in interface IAgent
isActive
public boolean isActive()
getObjectSpace
public IObjectSpace getObjectSpace()
- Specified by:
getObjectSpace
in interface IAgent
getQualifiedName
public java.lang.String getQualifiedName()
- Specified by:
getQualifiedName
in interface IAgent
getCapability
public Capability getCapability()
- Specified by:
getCapability
in interface IAgent
- Returns:
isSystemAgent
public abstract boolean isSystemAgent()
- Specified by:
isSystemAgent
in interface IAgent
isApplicationAgent
public abstract boolean isApplicationAgent()
- Specified by:
isApplicationAgent
in interface IAgent
getSystemApplication
public SystemApplication getSystemApplication()
throws InsufficientPrivilegeException
- Specified by:
getSystemApplication
in interface IAgent
- Throws:
InsufficientPrivilegeException
getAgentProxy
public IAgentProxy getAgentProxy()
- Specified by:
getAgentProxy
in interface IAgent
getPath
public AgentPath getPath()
getLocalPath
public LocalAgentPath getLocalPath()
stop
public void stop()
- Specified by:
stop
in interface IAgent
prepareFinalize
protected void prepareFinalize()
getAllForeignAgents
public IAgentProxy getAllForeignAgents()
throws java.lang.IllegalArgumentException,
NoSuchAgentException,
IllegalAgentAccessException
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException
getAgentPath
public AgentPath getAgentPath()
- Specified by:
getAgentPath
in interface IAgent
- Returns:
getAllForeignAgents
public IAgentProxy getAllForeignAgents(java.lang.String capabilityName)
throws java.lang.IllegalArgumentException,
NoSuchAgentException,
IllegalAgentAccessException
- Specified by:
getAllForeignAgents
in interface IAgent
- Parameters:
string
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException
getAllForeignAgents
public IAgentProxy getAllForeignAgents(java.lang.String capabilityName,
java.lang.String agentName)
throws java.lang.IllegalArgumentException,
NoSuchAgentException,
IllegalAgentAccessException
- Specified by:
getAllForeignAgents
in interface IAgent
- Parameters:
string
-
- 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
- Specified by:
getForeignAgent
in interface IAgent
- Parameters:
appName
- string
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException
getLogger
public Logger getLogger()
- Specified by:
getLogger
in interface IAgent
- Returns:
- Returns the logger.
isSystemApplication
public boolean isSystemApplication()
isIdle
public abstract boolean isIdle()
- Specified by:
isIdle
in interface IAgent
getQueueSize
public abstract long getQueueSize()
- Specified by:
getQueueSize
in interface IAgent
- Returns: