|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sdsu.io.ASCIIFileRepository
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 ASCIIFileRepository stores each item in a separate ASCII file. The name of the file is in the format "key.class", where key = key for the item, class is the short name of the class of the item. Items in an ASCIIFileRepository can be instances of: String, java.util.Properties, sdsu.util.Stringizable (which includes sdsu.util.List, sdsu.util.LabeledData, sdsu.util.Table, sdsu.util.LabeledTable) and any class that implements java.io.Serializable. When created by the ASCIIFileRepository a file contains comments and metadata. Comments are lines starting with '#' and end at the end of the line. Metadata are on lines starting with "#!". Metadata includes the key and class of the item in the file. The file starts with comment lines, then metadata lines, then comment lines, then a string version of the item. If the file is created by hand the comments and metadata are not required.
Constructor Summary | |
ASCIIFileRepository(java.io.File repositoryDirectory)
Open a ASCIIFileRepository. |
|
ASCIIFileRepository(java.lang.String directoryName)
Open a ASCIIFileRepository. |
Method Summary | |
boolean |
containsKey(java.lang.String key)
Returns true is the repostitory contains data at the given key |
boolean |
containsSubrepository(java.lang.String name)
Returns false as does not support subrepositories |
boolean |
create()
Create the required storage structures for the repository. |
boolean |
createSubrepository(java.lang.String name)
Returns false as does not support subrepositories. |
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()
Returns null as does not support subrepositories |
Repository |
getSubrepository(java.lang.String name)
Returns a null as subrepository are not supported. |
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)
|
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)
|
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. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ASCIIFileRepository(java.lang.String directoryName)
directoryName
- The directory containing the repository files.public ASCIIFileRepository(java.io.File repositoryDirectory)
repositoryDirectory
- The directory containing the
repository files.Method Detail |
public boolean exists()
public boolean create()
public boolean createSubrepository(java.lang.String name)
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 Repository getSubrepository(java.lang.String name)
public boolean containsKey(java.lang.String key)
public boolean containsSubrepository(java.lang.String name)
public void setNameSeparator(char newSeparator)
public java.util.Enumeration getSubrepositories()
public java.util.Enumeration keys()
public boolean isEmpty()
public int size()
public int length()
public boolean remove(java.lang.String key)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |