webfunds.store
Class Store

java.lang.Object
  |
  +--webfunds.store.Store
Direct Known Subclasses:
AppendFileStore, MultiStoreStore, SepFileStore

public abstract class Store
extends java.lang.Object

A Persistant Hashtable, that stores its hash entries somewhere permanent. Subclasses might store their data on disk, for example. XXX: This class has too much implementation detail. The HashTable needs be moved out as not all subclasses will need it.


Field Summary
static int APPEND
          Flags.
protected  boolean changed
           
protected  boolean error
           
protected  java.util.Hashtable hash
           
protected  java.lang.String name
           
static int NET
          Flags.
static int SOMETHING
          Flags.
 
Constructor Summary
Store()
           
 
Method Summary
 boolean checkErrors()
           
 void clear()
          Remove all?
 boolean contains(java.lang.Object o)
           
 boolean containsKey(java.lang.Object o)
           
 java.util.Enumeration elements()
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.ClassLoader getClassLoader()
          Get the ClassLoader, for 3rd party wallets.
 java.lang.String getName()
           
 Store getStore(java.lang.String storename)
          Bug.
abstract  Store getStore(java.lang.String storename, int flags)
           
abstract  Store[] getStores()
           
 java.lang.String getType()
           
 boolean isChanged()
           
 boolean isEmpty()
           
 java.util.Enumeration keys()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Caller's responsibility to ensure that the value really needs saving.
 java.lang.Object remove(java.lang.Object key)
           
protected  void setChanged(boolean bool)
           
 void setClassLoader(java.lang.ClassLoader cl)
           
 int size()
           
protected abstract  void sync()
          Some way to sync to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPEND

public static final int APPEND
Flags. APPEND causes the append-file store to be used.

NET

public static final int NET
Flags. APPEND causes the append-file store to be used.

SOMETHING

public static final int SOMETHING
Flags. APPEND causes the append-file store to be used.

error

protected boolean error

changed

protected boolean changed

name

protected java.lang.String name

hash

protected java.util.Hashtable hash
Constructor Detail

Store

public Store()
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the ClassLoader, for 3rd party wallets. If the store is held by a classloader-instantiated wallet, store also needs explicit access to the classloader, in order to recover the classes specific to the wallet.

setClassLoader

public void setClassLoader(java.lang.ClassLoader cl)

getStore

public Store getStore(java.lang.String storename)
               throws StoreException
Bug. If this fails because of corruption, there is no way to recover it, nor any way to remove (can only remove by Object, not string).

getStore

public abstract Store getStore(java.lang.String storename,
                               int flags)
                        throws StoreException

getStores

public abstract Store[] getStores()
                           throws StoreException

getName

public java.lang.String getName()

getType

public java.lang.String getType()

clear

public void clear()
Remove all?

get

public java.lang.Object get(java.lang.Object key)

size

public int size()

keys

public java.util.Enumeration keys()

elements

public java.util.Enumeration elements()

isEmpty

public boolean isEmpty()

contains

public boolean contains(java.lang.Object o)

containsKey

public boolean containsKey(java.lang.Object o)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Caller's responsibility to ensure that the value really needs saving. As we mostly deal in copied refs of the Object rather than copies of the Object, it is the caller's responsibility to ensure that it needs put'ing. There is no support for copies getting out of sync within separate threads. It would be up to each application to ensure that only one Object is shared, and that changes to it are internally syncronised.

remove

public java.lang.Object remove(java.lang.Object key)

isChanged

public boolean isChanged()

setChanged

protected void setChanged(boolean bool)

checkErrors

public boolean checkErrors()

sync

protected abstract void sync()
Some way to sync to disk. This might be ignored by the extending store?