agentland.device
Class UniversalDeviceAgent

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.UniversalDeviceAgent
All Implemented Interfaces:
Agent, Device, Good, Managed, MetagluePrimitives, Remote, Serializable, Spy, UniversalDevice

public class UniversalDeviceAgent
extends DeviceAgent
implements UniversalDevice

This class should be the superclass of all Universal device controllers. Universal device controllers do not do any work by themselves but delegate it to the appropirate controller. What controller is doing the actual work is decided by the value of the attribute "device". Why is it useful? Just look: in Michael's office the VCR is controlled over IR. In the new conference room it will probably be controlled over RS232. Instead of hardcoding what controller to rely on in each case, you always rely on UniversalVCR and this will grab whatever controller is supposed to do the work in a given space.

See Also:
DeviceAgent, UniversalDevice, Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  Device actualDevice
           
protected  AgentID actualDeviceID
           
 
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
UniversalDeviceAgent()
           
 
Method Summary
protected  boolean checkMulti(String devName)
          A little tool for subclasses -- should be called by subclasses that implement both UniversalDevice and MultiDevice in cases where a named call is made.
 AgentID getActualDevice()
           
 boolean startSpeech()
          If possible, this method should load appropriate speech control for the device.
 
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

actualDeviceID

protected AgentID actualDeviceID

actualDevice

protected Device actualDevice
Constructor Detail

UniversalDeviceAgent

public UniversalDeviceAgent()
                     throws RemoteException
Method Detail

checkMulti

protected boolean checkMulti(String devName)
A little tool for subclasses -- should be called by subclasses that implement both UniversalDevice and MultiDevice in cases where a named call is made. This method will check if the actual device is a multi device contorller. If not, it will log a complaint messate.
Parameters:
devName - name of the device. right now used only for logging.
Returns:
true if actualdevice is a multi device, false otherwise

getActualDevice

public AgentID getActualDevice()
                        throws RemoteException
Specified by:
getActualDevice in interface UniversalDevice
Returns:
AgentID of the actual device that is doing the job

startSpeech

public boolean startSpeech()
                    throws RemoteException
Description copied from interface: UniversalDevice
If possible, this method should load appropriate speech control for the device.
Specified by:
startSpeech in interface UniversalDevice
Following copied from interface: agentland.device.UniversalDevice
Returns:
true if speech was started, false otherwise