ihelp
Class MMAgent

java.lang.Object
  |
  +--fipaos.agent.FIPAOSAgent
        |
        +--repserver.RepAgent
              |
              +--ihelp.MMAgent
All Implemented Interfaces:
fipaos.agent.conversation.ConversationListener, LocalMsg

public class MMAgent
extends RepAgent

MMAgent is the IHelp matchmaker agent It maintains a hashtable of personal agents, broadcasts help requests to all the PersAgents that it knows about and assembles the replies that it gets.


Inner Class Summary
 class MMAgent.FindTask
          FindTask sends a help request to all the personal agents that this MM knows about.
 class MMAgent.HandleRequestTask
          Handles all incoming i-help requests
 class MMAgent.IdleTask
          IdleTask
 class MMAgent.SendFindTask
          send a message to the given agent to see if the agents user is willing and able to help.
 
Inner classes inherited from class repserver.RepAgent
RepAgent.RegisterTask, RepAgent.RepServerManagementTask, RepAgent.StateTask
 
Inner classes inherited from class fipaos.agent.FIPAOSAgent
fipaos.agent.FIPAOSAgent.TopLevelHandlerTask
 
Fields inherited from class fipaos.agent.FIPAOSAgent
_database_profile, _registered_with, _state, _tm
 
Constructor Summary
MMAgent(java.lang.String platform, java.lang.String name, java.lang.String ownership, fipaos.ont.fipa.fipaman.AgentID rs, java.lang.String role, java.lang.String group_name)
           
 
Method Summary
 void addPersAgent(fipaos.ont.fipa.fipaman.AgentID aid)
          Add the given AgentID to the MM
 void checkForFailure()
          generate a random number, and if the number is in the range to fail, shutdown this agent.
 void delPersAgent(fipaos.ont.fipa.fipaman.AgentID aid)
          Remove the given AgentID from the MM
 byte[] getAState()
          returns a byte stream representing the current state of this agent.
 void goActive()
          Code to execute when this agent is set to ACTIVE_AGENT.
 boolean hasPersAgent(fipaos.ont.fipa.fipaman.AgentID aid)
          true if the given AgentID is registered with this MM
 java.lang.String listAgents()
          List, as a string the names of all the agents currently registered with this matchmaker
static void main(java.lang.String[] args)
          Test harness
 boolean setAState(byte[] b)
          set the state of the agent, given a byte stream.
 void shutdown()
           
 
Methods inherited from class repserver.RepAgent
doneRepAgent_RegisterTask, getConvs, getGroupName, getLocalPostOffice, getProxyAID, getReceiver, getRepServer, getRole, isActiveAgent, isReplicant, removeConv, sendReply, sendReply, setLocalPostOffice, setRepServer, setRole
 
Methods inherited from class fipaos.agent.FIPAOSAgent
activate, addNewProtocol, deregisterWithAMS, deregisterWithDF, forward, forward, getAID, getCM, getCurrentConversation, getHAP, getLocalAMS, getLocalAMSAID, getLocalDF, getLocalDFAID, getNewConversation, getOwnership, getPlatformProfile, getProfile, getState, isShutdown, knowsProtocol, notify, notify, notifyDone, notifyError, notifyMessageInEndedConversation, notifyMessageUndeliverable, notifyTimeout, registeredWith, registeredWithAMS, registeredWithDF, registerWithAMS, registerWithAMS, registerWithAMS, registerWithAMS, registerWithDF, registerWithDF, registerWithDF, registerWithDF, sendNotUnderstood, sendNotUnderstood, setListenerTask, setMessageSender, startPushing, waitForPushLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MMAgent

public MMAgent(java.lang.String platform,
               java.lang.String name,
               java.lang.String ownership,
               fipaos.ont.fipa.fipaman.AgentID rs,
               java.lang.String role,
               java.lang.String group_name)
Method Detail

goActive

public void goActive()
Description copied from class: RepAgent
Code to execute when this agent is set to ACTIVE_AGENT. This method should be overridden when implementing an agent.
Overrides:
goActive in class RepAgent

shutdown

public void shutdown()
Overrides:
shutdown in class fipaos.agent.FIPAOSAgent

hasPersAgent

public boolean hasPersAgent(fipaos.ont.fipa.fipaman.AgentID aid)
true if the given AgentID is registered with this MM

addPersAgent

public void addPersAgent(fipaos.ont.fipa.fipaman.AgentID aid)
Add the given AgentID to the MM

delPersAgent

public void delPersAgent(fipaos.ont.fipa.fipaman.AgentID aid)
Remove the given AgentID from the MM

listAgents

public java.lang.String listAgents()
List, as a string the names of all the agents currently registered with this matchmaker

checkForFailure

public void checkForFailure()
generate a random number, and if the number is in the range to fail, shutdown this agent.

getAState

public byte[] getAState()
Description copied from class: RepAgent
returns a byte stream representing the current state of this agent. This should be overridden by the implementing agent.
Overrides:
getAState in class RepAgent

setAState

public boolean setAState(byte[] b)
set the state of the agent, given a byte stream.
Overrides:
setAState in class RepAgent
Following copied from class: repserver.RepAgent
Parameters:
state - a byte stream representing the state of this agent. returns true if successful.

main

public static void main(java.lang.String[] args)
Test harness