Underwater networking stack framework API agent. This class provides an agent superclass for all agents in UnetStack.
Modifiers | Name | Description |
---|---|---|
protected long |
timeout |
Timeout used in request messages. |
Fields inherited from class | Fields |
---|---|
class Agent |
NON_BLOCKING, BLOCKING |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
addCapability(Capability cap) Adds capability the agent is capable of. |
|
protected List<Parameter> |
allOf(Class... paramEnumClasses) Generate a list of parameters from a parameter enumeration. |
|
boolean |
deregister(String service) |
|
boolean |
deregister(Enum<?> service) |
|
protected void |
die(Throwable ex) |
|
protected Object |
get(AgentID aid, Parameter param) Requests value of parameter from another agent. |
|
protected Object |
get(AgentID aid, int index, Parameter param) Requests value of indexed parameter from another agent. |
|
protected String |
getBuildInfo() Gets the build string for a given class. |
|
Level |
getLogLevel() Gets the current log level for the agent. |
|
protected Object |
getParam(Parameter p, int ndx) Agents providing dynamic parameters may override this method to provide a value for a given parameter. |
|
List<Class<Parameter>> |
getParameterClasses() Gets a list of parameter classes supported by this agent. |
|
List<Class<Parameter>> |
getParameterClasses(int index) Gets a list of indexed parameter classes supported by this agent. |
|
protected List<Parameter> |
getParameterList() An agent supporting parameters should return a list of parameters by overriding this method. |
|
protected List<Parameter> |
getParameterList(int index) An agent supporting indexed parameters should return a list of indexed parameters by overriding this method. |
|
String[] |
getServices() Gets a list of services provided by the agent. |
|
String |
getTitle() Gets a descriptive name for the agent. |
|
String |
getVersion() Gets a version string for the agent. |
|
protected void |
init() Initialize the unet agent and its behaviors. |
|
protected Boolean |
isReadOnly(Parameter p, int ndx) Agents providing dynamic parameters may override this method to specify whether a parameter is read-only or read-write. |
|
protected Long |
longValue(Object v) Returns the value of any given object as a Long. null objects have a null value. |
|
protected void |
processMessage(Message msg) An agent wishing to process all messages other than requests and queries may override this method to handle incoming messages. |
|
protected Message |
processQuery(Message msg) An agent supporting queries should override this method to handle incoming queries. |
|
protected Message |
processRequest(Message msg) An agent supporting requests should override this method to handle incoming requests. |
|
boolean |
register(String service) |
|
boolean |
register(Enum<?> service) |
|
protected Object |
set(AgentID aid, Parameter param, Object value) Requests value of parameter to be changed in another agent. |
|
protected Object |
set(AgentID aid, int index, Parameter param, Object value) Requests value of indexed parameter to be changed in another agent. |
|
void |
setLogLevel(Level lvl) Sets the current log level for the agent. |
|
protected Object |
setParam(Parameter p, int ndx, Object v) Agents providing dynamic parameters may override this method to set a value for a given parameter. |
|
protected void |
setup() Called by UnetAgent when the agent is being initialized. |
|
protected void |
shutdown() |
|
protected void |
startup() Called by UnetAgent after all agents are fully initialized. |
|
protected void |
subscribeForService(String service) Subscribe to all agents providing a specified service. |
|
protected void |
subscribeForService(Enum<?> service) Subscribe to all agents providing a specified service. |
|
protected Message |
trace(Message msg) Log event trace. |
|
protected Message |
trace(Message stimulus, Message response) Log event trace. |
|
protected Message |
trace(Message stimulus, Message response, Object info) Log event trace. |
|
protected void |
unsubscribeForService(String service) Unsubscribe from all agents providing a specified service. |
|
protected void |
unsubscribeForService(Enum<?> service) Unsubscribe from all agents providing a specified service. |
Methods inherited from class | Name |
---|---|
class Agent |
send, receive, receive, receive, receive, receive, receive, receive, receive, setLogLevel, getPlatform, request, request, getStore, subscribe, deregister, deregister, getContainer, println, run, add, toString, register, register, clone, currentTimeMillis, nanoTime, getName, stop, getState, getAgentID, prepareRequest, platformSend, setQueueSize, unsubscribe, agentForService, agentForService, agentsForService, agentsForService, topic, topic, topic, topic, topic, topic, agent, wake, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll |
Adds capability the agent is capable of.
cap
- capabilityGenerate a list of parameters from a parameter enumeration. This method is designed for agents to use in the getParameterList() method.
paramEnumClasses
- enums representing the parameters.Requests value of parameter from another agent.
aid
- agent to request parameter fromparam
- parameter to requestRequests value of indexed parameter from another agent.
aid
- agent to request parameter fromindex
- index of parameter setparam
- parameter to requestGets the build string for a given class. The build information is extracted from the jar is available.
Gets the current log level for the agent.
Agents providing dynamic parameters may override this method to provide a value for a given parameter.
p
- parameter to get value.ndx
- index for indexed parameters, -1 if non-indexed.Gets a list of parameter classes supported by this agent.
Gets a list of indexed parameter classes supported by this agent.
index
- index to list parameter classes.An agent supporting parameters should return a list of parameters by overriding this method.
An agent supporting indexed parameters should return a list of indexed parameters by overriding this method.
index
- index to list parameters.Gets a list of services provided by the agent.
Gets a descriptive name for the agent.
Gets a version string for the agent.
Initialize the unet agent and its behaviors.
Agents providing dynamic parameters may override this method to specify whether a parameter is read-only or read-write.
p
- parameter to get value.ndx
- index for indexed parameters, -1 if non-indexed.Returns the value of any given object as a Long. null objects have a null value. Numeric values are converted to the closest Long value. String values are parsed into Long. Booleans have a value of 1 if true, and 0 if false. Any other type of input value results in a null.
v
- object to convert to Long.An agent wishing to process all messages other than requests and queries may override this method to handle incoming messages.
msg
- incoming message.An agent supporting queries should override this method to handle incoming queries.
msg
- incoming query.An agent supporting requests should override this method to handle incoming requests.
msg
- incoming request.Requests value of parameter to be changed in another agent.
aid
- agent to request parameter changeparam
- parameter to request to be changedvalue
- new value of parameterRequests value of indexed parameter to be changed in another agent.
aid
- agent to request parameter changeindex
- index of parameter setparam
- parameter to request to be changedvalue
- new value of parameterSets the current log level for the agent.
lvl
- log levelAgents providing dynamic parameters may override this method to set a value for a given parameter.
p
- parameter to set value.ndx
- index for indexed parameters, -1 if non-indexed.v
- value of the parameter.Called by UnetAgent when the agent is being initialized.
Called by UnetAgent after all agents are fully initialized.
Subscribe to all agents providing a specified service.
service
- name of the serviceSubscribe to all agents providing a specified service.
service
- name of the serviceLog event trace.
msg
- unsolicited message or a message with an inReplyTo field.Log event trace.
stimulus
- message that resulted in this event.response
- message that was generated as part of this event.Log event trace.
stimulus
- message that resulted in this event.response
- message that was generated as part of this event.info
- event-specific information.Unsubscribe from all agents providing a specified service.
service
- name of the serviceUnsubscribe from all agents providing a specified service.
service
- name of the service