es.upv.dsic.gti_ia.architecture
Class FIPARequestInitiator

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

public class FIPARequestInitiator
extends Object

This class implements the FIPA-Request interaction protocol, Role Initiator

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

Field Summary
 QueueAgent myAgent
           
 
Constructor Summary
FIPARequestInitiator(QueueAgent agent, ACLMessage msg)
          Creates a new FIPA-Request interaction protocol, Role initiator.
 
Method Summary
 void action()
          Runs the state machine with the communication protocol
 void finish()
          Sends a CANCEL Message for active conversation and and terminates the protocol
 boolean finished()
          This method reports if the protocol has been finished
 String getIdConversation()
          Returns the id of the message used in communication protocol
 QueueAgent getQueueAgent()
          Returns the agent.
protected  void handleAgree(ACLMessage msg)
          This method is called when a agree message is received.
protected  void handleFailure(ACLMessage msg)
          This method is called when a Failure message is received.
protected  void handleInform(ACLMessage msg)
          This method is called when a Inform message is received.
protected  void handleNotUnderstood(ACLMessage msg)
          This method is called when a NotUnderstood message is received.
protected  void handleOutOfSequence(ACLMessage msg)
          This method is called when a unexpected message is received.
protected  void handleRefuse(ACLMessage msg)
          This method is called when a refuse message is received.
protected  ACLMessage prepareRequest(ACLMessage msg)
          This method must return the ACLMessage to be 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

FIPARequestInitiator

public FIPARequestInitiator(QueueAgent agent,
                            ACLMessage msg)
Creates a new FIPA-Request interaction protocol, Role initiator.

Parameters:
agent - agent is the reference to the Agent Object
msg - initial message
Method Detail

getQueueAgent

public QueueAgent getQueueAgent()
Returns the agent.

Returns:
QueueAgent

finished

public boolean finished()
This method reports if the protocol has been finished

Returns:
value a boolean value is returned, true: the protocol has finished, false: the protocol even has not finished

getIdConversation

public String getIdConversation()
Returns the id of the message used in communication protocol

Returns:
conversationID

finish

public void finish()
Sends a CANCEL Message for active conversation and and terminates the protocol


action

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


prepareRequest

protected ACLMessage prepareRequest(ACLMessage msg)
This method must return the ACLMessage to be sent. This default implementation just return the ACLMessage object passed in the constructor. Programmer might override the method in order to return a different ACLMessage. Note that for this simple version of protocol, the message will be just send to the first receiver set.

Parameters:
msg - the ACLMessage object passed in the constructor.
Returns:
a ACLMessage.

handleAgree

protected void handleAgree(ACLMessage msg)
This method is called when a agree message is received.

Parameters:
msg - the received agree message.

handleRefuse

protected void handleRefuse(ACLMessage msg)
This method is called when a refuse message is received.

Parameters:
msg - the received refuse message.

handleNotUnderstood

protected void handleNotUnderstood(ACLMessage msg)
This method is called when a NotUnderstood message is received.

Parameters:
msg - the received NotUnderstood message.

handleInform

protected void handleInform(ACLMessage msg)
This method is called when a Inform message is received.

Parameters:
msg - the received Inform message.

handleFailure

protected void handleFailure(ACLMessage msg)
This method is called when a Failure message is received.

Parameters:
msg - the received Failure message.

handleOutOfSequence

protected void handleOutOfSequence(ACLMessage msg)
This method is called when a unexpected message is received.

Parameters:
msg - the received message


Copyright © 2012 GTI-IA. All Rights Reserved.