agentland.util
Interface Notifier

All Known Subinterfaces:
Catalog, LocalLogManager, WindowsWebBrowser
All Known Implementing Classes:
NotifierAgent

public interface Notifier
extends Agent

The Notifier allows other agents to register interest in other agent's behavior. This effectively means that many different agents can listen to what other agents are doing, and perform actions based on their behavior.


Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Method Summary
 void addSpy(AgentID spy, String noteType)
          This assumes the Spy implements the Spy interface.
 void addSpy(AgentID spy, String callMethod, String noteType)
          Registers an agent as having an interest in certain messages.
 void gossip(Secret secret)
          Does the same work as notify.
 void notify(Secret secret)
          Sends a notification to any agents who have registered an interest in the given notification type.
 void passNotify(Secret secret)
          So we can chain notifiers together in big nets o fun.
 void removeAllSpies()
           
 void removeSpy(AgentID spy, String noteType)
          This assumes the spy implements the Spy interface.
 void removeSpy(AgentID spy, String callMethod, String noteType)
          Unregisters an agent from having an interest in certain messages.
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 

Method Detail

addSpy

public void addSpy(AgentID spy,
                   String callMethod,
                   String noteType)
            throws RemoteException
Registers an agent as having an interest in certain messages. To remove the registration, call removeSpy with the same arguments.
Parameters:
spyName - The spy to be found.
callMethod - A string specifying the method name to call when the requested notification occurs. The method should return void, and take two arguments; first, a String specifying the notification type, and second, another String with extra information. This is the same signature as the notify method in this class.
noteType - A simple string specifying the type of the notification. Any Secret with a name string which _begins_ with the passed notetype will be sent to the spy. So if a spy registers for Boogie events, then a Boogie.Down event will get shipped to the spy as well as strict Boogie events.
See Also:
AgentAgent.reliesOn(java.lang.String), removeSpy(metaglue.AgentID, java.lang.String, java.lang.String), notify(agentland.util.Secret)

addSpy

public void addSpy(AgentID spy,
                   String noteType)
            throws RemoteException
This assumes the Spy implements the Spy interface.

removeSpy

public void removeSpy(AgentID spy,
                      String callMethod,
                      String noteType)
               throws RemoteException
Unregisters an agent from having an interest in certain messages. The three parameters should be the same as were previously used in the addSpy call.
Parameters:
spyName - A string specifiying the agent's class name.
callMethod - A string specifying the method name.
noteType - A string specifying the type of the notification.
See Also:
AgentAgent.reliesOn(java.lang.String), addSpy(metaglue.AgentID, java.lang.String, java.lang.String), notify(agentland.util.Secret)

removeSpy

public void removeSpy(AgentID spy,
                      String noteType)
               throws RemoteException
This assumes the spy implements the Spy interface.

notify

public void notify(Secret secret)
            throws RemoteException
Sends a notification to any agents who have registered an interest in the given notification type. Also provides extra information to the agents.
Parameters:
secret - This is the Secret to pass to any registered Spy agents.

gossip

public void gossip(Secret secret)
            throws RemoteException
Does the same work as notify.
See Also:
notify(Secret)

passNotify

public void passNotify(Secret secret)
                throws RemoteException
So we can chain notifiers together in big nets o fun. It calls notify if and only if the society of the secret sender is not the same as ours

removeAllSpies

public void removeAllSpies()
                    throws RemoteException