agentland.device
Class MultiDeviceAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--agentland.device.DeviceAgent
                                            |
                                            +--agentland.device.MultiDeviceAgent
All Implemented Interfaces:
Agent, Device, Good, Managed, MetagluePrimitives, MultiDevice, Remote, Serializable, Spy
Direct Known Subclasses:
AbstractDeviceManagerAgent

public abstract class MultiDeviceAgent
extends DeviceAgent
implements MultiDevice

Base for all agents that directly control multiple devices at once. This can refer to single agents that directly control multiple devices or can be extended by device managers

See Also:
DeviceAgent, MultiDevice, Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  Hashtable grammars
           
protected  Translator nameResolver
           
protected  AgentID nameResolverID
           
 
Fields inherited from class agentland.device.DeviceAgent
defaultState, fName, names, states
 
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
MultiDeviceAgent()
           
 
Method Summary
 boolean addManagedGrammar(String name)
          Allows you to add a grammar that this agent will manage for you.
 AgentID getNameResolver()
          Returns the name resolver that this agent uses to store it's name-device associations
 boolean removeManagedGrammar(String name)
          Removes the grammar for the list of grammars to manage
protected  boolean setNameResolver(AgentID rid)
           
protected  void setUpNaming()
          This method gets called after name resolver is set up.
 void updateGrammar(AppGrammar g)
           
 void updateGrammars()
           
 
Methods inherited from class agentland.device.DeviceAgent
addName, createStateChangeNotification, ensureState, getDefaultNames, getDefaultStateName, getName, getNames, getState, getState, getStateNames, hasName, quietException, resetAllStates, resetName, resetState, resetState, setDefaultStateName, setName, setState, throwException, updateState, updateState, updateState, updateState, updateState, updateState, updateState, updateState
 
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.device.Device
addName, getName, getNames, getState, getState, getStateNames, hasName, resetAllStates, resetName, resetState, resetState, setName, setState
 
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

grammars

protected Hashtable grammars

nameResolverID

protected AgentID nameResolverID

nameResolver

protected Translator nameResolver
Constructor Detail

MultiDeviceAgent

public MultiDeviceAgent()
                 throws RemoteException
Method Detail

setNameResolver

protected boolean setNameResolver(AgentID rid)
                           throws RemoteException

getNameResolver

public AgentID getNameResolver()
                        throws RemoteException
Description copied from interface: MultiDevice
Returns the name resolver that this agent uses to store it's name-device associations
Specified by:
getNameResolver in interface MultiDevice

setUpNaming

protected void setUpNaming()
                    throws RemoteException
This method gets called after name resolver is set up. You shuld override it in child classes to do things that depend on the resolver being there.

addManagedGrammar

public boolean addManagedGrammar(String name)
                          throws RemoteException
Allows you to add a grammar that this agent will manage for you. If you ask this agent to manage a grammar, then every time its list of names changes, it will update the grammar by setting the list of alsternatives in rule "devices" to the list of names it knows about. So you have to make sure you have the rule "devices" in your grammar.
Specified by:
addManagedGrammar in interface MultiDevice
Returns:
true if the grammar was successfuly added, false otherwise (e.g. if no such grammar exists)

removeManagedGrammar

public boolean removeManagedGrammar(String name)
                             throws RemoteException
Removes the grammar for the list of grammars to manage
Specified by:
removeManagedGrammar in interface MultiDevice
Returns:
true if the grammar was there, false otherwise

updateGrammar

public void updateGrammar(AppGrammar g)
                   throws RemoteException

updateGrammars

public void updateGrammars()
                    throws RemoteException