directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1088671 - in /directory: shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/ shared/trunk/ldap/model/src/test/java/org/apach...
Date Mon, 04 Apr 2011 16:12:23 GMT
Author: elecharny
Date: Mon Apr  4 16:12:23 2011
New Revision: 1088671

URL: http://svn.apache.org/viewvc?rev=1088671&view=rev
Log:
o Removed some unused methods from AttributeUtils
o Renamed some other ones

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportDsmlRunnable.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
Mon Apr  4 16:12:23 2011
@@ -23,7 +23,6 @@ package org.apache.directory.shared.ldap
 import java.text.ParseException;
 import java.util.Arrays;
 import java.util.Iterator;
-import java.util.List;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -31,18 +30,12 @@ import javax.naming.directory.Attributes
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 
-import org.apache.commons.lang.ArrayUtils;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeTypeException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.MatchingRule;
-import org.apache.directory.shared.ldap.model.schema.Normalizer;
-import org.apache.directory.shared.ldap.model.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.util.Chars;
-import org.apache.directory.shared.util.Hex;
 import org.apache.directory.shared.util.Position;
 import org.apache.directory.shared.util.Strings;
 
@@ -56,332 +49,6 @@ public final class AttributeUtils
 {
 
     /**
-     * Private constructor.
-     */
-    private AttributeUtils()
-    {
-    }
-
-
-    /**
-     * Correctly removes an attribute from an entry using it's attributeType information.
-     * 
-     * @param type the attributeType of the attribute to remove
-     * @param entry the entry to remove the attribute from 
-     * @return the Attribute that is removed
-     */
-    public static javax.naming.directory.Attribute removeAttribute( AttributeType type, Attributes
entry )
-    {
-        javax.naming.directory.Attribute attr = entry.get( type.getOid() );
-
-        if ( attr == null )
-        {
-            List<String> aliases = type.getNames();
-
-            for ( String alias : aliases )
-            {
-                attr = entry.get( alias );
-
-                if ( attr != null )
-                {
-                    return entry.remove( attr.getID() );
-                }
-            }
-        }
-
-        if ( attr == null )
-        {
-            return null;
-        }
-
-        return entry.remove( attr.getID() );
-    }
-
-
-    /**
-     * Compare two values and return true if they are equal.
-     * 
-     * @param value1 The first value
-     * @param value2 The second value
-     * @return true if both value are null or if they are equal.
-     */
-    public static boolean equals( Object value1, Object value2 )
-    {
-        if ( value1 == value2 )
-        {
-            return true;
-        }
-
-        if ( value1 == null )
-        {
-            return false;
-        }
-
-        if ( value1 instanceof byte[] )
-        {
-            if ( value2 instanceof byte[] )
-            {
-                return Arrays.equals( ( byte[] ) value1, ( byte[] ) value2 );
-            }
-            else
-            {
-                return false;
-            }
-        }
-        else
-        {
-            return value1.equals( value2 );
-        }
-    }
-
-
-    /**
-     * Clone the value. An attribute value is supposed to be either a String
-     * or a byte array. If it's a String, then we just return it ( as String
-     * is immutable, we don't need to copy it). If it's a bu=yte array, we
-     * create a new byte array and copy the bytes into it.
-     * 
-     * @param value The value to clone
-     * @return The cloned value
-     */
-    public static Object cloneValue( Object value )
-    {
-        // First copy the value
-        Object newValue = null;
-
-        if ( value instanceof byte[] )
-        {
-            newValue = ( ( byte[] ) value ).clone();
-        }
-        else
-        {
-            newValue = value;
-        }
-
-        return newValue;
-    }
-
-
-    /**
-     * Switch from a BasicAttribute to a AttributeImpl. This is
-     * necessary to allow cloning to be correctly handled.
-     * 
-     * @param attribute The attribute to transform
-     * @return A instance of AttributeImpl
-     */
-    public static javax.naming.directory.Attribute toBasicAttribute( javax.naming.directory.Attribute
attribute )
-    {
-        if ( attribute instanceof BasicAttribute )
-        {
-            // Just return the attribute
-            return attribute;
-        }
-        else
-        {
-            // Create a new AttributeImpl from the original attribute
-            javax.naming.directory.Attribute newAttribute = new BasicAttribute( attribute.getID()
);
-
-            try
-            {
-                NamingEnumeration<?> values = attribute.getAll();
-
-                while ( values.hasMoreElements() )
-                {
-                    newAttribute.add( cloneValue( values.next() ) );
-                }
-
-                return newAttribute;
-            }
-            catch ( NamingException ne )
-            {
-                return newAttribute;
-            }
-        }
-    }
-
-
-    /**
-     * Utility method to extract an attribute from Attributes object using
-     * all combinationos of the name including aliases.
-     * 
-     * @param attrs the Attributes to get the Attribute object from
-     * @param type the attribute type specification
-     * @return an Attribute with matching the attributeType spec or null
-     */
-    public static javax.naming.directory.Attribute getAttribute( Attributes attrs, AttributeType
type )
-    {
-        // check if the attribute's OID is used
-        javax.naming.directory.Attribute attr = attrs.get( type.getOid() );
-
-        if ( attr != null )
-        {
-            return attr;
-        }
-
-        // optimization bypass to avoid cost of the loop below
-        if ( type.getNames().size() == 1 )
-        {
-            attr = attrs.get( type.getNames().get( 0 ) );
-
-            if ( attr != null )
-            {
-                return attr;
-            }
-        }
-
-        // iterate through aliases
-        for ( String alias : type.getNames() )
-        {
-            attr = attrs.get( alias );
-
-            if ( attr != null )
-            {
-                return attr;
-            }
-        }
-
-        return null;
-    }
-
-
-    /**
-     * Check if an attribute contains a specific value, using the associated matchingRule
for that
-     *
-     * @param attr The attribute we are searching in
-     * @param compared The object we are looking for
-     * @param type The attribute type
-     * @return <code>true</code> if the value exists in the attribute
-     * @throws LdapException If something went wrong while accessing the data
-     */
-    public static boolean containsValue( javax.naming.directory.Attribute attr, Value<?>
compared, AttributeType type ) throws LdapException
-    {
-        // quick bypass test
-        if ( attr.contains( compared ) )
-        {
-            return true;
-        }
-
-        MatchingRule matchingRule = type.getEquality();
-
-        Normalizer normalizer = null;
-
-        if ( matchingRule != null )
-        {
-            normalizer = matchingRule.getNormalizer();
-        }
-        else
-        {
-            normalizer = new NoOpNormalizer( type.getOid() );
-        }
-
-        if ( type.getSyntax().isHumanReadable() )
-        {
-            try
-            {
-                String comparedStr = normalizer.normalize( compared.getString() );
-
-                for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements();
/**/)
-                {
-                    String value = ( String ) values.nextElement();
-                    if ( comparedStr.equals( normalizer.normalize( value ) ) )
-                    {
-                        return true;
-                    }
-                }
-            }
-            catch ( NamingException e )
-            {
-                throw new LdapException( e.getMessage() );
-            }
-        }
-        else
-        {
-            byte[] comparedBytes = null;
-
-            if ( compared.isHumanReadable() )
-            {
-                if ( compared.getString().length() < 3 )
-                {
-                    return false;
-                }
-
-                // Transform the String to a byte array
-                int state = 1;
-                comparedBytes = new byte[compared.getString().length() / 3];
-                int pos = 0;
-
-                for ( char c : compared.getString().toCharArray() )
-                {
-                    switch ( state )
-                    {
-                        case 1:
-                            if ( c != '\\' )
-                            {
-                                return false;
-                            }
-
-                            state++;
-                            break;
-
-                        case 2:
-                            int high = Hex.getHexValue(c);
-
-                            if ( high == -1 )
-                            {
-                                return false;
-                            }
-
-                            comparedBytes[pos] = ( byte ) ( high << 4 );
-
-                            state++;
-                            break;
-
-                        case 3:
-                            int low = Hex.getHexValue(c);
-
-                            if ( low == -1 )
-                            {
-                                return false;
-                            }
-
-                            comparedBytes[pos] += ( byte ) low;
-                            pos++;
-
-                            state = 1;
-                            break;
-                        default:
-                            break;
-                    }
-                }
-            }
-            else
-            {
-                comparedBytes = compared.getBytes();
-            }
-
-            try
-            {
-                for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements();
/**/)
-                {
-                    Object value = values.nextElement();
-
-                    if ( value instanceof byte[] && ArrayUtils.isEquals( comparedBytes,
value ) )
-                    {
-                        return true;
-                    }
-                }
-            }
-            catch ( NamingException ne )
-            {
-                throw new LdapException( ne.getMessage() );
-            }
-        }
-
-        return false;
-    }
-
-
-    /**
      * Check if an attribute contains a value. The test is case insensitive,
      * and the value is supposed to be a String. If the value is a byte[],
      * then the case sensitivity is useless.
@@ -443,125 +110,6 @@ public final class AttributeUtils
 
 
     /**
-     * Creates a new attribute which contains the values representing the
-     * difference of two attributes. If both attributes are null then we cannot
-     * determine the attribute ID and an {@link IllegalArgumentException} is
-     * raised. Note that the order of arguments makes a difference.
-     * 
-     * @param attr0
-     *            the first attribute
-     * @param attr1
-     *            the second attribute
-     * @return a new attribute with the difference of values from both attribute
-     *         arguments
-     * @throws NamingException
-     *             if there are problems accessing attribute values
-     */
-    public static javax.naming.directory.Attribute getDifference( javax.naming.directory.Attribute
attr0, javax.naming.directory.Attribute attr1 ) throws NamingException
-    {
-        String id;
-
-        if ( ( attr0 == null ) && ( attr1 == null ) )
-        {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04339 ) );
-        }
-        else if ( attr0 == null )
-        {
-            return new BasicAttribute( attr1.getID() );
-        }
-        else if ( attr1 == null )
-        {
-            return ( javax.naming.directory.Attribute ) attr0.clone();
-        }
-        else if ( !attr0.getID().equalsIgnoreCase( attr1.getID() ) )
-        {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04340 ) );
-        }
-        else
-        {
-            id = attr0.getID();
-        }
-
-        javax.naming.directory.Attribute attr = new BasicAttribute( id );
-
-        for ( int ii = 0; ii < attr0.size(); ii++ )
-        {
-            attr.add( attr0.get( ii ) );
-        }
-
-        for ( int ii = 0; ii < attr1.size(); ii++ )
-        {
-            attr.remove( attr1.get( ii ) );
-        }
-
-        return attr;
-    }
-
-
-    /**
-     * Creates a new attribute which contains the values representing the union
-     * of two attributes. If one attribute is null then the resultant attribute
-     * returned is a copy of the non-null attribute. If both are null then we
-     * cannot determine the attribute ID and an {@link IllegalArgumentException}
-     * is raised.
-     * 
-     * @param attr0
-     *            the first attribute
-     * @param attr1
-     *            the second attribute
-     * @return a new attribute with the union of values from both attribute
-     *         arguments
-     * @throws NamingException
-     *             if there are problems accessing attribute values
-     */
-    public static javax.naming.directory.Attribute getUnion( javax.naming.directory.Attribute
attr0, javax.naming.directory.Attribute attr1 ) throws NamingException
-    {
-        String id;
-
-        if ( attr0 == null && attr1 == null )
-        {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04341 ) );
-        }
-        else if ( attr0 == null )
-        {
-            id = attr1.getID();
-        }
-        else if ( attr1 == null )
-        {
-            id = attr0.getID();
-        }
-        else if ( !attr0.getID().equalsIgnoreCase( attr1.getID() ) )
-        {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04342 ) );
-        }
-        else
-        {
-            id = attr0.getID();
-        }
-
-        javax.naming.directory.Attribute attr = new BasicAttribute( id );
-
-        if ( attr0 != null )
-        {
-            for ( int ii = 0; ii < attr0.size(); ii++ )
-            {
-                attr.add( attr0.get( ii ) );
-            }
-        }
-
-        if ( attr1 != null )
-        {
-            for ( int ii = 0; ii < attr1.size(); ii++ )
-            {
-                attr.add( attr1.get( ii ) );
-            }
-        }
-
-        return attr;
-    }
-
-
-    /**
      * Check if the attributes is a BasicAttributes, and if so, switch
      * the case sensitivity to false to avoid tricky problems in the server.
      * (Ldap attributeTypes are *always* case insensitive)
@@ -611,110 +159,6 @@ public final class AttributeUtils
 
 
     /**
-     * Return a string representing the attributes with tabs in front of the
-     * string
-     * 
-     * @param tabs
-     *            Spaces to be added before the string
-     * @param attribute
-     *            The attribute to print
-     * @return A string
-     */
-    public static String toString( String tabs, javax.naming.directory.Attribute attribute
)
-    {
-        StringBuffer sb = new StringBuffer();
-
-        sb.append( tabs ).append( "Attribute\n" );
-
-        if ( attribute != null )
-        {
-            sb.append( tabs ).append( "    Type : '" ).append( attribute.getID() ).append(
"'\n" );
-
-            for ( int j = 0; j < attribute.size(); j++ )
-            {
-
-                try
-                {
-                    Object attr = attribute.get( j );
-
-                    if ( attr != null )
-                    {
-                        if ( attr instanceof String )
-                        {
-                            sb.append( tabs ).append( "        Val[" ).append( j ).append(
"] : " ).append( attr )
-                                .append( " \n" );
-                        }
-                        else if ( attr instanceof byte[] )
-                        {
-                            String string = Strings.utf8ToString((byte[]) attr);
-
-                            sb.append( tabs ).append( "        Val[" ).append( j ).append(
"] : " );
-                            sb.append( string ).append( '/' );
-                            sb.append( Strings.dumpBytes((byte[]) attr) );
-                            sb.append( " \n" );
-                        }
-                        else
-                        {
-                            sb.append( tabs ).append( "        Val[" ).append( j ).append(
"] : " ).append( attr )
-                                .append( " \n" );
-                        }
-                    }
-                }
-                catch ( NamingException ne )
-                {
-                    sb.append( "Bad attribute : " ).append( ne.getMessage() );
-                }
-            }
-        }
-
-        return sb.toString();
-    }
-
-
-    /**
-     * Return a string representing the attribute
-     * 
-     * @param attribute
-     *            The attribute to print
-     * @return A string
-     */
-    public static String toString( javax.naming.directory.Attribute attribute )
-    {
-        return toString( "", attribute );
-    }
-
-
-    /**
-     * Return a string representing the attributes with tabs in front of the
-     * string
-     * 
-     * @param tabs
-     *            Spaces to be added before the string
-     * @param attributes
-     *            The attributes to print
-     * @return A string
-     */
-    public static String toString( String tabs, Attributes attributes )
-    {
-        StringBuffer sb = new StringBuffer();
-        sb.append( tabs ).append( "Attributes\n" );
-
-        if ( attributes != null )
-        {
-            NamingEnumeration<?> attributesIterator = attributes.getAll();
-
-            while ( attributesIterator.hasMoreElements() )
-            {
-                javax.naming.directory.Attribute attribute = ( javax.naming.directory.Attribute
) attributesIterator.nextElement();
-                sb.append( tabs ).append( attribute.toString() );
-            }
-        }
-
-        return sb.toString();
-    }
-
-
-    /**
      * Parse attribute's options :
      * 
      * options = *( ';' option )
@@ -800,7 +244,7 @@ public final class AttributeUtils
      * @param pos The current position in the string
      * @throws ParseException If we don't have a valid OID
      */
