Framework Professional Edition Package


com.prosyst.util.io
Class ExternalizableDictionary

java.lang.Object
  extended by java.util.Dictionary
      extended by com.prosyst.util.io.ExternalizableDictionary
All Implemented Interfaces:
Externalizable, Remote, java.lang.Cloneable

public class ExternalizableDictionary
extends java.util.Dictionary
implements Externalizable, java.lang.Cloneable, Remote

This class implements a hashtable, which serves the needs of ConfigurationManagement of capsulation of configuration properties with String keys, which are case insentive at lookup (at get, remove, put operations) but preserve the last case of keys. The implementaion of the Externalizable interface allows remote transfer of those properties.


Field Summary
 
Fields inherited from interface com.prosyst.util.io.Remote
AUTHORIZED_ROLES
 
Constructor Summary
ExternalizableDictionary()
          Constructs a new, empty dictionary with a default capacity and load factor.
ExternalizableDictionary(int initialCapacity)
          Constructs a new, empty dictionary with the wanted capacity and default load factor.
ExternalizableDictionary(int initialCapacity, float loadFactor)
          Constructs a new, empty dictionary with the specified initial capacity and the specified load factor.
 
Method Summary
 void clear()
          Clears all elements from the distionary.
 java.lang.Object clone()
          Creates a shallow copy of this hashtable.
 void copyFrom(java.util.Dictionary props)
           
 java.util.Enumeration elements()
          Gets an enumeration with dictionary's values.
 boolean equals(java.lang.Object o)
          Compares the specified Object with this Dictionary for equality,
 java.lang.Object get(java.lang.Object key)
          Gets the value corresponding to this key or any of its case representations.
 boolean isEmpty()
          Checks if there is any element in the dictionary.
 java.util.Enumeration keys()
          Gets an enumeration with dictionary's keys.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts the key and the value in the table.
 void readObject(java.io.InputStream is)
          Reads the data from the InputStream and loads the data in the table.
protected  void rehash()
           
 java.lang.Class[] remoteInterfaces()
          Returns the interfaces/classes that contain the methods that can be invoked remotely.
 java.lang.Object remove(java.lang.Object key)
          Removes the key and its corresponding value.
 java.lang.ClassLoader setClassLaoder(java.lang.ClassLoader loader)
           
 java.lang.ClassLoader setClassLoader(java.lang.ClassLoader loader)
           
 int size()
          Gets the size of the elements in the dictionary.
 java.lang.String toString()
          Makes a string represntation of this object.
 void writeObject(java.io.OutputStream os)
          Writes this object to the stream passed.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExternalizableDictionary

public ExternalizableDictionary(int initialCapacity,
                                float loadFactor)
Constructs a new, empty dictionary with the specified initial capacity and the specified load factor.

Parameters:
initialCapacity - the initial capacity of the hashtable. when 0 is passed for capacity, minimum possible capacity is used; i.e. when the object is read as externalizable, then the table is created with the written size.
loadFactor - a number between 0.0 and 1.0.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is less than zero, or if the load factor is less than or equal to zero.

ExternalizableDictionary

public ExternalizableDictionary(int initialCapacity)
Constructs a new, empty dictionary with the wanted capacity and default load factor.


ExternalizableDictionary

public ExternalizableDictionary()
Constructs a new, empty dictionary with a default capacity and load factor.

Method Detail

setClassLaoder

public java.lang.ClassLoader setClassLaoder(java.lang.ClassLoader loader)

setClassLoader

public java.lang.ClassLoader setClassLoader(java.lang.ClassLoader loader)

remoteInterfaces

public java.lang.Class[] remoteInterfaces()
Description copied from interface: Remote
Returns the interfaces/classes that contain the methods that can be invoked remotely.

Specified by:
remoteInterfaces in interface Remote

size

public int size()
Gets the size of the elements in the dictionary.

Specified by:
size in class java.util.Dictionary
Returns:
size of hashtable

isEmpty

public boolean isEmpty()
Checks if there is any element in the dictionary.

Specified by:
isEmpty in class java.util.Dictionary
Returns:
true if empty.

keys

public java.util.Enumeration keys()
Gets an enumeration with dictionary's keys.

Specified by:
keys in class java.util.Dictionary
Returns:
an enumeration with dictionary's keys.

elements

public java.util.Enumeration elements()
Gets an enumeration with dictionary's values.

Specified by:
elements in class java.util.Dictionary
Returns:
an enumeration with dictionary's values.

get

public java.lang.Object get(java.lang.Object key)
Gets the value corresponding to this key or any of its case representations.

Specified by:
get in class java.util.Dictionary
Parameters:
key - String key
Returns:
object value or null if none

rehash

protected void rehash()

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
                     throws java.lang.IllegalArgumentException
Puts the key and the value in the table. If there already is a key equal ignore case to the one passed the new value exchhanes the old one.

Specified by:
put in class java.util.Dictionary
Parameters:
key - String key
value - object to put
Returns:
old value if any, or null if none
Throws:
java.lang.IllegalArgumentException - if key is not a string

remove

public java.lang.Object remove(java.lang.Object key)
                        throws java.lang.IllegalArgumentException
Removes the key and its corresponding value. Key is searched case insensitively.

Specified by:
remove in class java.util.Dictionary
Parameters:
key - string key
Returns:
object removed or null if none
Throws:
java.lang.IllegalArgumentException - if key is not s string

clear

public void clear()
Clears all elements from the distionary.


clone

public java.lang.Object clone()
Creates a shallow copy of this hashtable. The keys and values themselves are not cloned.

Overrides:
clone in class java.lang.Object
Returns:
a new CMDictioanry with the same fields

equals

public boolean equals(java.lang.Object o)
Compares the specified Object with this Dictionary for equality,

Overrides:
equals in class java.lang.Object
Returns:
true if the specified Object is equal to this Dictionary.

toString

public java.lang.String toString()
Makes a string represntation of this object.

Overrides:
toString in class java.lang.Object
Returns:
string represntation of this object

writeObject

public void writeObject(java.io.OutputStream os)
                 throws java.lang.Exception
Writes this object to the stream passed. The object can be loaded again via its readObject method.

Specified by:
writeObject in interface Externalizable
Parameters:
os - strream to write data to.
Throws:
java.lang.Exception - if error of any kind occurs

readObject

public void readObject(java.io.InputStream is)
                throws java.lang.Exception
Reads the data from the InputStream and loads the data in the table.

Specified by:
readObject in interface Externalizable
Parameters:
is - stream to read dictionary's data from
Throws:
java.lang.Exception - if an error of any kind occurs while reading

copyFrom

public void copyFrom(java.util.Dictionary props)
              throws java.lang.IllegalArgumentException
Parameters:
props -
Throws:
java.lang.IllegalArgumentException

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved