agentland.help
Class HelpFileManagerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--agentland.help.HelpFileManagerAgent
All Implemented Interfaces:
Agent, Good, HelpFileManager, Managed, MetagluePrimitives, Remote, Serializable, Spy

public class HelpFileManagerAgent
extends ManagedAgent
implements HelpFileManager

The HelpFileManagerAgent is the central HelpFile repository, i.e. the central knowledge base. This agent handles the loading of HelpFiles, the removing of HelpFiles, and various requests for HelpFiles

See Also:
ManagedAgent, HelpFileManager, Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
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
HelpFileManagerAgent()
          Creates a new HelpFileManagerAgent instance.
 
Method Summary
 boolean add(Collection cHelpFileFullFileNames)
          Add a bunch of help files into the HelpFileManager's database.
 boolean add(String sHelpFileFullFileName)
          Add an XML help file to the database.
 void clear()
          Clears all the HelpFiles from this database.
 boolean contains(HelpFile hFile)
          Returns true if this has the HelpFile hFile.
 boolean contains(String sKeyword)
          Returns true if there exists a loaded HelpFile that has the given keyword.
 boolean contains(String sKeyword, HelpFile hFile)
          Returns true if this contains a HelpFile with a given keyword.
 void createInitialHelpFiles()
          Load the help files specified in the startup file.
 Vector get()
          Returns all the HelpFiles in this agent as a Vector.
 ArrayList get(String sKeyword)
          Returns the HelpFile with the given keyword.
 String getBasePath()
          Gets the directory where all the files are.
 String getHelpSetName()
          Gets the name of the helpset specified in the startup file.
 ArrayList getKeywords()
          Returns a Vector of all the keywords that exist in the loaded HelpFiles.
 HelpFile getLast()
          Returns the last accessed HelpFile.
 HelpFile getMost()
          Returns the most accessed HelpFile (the most popular).
 Vector getSorted()
          Returns in sorted order all the HelpFiles in this agent as a Vector.
 ArrayList getSubtopicNames()
          Gets a Vector of all the subtopic names.
 int size()
          Returns the number of HelpFiles loaded.
 boolean touch(HelpFile hFile)
          Update the internal container's counters relating to a given HelpFile.
 void updateState()
          Describe updateState method here.
 
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, tell
 
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 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
 

Constructor Detail

HelpFileManagerAgent

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

clear

public void clear()
Clears all the HelpFiles from this database.
Specified by:
clear in interface HelpFileManager
Following copied from interface: agentland.help.HelpFileManager
Throws:
RemoteException - if an error occurs

updateState

public void updateState()
Describe updateState method here.

createInitialHelpFiles

public void createInitialHelpFiles()
Load the help files specified in the startup file.
Specified by:
createInitialHelpFiles in interface HelpFileManager
Following copied from interface: agentland.help.HelpFileManager
Throws:
RemoteException - if an error occurs

getHelpSetName

public String getHelpSetName()
Gets the name of the helpset specified in the startup file.
Specified by:
getHelpSetName in interface HelpFileManager
Returns:
a String value

getBasePath

public String getBasePath()
Gets the directory where all the files are.
Specified by:
getBasePath in interface HelpFileManager
Returns:
a String value

add

public boolean add(String sHelpFileFullFileName)
Add an XML help file to the database.
Specified by:
add in interface HelpFileManager
Parameters:
sHelpFileFullFileName - a String value
Returns:
a boolean value

add

public boolean add(Collection cHelpFileFullFileNames)
Add a bunch of help files into the HelpFileManager's database. The input Vector contains a list of the file names of the XML help files to be added, relative to the base directory (which is usually /hal/source/help/).
Specified by:
add in interface HelpFileManager
Parameters:
vHelpFileFullFileNames - a Vector value
Returns:
a boolean value

get

public Vector get()
Returns all the HelpFiles in this agent as a Vector. The HelpFiles in the Vector are sorted in order of their addition to the HelpFileManagerAgent.
Specified by:
get in interface HelpFileManager
Returns:
a Vector value

getSorted

public Vector getSorted()
Returns in sorted order all the HelpFiles in this agent as a Vector. The HelpFiles in the Vector are sorted based on the Comparable interface.
Specified by:
getSorted in interface HelpFileManager
Returns:
a Vector value

get

public ArrayList get(String sKeyword)
Returns the HelpFile with the given keyword. If the keyword is not found, then returns null.
Specified by:
get in interface HelpFileManager
Parameters:
sKeyword - a String value
Returns:
a HelpFile value
Throws:
RemoteException - if an error occurs

getLast

public HelpFile getLast()
Returns the last accessed HelpFile.
Specified by:
getLast in interface HelpFileManager
Returns:
a HelpFile value
Throws:
RemoteException - if an error occurs

getMost

public HelpFile getMost()
Returns the most accessed HelpFile (the most popular).
Specified by:
getMost in interface HelpFileManager
Returns:
a HelpFile value
Throws:
RemoteException - if an error occurs

getKeywords

public ArrayList getKeywords()
Returns a Vector of all the keywords that exist in the loaded HelpFiles. This is used by HelpSpeech to dynamically update the rule grammar.
Specified by:
getKeywords in interface HelpFileManager
Returns:
a Vector value
Throws:
RemoteException - if an error occurs

getSubtopicNames

public ArrayList getSubtopicNames()
Gets a Vector of all the subtopic names. This is used by HelpSpeech to dynamically set a grammar rule.
Specified by:
getSubtopicNames in interface HelpFileManager
Returns:
a Vector value
Throws:
RemoteException - if an error occurs

contains

public boolean contains(HelpFile hFile)
Returns true if this has the HelpFile hFile. Otherwise returns false.
Specified by:
contains in interface HelpFileManager
Parameters:
hFile - a HelpFile value
Returns:
a boolean value
Throws:
RemoteException - if an error occurs

contains

public boolean contains(String sKeyword)
Returns true if there exists a loaded HelpFile that has the given keyword. Otherwise returns false.
Specified by:
contains in interface HelpFileManager
Parameters:
sKeyword - a String value
Returns:
a boolean value
Throws:
RemoteException - if an error occurs

contains

public boolean contains(String sKeyword,
                        HelpFile hFile)
Returns true if this contains a HelpFile with a given keyword. Otherwise returns false.
Specified by:
contains in interface HelpFileManager
Parameters:
sKeyword - a String value
hFile - a HelpFile value
Returns:
a boolean value
Throws:
RemoteException - if an error occurs

size

public int size()
Returns the number of HelpFiles loaded.
Specified by:
size in interface HelpFileManager
Returns:
an int value
Throws:
RemoteException - if an error occurs

touch

public boolean touch(HelpFile hFile)
Update the internal container's counters relating to a given HelpFile. The counter is used to keep track of the number of accesses of each HelpFile.
Specified by:
touch in interface HelpFileManager
Parameters:
hFile - a HelpFile value
Returns:
a boolean value