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

Method Index

 o containsKey(String)
Returns true if the repostitory contains data at the given key
 o containsSubrepository(String)
Returns true if the repostitory contains the given subrepository
 o create()
Create the required storage structures for the repository.
 o createSubrepository(String)
Create a subrepository.
 o exists()
Returns true if the repository exists
 o get(String)
Retreive the item in the repository stored under the given key.
 o getSubrepositories()
Return an enumeration of the subrepositories.
 o getSubrepository(String)
Return a subrepository.
 o isEmpty()
Returns true if the repository contains no keys or values
 o keys()
Returns an enumeration of the keys in the repository
 o length()
Returns the number of keys in the repository.
 o put(String, Object)
Add the object "value" to the repository with the given key.
 o put(String, Object, String)
Add the object "value" to the repository with the given key.
 o putSerializable(String, Serializable)
Add the object "value" to the repository with the given key.
 o putSerializable(String, Serializable, String)
Add the object "value" to the repository with the given key.
 o remove(String)
Removes the given key and corresponding value from the repository.
 o setNameSeparator(char)
The name separator is the char used to separate the name of a Repository and a subrepository or key.
 o size()
Returns the number of keys in the repository.

Methods

 o exists
 public abstract boolean exists()
Returns true if the repository exists

 o create
 public abstract boolean create()
Create the required storage structures for the repository. Returns true if create was successful, false otherwise.

 o put
 public abstract void put(String key,
                          Object value) throws IOException
Add the object "value" to the repository with the given key.

 o 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.

 o 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.

 o 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.

 o 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.

 o containsKey
 public abstract boolean containsKey(String key)
Returns true if the repostitory contains data at the given key

 o keys
 public abstract Enumeration keys()
Returns an enumeration of the keys in the repository

 o isEmpty
 public abstract boolean isEmpty()
Returns true if the repository contains no keys or values

 o size
 public abstract int size()
Returns the number of keys in the repository. Same as length

 o length
 public abstract int length()
Returns the number of keys in the repository. Same as size.

 o remove
 public abstract boolean remove(String key)
Removes the given key and corresponding value from the repository.

 o createSubrepository
 public abstract boolean createSubrepository(String name)
Create a subrepository. Returns true if create was successful, false otherwise.

 o getSubrepository
 public abstract Repository getSubrepository(String name)
Return a subrepository. Returns null if repository does not exist.

 o getSubrepositories
 public abstract Enumeration getSubrepositories()
Return an enumeration of the subrepositories. The enumeration does not directly contain sub-subrepositories.

 o containsSubrepository
 public abstract boolean containsSubrepository(String name)
Returns true if the repostitory contains the given subrepository

 o 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