diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-24 02:27:47 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-26 11:43:54 -0500 |
commit | 621d9e5c413e561293d7484b93882d985b3fe15f (patch) | |
tree | 638f3d75761c121d9a8fb50b52a12a6686c5ac5c /base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java | |
parent | 40d3643b8d91886bf210aa27f711731c81a11e49 (diff) | |
download | pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip |
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder.
This folder was created during svn migration and is no longer
needed. This folder has now been removed and the contents have
been moved up one level.
Ticket #131
Diffstat (limited to 'base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java')
-rw-r--r-- | base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java b/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java new file mode 100644 index 000000000..86e6c0530 --- /dev/null +++ b/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java @@ -0,0 +1,78 @@ +package com.netscape.cmscore.request; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** + * Subclass of Hashtable returned by IRequest.getExtDataInHashtable. Its + * purpose is to hide the fact that LDAP doesn't preserve the case of keys. + * It does this by lowercasing all keys used to access the Hashtable. + */ +public class ExtDataHashtable<V> extends Hashtable<String, V> { + + /** + * + */ + private static final long serialVersionUID = 8401134619951331450L; + + public ExtDataHashtable() { + super(); + } + + public ExtDataHashtable(int i) { + super(i); + } + + public ExtDataHashtable(int i, float v) { + super(i, v); + } + + public ExtDataHashtable(Map<? extends String, ? extends V> map) { + // the super constructor seems to call putAll, but I can't + // rely on that behaviour + super(); + putAll(map); + } + + public boolean containsKey(Object o) { + if (o instanceof String) { + String key = (String) o; + return super.containsKey(key.toLowerCase()); + } + return super.containsKey(o); + } + + public V get(Object o) { + if (o instanceof String) { + String key = (String) o; + return super.get(key.toLowerCase()); + } + return super.get(o); + } + + public V put(String oKey, V val) { + if (oKey instanceof String) { + String key = (String) oKey; + return super.put(key.toLowerCase(), val); + } + return super.put(oKey, val); + } + + public void putAll(Map<? extends String, ? extends V> map) { + Set<? extends String> keys = map.keySet(); + for (Iterator<? extends String> i = keys.iterator(); i.hasNext();) { + Object key = i.next(); + put((String) key, map.get(key)); + } + } + + public V remove(Object o) { + if (o instanceof String) { + String key = (String) o; + return super.remove(key.toLowerCase()); + } + return super.remove(o); + } +} |