agentland.util.launcher
Class LauncherAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.launcher.LauncherAgent
All Implemented Interfaces:
Agent, Launcher, MetagluePrimitives, Remote, Serializable

public class LauncherAgent
extends AgentAgent
implements Launcher

A Launcher agent can start other agents or query to see if they are running. Launcher is general enough to respond to requests regarding specific AgentID's, although such generality is probably useful only in very special circumstances (you're prolly better off calling reliesOn() yourself). The list of agents it knows about are stashed in a persistant map. This maps Strings ==> AgentIDs, where the string is representative of the agent; eg. "MapDisplaySpeech" ==> maps.speechin.MapDisplaySpeech

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface agentland.util.launcher.Launcher
ERROR
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
LauncherAgent()
           
 
Method Summary
 void addLaunchableAgent(String spoken_text, AgentID agentid)
          Adds an association between a name and an agentID.
 Vector launchableAgents()
          Returns the vector of names (not agent ID's) of agents that can be started through this agent
protected  int queryAgent(AgentID aid)
           
 int queryAgent(String aName)
          Returns true if the agent referred to by this name is running; false if the agent is not running or the name could not be resolved
 void removeLaunchableAgent(String text)
          Remove the name from the database
 boolean startAgent(String aName)
          Attempts to start the agent.
 AgentID whois(String agentname)
          Given a name, it returns the agentID of the corresponding agent (or null of name could not be resolved)
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, log, lookupClass, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 

Constructor Detail

LauncherAgent

public LauncherAgent()
              throws RemoteException
Method Detail

startAgent

public boolean startAgent(String aName)
                   throws RemoteException
Attempts to start the agent. Returns true if all goes well or false if name could not be resolved or an error occurs
Specified by:
startAgent in interface Launcher
Parameters:
aName - The name of the agent to start

queryAgent

public int queryAgent(String aName)
               throws RemoteException
Returns true if the agent referred to by this name is running; false if the agent is not running or the name could not be resolved
Specified by:
queryAgent in interface Launcher
Following copied from interface: agentland.util.launcher.Launcher
See Also:
Agent

queryAgent

protected int queryAgent(AgentID aid)
                  throws RemoteException

launchableAgents

public Vector launchableAgents()
                        throws RemoteException
Returns the vector of names (not agent ID's) of agents that can be started through this agent
Specified by:
launchableAgents in interface Launcher

whois

public AgentID whois(String agentname)
              throws RemoteException
Given a name, it returns the agentID of the corresponding agent (or null of name could not be resolved)
Specified by:
whois in interface Launcher

removeLaunchableAgent

public void removeLaunchableAgent(String text)
                           throws RemoteException
Remove the name from the database
Specified by:
removeLaunchableAgent in interface Launcher

addLaunchableAgent

public void addLaunchableAgent(String spoken_text,
                               AgentID agentid)
                        throws RemoteException
Adds an association between a name and an agentID. If the name already exists pointing to some agent, this method will override the previous association.
Specified by:
addLaunchableAgent in interface Launcher
Parameters:
spoken_text - the name to be used when referring the agent
agentid - Agent's ID