fipaos.tutorial.emarkets.agent
Class SubscribingAgent

fipaos.agent.FIPAOSAgent
  |
  +--fipaos.tutorial.emarkets.agent.SubscribingAgent
Direct Known Subclasses:
BuyerAgent, SellerAgent

public abstract class SubscribingAgent
extends FIPAOSAgent
implements FIPASubscribeInitiatorAbility, FIPASubscribeInitiatorGUIAbility

Abstract class that provides the ability to subscribe to another agent using the FIPA subscribe protocol


Inner classes inherited from class fipaos.agent.FIPAOSAgent
FIPAOSAgent.TopLevelHandlerTask

Fields inherited from class fipaos.agent.FIPAOSAgent
_registered_with, _state

Constructor Summary
SubscribingAgent(String platform_profile, String name, String owner, String agent_type)
          Constructs a SubscribingAgent

Method Summary
 voidaddAgent(AgentID agent_id)
          An extending subclass must implement the missing methods from the interfaces implemented by this SubscribingAgent When the subclass is notified of a successful subscription it makes a callback to its parent (this) via this method
 voiddoneFIPASubscribeInitiatorHandlerTask(Object obj)
          Callback method that is invoked when the task used to make subscriptions has finished.
 voiddoneFIPASubscribeInitiatorHandlerTask(Task t)
          Callback method that is invoked when the task used to make subscriptions has finished.
 AgentIDgetSubscribedWith()
          Returns the AgentID of the agent that this agent is currently subscribed with
 VectorsearchForAgents(String service_type)
          This method is called by the gui to request that this agent performs a DF search to locate agents which are offering a service of the given type
 synchronized voidshutdown()
          Shuts down the agent by first deregistering with the DF and AMS (if registered) and then invoking shutdown() on the FIPAOSAgent shell
 voidsubscribe(AgentID agent)
          Attempts to subscribe to the specified agent using the FIPA subscribe protocol
 voidsubscriberGUIClosed()
          Callback from the subscriber GUI to inform this agent that its close icon was pressed
 voidunsubscribe(AgentID agent)
          Unsubscribe this agent from the specified agent

Methods inherited from class fipaos.agent.FIPAOSAgent
activate, forward, forward, getAID, getCurrentConversation, getHAP, getLocalAMS, getLocalAMSAID, getLocalDF, getLocalDFAID, getNewConversation, getOwnership, getPlatformProfile, getProfile, getState, isShutdown, notify, notify, notifyDone, notifyError, notifyMessageInEndedConversation, notifyMessageUndeliverable, notifyTimeout, sendNotUnderstood, sendNotUnderstood, setMessageSender, waitForPushLock

Constructor Detail

SubscribingAgent

public SubscribingAgent(String platform_profile, String name, String owner, String agent_type)
Constructs a SubscribingAgent
Parameters:
platform_profile - The location of the platform profile
name - The agent name
owner - The owner of this agent
agent_type - The type of agent that extends this agent
Method Detail

addAgent

public void addAgent(AgentID agent_id)
An extending subclass must implement the missing methods from the interfaces implemented by this SubscribingAgent When the subclass is notified of a successful subscription it makes a callback to its parent (this) via this method
Parameters:
agent_id - The agent that was subscribed to

doneFIPASubscribeInitiatorHandlerTask

public void doneFIPASubscribeInitiatorHandlerTask(Object obj)
Callback method that is invoked when the task used to make subscriptions has finished. This should only occur when this agent has unsubscribed from the agent associated with this task
Parameters:
obj - The result passed back from the task

doneFIPASubscribeInitiatorHandlerTask

public void doneFIPASubscribeInitiatorHandlerTask(Task t)
Callback method that is invoked when the task used to make subscriptions has finished.
Parameters:
t - If no parameter was passed by the task's done() method then a reference to the task itself will be passed back in this parameter

getSubscribedWith

public AgentID getSubscribedWith()
Returns the AgentID of the agent that this agent is currently subscribed with
Returns: The AgentID of the agent we are subscribed with

searchForAgents

public Vector searchForAgents(String service_type)
This method is called by the gui to request that this agent performs a DF search to locate agents which are offering a service of the given type
Parameters:
service_type. - The type of service to search for.
Returns: A Vector of the AgentIDs of agents which provide the given service description

shutdown

public synchronized void shutdown()
Shuts down the agent by first deregistering with the DF and AMS (if registered) and then invoking shutdown() on the FIPAOSAgent shell

subscribe

public void subscribe(AgentID agent)
Attempts to subscribe to the specified agent using the FIPA subscribe protocol
Parameters:
agent - The AgentID of the agent we are trying to subscribe to

subscriberGUIClosed

public void subscriberGUIClosed()
Callback from the subscriber GUI to inform this agent that its close icon was pressed

unsubscribe

public void unsubscribe(AgentID agent)
Unsubscribe this agent from the specified agent
Parameters:
agent - The AgentID of the agent to unsubscribe from

Association Links

to Class fipaos.tutorial.emarkets.subscribe.FIPASubscribeInitiatorHandlerTask

Reference to the subscribe initiator task. Inform messages from the subscription manager will be returned to this task

to Class java.lang.String

An agent which extends this class must pass its type identifier to this class which is used in the subscription request

to Class fipaos.ont.fipa.fipaman.AgentID

The AgentID of the agent that this agent is subscribed to

to Class fipaos.tutorial.emarkets.agent.InitiatorGUI