Magentix2
2.1.1
|
Classes | |
class | AGREE_Method |
class | BEGIN_Method |
class | FAILURE_Method |
class | FINAL_Method |
class | INFORM_Method |
class | NOT_UNDERSTOOD_Method |
class | REFUSE_Method |
class | REQUEST_Method |
class | SECOND_WAIT_Method |
Public Member Functions | |
CFactory | newFactory (String name, MessageFilter filter, ACLMessage requestMessage, int availableConversations, CAgent myAgent, long timeout) |
Protected Member Functions | |
void | doBegin (CProcessor myProcessor, ACLMessage msg) |
void | doRequest (CProcessor myProcessor, ACLMessage messageToSend) |
void | doNotUnderstood (CProcessor myProcessor, ACLMessage msg) |
void | doRefuse (CProcessor myProcessor, ACLMessage msg) |
void | doAgree (CProcessor myProcessor, ACLMessage msg) |
void | doSecondWait (CProcessor myProcessor, ACLMessage msg) |
void | doFailure (CProcessor myProcessor, ACLMessage msg) |
abstract void | doInform (CProcessor myProcessor, ACLMessage msg) |
void | doFinal (CProcessor myProcessor, ACLMessage messageToSend) |
Template for CFactories that manage fipa request initiator conversation. The user has to create his/her own class extending from this one. And implement the abstract methods. Other methods can be overriden in order to modify the default behaviour
Definition at line 27 of file FIPA_REQUEST_Initiator.java.
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doAgree | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method to execute when the initiator receives an agree message
myProcessor | the CProcessor managing the conversation |
msg | agree message |
Reimplemented in es.upv.dsic.gti_ia.organization.THOMASProxy.THOMASCAgentRequest.
Definition at line 102 of file FIPA_REQUEST_Initiator.java.
{ }
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doBegin | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method to execute at the beginning of the conversation
myProcessor | the CProcessor managing the conversation |
msg | first message to send |
Definition at line 34 of file FIPA_REQUEST_Initiator.java.
{
myProcessor.getInternalData().put("InitialMessage", msg);
}
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doFailure | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method to execute when the initiator receives a failure message
myProcessor | the CProcessor managing the conversation |
msg | failure message |
Reimplemented in es.upv.dsic.gti_ia.organization.THOMASProxy.THOMASCAgentRequest.
Definition at line 132 of file FIPA_REQUEST_Initiator.java.
{ }
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doFinal | ( | CProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Method to execute when the initiator ends the conversation
myProcessor | |
messageToSend |
Definition at line 161 of file FIPA_REQUEST_Initiator.java.
{ messageToSend = myProcessor.getLastSentMessage(); }
abstract void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doInform | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected, pure virtual] |
Method to execute when the initiator receives an inform message
myProcessor | |
msg |
Implemented in es.upv.dsic.gti_ia.organization.THOMASProxy.THOMASCAgentRequest.
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doNotUnderstood | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method to execute when the initiator receives a not-understood message
myProcessor | the CProcessor managing the conversation |
msg | not-understood message |
Reimplemented in es.upv.dsic.gti_ia.organization.THOMASProxy.THOMASCAgentRequest.
Definition at line 72 of file FIPA_REQUEST_Initiator.java.
{ }
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doRefuse | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method to execute when the initiator receives a failure message
myProcessor | the CProcessor managing the conversation |
msg | failure message |
Reimplemented in es.upv.dsic.gti_ia.organization.THOMASProxy.THOMASCAgentRequest.
Definition at line 87 of file FIPA_REQUEST_Initiator.java.
{ }
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doRequest | ( | CProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Sets the request message
myProcessor | the CProcessor managing the conversation |
messageToSend | request message |
Definition at line 50 of file FIPA_REQUEST_Initiator.java.
{ /*ACLMessage aux = (ACLMessage) myProcessor.getInternalData().get( "InitialMessage"); messageToSend.copyFromAsTemplate(aux); messageToSend.setProtocol("fipa-request"); messageToSend.setPerformative(ACLMessage.REQUEST); messageToSend.setSender(myProcessor.getMyAgent().getAid());*/ }
void es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.doSecondWait | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method to execute when the timeout is reached
myProcessor | the CProcessor managing the conversation |
msg | timeout message |
Definition at line 117 of file FIPA_REQUEST_Initiator.java.
{ }
CFactory es.upv.dsic.gti_ia.cAgents.protocols.FIPA_REQUEST_Initiator.newFactory | ( | String | name, |
MessageFilter | filter, | ||
ACLMessage | requestMessage, | ||
int | availableConversations, | ||
CAgent | myAgent, | ||
long | timeout | ||
) |
Creates a new initiator fipa request cfactory
name | factory's name |
filter | message filter |
requestMessage | first message to send |
availableConversations | maximum number of conversation this CFactory can manage simultaneously |
myAgent | agent owner of this CFactory |
timeout | for waiting after sending the request message |
Definition at line 181 of file FIPA_REQUEST_Initiator.java.
{ // Create factory if (filter == null) { filter = new MessageFilter("performative = REQUEST"); //falta AND protocol = fipa-request; } CFactory theFactory = new CFactory(name, filter, availableConversations, myAgent); // Processor template setup CProcessor processor = theFactory.cProcessorTemplate(); // BEGIN State BeginState BEGIN = (BeginState) processor.getState("BEGIN"); BEGIN.setMethod(new BEGIN_Method()); // REQUEST State SendState REQUEST = new SendState("REQUEST_REQUEST_INITIATOR"); REQUEST.setMethod(new REQUEST_Method()); //requestMessage = new ACLMessage(ACLMessage.REQUEST); //requestMessage.setProtocol("REQUEST"); REQUEST.setMessageTemplate(requestMessage); processor.registerState(REQUEST); processor.addTransition("BEGIN", "REQUEST_REQUEST_INITIATOR"); // FIRST_WAIT State processor.registerState(new WaitState("FIRST_WAIT_REQUEST_INITIATOR", timeout)); processor.addTransition("REQUEST_REQUEST_INITIATOR", "FIRST_WAIT_REQUEST_INITIATOR"); // NOT_UNDERSTOOD State ReceiveState NOT_UNDERSTOOD = new ReceiveState("NOT_UNDERSTOOD_REQUEST_INITIATOR"); NOT_UNDERSTOOD.setMethod(new NOT_UNDERSTOOD_Method()); filter = new MessageFilter("performative = "+ACLMessage.getPerformative(ACLMessage.NOT_UNDERSTOOD)); NOT_UNDERSTOOD.setAcceptFilter(filter); processor.registerState(NOT_UNDERSTOOD); processor.addTransition("FIRST_WAIT_REQUEST_INITIATOR", "NOT_UNDERSTOOD_REQUEST_INITIATOR"); // REFUSE State ReceiveState REFUSE = new ReceiveState("REFUSE_REQUEST_INITIATOR"); REFUSE.setMethod(new REFUSE_Method()); filter = new MessageFilter("performative = REFUSE"); REFUSE.setAcceptFilter(filter); processor.registerState(REFUSE); processor.addTransition("FIRST_WAIT_REQUEST_INITIATOR", "REFUSE_REQUEST_INITIATOR"); // AGREE State ReceiveState AGREE = new ReceiveState("AGREE_REQUEST_INITIATOR"); AGREE.setMethod(new AGREE_Method()); filter = new MessageFilter("performative = AGREE"); AGREE.setAcceptFilter(filter); processor.registerState(AGREE); processor.addTransition("FIRST_WAIT_REQUEST_INITIATOR", "AGREE_REQUEST_INITIATOR"); // SECOND_WAIT State processor.registerState(new WaitState("SECOND_WAIT_REQUEST_INITIATOR", timeout)); processor.addTransition("AGREE_REQUEST_INITIATOR", "SECOND_WAIT_REQUEST_INITIATOR"); // FAILURE State ReceiveState FAILURE = new ReceiveState("FAILURE_REQUEST_INITIATOR"); FAILURE.setMethod(new FAILURE_Method()); filter = new MessageFilter("performative = FAILURE"); FAILURE.setAcceptFilter(filter); processor.registerState(FAILURE); processor.addTransition("SECOND_WAIT_REQUEST_INITIATOR", "FAILURE_REQUEST_INITIATOR"); // INFORM State ReceiveState INFORM = new ReceiveState("INFORM_REQUEST_INITIATOR"); INFORM.setMethod(new INFORM_Method()); filter = new MessageFilter("performative = INFORM"); INFORM.setAcceptFilter(filter); processor.registerState(INFORM); processor.addTransition("SECOND_WAIT_REQUEST_INITIATOR", "INFORM_REQUEST_INITIATOR"); // FINAL State FinalState FINAL = new FinalState("FINAL_REQUEST_INITIATOR"); FINAL.setMethod(new FINAL_Method()); processor.registerState(FINAL); processor.addTransition("INFORM_REQUEST_INITIATOR", "FINAL_REQUEST_INITIATOR"); processor.addTransition("FAILURE_REQUEST_INITIATOR", "FINAL_REQUEST_INITIATOR"); processor.addTransition("NOT_UNDERSTOOD_REQUEST_INITIATOR", "FINAL_REQUEST_INITIATOR"); processor.addTransition("REFUSE_REQUEST_INITIATOR", "FINAL_REQUEST_INITIATOR"); return theFactory; }