directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java
Date Mon, 01 Sep 2008 15:19:32 GMT
Author: elecharny
Date: Mon Sep  1 08:19:32 2008
New Revision: 690996

URL: http://svn.apache.org/viewvc?rev=690996&view=rev
Log:
Removed some reference to AttributesImpl

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

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=690996&r1=690995&r2=690996&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
Mon Sep  1 08:19:32 2008
@@ -21,10 +21,13 @@
 
 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.message.AttributesImpl;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import javax.naming.NamingEnumeration;
@@ -103,17 +106,16 @@
     /**
      * Read an entry (without DN)
      * 
-     * @param text
-     *            The ldif format file
-     * @return An Attributes.
+     * @param text The ldif format file
+     * @return An entry.
      */
-    private Attributes readEntry( String text )
+    private Entry readEntry( String text )
     {
         StringReader strIn = new StringReader( text );
         BufferedReader in = new BufferedReader( strIn );
 
         String line = null;
-        Attributes attributes = new AttributesImpl( true );
+        Entry entry = new DefaultClientEntry();
 
         try
         {
@@ -131,15 +133,15 @@
                     continue;
                 }
 
-                Attribute attribute = LdifReader.parseAttributeValue( addedLine );
-                Attribute oldAttribute = attributes.get( attribute.getID() );
+                EntryAttribute attribute = AttributeUtils.toClientAttribute( LdifReader.parseAttributeValue(
addedLine ) );
+                EntryAttribute oldAttribute = entry.get( attribute.getId() );
 
                 if ( oldAttribute != null )
                 {
                     try
                     {
                         oldAttribute.add( attribute.get() );
-                        attributes.put( oldAttribute );
+                        entry.put( oldAttribute );
                     }
                     catch (NamingException ne)
                     {
@@ -148,7 +150,14 @@
                 }
                 else
                 {
-                    attributes.put( attribute );
+                    try
+                    {
+                        entry.put( attribute );
+                    }
+                    catch ( NamingException ne )
+                    {
+                        // Do nothing...
+                    }
                 }
             }
         }
@@ -157,7 +166,7 @@
             // Do nothing : we can't reach this point !
         }
 
-        return attributes;
+        return entry;
     }
 
     /**
@@ -170,6 +179,7 @@
             text = "";
         }
 
-        setValue( readEntry( text ) );
+        Entry entry = readEntry( text );
+        setValue( entry );
     }
 }



Mime
View raw message