fipaos.tutorial.emarkets.agent.manager
Class MarketManagerAgent

fipaos.agent.FIPAOSAgent
  |
  +--fipaos.tutorial.emarkets.agent.manager.MarketManagerAgent

public class MarketManagerAgent
extends FIPAOSAgent
implements EmarketControlGUIAbility, EscrowDataManagerAbility, EscrowProtocolParticipantAbility, FIPASubscribeParticipantAbility, FIPASubscribeParticipantGUIAbility

This class represents an agent that manages an e-marketplace. It provides a subscription management service that can accept subscriptions from buyers and sellers interested in forming e-markets. The MarketManagerAgent also provides an escrow service to validate buyer and seller claims of deals made.


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

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

Constructor Summary
MarketManagerAgent(String platform_profile, String name, String owner)
          Constructs a MarketManagerAgent

Method Summary
 voiddealWithEscrowProtocolRequest(Object[] request)
          Handles an escrow request from a buyer or a seller
 voiddealWithFIPASubscribeCancel(Object cancel)
          Handles an unsubscription request from a buyer or seller agent
 voiddealWithFIPASubscribeSubscribe(Object[] subscribe)
          Handles a subscription request from a buyer or seller agent
 voiddoneEmarketsTimerTask(Object obj)
           
 voiddoneEscrowProtocolParticipantHandlerTask(Task t)
          Callback method invoked when an escrow handling task has completed
 voidemarketControlGUIClosed()
          Invoked when the emarket control GUI is closed.
 static voidmain(String[] args)
          A main method to enable the agent to be run from the command line.
 voidsaveReports()
           
 voidsendEscrowFailure(EscrowMessage escrow_msg, EscrowProtocolParticipantHandlerTask handler)
           
 voidsendEscrowInform(EscrowMessage escrow_msg, EscrowProtocolParticipantHandlerTask handler)
           
 synchronized voidshutdown()
          Shuts down the agent by first deregistering with the DF and AMS (if registered) and then invoking shutdown() on the FIPAOSAgent shell
 voidstartEmarket(MarketplaceMap map)
          Starts an emarket by sending emarket and target messages to the subscribed buyer and seller agents
 voidstartEscrowTimer(EscrowDataManager edm, String deal_id)
           
 voidsubscriberManagerGUIClosed()
          This method is invoked when the close icon of the subscription manager GUI is pressed.

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

MarketManagerAgent

public MarketManagerAgent(String platform_profile, String name, String owner)
Constructs a MarketManagerAgent
Parameters:
platform_profile - The location of the platform profile
name - The agent name
owner - The owner of this agent
Method Detail

dealWithEscrowProtocolRequest

public void dealWithEscrowProtocolRequest(Object[] request)
Handles an escrow request from a buyer or a seller
Parameters:
request - An Object array. The object at index 0 is the message content. The object at index 1 contains a handler task that must be stored in order to return the escrow result to the requesting agent

dealWithFIPASubscribeCancel

public void dealWithFIPASubscribeCancel(Object cancel)
Handles an unsubscription request from a buyer or seller agent
Parameters:
content - The message content

dealWithFIPASubscribeSubscribe

public void dealWithFIPASubscribeSubscribe(Object[] subscribe)
Handles a subscription request from a buyer or seller agent
Parameters:
subscribe - An Object array. The object at index 0 is the content of the subscribe message. The object at index 1 is the handler task which must be stored in order to return information to the subscriber

doneEmarketsTimerTask

public void doneEmarketsTimerTask(Object obj)

doneEscrowProtocolParticipantHandlerTask

public void doneEscrowProtocolParticipantHandlerTask(Task t)
Callback method invoked when an escrow handling task has completed
Parameters:
t - The task that completed

emarketControlGUIClosed

public void emarketControlGUIClosed()
Invoked when the emarket control GUI is closed. This method closes all other open GUIs and shuts down the market manager agent

main

public static void main(String[] args)
A main method to enable the agent to be run from the command line. The agent takes two command line parameters - the platform profile location, which is set up by the SetupFIPAOS.bat file to be in the system variable %PLATFORM%, and the agent name.
Parameters:
args - A string array containing the location of platform.profile and the agent name

saveReports

public void saveReports()

sendEscrowFailure

public void sendEscrowFailure(EscrowMessage escrow_msg, EscrowProtocolParticipantHandlerTask handler)

sendEscrowInform

public void sendEscrowInform(EscrowMessage escrow_msg, EscrowProtocolParticipantHandlerTask handler)

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

startEmarket

public void startEmarket(MarketplaceMap map)
Starts an emarket by sending emarket and target messages to the subscribed buyer and seller agents
Parameters:
seller_tgt_msg - The SellerTargetMessage from the GUI that informs a seller of its starting position and goals
buyer_tgt_msg - The BuyerTargetMessage from the GUI that informs a buyer of its starting position and goals
negotiations - The number of negotiations in this emarket

startEscrowTimer

public void startEscrowTimer(EscrowDataManager edm, String deal_id)

subscriberManagerGUIClosed

public void subscriberManagerGUIClosed()
This method is invoked when the close icon of the subscription manager GUI is pressed. It causes all other market manager GUIs to shutdown and then closes down the market manager agent

Association Links

to Class java.util.Vector

A Vector of the id's of component seller agents that are subscribed to the market manager

to Class java.util.Vector

A Vector of the id's of manufacturer buyer agents that are subscribed to the market manager

to Class java.util.Vector

A Vector of the id's of manufacturer seller agents that are subscribed to the market manager

to Class java.util.Vector

A Vector of the id's of retail buyer agents that are subscribed to the market manager

to Class fipaos.tutorial.emarkets.subscribe.gui.FIPASubscribeParticipantGUI

A reference to the subscription management GUI that displays information about subscribed agents

to Class java.util.Hashtable

A Hashtable of references to handler tasks that are used to push inform messages to the subscribed agents using the FIPA subscribe protocol

to Class fipaos.tutorial.emarkets.agent.manager.gui.EmarketControlGUI

A reference to the market manager GUI that controls the emarkets

to Class java.util.Hashtable

to Class fipaos.tutorial.emarkets.message.MarketplaceMap