agentland.info
Class StartInterfaceAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--mess.MessAgent
                                            |
                                            +--agentland.info.StartInterfaceAgent
All Implemented Interfaces:
Agent, Good, Managed, Mess, MetagluePrimitives, Remote, RemoteTagsListener, Serializable, Spy, StartInterface, Userfunction

public class StartInterfaceAgent
extends MessAgent
implements StartInterface

This is the agent that START should communicate with. StartInterfaceAgent handles commands, queries, and assertions issued by START. This agent also listens for state change notification from DeviceAgents, and records the state changes in Jess. Scripts for agents that support START queries and commands should be added to the script agentland.info.scripts.knownAgents. Use fread to send queries or assertions to START. Be sure to call connectToStart to open the connection first.

See Also:
AgentAgent, StartInterface, Serialized Form

Inner classes inherited from class mess.MessAgent
MessAgent.RunPrompt
 
Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  Notifier notifier
           
 
Fields inherited from class mess.MessAgent
rete
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
Fields inherited from class agentland.util.GoodAgent
alert
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
StartInterfaceAgent()
          Creates a new StartInterfaceAgent instance.
 
Method Summary
 void closeConnectionToStart()
          Close the connection to START.
 boolean connectToStart()
          Call this to set up connection to START
 boolean doAssert(String assertion)
          Make an assertion.
 boolean doCommand(String object, String args)
          Execute a command.
 String doQuery(String object, String args)
          Execute a query and return the result.
 String fread(String input)
          Call START's fread function.
 void hearStateChange(Secret s)
           
 void help()
          Prints the queries and commands that this agent can handle on System.out.
 boolean isConnected()
           
 void showFacts()
          Prints the facts in the system on System.out
 
Methods inherited from class mess.MessAgent
acceptedTagsResult, addMessSpy, addUserfunction, addUserFunctions, assert, assert, assertAttribute, assertSpeechTag, call, callInitScripts, clear, execCommand, facts, fetch, fetchInt, getName, getReturnValue, loadFacts, loadFile, loadGrammar, loadPackages, loadReader, loadScript, loadString, loadURL, messAsk, messAskFree, messSay, messSaySafe, messSaySync, messThink, newFact, newFact, reset, retract, retract, run, runRete, saveFacts, setReturnValue, startRete, store, store, tell
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, 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, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mess.Mess
addUserfunction, assert, assert, assertAttribute, assertSpeechTag, clear, execCommand, facts, fetch, fetchInt, loadFacts, loadFile, loadScript, loadString, loadURL, newFact, newFact, reset, retract, retract, run, saveFacts, store
 
Methods inherited from interface agentland.resource.Managed
getNeed, replace, replace, resources, yank, yank
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Field Detail

notifier

protected Notifier notifier
Constructor Detail

StartInterfaceAgent

public StartInterfaceAgent()
                    throws RemoteException
Creates a new StartInterfaceAgent instance.
Throws:
RemoteException - if an error occurs
Method Detail

doCommand

public boolean doCommand(String object,
                         String args)
                  throws RemoteException
Execute a command.
Specified by:
doCommand in interface StartInterface
Parameters:
object - the object you are asking about
args - other parts of the command
Returns:
true if successful, false otherwise
Throws:
RemoteException - if an error occurs

doQuery

public String doQuery(String object,
                      String args)
               throws RemoteException
Execute a query and return the result.
Specified by:
doQuery in interface StartInterface
Parameters:
object - the object you are asking about
args - other parts of the query
Returns:
the answer to the query if successful, null otherwise
Throws:
RemoteException - if an error occurs

doAssert

public boolean doAssert(String assertion)
                 throws RemoteException
Make an assertion.
Specified by:
doAssert in interface StartInterface
Parameters:
assertion - the fact to be asserted
Returns:
true if successful, false otherwise
Throws:
RemoteException - if an error occurs

hearStateChange

public void hearStateChange(Secret s)
                     throws RemoteException
Specified by:
hearStateChange in interface StartInterface

help

public void help()
          throws RemoteException
Prints the queries and commands that this agent can handle on System.out.
Specified by:
help in interface StartInterface
Throws:
RemoteException - if an error occurs

showFacts

public void showFacts()
               throws RemoteException
Prints the facts in the system on System.out
Specified by:
showFacts in interface StartInterface
Throws:
RemoteException - if an error occurs

connectToStart

public boolean connectToStart()
                       throws RemoteException
Call this to set up connection to START
Specified by:
connectToStart in interface StartInterface
Returns:
true if successful
Throws:
RemoteException - if an error occurs

fread

public String fread(String input)
             throws RemoteException
Call START's fread function.
Specified by:
fread in interface StartInterface
Parameters:
input - a string to give to fread
Returns:
START's response

closeConnectionToStart

public void closeConnectionToStart()
                            throws RemoteException
Close the connection to START.
Specified by:
closeConnectionToStart in interface StartInterface
Throws:
RemoteException - if an error occurs

isConnected

public boolean isConnected()
                    throws RemoteException
Specified by:
isConnected in interface StartInterface