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/09/01 17:19:32 UTC

svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

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 );
     }
 }



Re: svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

Posted by Alex Karasulu <ak...@apache.org>.
Thanks!

Alex

On Mon, Sep 1, 2008 at 1:07 PM, Emmanuel Lecharny <el...@gmail.com>wrote:

> Alex Karasulu wrote:
>
>> Hehe no worries you did the right thing.  So if you want to blow it away
>> let's go ahead and do that.
>>
>>
>
> I will do it as soon as I will be rid of Attributes all over the server :)
>
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

Re: svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

Posted by Emmanuel Lecharny <el...@gmail.com>.
Alex Karasulu wrote:
> Hehe no worries you did the right thing.  So if you want to blow it away
> let's go ahead and do that.
>   

I will do it as soon as I will be rid of Attributes all over the server :)

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

Posted by Alex Karasulu <ak...@apache.org>.
Hehe no worries you did the right thing.  So if you want to blow it away
let's go ahead and do that.

Alex

On Mon, Sep 1, 2008 at 12:34 PM, Emmanuel Lecharny <el...@gmail.com>wrote:

> Alex Karasulu wrote:
>
>> Do we even need this class now that we removed the context entry from the
>> server.xml ?  We might just be able to delete this POS.  WDYT?
>>
>>
>
> It's a duplicated class anyway. I think we should get rid of it. I didn't
> want to do it while modifying it, because it was not my main target, but I
> thought "why the hell don't we remove it?" while fixing it... I was just a
> bit lazzy :)
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

Re: svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

Posted by Emmanuel Lecharny <el...@gmail.com>.
Alex Karasulu wrote:
> Do we even need this class now that we removed the context entry from the
> server.xml ?  We might just be able to delete this POS.  WDYT?
>   

It's a duplicated class anyway. I think we should get rid of it. I 
didn't want to do it while modifying it, because it was not my main 
target, but I thought "why the hell don't we remove it?" while fixing 
it... I was just a bit lazzy :)

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: svn commit: r690996 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java

Posted by Alex Karasulu <ak...@apache.org>.
Do we even need this class now that we removed the context entry from the
server.xml ?  We might just be able to delete this POS.  WDYT?

Alex

On Mon, Sep 1, 2008 at 11:19 AM, <el...@apache.org> wrote:

> 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 );
>     }
>  }
>
>
>