metaglue
Class AttributeManagerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--metaglue.AttributeManagerAgent

public class AttributeManagerAgent
extends AgentAgent
implements AttributeManager

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
static int CAN_DEFAULT
           
static int NO_DEFAULT
           
static int ONLY_DEFAULT
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
AttributeManagerAgent()
           
 
Method Summary
 void addAgentStrong(String society, String occupation)
           
 void addAttribute(AgentID agentID, String attributeName)
          Adds attribute for agent with empty value
 void addAttribute(AgentID agentID, String attributeName, String attributeValue)
          Adds new agent along with attribute if necessary and initializes with value
 void addAttribute(String society, String occupation, String attributeName)
          Adds new agent along with attribute if necessary
 void addAttributeListener(AttributeListener attributeListener)
           
 void addSocietyStrong(String society)
           
 void addSocietyStrong(String society, Hashtable olevel)
           
 void deleteSociety(String oldSociety)
          delete society name in attributeDB
 void exportHumanReadable(String xfile)
           
 Object getAllAttributes()
           
 String getAttribute(AgentID agentID, String attributeName)
           
 String getAttribute(AgentID agentID, String attributeName, int default_switch)
           
 String getDefaultAttribute(AgentID agentID, String attributeName)
           
 Vector getDesignations(String occupation)
          Look for all possible designations for a given occupation in the attribute database.
 boolean hasAttribute(AgentID agentID, String attributeName)
          Return whether the given agent has a defined attribute (or if there is a default attribute for) with given attributeName This is since getAttribute throws exceptions at drop of hat.
 void importHumanReadable(String ifile)
           
 Vector removeDesignation(AgentID agentID)
           
 Hashtable removeSociety(String society)
           
 void saveAttributes()
           
 void synchronizeAgents()
           
 void synchronizeAgents(Object selection)
           
 void synchronizeAttributes()
           
 void updateAttribute(AgentID agentID, String attributeName, String attributeValue)
          Value overwrites old value, adding attribute if necessary
 void updateDesignation(AgentID oldAgentID, String newDesignation)
           
 void updateSociety(String oldSociety, String newSociety)
          change society name in attributeDB
 
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, log, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOn, 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
 

Field Detail

NO_DEFAULT

public static final int NO_DEFAULT

ONLY_DEFAULT

public static final int ONLY_DEFAULT

CAN_DEFAULT

public static final int CAN_DEFAULT
Constructor Detail

AttributeManagerAgent

public AttributeManagerAgent()
                      throws RemoteException,
                             MissingAttributeDBException,
                             CorruptAttributeDBException
Method Detail

getDesignations

public Vector getDesignations(String occupation)
                       throws CorruptAttributeDBException
Look for all possible designations for a given occupation in the attribute database. (for Debugging use)
Specified by:
getDesignations in interface AttributeManager

getDefaultAttribute

public String getDefaultAttribute(AgentID agentID,
                                  String attributeName)
                           throws RemoteException,
                                  MissingAgentInAttributeDBException,
                                  CorruptAttributeDBException,
                                  MissingAttributeException
Specified by:
getDefaultAttribute in interface AttributeManager

getAttribute

public String getAttribute(AgentID agentID,
                           String attributeName)
                    throws RemoteException,
                           MissingAgentInAttributeDBException,
                           CorruptAttributeDBException,
                           MissingAttributeException
Specified by:
getAttribute in interface AttributeManager

getAttribute

public String getAttribute(AgentID agentID,
                           String attributeName,
                           int default_switch)
                    throws RemoteException,
                           MissingAgentInAttributeDBException,
                           CorruptAttributeDBException,
                           MissingAttributeException

hasAttribute

public boolean hasAttribute(AgentID agentID,
                            String attributeName)
                     throws RemoteException
Return whether the given agent has a defined attribute (or if there is a default attribute for) with given attributeName This is since getAttribute throws exceptions at drop of hat.
Specified by:
hasAttribute in interface AttributeManager

updateSociety

public void updateSociety(String oldSociety,
                          String newSociety)
                   throws RemoteException,
                          MissingAgentInAttributeDBException
change society name in attributeDB
Specified by:
updateSociety in interface AttributeManager

deleteSociety

public void deleteSociety(String oldSociety)
                   throws RemoteException,
                          MissingAgentInAttributeDBException
delete society name in attributeDB
Specified by:
deleteSociety in interface AttributeManager

addAttribute

public void addAttribute(String society,
                         String occupation,
                         String attributeName)
                  throws RemoteException,
                         CorruptAttributeDBException
Adds new agent along with attribute if necessary
Throws:
CorruptAttributeDBException - attributeDB does not contain expected data types

addAttribute

public void addAttribute(AgentID agentID,
                         String attributeName,
                         String attributeValue)
                  throws RemoteException,
                         CorruptAttributeDBException
Adds new agent along with attribute if necessary and initializes with value
Specified by:
addAttribute in interface AttributeManager
Throws:
CorruptAttributeDBException - attributeDB does not contain expected data types

addAttribute

public void addAttribute(AgentID agentID,
                         String attributeName)
                  throws RemoteException,
                         CorruptAttributeDBException
Adds attribute for agent with empty value
Specified by:
addAttribute in interface AttributeManager
Throws:
CorruptAttributeDBException - attributeDB does not contain expected data types

updateAttribute

public void updateAttribute(AgentID agentID,
                            String attributeName,
                            String attributeValue)
                     throws RemoteException,
                            CorruptAttributeDBException
Value overwrites old value, adding attribute if necessary
Specified by:
updateAttribute in interface AttributeManager
Throws:
CorruptAttributeDBException - attributeDB does not contain expected data types

addAttributeListener

public void addAttributeListener(AttributeListener attributeListener)
                          throws RemoteException
Specified by:
addAttributeListener in interface AttributeManager

saveAttributes

public void saveAttributes()
                    throws RemoteException,
                           CorruptAttributeDBException
Specified by:
saveAttributes in interface AttributeManager

exportHumanReadable

public void exportHumanReadable(String xfile)
                         throws RemoteException
Specified by:
exportHumanReadable in interface AttributeManager

importHumanReadable

public void importHumanReadable(String ifile)
                         throws RemoteException
Specified by:
importHumanReadable in interface AttributeManager

synchronizeAgents

public void synchronizeAgents()
                       throws RemoteException,
                              CorruptAttributeDBException
Specified by:
synchronizeAgents in interface AttributeManager

synchronizeAgents

public void synchronizeAgents(Object selection)
                       throws RemoteException,
                              CorruptAttributeDBException
Specified by:
synchronizeAgents in interface AttributeManager

synchronizeAttributes

public void synchronizeAttributes()
                           throws RemoteException,
                                  CorruptAttributeDBException
Specified by:
synchronizeAttributes in interface AttributeManager

getAllAttributes

public Object getAllAttributes()
                        throws RemoteException
Specified by:
getAllAttributes in interface AttributeManager

addSocietyStrong

public void addSocietyStrong(String society)
                      throws RemoteException,
                             AgentAlreadyInAttributeDBException
Specified by:
addSocietyStrong in interface AttributeManager

addSocietyStrong

public void addSocietyStrong(String society,
                             Hashtable olevel)
                      throws RemoteException,
                             AgentAlreadyInAttributeDBException,
                             CorruptAttributeDBException
Specified by:
addSocietyStrong in interface AttributeManager

addAgentStrong

public void addAgentStrong(String society,
                           String occupation)
                    throws RemoteException,
                           AgentAlreadyInAttributeDBException,
                           MissingAgentInAttributeDBException,
                           CorruptAttributeDBException
Specified by:
addAgentStrong in interface AttributeManager

removeSociety

public Hashtable removeSociety(String society)
                        throws RemoteException,
                               CorruptAttributeDBException
Specified by:
removeSociety in interface AttributeManager

removeDesignation

public Vector removeDesignation(AgentID agentID)
                         throws RemoteException
Specified by:
removeDesignation in interface AttributeManager

updateDesignation

public void updateDesignation(AgentID oldAgentID,
                              String newDesignation)
                       throws RemoteException
Specified by:
updateDesignation in interface AttributeManager