metaglue
Interface Catalog

All Superinterfaces:
Agent, Notifier, Remote
All Known Subinterfaces:
GoodCatalog
All Known Implementing Classes:
CatalogAgent

public interface Catalog
extends Notifier

The Catalog -- center of metaglue


 Hearing stuff from the Catalog:
   register, via addSpy on the Catalog, for "load.INTERFACE"
   events.  Then implement tell( Secret s ) and you will get
   secrets with a details() of the AgentID in question.

  eg in constructor:  getCatalog().addSpy( getAgentID(),
                                           "load.agentland.test.Test" );
  and then
  public void tell( Secret s )
  {
      say( "Got " + s.details() + " as agentID" );
  }
 remember to make your agent interface extend agentland.util.Spy
 

See Also:
CatalogAgent, Notifier

Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Method Summary
 void add(AgentID agentID, Remote agentAgent)
           
 void addCatalogMonitor(CatalogMessageListener cml)
           
 int checkStatus(AgentID agentID)
           
 Vector enumerateAgents()
           
 Vector enumerateAgents(Filter filter)
          Return an enumeration of all of the AgentID's in this catalog that pass the passed filter.
 Agent lookup(AgentID agentID)
          Get the agent with the given ID.
 Agent lookupBlocking(AgentID agentID)
          lookupBlocking with _false_ as the retry_if_not_found parameter.
 Agent lookupBlocking(AgentID agentID, boolean retry_if_not_found)
          Does lookup, if it finds an agentstartingexception, it waits until something changes.
 void remove(AgentID agentID)
           
 void removeCatalogMonitor(CatalogMessageListener cml)
           
 void replaceStartingMG(AgentID aID, AgentID mID)
           
 
Methods inherited from interface agentland.util.Notifier
addSpy, addSpy, gossip, notify, passNotify, removeAllSpies, removeSpy, removeSpy
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 

Method Detail

checkStatus

public int checkStatus(AgentID agentID)
                throws RemoteException

lookup

public Agent lookup(AgentID agentID)
             throws RemoteException,
                    AgentNotFoundException,
                    AgentStartingException
Get the agent with the given ID. Does not block.

lookupBlocking

public Agent lookupBlocking(AgentID agentID,
                            boolean retry_if_not_found)
                     throws AgentNotFoundException,
                            RemoteException
Does lookup, if it finds an agentstartingexception, it waits until something changes. If it does not find an agent at all, it

lookupBlocking

public Agent lookupBlocking(AgentID agentID)
                     throws AgentNotFoundException,
                            RemoteException
lookupBlocking with _false_ as the retry_if_not_found parameter.

add

public void add(AgentID agentID,
                Remote agentAgent)
         throws RemoteException,
                AlreadyBoundException

remove

public void remove(AgentID agentID)
            throws RemoteException

replaceStartingMG

public void replaceStartingMG(AgentID aID,
                              AgentID mID)
                       throws RemoteException

addCatalogMonitor

public void addCatalogMonitor(CatalogMessageListener cml)
                       throws RemoteException

removeCatalogMonitor

public void removeCatalogMonitor(CatalogMessageListener cml)
                          throws RemoteException

enumerateAgents

public Vector enumerateAgents(Filter filter)
                       throws RemoteException
Return an enumeration of all of the AgentID's in this catalog that pass the passed filter.

If you use agentland.util.AgentRegexp's catalogFilter it will make sure each of the 3 elements passed matches (as a substring) NULL for any of the matching parts is the wildcard. $ indicates a beginning or end of a string. eg: enumerateAgents( AgentRegexp.makegFilter( "$luke", "metaglue.MetaglueAgent", nul ) ) gives all metaglue agents for society luke, lukeshal, and anything starting with luke.

Returns:
Vector of AgentIDs

enumerateAgents

public Vector enumerateAgents()
                       throws RemoteException