metaglue
Class SQLAttributeDatabase

java.lang.Object
  |
  +--metaglue.SQLAttributeDatabase

public class SQLAttributeDatabase
extends Object

Communication object for talking to the attribute database via SQL. This separates the database manipulation from the AttributeManager agent. This object also handles rudimentary versioning -- it checks a versions table in the database to figure out the current version of the attribute database.


Field Summary
protected  String attCol
           
static int CAN_DEFAULT
           
static int NO_DEFAULT
           
protected  String occCol
           
static int ONLY_DEFAULT
           
protected  String socCol
           
protected  String tableName
           
protected  String valCol
           
 
Constructor Summary
SQLAttributeDatabase(Connection c)
           
 
Method Summary
 void addAttribute(AgentID agentID, String attributeName, String attributeValue)
          Insert a new attribute value for an agent.
 boolean agentExists(AgentID agentID)
          Find out if the agent has been put into the table.
 void deleteSociety(String oldSociety)
          delete society name in attributeDB
 Vector getDesignations(String occupation)
          Look for all possible designations for a given occupation in the attribute database.
 String lookup(String society, String occupation, String attr, int default_switch)
          Lookup the attribute value given the information provided.
 void updateAttribute(AgentID agentID, String attributeName, String attributeValue)
          Update the old attribute value, inserting if necessary.
 void updateSociety(String oldSociety, String newSociety)
          Change the society name in attributeDB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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

socCol

protected String socCol

occCol

protected String occCol

valCol

protected String valCol

attCol

protected String attCol

tableName

protected String tableName
Constructor Detail

SQLAttributeDatabase

public SQLAttributeDatabase(Connection c)
Method Detail

lookup

public String lookup(String society,
                     String occupation,
                     String attr,
                     int default_switch)
              throws CorruptAttributeDBException,
                     MissingAttributeException
Lookup the attribute value given the information provided.

getDesignations

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

agentExists

public boolean agentExists(AgentID agentID)
Find out if the agent has been put into the table. Returns true if it does exist, false if not or there are errors.

updateSociety

public void updateSociety(String oldSociety,
                          String newSociety)
                   throws MissingAgentInAttributeDBException
Change the society name in attributeDB

deleteSociety

public void deleteSociety(String oldSociety)
                   throws MissingAgentInAttributeDBException
delete society name in attributeDB

addAttribute

public void addAttribute(AgentID agentID,
                         String attributeName,
                         String attributeValue)
                  throws CorruptAttributeDBException
Insert a new attribute value for an agent.

updateAttribute

public void updateAttribute(AgentID agentID,
                            String attributeName,
                            String attributeValue)
                     throws CorruptAttributeDBException
Update the old attribute value, inserting if necessary.