|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--database.Database
This abstract class provieds high level access to local PKI databases. Classes that implements this interface is free to add whatever extra implementation-dependent methods they want, as well as overload methods as they please.
Concrete implementations of this abstract class will have to register themselves using the class-method registerDatabase(). This allows from the very flexible approach of using database.getInstance() to get whatever database implementation one wants.
The similarity to java.util.Hashtable isn't as coincidental as I'd like. To accomendate (possibly) safer multi-threading, quite a number of methods here have been declared synchronized.
TODO: Define a minimal SQL table? I.e. mandatory rows?
TODO: Add support for iterating over keys (key scan)
| Field Summary | |
private static Hashtable |
_registeredDB_ht
|
| Constructor Summary | |
Database()
|
|
| Method Summary | |
(package private) static void |
|
abstract void |
close()
Close database, after commiting changes. |
abstract void |
closeNoCommit()
Close database, without commiting changes. |
abstract void |
commit()
Explicitly commit changes to stable storage. |
abstract Enumeration |
enumerate()
Returns an enumeration of the keys/values in the database, at the time this method was called. |
abstract boolean |
exists(Object key)
Test to see if an object exists in database. |
abstract Result |
get(Object key)
Retrieve a stored object by key. |
abstract Connection |
getConnection()
If possible, return the java.sql.Connection object representing this database connection. |
static Database |
getInstance(String db)
Request an instance of the named Database class. |
abstract Properties |
getProperties()
Return Database's properties. |
abstract boolean |
isJDBC()
Test to see if the implementing class is JDBC-compliant. |
abstract void |
open(Object ref)
Open database by some reference. |
abstract void |
put(Object key,
Object value)
Store object in database. |
static void |
registerDatabase(Database db)
Register a concrete Database class. |
abstract void |
remove(Object key)
Removes an object from the database |
abstract Object |
search(Object criterium)
Search database for data matching a criterium. |
abstract void |
setProperties(Properties prop)
Set Database's properties. |
protected void |
unRegister()
Remove a registered Database class. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
| Field Detail |
private static final Hashtable _registeredDB_ht
| Constructor Detail |
public Database()
| Method Detail |
static void()
public static final void registerDatabase(Database db)
db - concrete Database class to register.
public static final Database getInstance(String db)
throws DatabaseException,
InstantiationException,
IllegalAccessException
db - name of registered Database class to instantiate.protected final void unRegister()
public abstract Properties getProperties()
throws DatabaseException
public abstract void setProperties(Properties prop)
throws DatabaseException
prop - this database's properties.public abstract boolean isJDBC()
getConnection
public abstract void put(Object key,
Object value)
throws DatabaseException
key - the Object used to reference the stored object by.value - the Object to store.
public abstract Result get(Object key)
throws DatabaseException,
NotFoundException
key - the Object used to reference the stored object by.
public abstract boolean exists(Object key)
throws DatabaseException
key - the Object used to reference the stored object by.
public abstract void remove(Object key)
throws DatabaseException
key - the Object used to reference the stored object by.
public abstract void open(Object ref)
throws DatabaseException
ref - some Object referring to the database stable storage.
public abstract void close()
throws DatabaseException
public abstract void closeNoCommit()
throws DatabaseException
public abstract void commit()
throws DatabaseException
public abstract Enumeration enumerate()
public abstract Object search(Object criterium)
throws DatabaseException,
NotFoundException
It is probably a good idea for implementing classes to provide one or more overloaded versions of this method.
criterium - object to search for.public abstract Connection getConnection()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||