directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r696211 - 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/...
Date Wed, 17 Sep 2008 09:15:18 GMT
Author: elecharny
Date: Wed Sep 17 02:15:17 2008
New Revision: 696211

URL: http://svn.apache.org/viewvc?rev=696211&view=rev
Log:
o Removed the LdifComposer(Impl) classes, as they are a duplicate of some LdifUtils methods

This will also fix DIRSERVER-666, as LdifUtils.convertToLdif() methods can fold the lines
to a specified length (default to 80)

Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
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

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=696211&r1=696210&r2=696211&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
Wed Sep 17 02:15:17 2008
@@ -24,18 +24,14 @@
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
-import java.util.Map;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttributes;
 
-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.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -72,28 +68,11 @@
      */
     public String getAsText()
     {
-        LdifComposer composer = new LdifComposerImpl();
-        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();
-                    map.put( attr.getID(), value );
-                }
-            }
-
-            return composer.compose( map );
+            return LdifUtils.convertToLdif( attrs );
         }
         catch ( Exception e )
         {

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=696211&r1=696210&r2=696211&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
Wed Sep 17 02:15:17 2008
@@ -19,27 +19,22 @@
  */
 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.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
-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.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import java.beans.PropertyEditor;
 import java.beans.PropertyEditorSupport;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
-import java.util.Map;
 
 
 /**
@@ -76,25 +71,11 @@
     @SuppressWarnings("deprecation")
     public String getAsText()
     {
-        LdifComposer composer = new LdifComposerImpl();
-        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();
-                    map.put( attr.getID(), value );
-                }
-            }
-
-            return composer.compose( map );
+            return LdifUtils.convertToLdif( attrs );
         }
         catch ( Exception e )
         {



Mime
View raw message