org.iids.aos.kernel.ac
Class PersistentStoreFS

java.lang.Object
  extended by org.iids.aos.kernel.ac.PersistentStore
      extended by org.iids.aos.kernel.ac.PersistentStoreFS

public class PersistentStoreFS
extends PersistentStore

A PersistentStoreFS is a persistent store that uses files to store the data. Each data item is stored in a separate file. The key value is interpreted as a filename (including directories if any). Relative filenames are resolved against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked. (See also the File interface of the Java language.) Author: Michel Oey


Constructor Summary
PersistentStoreFS(java.io.File directory)
           
 
Method Summary
 void close()
          Close the persistent store.
 void delete(java.lang.String key)
          Deletes a (key, value) pair from the persistent storage.
 boolean exists(java.lang.String key)
          Checks whether a key is stored in the persistent storage.
 byte[] get(java.lang.String key)
          Retrieves value associated with key from the persistent storage.
 byte[] get(java.lang.String key, int offset, int length)
          Retrieves part of the value associated with key from the persistent storage.
 void put(java.lang.String key, byte[] value)
          Stores (key, value) pair in the persistent storage.
 void put(java.lang.String key, byte[] value, int length)
          Stores (key, value) pair in the persistent storage.
 void put(java.lang.String key, int offset, byte[] value, int length)
          Overwrite any (key, value) pair in the persistent storage by overwriting the stored value starting at offset with the byte array given as parameter.
 void put(java.lang.String key, int offset, byte[] value, int length, boolean sync)
          Overwrite any (key, value) pair in the persistent storage by overwriting the stored value starting at offset with the byte array given as parameter.
 
Methods inherited from class org.iids.aos.kernel.ac.PersistentStore
getInstance, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentStoreFS

public PersistentStoreFS(java.io.File directory)
                  throws InputOutputException
Throws:
InputOutputException
Method Detail

close

public void close()
Description copied from class: PersistentStore
Close the persistent store. Allows the implementation to do some cleanup.

Specified by:
close in class PersistentStore

put

public void put(java.lang.String key,
                byte[] value)
         throws InputOutputException
Stores (key, value) pair in the persistent storage.

Specified by:
put in class PersistentStore
Throws:
InputOutputException

put

public void put(java.lang.String key,
                byte[] value,
                int length)
         throws InputOutputException
Stores (key, value) pair in the persistent storage.

Specified by:
put in class PersistentStore
Throws:
InputOutputException

put

public void put(java.lang.String key,
                int offset,
                byte[] value,
                int length)
         throws InputOutputException
Overwrite any (key, value) pair in the persistent storage by overwriting the stored value starting at offset with the byte array given as parameter. Only length bytes are copied.

Specified by:
put in class PersistentStore
Throws:
InputOutputException

put

public void put(java.lang.String key,
                int offset,
                byte[] value,
                int length,
                boolean sync)
         throws InputOutputException
Overwrite any (key, value) pair in the persistent storage by overwriting the stored value starting at offset with the byte array given as parameter. Only length bytes are copied. Sync indicates whether the write should be made persistent immediately.

Specified by:
put in class PersistentStore
Throws:
InputOutputException

get

public byte[] get(java.lang.String key)
           throws InputOutputException
Retrieves value associated with key from the persistent storage. If the data cannot be found, null is returned.

Specified by:
get in class PersistentStore
Throws:
InputOutputException

get

public byte[] get(java.lang.String key,
                  int offset,
                  int length)
           throws InputOutputException
Retrieves part of the value associated with key from the persistent storage. Which part of the value is returned is specified by the offset and length parameters. No more bytes than are available in the value will be returned. If the data cannot be found, null is returned.

Specified by:
get in class PersistentStore
Throws:
InputOutputException

exists

public boolean exists(java.lang.String key)
               throws InputOutputException
Checks whether a key is stored in the persistent storage.

Specified by:
exists in class PersistentStore
Throws:
InputOutputException

delete

public void delete(java.lang.String key)
            throws InputOutputException
Deletes a (key, value) pair from the persistent storage.

Specified by:
delete in class PersistentStore
Throws:
InputOutputException


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.