es.upv.dsic.gti_ia.architecture
Class FIPAContractNetResponder

java.lang.Object
  extended by es.upv.dsic.gti_ia.architecture.FIPAContractNetResponder

public class FIPAContractNetResponder
extends Object

This class implements the FIPA-Contract-Net interaction protocol, Role Responder

Version:
2009.9.07
Author:
Joan Bellver Faus, GTI-IA, DSIC, UPV

Field Summary
 QueueAgent myAgent
           
 
Constructor Summary
FIPAContractNetResponder(QueueAgent _agent, MessageTemplate _template)
          Creates a new FIPA-Contract-Net interaction protocol, rol responder.
 
Method Summary
 void action()
          Runs the state machine with the communication protocol
 QueueAgent getQueueAgent()
          Returns the agent.
protected  void handleAcceptProposal(ACLMessage cfp, ACLMessage propose, ACLMessage accept)
          This method is called when ACCEPT-PROPOSAL is received from the initiator.
protected  void handleRejectProposal(ACLMessage cfp, ACLMessage propose, ACLMessage reject)
          This method is called when REJECT-PROPOSAL is received from the initiator.
protected  ACLMessage prepareResponse(ACLMessage cfp)
          This method is called when the initiator's message is received that matches the message template passed in the constructor.
protected  ACLMessage prepareResultNotification(ACLMessage cfp, ACLMessage propose, ACLMessage accept)
          This method is called after the response has been sent and only when one of the following two cases arise: the response was an agree message OR no response message was sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myAgent

public QueueAgent myAgent
Constructor Detail

FIPAContractNetResponder

public FIPAContractNetResponder(QueueAgent _agent,
                                MessageTemplate _template)
Creates a new FIPA-Contract-Net interaction protocol, rol responder.

Parameters:
agent - is the reference to the Agent Object
template - is a MessageTemplate, will serve as a filter for receiving the right message
Method Detail

getQueueAgent

public QueueAgent getQueueAgent()
Returns the agent.

Returns:
QueueAgent

action

public void action()
Runs the state machine with the communication protocol


prepareResponse

protected ACLMessage prepareResponse(ACLMessage cfp)
                              throws NotUnderstoodException,
                                     RefuseException
This method is called when the initiator's message is received that matches the message template passed in the constructor.

Parameters:
cfp - initial CFP message
Returns:
Throws:
NotUnderstoodException
RefuseException

prepareResultNotification

protected ACLMessage prepareResultNotification(ACLMessage cfp,
                                               ACLMessage propose,
                                               ACLMessage accept)
                                        throws FailureException
This method is called after the response has been sent and only when one of the following two cases arise: the response was an agree message OR no response message was sent.

Parameters:
cfp - initial CFP message
propose - propose message
accept - accept message
Returns:
Throws:
FailureException

handleRejectProposal

protected void handleRejectProposal(ACLMessage cfp,
                                    ACLMessage propose,
                                    ACLMessage reject)
This method is called when REJECT-PROPOSAL is received from the initiator.

Parameters:
cfp - initial CFP message
propose - the PROPOSE message sent back as reply to the initial CFP message
reject - the received REJECT_PROPOSAL message

handleAcceptProposal

protected void handleAcceptProposal(ACLMessage cfp,
                                    ACLMessage propose,
                                    ACLMessage accept)
This method is called when ACCEPT-PROPOSAL is received from the initiator.

Parameters:
cfp - initial CFP message
propose - the PROPOSE message sent back as reply to the initial CFP message
accept - the received ACCEPT_PROPOSAL message.


Copyright © 2012 GTI-IA. All Rights Reserved.