fipaos.platform.df
Class DFListenerTask

fipaos.agent.task.Task
  |
  +--fipaos.platform.df.DFListenerTask

public class DFListenerTask
extends Task
implements DFListenerManager

This Task provides a mechanism for listening to events occuring to a particular DF.

Currently this Task (and its counterpart) only support intra-platform communication
over a transport which maintains message content as objects (i.e. RMI).


Constructor Summary
DFListenerTask()
          Creates a DFListenerTask - once the Task has started, it will attempt to subscribe
to events from the given DF and forward them to the given DFListener

Method Summary
 voidhandleInform(Conversation conv)
          Invoked when an inform is received - either indicates that the subscription
has been setup OK, or indicates an event has occured that meets the requirements
of the original subscription request.
 voidhandleNotUnderstood(Conversation conv)
          Deal with not-understood messages here.
 voidhandleRefuse(Conversation conv)
          Invoked when the DF refuses subscription.
 voidinit(DFListener listener, AgentID df, Task idle_task)
          Initialises the DFListenerManager - should be invoked BEFORE
newTask() is invoked on an instance of DFListenerManager.
 voidstartTask()
          Invoked when the Task starts - sends subscription message to target DF
 voidstopListening()
          When invoked, causes the subscription with the DF to be cancelled
 booleansubscribedOK()
          Indicates if this DFListenerTask has been succesfull in subscribing.

Methods inherited from class fipaos.agent.task.Task
doneDFSearchTask, endTask, errorDFSearchTask, getContext, getState, handleAcceptProposal, handleAgree, handleCfp, handleConfirm, handleDisconfirm, handleFailure, handleInformIf, handleInformRef, handleLateMessage, handlePropagate, handlePropose, handleProxy, handleQueryIf, handleQueryRef, handleRejectProposal, handleRequest, handleRequestWhen, handleRequestWhenever, handleSubscribe, handleUndeliverableMessage, notify, notifyMessageFailure, notifyMessageForEndedConversation, setContext, timeoutDFSearchTask

Constructor Detail

DFListenerTask

public DFListenerTask()
Creates a DFListenerTask - once the Task has started, it will attempt to subscribe
to events from the given DF and forward them to the given DFListener
Method Detail

handleInform

public void handleInform(Conversation conv)
Invoked when an inform is received - either indicates that the subscription
has been setup OK, or indicates an event has occured that meets the requirements
of the original subscription request.
Parameters:
conv - the conversation this message is part of

handleNotUnderstood

public void handleNotUnderstood(Conversation conv)
Deal with not-understood messages here.
Parameters:
conv - the conversation this message is part of

handleRefuse

public void handleRefuse(Conversation conv)
Invoked when the DF refuses subscription.
Parameters:
conv - the conversation this message is part of

init

public void init(DFListener listener, AgentID df, Task idle_task)
Initialises the DFListenerManager - should be invoked BEFORE
newTask() is invoked on an instance of DFListenerManager.
Parameters:
listener - Object to receive DF event notification
df - DF to monitor

startTask

public void startTask()
Invoked when the Task starts - sends subscription message to target DF

stopListening

public void stopListening()
When invoked, causes the subscription with the DF to be cancelled

subscribedOK

public boolean subscribedOK()
Indicates if this DFListenerTask has been succesfull in subscribing.
Returns: result

Association Links

to Class fipaos.platform.df.DFListener

Object that is listening for DF events

to Class fipaos.ont.fipa.fipaman.AgentID

DF that is being monitored

to Class java.lang.String

Conversation ID associated with our subscription messages