fipaos.tutorial.emarkets.agent.buyer
Class BuyerAgent

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

public abstract class BuyerAgent
extends SubscribingAgent
implements BuyerAbility, EscrowProtocolInitiatorAbility, NegotiationProtocolParticipantAbility

The BuyerAgent class represents an agent seeking to make purchases in a an e-marketplace


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

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

Constructor Summary
BuyerAgent(String platform_profile, String name, String owner, String type)
          Constructs a buyer agent

Method Summary
 voiddealWithEscrowProtocolFailure(Object failure)
          Callback method to indicate that the escrow agent detected errors while matching our claims with those made by the seller
 voiddealWithEscrowProtocolInform(Object inform)
          Callback to handle a success signal from the escrow service.
 voiddealWithFIPASubscribeInform(Object notification)
          Callback method to signal that an inform message was sent by the agent we are subscribed to
 voiddealWithFIPASubscribeRefuse(Object content)
          Callback method to indicate that our attempt to subscribe to an agent was refused
 voiddealWithNegotiationProtocolAcceptProposal(Object acceptproposal)
          Callback method to signal that an accept-proposal message was received from the seller.
 voiddealWithNegotiationProtocolCfp(Object[] cfp)
          Callback method to signal that a CFP message was received from the seller.
 voiddealWithNegotiationProtocolInform(Object inform)
          Callback method to signal that an inform message was received from the seller.
 voiddealWithNegotiationProtocolRejectProposal(Object rejectproposal)
          Callback method to signal that a reject-proposal message was received from the seller.
 voiddealWithNegotiationProtocolStart(Object[] cfp)
          Callback method to signal that a CFP message was received from the seller.
 voiddoneEscrowProtocolInitiatorHandlerTask(Task t)
          Callback method to notify the BuyerAgent that its interaction with the escrow agent has finished
 intgetCredits()
           
 intgetItems()
           
 intgetTargetItems()
           
 voidGUIClosed()
          Invoked when the buyer's gui is closed.
 synchronized voidshutdown()
          Attempts to unsubscribe from the market manager before shutting down the agent

Methods inherited from class fipaos.tutorial.emarkets.agent.SubscribingAgent
addAgent, doneFIPASubscribeInitiatorHandlerTask, doneFIPASubscribeInitiatorHandlerTask, getSubscribedWith, searchForAgents, subscribe, subscriberGUIClosed, unsubscribe

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

BuyerAgent

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

dealWithEscrowProtocolFailure

public void dealWithEscrowProtocolFailure(Object failure)
Callback method to indicate that the escrow agent detected errors while matching our claims with those made by the seller
Parameters:
failure - The content of the failure message sent by the escrow agent

dealWithEscrowProtocolInform

public void dealWithEscrowProtocolInform(Object inform)
Callback to handle a success signal from the escrow service. The escrow message we sent was validated with the deals reported by the seller
Parameters:
inform - The content of the message returned by the escrow service

dealWithFIPASubscribeInform

public void dealWithFIPASubscribeInform(Object notification)
Callback method to signal that an inform message was sent by the agent we are subscribed to
Parameters:
content - The content of the inform message

dealWithFIPASubscribeRefuse

public void dealWithFIPASubscribeRefuse(Object content)
Callback method to indicate that our attempt to subscribe to an agent was refused
Parameters:
content - The content of the refuse message

dealWithNegotiationProtocolAcceptProposal

public void dealWithNegotiationProtocolAcceptProposal(Object acceptproposal)
Callback method to signal that an accept-proposal message was received from the seller. This indicates that our last proposal was successful and a deal has been made.
Parameters:
acceptproposal - The contents of the accept-proposal message

dealWithNegotiationProtocolCfp

public void dealWithNegotiationProtocolCfp(Object[] cfp)
Callback method to signal that a CFP message was received from the seller. This is a counter-proposal from the seller in response to a proposal we made
Parameters:
cfp - The content of the CFP message

dealWithNegotiationProtocolInform

public void dealWithNegotiationProtocolInform(Object inform)
Callback method to signal that an inform message was received from the seller. This message means that no proposal was received from us in response to the seller's CFP. This means that we are now excluded from the rest of the negotiation
Parameters:
inform - The contents of the inform message

dealWithNegotiationProtocolRejectProposal

public void dealWithNegotiationProtocolRejectProposal(Object rejectproposal)
Callback method to signal that a reject-proposal message was received from the seller. This means that our proposal was rejected and that the negotiation has now finished
Parameters:
rejectproposal - The contents of the reject-proposal message

dealWithNegotiationProtocolStart

public void dealWithNegotiationProtocolStart(Object[] cfp)
Callback method to signal that a CFP message was received from the seller. This is the start of a new negotiation
Parameters:
cfp - The content of the CFP message

doneEscrowProtocolInitiatorHandlerTask

public void doneEscrowProtocolInitiatorHandlerTask(Task t)
Callback method to notify the BuyerAgent that its interaction with the escrow agent has finished
Parameters:
t - The reference to the task that has just completed

getCredits

public int getCredits()

getItems

public int getItems()

getTargetItems

public int getTargetItems()

GUIClosed

public void GUIClosed()
Invoked when the buyer's gui is closed.

shutdown

public synchronized void shutdown()
Attempts to unsubscribe from the market manager before shutting down the agent

Association Links

to Class fipaos.tutorial.emarkets.message.EscrowMessage

Used to store the escrow data for the current emarket of negotiations. This object will be sent to the escrow service at the end of the negotiations

to Class fipaos.ont.fipa.fipaman.AgentID

The AgentID of the seller that we are buying from

to Class java.lang.String

The identifier of the emarket we are currently trading in

to Class fipaos.tutorial.emarkets.message.BuyerEmarketMessage

Provides information about the current emarket, including the seller to trade with and the number of negotiations in the emarket