es.upv.dsic.gti_ia.architecture
Class QueueAgent

java.lang.Object
  extended by es.upv.dsic.gti_ia.core.BaseAgent
      extended by es.upv.dsic.gti_ia.architecture.QueueAgent
All Implemented Interfaces:
Runnable

public class QueueAgent
extends BaseAgent

This class defines an new agents template, extending of BaseAgent. This type of agent's implements the protocols.

Author:
Joan Bellver Faus

Field Summary
 
Fields inherited from class es.upv.dsic.gti_ia.core.BaseAgent
logger, session, traceSession
 
Constructor Summary
QueueAgent(AgentID aid)
          Create a new QueueAgent.
 
Method Summary
 void addTask(Object obj)
          Adds a new task (FIPA protocol) to the agent,was creating a new thread
protected  void onMessage(ACLMessage msg)
          Function that will be executed when the agent gets a message
 ACLMessage receiveACLMessage(MessageTemplate template)
          Method to receives a magentix2 ACLMessage
protected  void terminate()
          When agent state is terminated
 
Methods inherited from class es.upv.dsic.gti_ia.core.BaseAgent
activateTraceService, changeIdentity, deactivateTraceService, execute, finalize, getAid, getName, init, onTraceEvent, run, send, sendTraceEvent, start
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueAgent

public QueueAgent(AgentID aid)
           throws Exception
Create a new QueueAgent.

Parameters:
aid - agent ID.
Throws:
Exception - if agent id already exists on the platform
Method Detail

onMessage

protected void onMessage(ACLMessage msg)
Function that will be executed when the agent gets a message

Overrides:
onMessage in class BaseAgent
Parameters:
msg - ACLMessage

receiveACLMessage

public ACLMessage receiveACLMessage(MessageTemplate template)
                             throws Exception
Method to receives a magentix2 ACLMessage

Parameters:
template - is a MessageTemplate, will serve as a filter for receiving the right message
Returns:
msg ACLMessage
Throws:
Exception

terminate

protected void terminate()
When agent state is terminated

Overrides:
terminate in class BaseAgent

addTask

public void addTask(Object obj)
Adds a new task (FIPA protocol) to the agent,was creating a new thread

Parameters:
obj - object of type FIPA protocol. ej: FIPARequestInitiator, FIPARequestResponder, FIPAQueryResponder, FIPAQueryInitiator, FIPAContractNetResponder, FIPAContractNetInitiator.


Copyright © 2012 GTI-IA. All Rights Reserved.