-    public static void parseOID( String str, Position pos ) throws ParseException
+    private static void parseOID( String str, Position pos ) throws ParseException
     {
         // We have an OID
         parseNumber( str, pos );
@@ -908,19 +352,6 @@ public final class AttributeUtils
 
 
     /**
-     * Return a string representing the attributes
-     * 
-     * @param attributes
-     *            The attributes to print
-     * @return A string
-     */
-    public static String toString( Attributes attributes )
-    {
-        return toString( "", attributes );
-    }
-
-
-    /**
      * A method to apply a modification to an existing entry.
      * 
      * @param entry The entry on which we want to apply a modification
@@ -1014,15 +445,15 @@ public final class AttributeUtils
 
 
     /**
-     * Convert a BasicAttributes or a AttributesImpl to a ServerEntry
+     * Convert a BasicAttributes or a AttributesImpl to an Entry
      *
      * @param attributes the BasicAttributes or AttributesImpl instance to convert
-     * @param dn The Dn which is needed by the ServerEntry
-     * @return An instance of a ServerEntry object
+     * @param dn The Dn which is needed by the Entry
+     * @return An instance of a Entry object
      * 
      * @throws LdapException If we get an invalid attribute
      */
-    public static Entry toClientEntry( Attributes attributes, Dn dn ) throws LdapException
+    public static Entry toEntry( Attributes attributes, Dn dn ) throws LdapException
     {
         if ( attributes instanceof BasicAttributes )
         {
@@ -1034,7 +465,7 @@ public final class AttributeUtils
                 {
                     javax.naming.directory.Attribute attr = attrs.nextElement();
 
-                    Attribute entryAttribute = toClientAttribute( attr );
+                    Attribute entryAttribute = toApiAttribute( attr );
 
                     if ( entryAttribute != null )
                     {
@@ -1075,7 +506,7 @@ public final class AttributeUtils
             {
                 Attribute entryAttribute = ( Attribute ) attributeIterator.next();
 
-                attributes.put( toAttribute( entryAttribute ) );
+                attributes.put( toJndiAttribute( entryAttribute ) );
             }
 
             return attributes;
@@ -1086,27 +517,25 @@ public final class AttributeUtils
 
 
     /**
-     * Converts an {@link Attribute} to an {@link Attribute}.
+     * Converts an {@link Attribute} to a JNDI Attribute.
      *
-     * @param entryAttribute
-     *      the {@link Attribute} to convert
-     * @return
-     *      the equivalent {@link Attribute}
+     * @param attribute the {@link Attribute} to convert
+     * @return the equivalent JNDI Attribute
      */
-    public static javax.naming.directory.Attribute toAttribute( Attribute entryAttribute
)
+    public static javax.naming.directory.Attribute toJndiAttribute( Attribute attribute )
     {
-        if ( entryAttribute != null )
+        if ( attribute != null )
         {
-            javax.naming.directory.Attribute attribute = new BasicAttribute( entryAttribute.getId()
);
+            javax.naming.directory.Attribute jndiAttribute = new BasicAttribute( attribute.getId()
);
 
             // Looping on values
-            for ( Iterator<Value<?>> valueIterator = entryAttribute.iterator();
valueIterator.hasNext(); )
+            for ( Iterator<Value<?>> valueIterator = attribute.iterator(); valueIterator.hasNext();
)
             {
                 Value<?> value = valueIterator.next();
-                attribute.add( value.getValue() );
+                jndiAttribute.add( value.getValue() );
             }
 
-            return attribute;
+            return jndiAttribute;
         }
 
         return null;
@@ -1114,42 +543,42 @@ public final class AttributeUtils
 
 
     /**
-     * Convert a BasicAttribute or a AttributeImpl to a EntryAttribute
+     * Convert a JNDI Attribute to an LDAP API Attribute
      *
-     * @param attribute the BasicAttributes or AttributesImpl instance to convert
-     * @return An instance of a ClientEntry object
+     * @param jndiAttribute the JNDI Attribute instance to convert
+     * @return An instance of a LDAP API Attribute object
      */
-    public static Attribute toClientAttribute( javax.naming.directory.Attribute attribute
) throws LdapInvalidAttributeValueException
+    public static Attribute toApiAttribute( javax.naming.directory.Attribute jndiAttribute
) throws LdapInvalidAttributeValueException
     {
-        if ( attribute == null )
+        if ( jndiAttribute == null )
         {
             return null;
         }
 
         try
         {
-            Attribute clientAttribute = new DefaultAttribute( attribute.getID() );
+            Attribute attribute = new DefaultAttribute( jndiAttribute.getID() );
 
-            for ( NamingEnumeration<?> values = attribute.getAll(); values.hasMoreElements();
)
+            for ( NamingEnumeration<?> values = jndiAttribute.getAll(); values.hasMoreElements();
)
             {
                 Object value = values.nextElement();
 
                 
                 if ( value instanceof String )
                 {
-                    clientAttribute.add( ( String ) value );
+                    attribute.add( ( String ) value );
                 }
                 else if ( value instanceof byte[] )
                 {
-                    clientAttribute.add( ( byte[] ) value );
+                    attribute.add( ( byte[] ) value );
                 }
                 else
                 {
-                    clientAttribute.add( ( String ) null );
+                    attribute.add( ( String ) null );
                 }
             }
 
-            return clientAttribute;
+            return attribute;
         }
         catch ( NamingException ne )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
Mon Apr  4 16:12:23 2011
@@ -165,7 +165,7 @@ public final class LdifUtils
      */
     public static String convertToLdif( Attributes attrs ) throws LdapException
     {
-        return convertAttributesToLdif( AttributeUtils.toClientEntry( attrs, null ), DEFAULT_LINE_LENGTH
);
+        return convertAttributesToLdif( AttributeUtils.toEntry( attrs, null ), DEFAULT_LINE_LENGTH
);
     }
 
 
@@ -179,7 +179,7 @@ public final class LdifUtils
      */
     public static String convertToLdif( Attributes attrs, int length ) throws LdapException
     {
-        return convertAttributesToLdif( AttributeUtils.toClientEntry(attrs, null), length
);
+        return convertAttributesToLdif( AttributeUtils.toEntry(attrs, null), length );
     }
 
 
@@ -194,7 +194,7 @@ public final class LdifUtils
      */
     public static String convertToLdif( Attributes attrs, Dn dn, int length ) throws LdapException
     {
-        return convertEntryToLdif( AttributeUtils.toClientEntry( attrs, dn ), length );
+        return convertEntryToLdif( AttributeUtils.toEntry( attrs, dn ), length );
     }
 
 
@@ -208,7 +208,7 @@ public final class LdifUtils
      */
     public static String convertToLdif( Attributes attrs, Dn dn ) throws LdapException
     {
-        return convertEntryToLdif( AttributeUtils.toClientEntry( attrs, dn ), DEFAULT_LINE_LENGTH
);
+        return convertEntryToLdif( AttributeUtils.toEntry( attrs, dn ), DEFAULT_LINE_LENGTH
);
     }
 
 

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeUtilsTest.java
Mon Apr  4 16:12:23 2011
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -29,13 +28,14 @@ import static org.junit.Assert.assertTru
 import java.util.HashSet;
 import java.util.Set;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * A test case for the AttributeUtils methods 
@@ -413,47 +413,5 @@ public class AttributeUtilsTest
         assertNotNull( entry.get( "cn" ) );
         assertNull( entry.get( "ou" ) );
     }
-
-    @Test
-    public void testEqualsNull() throws Exception
-    {
-        assertFalse( AttributeUtils.equals( byteArrayA, null ) );
-        assertFalse( AttributeUtils.equals( null, byteArrayA ) );
-        assertTrue( AttributeUtils.equals( null, null ) );
-    }
-
-
-    @Test
-    public void testEqualsReflexive() throws Exception
-    {
-        assertTrue( AttributeUtils.equals( byteArrayA, byteArrayA ) );
-    }
-
-
-    @Test
-    public void testEqualsSymmetric() throws Exception
-    {
-        assertTrue( AttributeUtils.equals( byteArrayA, byteArrayACopy ) );
-        assertTrue( AttributeUtils.equals( byteArrayACopy, byteArrayA ) );
-    }
-
-
-    @Test
-    public void testEqualsTransitive() throws Exception
-    {
-        assertTrue( AttributeUtils.equals( byteArrayA, byteArrayACopy ) );
-        assertTrue( AttributeUtils.equals(byteArrayACopy, byteArrayB) );
-        assertTrue( AttributeUtils.equals( byteArrayA, byteArrayB ) );
-    }
-
-
-    @Test
-    public void testNotEqualDiffValue() throws Exception
-    {
-        assertFalse( AttributeUtils.equals( byteArrayA, byteArrayC ) );
-        assertFalse( AttributeUtils.equals( byteArrayC, byteArrayA ) );
-        assertFalse( AttributeUtils.equals( byteArrayA, "otherObject" ) );
-        assertFalse( AttributeUtils.equals( byteArrayA, "otherObject" ) );
-    }
 }
 

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
Mon Apr  4 16:12:23 2011
@@ -303,7 +303,7 @@ public class LoadConfigurationRunnable i
             {
                 // Creating the 'ou=config' base entry
                 SearchResult searchResult = ( SearchResult ) enumeration.next();
-                configEntry = new DefaultEntry( schemaManager, AttributeUtils.toClientEntry(
+                configEntry = new DefaultEntry( schemaManager, AttributeUtils.toEntry(
                     searchResult.getAttributes(), new Dn( searchResult.getNameInNamespace()
) ) );
             }
             enumeration.close();
@@ -359,7 +359,7 @@ public class LoadConfigurationRunnable i
                 {
                     // Creating the child entry
                     SearchResult searchResult = ( SearchResult ) childrenEnumeration.next();
-                    Entry childEntry = new DefaultEntry( schemaManager, AttributeUtils.toClientEntry(
+                    Entry childEntry = new DefaultEntry( schemaManager, AttributeUtils.toEntry(
                         searchResult.getAttributes(), new Dn( searchResult.getNameInNamespace()
) ) );
 
                     // Adding the children to the list of entries

Modified: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
(original)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Mon Apr  4 16:12:23 2011
@@ -706,7 +706,7 @@ public class DirectoryApiConnectionWrapp
 
                 try
                 {
-                    modification.setAttribute( AttributeUtils.toClientAttribute( modificationItem.getAttribute()
) );
+                    modification.setAttribute( AttributeUtils.toApiAttribute( modificationItem.getAttribute()
) );
                 }
                 catch ( LdapInvalidAttributeValueException liave )
                 {
@@ -845,7 +845,7 @@ public class DirectoryApiConnectionWrapp
                     // Preparing the add request
                     AddRequest request = new AddRequestImpl();
                     request.setEntryDn( new Dn( dn ) );
-                    request.setEntry( AttributeUtils.toClientEntry( attributes, new Dn( dn
) ) );
+                    request.setEntry( AttributeUtils.toEntry( attributes, new Dn( dn ) )
);
                     request.addAllControls( convertControls( controls ) );
 
                     // Performing the add operation

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
Mon Apr  4 16:12:23 2011
@@ -350,7 +350,7 @@ public class ExportDsmlRunnable implemen
     private static DsmlDecorator<? extends Response> convertSearchResultToDsml( SearchResult
searchResult, SearchParameter searchParameter )
         throws LdapException, LdapURLEncodingException
     {
-        Entry entry = AttributeUtils.toClientEntry(searchResult.getAttributes(),
+        Entry entry = AttributeUtils.toEntry(searchResult.getAttributes(),
                 new Dn(searchResult.getNameInNamespace()));
 
         if ( isReferral( entry ) )
@@ -491,7 +491,7 @@ public class ExportDsmlRunnable implemen
         throws LdapException
     {
         AddRequestDsml ar = new AddRequestDsml( codec );
-        Entry entry = AttributeUtils.toClientEntry( searchResult.getAttributes(),
+        Entry entry = AttributeUtils.toEntry( searchResult.getAttributes(),
             new Dn( searchResult.getNameInNamespace() ) );
         ar.setEntry( entry );
 

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportDsmlRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportDsmlRunnable.java?rev=1088671&r1=1088670&r2=1088671&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportDsmlRunnable.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportDsmlRunnable.java
Mon Apr  4 16:12:23 2011
@@ -498,7 +498,7 @@ public class ImportDsmlRunnable implemen
         for ( Modification modification : request.getModifications() )
         {
             modificationItems.add( new ModificationItem( convertModificationOperation( modification.getOperation()
),
-                AttributeUtils.toAttribute( modification.getAttribute() ) ) );
+                AttributeUtils.toJndiAttribute( modification.getAttribute() ) ) );
         }
 
         // Executing the modify request



Mime
View raw message