|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.db.OskiDB
Think of this as Cheap-and-Quick-and-Unreliable-DB [tm], no guarantees anywhere. It implements a generic serializable hashtable that things can be stored in. It serves as part of a generic Remote Data Server that ensures that objects retrieved become eventually consistent and written to persistent storage.
Be sure to call updateDB(Object key) whenever a change to an Object in this database is made. Otherwise, there is no way for the system to know that things have been changed.
For example, in the picture below, the Impl is a Remote Data Server. It is essentially a wrapper around the Data that tells the Database (this class) that changes have been made to the Data and that these changes should be sent to persistent storage eventually.
Tier 1 Tier 2 Tier 3 ------ ---------------------------------- -------------- Data ---- ---- ---- | | | | | | ----- | | | | ---- | | ---- | | ---- | | ---------------------- | | | | | | RMI | | ------------ | | ---- | | ----- | | | | | | | DATABASE | ---- ---- | | Interface Stub Impl | | (Remote) (RemoteObj) ------------ ------------------ ------------------------ CLIENT SERVER
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Dec 05 1998, JH / CBM Created class - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH Touched for GUIRLib release - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH Touched for GUIRLib release
Field Summary | |
static int |
DEFAULT_FLUSHTIME
Default to 30 seconds between writes. |
static String |
EXTENSION
Extension for serialized files. |
static String |
ROOT
Root name for serialized files. |
Constructor Summary | |
OskiDB(String nme)
Create a new database. |
|
OskiDB(String nme,
int newSleepTime)
Create a new database with the specified sleeptime. |
|
OskiDB(String nme,
String tableName,
String path)
Create a database, unserializing one if it exists. |
|
OskiDB(String nme,
String tableName,
String path,
int newFlushTime)
Create a database, unserializing one if it exists. |
Method Summary | |
boolean |
containsKey(Object key)
See if the specified key lies within the database. |
void |
finalize()
|
void |
flushData()
Flush the data out when called. |
Object |
get(Object key)
Get something from the database. |
boolean |
isDirty()
Is the data this data server holding dirty (and should be written out)? |
static void |
main(String[] argv)
|
void |
put(Object key,
Serializable value)
Put something into the database. |
void |
setFlushTime(int newFlushTime)
|
String |
toString()
Print out the contents of the database. |
void |
updateDB()
Signal that there all objects that have changed and should be written to persistent storage. |
void |
updateDB(Object key)
Signal that a specific object is dirty and should be written to persistent storage. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DEFAULT_FLUSHTIME
public static final String ROOT
public static final String EXTENSION
Constructor Detail |
public OskiDB(String nme, String tableName, String path)
nme
- is the name of the database.tableName
- is the name of the database to unserialize.path
- is where the files are.public OskiDB(String nme, String tableName, String path, int newFlushTime)
nme
- is the name of the database.tableName
- is the name of the database to unserialize.path
- is where the files are.newFlushTime
- is how often to flush to disk.public OskiDB(String nme)
nme
- is the name of the database.public OskiDB(String nme, int newSleepTime)
nme
- is the name of the database.newSleepTime
- is the number of seconds to wait for writes.Method Detail |
public void finalize()
finalize
in class Object
public void setFlushTime(int newFlushTime)
public final void flushData()
public final boolean isDirty()
public final void updateDB()
public final void updateDB(Object key)
public Object get(Object key)
object
- referred to by the key, or null if it does not exist.public void put(Object key, Serializable value)
public boolean containsKey(Object key)
public String toString()
toString
in class Object
public static void main(String[] argv) throws Exception
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |