fipaos.skill.wrapper
Class FIPAWrapperTask

java.lang.Object
  |
  +--fipaos.agent.task.Task
        |
        +--fipaos.skill.wrapper.FIPAWrapperTask

public abstract class FIPAWrapperTask
extends Task

This is a default implementation of a FIPA Wrapper. It will respond to all valid incoming FIPA-Wrapper messages with a default refuse for that message type. It will also respond to other messages with a not-understood. To implement a working FIPA Wrapper agent simply subclass this Task in the agent state that will contain the wrapper functionality in your agent. Your agent can either subclass this state for it's IDLE listener state, or it can pass incoming wrapper requests on to a dedicated wrapper state that subclasses this object.

Implementation notes:




Fields inherited from class fipaos.agent.task.Task
_children, _lock, _owner, _tm
 
Constructor Summary
FIPAWrapperTask(FIPAOSAgent owner, TaskManager sm)
          FIPA Wrapper constructor creates the wrapper state and makes the calls to the API to start everything going.
 
Method Summary
protected  java.lang.String generateServiceID(java.lang.String prefix)
          Returns a unique service instance ID for a wrapper session.
protected  void handleOtherCommand(Conversation conv)
          Replies back to the sender with a default error.
 void handleQueryIf(Conversation conv)
          Handler ACL messages with a query-if performative.
 void handleQueryRef(Conversation conv)
          Handler ACL messages with a query-ref performative.
 void handleRequest(Conversation conv)
          Handler ACL messages with a request performative.
 
Methods inherited from class fipaos.agent.task.Task
DFSearchResults, done, done, doneDFSearchTask, errorDFSearchTask, forward, forward, getContext, getNewConversation, getState, handleAcceptProposal, handleAgree, handleCfp, handleConfirm, handleDisconfirm, handleFailure, handleInform, handleInformIf, handleInformRef, handleLateMessage, handleNotUnderstood, handleOther, handlePropagate, handlePropose, handleProxy, handleRefuse, handleRejectProposal, handleRequestWhen, handleRequestWhenever, handleSubscribe, handleUndeliverableMessage, newTask, newTask, newTask, newTask, newTask, newTask, newTask, newTask, notify, notifyDone, notifyError, notifyMessageFailure, notifyMessageForEndedConversation, notifyTimeout, searchDF, searchDF, searchDF, searchDF, searchDF, sendNotUnderstood, setContext, startTask, timeoutDFSearchTask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIPAWrapperTask

public FIPAWrapperTask(FIPAOSAgent owner,
                       TaskManager sm)
FIPA Wrapper constructor creates the wrapper state and makes the calls to the API to start everything going. Your state's constructor should mirror the parameters of this method and just make a call to super.
Parameters:
owner - The owner agent of this state
sm - The Task Manager that will control this state
Method Detail

handleRequest

public void handleRequest(Conversation conv)
Handler ACL messages with a request performative. These are the starting messages of the fipa-request protocol.
Overrides:
handleRequest in class Task
Parameters:
conv - The conversation containing the new message

handleQueryRef

public void handleQueryRef(Conversation conv)
Handler ACL messages with a query-ref performative. These are the starting messages of the fipa-query protocol.
Overrides:
handleQueryRef in class Task
Parameters:
conv - The conversation containing the new message

handleQueryIf

public void handleQueryIf(Conversation conv)
Handler ACL messages with a query-if performative. These are the starting messages of the fipa-query protocol.
Overrides:
handleQueryIf in class Task
Parameters:
conv - The conversation containing the new message

generateServiceID

protected java.lang.String generateServiceID(java.lang.String prefix)
Returns a unique service instance ID for a wrapper session. If your wrapper needs to provide a different ID then you should override this method.
Parameters:
prefix - An optional string prefix for the service instance ID - if you do not wish to use the prefix pass in a null parameter

handleOtherCommand

protected void handleOtherCommand(Conversation conv)
Replies back to the sender with a default error. If your wrapper needs to handle unknown/incorrect wrapper commands in a different way then you will need to override this method.
Parameters:
conv - The conversation to reply into