org.iids.aos.kernel.ac
Class PersistentStore

java.lang.Object
  extended by org.iids.aos.kernel.ac.PersistentStore
Direct Known Subclasses:
PersistentStoreFS

public abstract class PersistentStore
extends java.lang.Object

Defines an abstract interface to acces persistent storage. A PersistentStore allows (key, value) pairs to be stored on persistent storage. Currently, only regular files are used as the actual persistent storage.

Author:
Michel Oey

Constructor Summary
PersistentStore()
           
 
Method Summary
abstract  void close()
          Close the persistent store.
abstract  void delete(java.lang.String key)
          Deletes a (key, value) pair from the persistent storage.
abstract  boolean exists(java.lang.String key)
          Checks whether a key is stored in the persistent storage.
abstract  byte[] get(java.lang.String key)
          Retrieves value associated with key from the persistent storage.
abstract  byte[] get(java.lang.String key, int offset, int length)
          Retrieves part of the value associated with key from the persistent storage.
static PersistentStore getInstance()
           
abstract  void put(java.lang.String key, byte[] value)
          Stores (key, value) pair in the persistent storage.
abstract  void put(java.lang.String key, byte[] value, int length)
          Stores (key, value) pair in the persistent storage.
abstract  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.
abstract  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.
static void setup(java.io.File directory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentStore

public PersistentStore()
Method Detail

setup

public static void setup(java.io.File directory)

getInstance

public static PersistentStore getInstance()
                                   throws InputOutputException
Throws:
InputOutputException

put

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

Throws:
InputOutputException

put

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

Throws:
InputOutputException

put

public abstract 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.

Throws:
InputOutputException

put

public abstract 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.

Throws:
InputOutputException

get

public abstract 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.

Throws:
InputOutputException

get

public abstract 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.

Throws:
InputOutputException

delete

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

Throws:
InputOutputException

exists

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

Throws:
InputOutputException

close

public abstract void close()
                    throws InputOutputException
Close the persistent store. Allows the implementation to do some cleanup.

Throws:
InputOutputException


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