speech
Class AppGrammarAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--speech.AppGrammarAgent
All Implemented Interfaces:
Agent, AppGrammar, Good, Managed, MetagluePrimitives, Remote, RemoteTagsListener, Serializable, Speakable, Spy

public class AppGrammarAgent
extends ManagedAgent
implements AppGrammar, RemoteTagsListener, Speakable

This is a Metaglue-ized interface to my ApplicationGrammar class, and thereby to the rule and dictation grammars in the Java Speech API (JSAPI beta v0.7). This interface provides all the basic functionality of the JSAPI RuleGrammar class but omits for the time being anything esoteric. For more information on the Java Speech Grammar Format (JSGF) specification, in which you write your grammars, see: http://java.sun.com/products/java-media/speech/forDevelopers/JSGF Your JSGF grammar files should all be located somewhere in _one_ of your root classpath directories. You can put them in whatever packages you like, but they must all be in the same root classpath directory. (This is due to the implementation of JSAPI's import mechanism.)

See Also:
ManagedAgent, AppGrammar, RemoteTagsListener, Speakable, 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
AppGrammarAgent()
          Set me up!
 
Method Summary
 void acceptedTagsResult(Hashtable tags)
          This is what is called by the GrammarCenter.
 void activate()
          Make folks able to say our stuff!
 void activate(String ruleName)
          Activate given rule.
 void addAlternative(String ruleName, String spokenText)
           
 void addAlternativeRule(String ruleName, String ruleNameToAdd)
           
 void addAlternatives(String ruleName, Collection spokenText)
           
 void addNewRuleAlternatives(String ruleName)
           
 void addTagsListener(RemoteTagsListener suppliedListener)
           
 void addTagsListener(String tag, TagsListener suppliedListener)
           
 void deactivate()
           
 void deactivate(String ruleName)
           
 Vector getActiveRules()
           
 String getFile()
           
 String getName()
           
 boolean hasRule(String ruleName)
           
 boolean isEnabled()
           
 Enumeration listRuleNames()
           
 void printRules()
           
 void replace(Resource old_r, Resource new_r)
          If we change GrammarCenters, we need to load up our grammar in the new center and get things going like they were in the old center.
 void requestWakeUp()
           
 void requestWakeUp(boolean playattention)
           
 void save()
           
 void setActive(boolean active)
          true = activate, false = deactivate
 void setAlternatives(String ruleName, Collection spokenText)
           
 String toSpeech()
          Returns a String that can be spoken by a speech synthesizer.
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, 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, 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, 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 agentland.resource.Managed
getNeed, replace, resources, yank, yank
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Constructor Detail

AppGrammarAgent

public AppGrammarAgent()
                throws RemoteException
Set me up!
Method Detail

replace

public void replace(Resource old_r,
                    Resource new_r)
If we change GrammarCenters, we need to load up our grammar in the new center and get things going like they were in the old center.
Specified by:
replace in interface Managed
Overrides:
replace in class ManagedAgent

acceptedTagsResult

public void acceptedTagsResult(Hashtable tags)
                        throws RemoteException
This is what is called by the GrammarCenter. We pass it on to all our friends and lovers.
Specified by:
acceptedTagsResult in interface RemoteTagsListener

addTagsListener

public void addTagsListener(RemoteTagsListener suppliedListener)
                     throws RemoteException
Specified by:
addTagsListener in interface AppGrammar

save

public void save()
          throws RemoteException
Specified by:
save in interface AppGrammar

addAlternative

public void addAlternative(String ruleName,
                           String spokenText)
                    throws RemoteException
Specified by:
addAlternative in interface AppGrammar

addAlternatives

public void addAlternatives(String ruleName,
                            Collection spokenText)
                     throws RemoteException
Specified by:
addAlternatives in interface AppGrammar

listRuleNames

public Enumeration listRuleNames()
                          throws RemoteException
Specified by:
listRuleNames in interface AppGrammar

printRules

public void printRules()
                throws RemoteException
Specified by:
printRules in interface AppGrammar

addTagsListener

public void addTagsListener(String tag,
                            TagsListener suppliedListener)
                     throws RemoteException

requestWakeUp

public void requestWakeUp()
                   throws RemoteException
Specified by:
requestWakeUp in interface AppGrammar

requestWakeUp

public void requestWakeUp(boolean playattention)
                   throws RemoteException
Specified by:
requestWakeUp in interface AppGrammar

setActive

public void setActive(boolean active)
               throws RemoteException
Description copied from interface: AppGrammar
true = activate, false = deactivate
Specified by:
setActive in interface AppGrammar

activate

public void activate()
              throws RemoteException
Description copied from interface: AppGrammar
Make folks able to say our stuff!
Specified by:
activate in interface AppGrammar

activate

public void activate(String ruleName)
              throws RemoteException
Description copied from interface: AppGrammar
Activate given rule.
Specified by:
activate in interface AppGrammar

deactivate

public void deactivate()
                throws RemoteException
Specified by:
deactivate in interface AppGrammar

deactivate

public void deactivate(String ruleName)
                throws RemoteException
Specified by:
deactivate in interface AppGrammar

getActiveRules

public Vector getActiveRules()
                      throws RemoteException
Specified by:
getActiveRules in interface AppGrammar

getName

public String getName()
               throws RemoteException
Specified by:
getName in interface AppGrammar

getFile

public String getFile()
               throws RemoteException
Specified by:
getFile in interface AppGrammar

isEnabled

public boolean isEnabled()
                  throws RemoteException
Specified by:
isEnabled in interface AppGrammar

addAlternativeRule

public void addAlternativeRule(String ruleName,
                               String ruleNameToAdd)
                        throws RemoteException
Specified by:
addAlternativeRule in interface AppGrammar

setAlternatives

public void setAlternatives(String ruleName,
                            Collection spokenText)
                     throws RemoteException
Specified by:
setAlternatives in interface AppGrammar

addNewRuleAlternatives

public void addNewRuleAlternatives(String ruleName)
                            throws RemoteException
Specified by:
addNewRuleAlternatives in interface AppGrammar

hasRule

public boolean hasRule(String ruleName)
                throws RemoteException
Specified by:
hasRule in interface AppGrammar

toSpeech

public String toSpeech()
Returns a String that can be spoken by a speech synthesizer.
Specified by:
toSpeech in interface Speakable
Returns:
a String value