agentland.web
Class WebInterfaceAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.web.WebInterfaceAgent
All Implemented Interfaces:
Agent, Good, MetagluePrimitives, Remote, Serializable, Spy, WebInterface

public class WebInterfaceAgent
extends GoodAgent
implements WebInterface

This class serves as an interface between the servlet and the rest of the metaglue agent community. This class contains a tool for starting an instance of this agent up and another one for communicating web requests to other agents;

See Also:
AgentAgent, WebInterface, Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
WebInterfaceAgent()
           
 
Method Summary
 WebInterface getWebInterface(String catalog)
           
static WebInterfaceAgent getWebInterfaceAgent(String catalog)
          This static method is called from a servlet to produce an instance of this agent.
 void init()
           
 String makeWebCall(String agentname, Hashtable h)
          This is the method a servlet will call in order to communicate with other agents.
 void setFooter(String fileName, String society)
           
 void setHeader(String fileName, String society)
           
 String test(String fileName, String society)
           
 String toString()
           
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getAlert, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
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, lookupClass, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, 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

WebInterfaceAgent

public WebInterfaceAgent()
                  throws RemoteException
Method Detail

test

public String test(String fileName,
                   String society)
            throws RemoteException
Specified by:
test in interface WebInterface

setHeader

public void setHeader(String fileName,
                      String society)
               throws RemoteException
Specified by:
setHeader in interface WebInterface

setFooter

public void setFooter(String fileName,
                      String society)
               throws RemoteException
Specified by:
setFooter in interface WebInterface

init

public void init()
          throws RemoteException
Specified by:
init in interface WebInterface

getWebInterfaceAgent

public static WebInterfaceAgent getWebInterfaceAgent(String catalog)
                                              throws RemoteException
This static method is called from a servlet to produce an instance of this agent. This method will create a metaglue agent in this vm and ask it to create an instance of WebInterfaceAgent here as well.
Parameters:
catalog - name of the host running the catalog that the new agent should register with
Returns:
the WebInterfaceAgent object -- it has to be local!

getWebInterface

public WebInterface getWebInterface(String catalog)
                             throws RemoteException
Specified by:
getWebInterface in interface WebInterface

toString

public String toString()
Overrides:
toString in class AgentAgent

makeWebCall

public String makeWebCall(String agentname,
                          Hashtable h)
This is the method a servlet will call in order to communicate with other agents.
Parameters:
agentname - a string representation of the agent to be contacted
h - a hashtable with all the variables and their values from the form submitted from the web
Returns:
HTML string from the agent we just called