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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
SQLAttributeDatabase
public SQLAttributeDatabase(Connection c)
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.