|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractMap | +--util.PersistentMap
A persistent hashtable (Map), which in this case maps to a SQL database.
This is based on AbstractMap, and for the most part is using AbstractMap's methods for doing lookups. This means that hash access is probably unbelievably slow, so using this for speed-critical code will probably not make you happy.
Developer's Note: This is probably more correct anyway, since for lookups we want to compare every item in the hashtable against the test object using the equals() method in order to be sure we've got the right thing.
Inner classes inherited from class java.util.Map |
Map.Entry |
Field Summary | |
static String |
Qkey
|
protected String |
tableName
the name of the current table |
Constructor Summary | |
PersistentMap(AgentID aid,
String tabname,
Connection cnxn)
This constructor works like the regular one except that it creates a table name specific to the agent instance. |
|
PersistentMap(String tabname,
Connection cnxn)
Creates a new persistent map file. |
Method Summary | |
void |
destroy()
Destroy the underlying table. |
Set |
entrySet()
Get all map entries as a set. |
protected int |
execSQL(String s)
Execute the given SQL updates |
protected int |
execSQL(String s,
boolean loud)
Execute the given SQL updates. |
static void |
main(String[] args)
Main method for testing |
Object |
put(Object k,
Object v)
Put a new value into the database. |
protected ResultSet |
querySQL(String s)
execute queries with automatic reconnection. |
protected ResultSet |
querySQL(String s,
boolean loud)
execute queries with automatic reconnection. |
Methods inherited from class java.util.AbstractMap |
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected String tableName
public static String Qkey
Constructor Detail |
public PersistentMap(String tabname, Connection cnxn)
tabname
- The name of the map. This is used to create a
database table (any non-alphanumeric characters will be
changed to underscores so that SQL doesn't choke on it).cnxn
- The database connection url. See the java.sql
Connection class for more information.Connection
public PersistentMap(AgentID aid, String tabname, Connection cnxn)
aid
- the agent requesting a table for itselftabname
- The name of the map. This is used to create a
database table (any non-alphanumeric characters will be
changed to underscores so that SQL doesn't choke on it).cnxn
- The database connection url. See the java.sql
Connection class for more information.Connection
Method Detail |
public Set entrySet()
entrySet
in class AbstractMap
public Object put(Object k, Object v)
put
in class AbstractMap
k
- the new key objectv
- the new value objectpublic void destroy()
protected int execSQL(String s)
s
- a string containing SQL commandsprotected int execSQL(String s, boolean loud)
db_verbose
is true.s
- a string containing SQL commandsloud
- enable|disable error reporting (disabling only works if
db_verbose
is also false)protected ResultSet querySQL(String s)
s
- the SQL command stringprotected ResultSet querySQL(String s, boolean loud)
db_verbose
is true.s
- a string containing SQL commandsloud
- enable|disable error reporting (disabling only works if
db_verbose
is also false)public static void main(String[] args)
args
- [driver]
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |