|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Repository is a hashtable like interface to a persistent storage medium. Items are placed into the repository via the put method, retrieved via the get method. The items in the repository are preserved between invocations of the programs that access the repository. Each item in the repository has a key (or label) which identifies the item, and an optional comment. The comment is stored with the object. In future releases the storage meduim could be local files, files on remote machines, or a database. In this release only local files are supported.
A nested repository can contain other (subrepository) repositories. Different implementations may organize nested repositories in different ways.
A top level repository can access keys of a subrepository. For example let Roger and Sam be repositories, let Roger contain the keys left and right and the repository Sam, let Sam contain the keys right and wrong. Also let the variable roger be a reference to the repository Roger. Then:
roger.get( "right" ); returns object in Roger stored at "right" roger.get( "Sam.right"); returns object in Sam stored at "right"The char '.' is used as the default name separator.
LocalRepository
Method Summary | |
boolean |
containsKey(java.lang.String key)
Returns true if the repostitory contains data at the given key |
boolean |
containsSubrepository(java.lang.String name)
Returns true if the repostitory contains the given subrepository |
boolean |
create()
Create the required storage structures for the repository. |
boolean |
createSubrepository(java.lang.String name)
Create a subrepository. |
boolean |
exists()
Returns true if the repository exists |
java.lang.Object |
get(java.lang.String key)
Retreive the item in the repository stored under the given key. |
java.util.Enumeration |
getSubrepositories()
Return an enumeration of the subrepositories. |
Repository |
getSubrepository(java.lang.String name)
Return a subrepository. |
boolean |
isEmpty()
Returns true if the repository contains no keys or values |
java.util.Enumeration |
keys()
Returns an enumeration of the keys in the repository |
int |
length()
Returns the number of keys in the repository. |
void |
put(java.lang.String key,
java.lang.Object value)
Add the object "value" to the repository with the given key. |
void |
put(java.lang.String key,
java.lang.Object value,
java.lang.String comment)
Add the object "value" to the repository with the given key. |
void |
putSerializable(java.lang.String key,
java.io.Serializable value)
Add the object "value" to the repository with the given key. |
void |
putSerializable(java.lang.String key,
java.io.Serializable value,
java.lang.String comment)
Add the object "value" to the repository with the given key. |
boolean |
remove(java.lang.String key)
Removes the given key and corresponding value from the repository. |
void |
setNameSeparator(char newSeparator)
The name separator is the char used to separate the name of a Repository and a subrepository or key. |
int |
size()
Returns the number of keys in the repository. |
Method Detail |
public boolean exists()
public boolean create()
public void put(java.lang.String key, java.lang.Object value) throws java.io.IOException
public void put(java.lang.String key, java.lang.Object value, java.lang.String comment) throws java.io.IOException
public void putSerializable(java.lang.String key, java.io.Serializable value) throws java.io.IOException
public void putSerializable(java.lang.String key, java.io.Serializable value, java.lang.String comment) throws java.io.IOException
public java.lang.Object get(java.lang.String key) throws java.io.IOException
public boolean containsKey(java.lang.String key)
public java.util.Enumeration keys()
public boolean isEmpty()
public int size()
public int length()
public boolean remove(java.lang.String key)
public boolean createSubrepository(java.lang.String name)
public Repository getSubrepository(java.lang.String name)
public java.util.Enumeration getSubrepositories()
public boolean containsSubrepository(java.lang.String name)
public void setNameSeparator(char newSeparator)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |