public class GatewayAgent extends Agent
JadeGateway
enables two alternative ways to implement a gateway
that allows non-JADE code to communicate with JADE agents.
The first one is to extend the GatewayAgent
The second one is to extend this GatewayBehaviour
and add an instance
of this Behaviour to your own agent that will have to function as a gateway (see its javadoc for reference).
JadeGateway
,
GatewayBehaviour
,
Serialized FormAgent.Interrupted
MSG_QUEUE_CLASS
Constructor and Description |
---|
GatewayAgent() |
Modifier and Type | Method and Description |
---|---|
protected void |
processCommand(java.lang.Object command)
subclasses may implement this method.
|
void |
releaseCommand(java.lang.Object command)
notify that the command has been processed and remove the command from the queue
|
protected void |
setup()
This protected method is an empty placeholder for application
specific startup code.
|
protected void |
takeDown()
This protected method is an empty placeholder for application
specific cleanup code.
|
addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getProperty, getQueueSize, here, isAlive, isRestarting, postMessage, putBack, putO2AObject, receive, receive, registerO2AInterface, removeBehaviour, restore, restoreBufferedState, send, setEnabledO2ACommunication, setO2AManager, setQueueSize, write
protected void processCommand(java.lang.Object command)
The recommended pattern is the following implementation:
if (c instanceof Command1)
exexCommand1(c);
else if (c instanceof Command2)
exexCommand2(c);
releaseCommand
.
onEnd()
method.public final void releaseCommand(java.lang.Object command)
command
- is the same object that was passed in the processCommand methodprotected void setup()
Agent
Behaviour
object to the agent, in order for it to be
able to do anything.setup
in class Agent
Agent.addBehaviour(Behaviour b)
,
Behaviour
protected void takeDown()
Agent