All Packages Class Hierarchy This Package Previous Next Index
Interface sdsu.io.Repository
- public interface Repository
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.
- Version:
- 0.8 5 June 1998
- Author:
- Roger Whitney
(whitney@cs.sdsu.edu)
- See Also:
- LocalRepository
-
containsKey(String)
- Returns true if the repostitory contains data at the given key
-
containsSubrepository(String)
- Returns true if the repostitory contains the given subrepository
-
create()
- Create the required storage structures for the
repository.
-
createSubrepository(String)
- Create a subrepository.
-
exists()
- Returns true if the repository exists
-
get(String)
- Retreive the item in the repository stored under the given key.
-
getSubrepositories()
- Return an enumeration of the subrepositories.
-
getSubrepository(String)
- Return a subrepository.
-
isEmpty()
- Returns true if the repository contains no keys or values
-
keys()
- Returns an enumeration of the keys in the repository
-
length()
- Returns the number of keys in the repository.
-
put(String, Object)
- Add the object "value" to the repository with the
given key.
-
put(String, Object, String)
- Add the object "value" to the repository with the
given key.
-
putSerializable(String, Serializable)
- Add the object "value" to the repository with the
given key.
-
putSerializable(String, Serializable, String)
- Add the object "value" to the repository with the
given key.
-
remove(String)
- Removes the given key and corresponding value from the repository.
-
setNameSeparator(char)
- The name separator is the char used to separate the name of a
Repository and a subrepository or key.
-
size()
- Returns the number of keys in the repository.
exists
public abstract boolean exists()
- Returns true if the repository exists
create
public abstract boolean create()
- Create the required storage structures for the
repository. Returns true if create was successful, false otherwise.
put
public abstract void put(String key,
Object value) throws IOException
- Add the object "value" to the repository with the
given key.
put
public abstract void put(String key,
Object value,
String comment) throws IOException
- Add the object "value" to the repository with the
given key. The object is stored with the given comment.
putSerializable
public abstract void putSerializable(String key,
Serializable value) throws IOException
- Add the object "value" to the repository with the
given key. Value is stored using Java's serialization process.
putSerializable
public abstract void putSerializable(String key,
Serializable value,
String comment) throws IOException
- Add the object "value" to the repository with the
given key. The object is stored with the given comment.
Value is stored using Java's serialization process.
get
public abstract Object get(String key) throws IOException
- Retreive the item in the repository stored under the given key.
Returns null if no object is mapped to the key.
containsKey
public abstract boolean containsKey(String key)
- Returns true if the repostitory contains data at the given key
keys
public abstract Enumeration keys()
- Returns an enumeration of the keys in the repository
isEmpty
public abstract boolean isEmpty()
- Returns true if the repository contains no keys or values
size
public abstract int size()
- Returns the number of keys in the repository.
Same as length
length
public abstract int length()
- Returns the number of keys in the repository.
Same as size.
remove
public abstract boolean remove(String key)
- Removes the given key and corresponding value from the repository.
createSubrepository
public abstract boolean createSubrepository(String name)
- Create a subrepository.
Returns true if create was successful, false otherwise.
getSubrepository
public abstract Repository getSubrepository(String name)
- Return a subrepository. Returns null if repository does
not exist.
getSubrepositories
public abstract Enumeration getSubrepositories()
- Return an enumeration of the subrepositories. The enumeration
does not directly contain sub-subrepositories.
containsSubrepository
public abstract boolean containsSubrepository(String name)
- Returns true if the repostitory contains the given subrepository
setNameSeparator
public abstract void setNameSeparator(char newSeparator)
- The name separator is the char used to separate the name of a
Repository and a subrepository or key. The default char used is a
'.'
All Packages Class Hierarchy This Package Previous Next Index