electric.util.dictionary.persistent
Class PersistentDictionary

java.lang.Object
  extended byjava.util.Dictionary
      extended byelectric.util.dictionary.persistent.PersistentDictionary
All Implemented Interfaces:
IDictionary, IPersistentDictionary

public class PersistentDictionary
extends java.util.Dictionary
implements IPersistentDictionary

PersistentDictionary is an implementation of Dictionary that allows the individual entries to be stored in a filesystem directory. Each entry is allocated its own file whose name is based on the key.

Author:
webMethods

Field Summary
static int VERSION
           
 
Constructor Summary
PersistentDictionary(java.lang.String root)
           
PersistentDictionary(java.lang.String root, boolean delete)
           
PersistentDictionary(java.lang.String root, boolean delete, boolean lazy)
           
 
Method Summary
 void clear()
           
 void delete()
           
 java.util.Enumeration elements()
           
 java.lang.Object get(java.lang.Object key)
           
 boolean getEncoded()
          Return true if I use an EncodedWriter to persist objects to storage.
 java.lang.String getRoot()
           
 boolean getSync()
           
 boolean isEmpty()
           
 java.util.Enumeration keys()
           
 java.lang.Object load(java.lang.Object key)
           
 java.lang.Object peek(java.lang.Object key)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 void setEncoded(boolean encoded)
          If the encoded argument is true, use an EncodedWriter to persist objects to storage, otherwise use a LiteralWriter.
 void setSync(boolean flag)
           
static void setSyncCycle(int milliseconds)
           
 int size()
           
 void sync()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final int VERSION
See Also:
Constant Field Values
Constructor Detail

PersistentDictionary

public PersistentDictionary(java.lang.String root)
Parameters:
root -

PersistentDictionary

public PersistentDictionary(java.lang.String root,
                            boolean delete)
Parameters:
root -
delete -

PersistentDictionary

public PersistentDictionary(java.lang.String root,
                            boolean delete,
                            boolean lazy)
Parameters:
root -
delete -
lazy -
Method Detail

toString

public java.lang.String toString()

getRoot

public java.lang.String getRoot()

get

public java.lang.Object get(java.lang.Object key)
                     throws WrappedException
Specified by:
get in interface IDictionary
Parameters:
key -
Throws:
WrappedException

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
                     throws java.lang.IllegalArgumentException,
                            WrappedException
Specified by:
put in interface IDictionary
Parameters:
key -
value -
Throws:
java.lang.IllegalArgumentException
WrappedException

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface IDictionary
Parameters:
key -

size

public int size()
Specified by:
size in interface IDictionary

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IDictionary

keys

public java.util.Enumeration keys()
Specified by:
keys in interface IDictionary

elements

public java.util.Enumeration elements()
Specified by:
elements in interface IDictionary

peek

public java.lang.Object peek(java.lang.Object key)
Specified by:
peek in interface IDictionary
Parameters:
key -

load

public java.lang.Object load(java.lang.Object key)
                      throws WrappedException
Specified by:
load in interface IPersistentDictionary
Parameters:
key -
Throws:
WrappedException

clear

public void clear()
Specified by:
clear in interface IPersistentDictionary

delete

public void delete()
Specified by:
delete in interface IPersistentDictionary

getEncoded

public boolean getEncoded()
Return true if I use an EncodedWriter to persist objects to storage.

Specified by:
getEncoded in interface IPersistentDictionary

setEncoded

public void setEncoded(boolean encoded)
If the encoded argument is true, use an EncodedWriter to persist objects to storage, otherwise use a LiteralWriter.

Specified by:
setEncoded in interface IPersistentDictionary
Parameters:
encoded - The new encoded mode.

setSyncCycle

public static void setSyncCycle(int milliseconds)
Parameters:
milliseconds -

setSync

public void setSync(boolean flag)
Specified by:
setSync in interface IPersistentDictionary
Parameters:
flag -

getSync

public boolean getSync()
Specified by:
getSync in interface IPersistentDictionary

sync

public void sync()
Specified by:
sync in interface IPersistentDictionary


copyright© 2001-2004 by webMethods All Rights Reserved.