You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/08/20 00:05:15 UTC
svn commit: r687179 - in /directory:
apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/
apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/
shared/trunk/ldap/src/main/java/org/apache/directory/...
Author: elecharny
Date: Tue Aug 19 15:05:15 2008
New Revision: 687179
URL: http://svn.apache.org/viewvc?rev=687179&view=rev
Log:
Replaced the MultiHashMap deprecated class by a MultiValueMap
Modified:
directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java?rev=687179&r1=687178&r2=687179&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java Tue Aug 19 15:05:15 2008
@@ -24,20 +24,18 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
-import java.util.Collection;
import java.util.Map;
-import java.util.Set;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
+import org.apache.commons.collections.map.MultiValueMap;
import org.apache.directory.shared.ldap.ldif.LdifComposer;
import org.apache.directory.shared.ldap.ldif.LdifComposerImpl;
import org.apache.directory.shared.ldap.ldif.LdifReader;
import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.util.MultiMap;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -75,88 +73,19 @@
public String getAsText()
{
LdifComposer composer = new LdifComposerImpl();
- MultiMap map = new MultiMap()
- {
- // FIXME Stop forking commons-collections.
- private final org.apache.commons.collections.MultiHashMap map =
- new org.apache.commons.collections.MultiHashMap();
-
- public Object remove( Object arg0, Object arg1 )
- {
- return map.remove( arg0, arg1 );
- }
-
- public int size()
- {
- return map.size();
- }
-
- public Object get( Object arg0 )
- {
- return map.get( arg0 );
- }
-
- public boolean containsValue( Object arg0 )
- {
- return map.containsValue( arg0 );
- }
-
- public Object put( Object arg0, Object arg1 )
- {
- return map.put( arg0, arg1 );
- }
-
- public Object remove( Object arg0 )
- {
- return map.remove( arg0 );
- }
-
- @SuppressWarnings("unchecked")
- public Collection<Object> values()
- {
- return map.values();
- }
-
- public boolean isEmpty()
- {
- return map.isEmpty();
- }
-
- public boolean containsKey( Object key )
- {
- return map.containsKey( key );
- }
-
- @SuppressWarnings("unchecked")
- public void putAll( Map arg0 )
- {
- map.putAll( arg0 );
- }
-
- public void clear()
- {
- map.clear();
- }
-
- public Set<?> keySet()
- {
- return map.keySet();
- }
-
- public Set<?> entrySet()
- {
- return map.entrySet();
- }
- };
+ Map<String, Object> map = new MultiValueMap();
Attributes attrs = (Attributes) getValue();
+
try
{
NamingEnumeration<? extends Attribute> e = attrs.getAll();
+
while ( e.hasMore() )
{
Attribute attr = e.next();
NamingEnumeration<? extends Object> e2 = attr.getAll();
+
while ( e2.hasMoreElements() )
{
Object value = e2.next();
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java?rev=687179&r1=687178&r2=687179&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java Tue Aug 19 15:05:15 2008
@@ -19,12 +19,12 @@
*/
package org.apache.directory.server.core.configuration;
+import org.apache.commons.collections.map.MultiValueMap;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.shared.ldap.ldif.LdifComposer;
import org.apache.directory.shared.ldap.ldif.LdifComposerImpl;
import org.apache.directory.shared.ldap.ldif.LdifReader;
import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.util.MultiMap;
import org.apache.directory.shared.ldap.util.StringTools;
import javax.naming.NamingEnumeration;
@@ -36,9 +36,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
-import java.util.Collection;
import java.util.Map;
-import java.util.Set;
/**
@@ -76,79 +74,7 @@
public String getAsText()
{
LdifComposer composer = new LdifComposerImpl();
- MultiMap map = new MultiMap()
- {
- // FIXME Stop forking commons-collections.
- private final org.apache.commons.collections.MultiHashMap map =
- new org.apache.commons.collections.MultiHashMap();
-
- public Object remove( Object arg0, Object arg1 )
- {
- return map.remove( arg0, arg1 );
- }
-
- public int size()
- {
- return map.size();
- }
-
- public Object get( Object arg0 )
- {
- return map.get( arg0 );
- }
-
- public boolean containsValue( Object arg0 )
- {
- return map.containsValue( arg0 );
- }
-
- public Object put( Object arg0, Object arg1 )
- {
- return map.put( arg0, arg1 );
- }
-
- public Object remove( Object arg0 )
- {
- return map.remove( arg0 );
- }
-
- @SuppressWarnings("unchecked")
- public Collection<Object> values()
- {
- return map.values();
- }
-
- public boolean isEmpty()
- {
- return map.isEmpty();
- }
-
- public boolean containsKey( Object key )
- {
- return map.containsKey( key );
- }
-
- @SuppressWarnings("unchecked")
- public void putAll( Map arg0 )
- {
- map.putAll( arg0 );
- }
-
- public void clear()
- {
- map.clear();
- }
-
- public Set<?> keySet()
- {
- return map.keySet();
- }
-
- public Set<?> entrySet()
- {
- return map.entrySet();
- }
- };
+ Map<String, Object> map = new MultiValueMap();
Attributes attrs = (Attributes) getValue();
try
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?rev=687179&r1=687178&r2=687179&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java Tue Aug 19 15:05:15 2008
@@ -34,7 +34,7 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
-import org.apache.commons.collections.MultiHashMap;
+import org.apache.commons.collections.map.MultiValueMap;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -149,7 +149,7 @@
* Note : there is no Generic available classes in commons-collection...
*/
@SuppressWarnings({"unchecked"})
- private Map<String, AttributeTypeAndValue> atavTypes = new MultiHashMap();
+ private Map<String, AttributeTypeAndValue> atavTypes = new MultiValueMap();
/**
* We keep the type for a single valued RDN, to avoid the creation of an HashMap
@@ -294,7 +294,7 @@
default:
// We must duplicate the treeSet and the hashMap
atavs = new TreeSet<AttributeTypeAndValue>();
- atavTypes = new MultiHashMap();
+ atavTypes = new MultiValueMap();
for ( AttributeTypeAndValue currentAtav:rdn.atavs )
{
@@ -402,7 +402,7 @@
// and store the existing AttributeTypeAndValue into it.
atavs.add( atav );
- atavTypes = new MultiHashMap();
+ atavTypes = new MultiValueMap();
atavTypes.put( atavType, atav );
atav = null;
@@ -453,7 +453,7 @@
// and store the existing AttributeTypeAndValue into it.
atavs.add( this.atav );
- atavTypes = new MultiHashMap();
+ atavTypes = new MultiValueMap();
atavTypes.put( atavType, this.atav );
this.atav = null;
@@ -686,7 +686,7 @@
default:
// We must duplicate the treeSet and the hashMap
- rdn.atavTypes = new MultiHashMap();
+ rdn.atavTypes = new MultiValueMap();
rdn.atavs = new TreeSet<AttributeTypeAndValue>();
for ( AttributeTypeAndValue currentAtav:this.atavs )
@@ -1480,7 +1480,7 @@
default :
atavs = new TreeSet<AttributeTypeAndValue>();
- atavTypes = new MultiHashMap();
+ atavTypes = new MultiValueMap();
for ( int i = 0; i < nbAtavs; i++ )
{