|
|||||||||
| Home >> All >> com >> lutris >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.lutris.util
Class FilePersistentStore

java.lang.Objectcom.lutris.util.FilePersistentStore
- All Implemented Interfaces:
- PersistentStore
- public class FilePersistentStore
- extends java.lang.Object
- implements PersistentStore
- extends java.lang.Object
File system implementation of PersistentStore.
| Nested Class Summary | |
private class |
FilePersistentStore.FilePersistentStoreKeys
Inner class that implements keys enumeration for this object. |
private class |
FilePersistentStore.FileStoreFilter
Inner class that implements a filename filter. |
| Field Summary | |
private java.lang.String |
DEFAULT_DIR_PROPERTY
|
private java.lang.String |
FILE_SEPARATOR_PROPERTY
|
private java.lang.String |
fileSeparator
Path separator used by operating system. |
private static char[] |
HexChars
Hexadecimal characters corresponding to each half byte value. |
private java.lang.ClassLoader |
loader
The loader that should be used to load serialized data. |
private java.lang.reflect.Constructor |
objectInputStreamConstructor
The class loader used when reading in serialized data. |
private java.lang.String |
SERIAL_SUFFIX
|
private java.lang.String |
storeDirectory
Directory (pathname) where objects are to be stored/retrieved. |
| Constructor Summary | |
FilePersistentStore()
Public constructor. |
|
FilePersistentStore(java.lang.ClassLoader loader)
Public constructor. |
|
FilePersistentStore(java.lang.String storeDirectory)
Public constructor that allows one to specify the directory (repository) where objects are stored/retrieved. |
|
FilePersistentStore(java.lang.String storeDirectory,
java.lang.ClassLoader loader)
Public constructor that allows one to specify the directory (repository) where objects are stored/retrieved. |
|
| Method Summary | |
private java.lang.String |
convertHexToKey(java.lang.String hex)
Converts an arbitrary ASCII hexadecimal string, with two hex characters corresponding to each byte, into a string. |
private java.lang.String |
convertKeyToHex(java.lang.String key)
Converts an arbitrary string to ASCII hexadecimal string form, with two hex characters corresponding to each byte. |
void |
delete(java.lang.String key)
Method to delete a a key. |
boolean |
exists(java.lang.String key)
Method to query if an an object is stored. |
private java.lang.String |
filename(java.lang.String key)
Method that calculates the absolute path to the stored object. |
java.lang.String |
getStoreDirectory()
Returns the location where objects are stored/retrieved. |
private byte |
hexCharToByte(char c)
Method that maps a hexadecimal character to a byte value. |
private void |
init(java.lang.String storeDirectory,
java.lang.ClassLoader loader)
Gets a reference to the object input stream constructor. |
java.util.Enumeration |
keys()
Method that returns an enumration of the keys of this persistent store. |
java.lang.Object |
remove(java.lang.String key)
Method to simultaneously retrieve and remove an object from persistent store. |
java.lang.Object |
retrieve(java.lang.String key)
Method to retrieve a stored object. |
private void |
setStoreDirectory(java.lang.String storeDirectory)
Sets the location (directory) from where objects are retrieved/archived. |
void |
store(java.lang.String key,
java.io.Serializable obj)
Method to store and object (persistent). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DEFAULT_DIR_PROPERTY
private final java.lang.String DEFAULT_DIR_PROPERTY
- See Also:
- Constant Field Values
FILE_SEPARATOR_PROPERTY
private final java.lang.String FILE_SEPARATOR_PROPERTY
- See Also:
- Constant Field Values
SERIAL_SUFFIX
private final java.lang.String SERIAL_SUFFIX
- See Also:
- Constant Field Values
fileSeparator
private java.lang.String fileSeparator
- Path separator used by operating system.
storeDirectory
private java.lang.String storeDirectory
- Directory (pathname) where objects are to be
stored/retrieved. The default is the
current directory.
objectInputStreamConstructor
private java.lang.reflect.Constructor objectInputStreamConstructor
- The class loader used when reading in serialized data.
loader
private java.lang.ClassLoader loader
- The loader that should be used to load serialized data.
HexChars
private static final char[] HexChars
- Hexadecimal characters corresponding to each half byte value.
| Constructor Detail |
FilePersistentStore
public FilePersistentStore()
throws PersistentStoreException
- Public constructor. Sets the
storeDirectory, the directory (repository) where objects are stored/retreived to/tmp.
FilePersistentStore
public FilePersistentStore(java.lang.ClassLoader loader) throws java.io.IOException, java.lang.SecurityException, PersistentStoreException
- Public constructor. Sets the
storeDirectory, the directory (repository) where objects are stored/retreived to/tmp.
FilePersistentStore
public FilePersistentStore(java.lang.String storeDirectory) throws PersistentStoreException
- Public constructor that allows one to specify
the directory (repository)
where objects are stored/retrieved.
If the specified directory doesn't exist then it is created.
FilePersistentStore
public FilePersistentStore(java.lang.String storeDirectory, java.lang.ClassLoader loader) throws PersistentStoreException
- Public constructor that allows one to specify
the directory (repository)
where objects are stored/retrieved.
If the specified directory doesn't exist then it is created.
| Method Detail |
init
private void init(java.lang.String storeDirectory, java.lang.ClassLoader loader) throws PersistentStoreException
- Gets a reference to the object input stream constructor.
setStoreDirectory
private void setStoreDirectory(java.lang.String storeDirectory) throws java.io.IOException, java.lang.SecurityException
- Sets the location (directory) from where objects are
retrieved/archived. If the specified directory doesn't
exist then it is created.
getStoreDirectory
public java.lang.String getStoreDirectory()
- Returns the location where objects are
stored/retrieved.
filename
private java.lang.String filename(java.lang.String key)
- Method that calculates the absolute path to the
stored object.
convertKeyToHex
private java.lang.String convertKeyToHex(java.lang.String key)
- Converts an arbitrary string to ASCII hexadecimal string
form, with two hex characters corresponding to each byte. The
length of the resultant string in characters will be twice the
length of the original string.
convertHexToKey
private java.lang.String convertHexToKey(java.lang.String hex)
- Converts an arbitrary ASCII hexadecimal string,
with two hex characters corresponding to each byte, into
a string.
hexCharToByte
private byte hexCharToByte(char c)
- Method that maps a hexadecimal character to a byte value.
store
public void store(java.lang.String key, java.io.Serializable obj) throws PersistentStoreException
- Method to store and object (persistent).
- Specified by:
storein interfacePersistentStore
retrieve
public java.lang.Object retrieve(java.lang.String key) throws PersistentStoreException
- Method to retrieve a stored object.
- Specified by:
retrievein interfacePersistentStore
exists
public boolean exists(java.lang.String key) throws PersistentStoreException
- Method to query if an an object is stored.
- Specified by:
existsin interfacePersistentStore
remove
public java.lang.Object remove(java.lang.String key) throws PersistentStoreException
- Method to simultaneously retrieve and remove an
object from persistent store. If an object is not
stored under key, then null is returned.
- Specified by:
removein interfacePersistentStore
delete
public void delete(java.lang.String key)
- Method to delete a a key. Any objects stored under
key are also removed. If key is not defined, then
this method does nothing.
- Specified by:
deletein interfacePersistentStore
keys
public java.util.Enumeration keys() throws PersistentStoreException
- Method that returns an enumration of the keys
of this persistent store.
- Specified by:
keysin interfacePersistentStore
|
|||||||||
| Home >> All >> com >> lutris >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.lutris.util.FilePersistentStore