directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1062285 [4/5] - in /directory: apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/changelog/ apacheds/trunk/core-api/src/main/java/...
Date Sat, 22 Jan 2011 22:37:12 GMT
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVASerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVASerializer.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVASerializer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVASerializer.java Sat Jan 22 22:37:04 2011
@@ -27,8 +27,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
-import org.apache.directory.shared.ldap.util.UTFUtils;
 import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -123,11 +123,11 @@ public final class AVASerializer
             throw new IOException( message );
         }
         
-        UTFUtils.writeUTF( out, atav.getUpName() );
+        Unicode.writeUTF(out, atav.getUpName());
         out.writeInt( atav.getStart() );
         out.writeInt( atav.getLength() );
-        UTFUtils.writeUTF( out, atav.getUpType() );
-        UTFUtils.writeUTF( out, atav.getNormType() );
+        Unicode.writeUTF(out, atav.getUpType());
+        Unicode.writeUTF(out, atav.getNormType());
         
         boolean isHR = !atav.getNormValue().isBinary();
         
@@ -135,8 +135,8 @@ public final class AVASerializer
         
         if ( isHR )
         {
-            UTFUtils.writeUTF( out, atav.getUpValue().getString() );
-            UTFUtils.writeUTF( out, atav.getNormValue().getString() );
+            Unicode.writeUTF(out, atav.getUpValue().getString());
+            Unicode.writeUTF(out, atav.getNormValue().getString());
         }
         else
         {
@@ -161,11 +161,11 @@ public final class AVASerializer
      */
     public static AVA deserialize( ObjectInput in ) throws IOException
     {
-        String upName = UTFUtils.readUTF( in );
+        String upName = Unicode.readUTF(in);
         in.readInt(); // start
         in.readInt(); // length
-        String upType = UTFUtils.readUTF( in );
-        String normType = UTFUtils.readUTF( in );
+        String upType = Unicode.readUTF(in);
+        String normType = Unicode.readUTF(in);
         
         boolean isHR = in.readBoolean();
 
@@ -173,8 +173,8 @@ public final class AVASerializer
         {
             if ( isHR )
             {
-                Value<String> upValue = new StringValue( UTFUtils.readUTF( in ) );
-                Value<String> normValue = new StringValue( UTFUtils.readUTF( in ) );
+                Value<String> upValue = new StringValue( Unicode.readUTF(in) );
+                Value<String> normValue = new StringValue( Unicode.readUTF(in) );
                 
                 AVA atav = 
                     new AVA( upType, normType, upValue, normValue, upName );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnSerializer.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnSerializer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnSerializer.java Sat Jan 22 22:37:04 2011
@@ -26,8 +26,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.util.UTFUtils;
 import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -77,18 +77,18 @@ public final class DnSerializer
         }
         
         // Write the UPName
-        UTFUtils.writeUTF( out, dn.getName() );
+        Unicode.writeUTF(out, dn.getName());
         
         // Write the NormName if different
         if ( dn.isNormalized() )
         {
             if ( dn.getName().equals( dn.getNormName() ) )
             {
-                UTFUtils.writeUTF( out, "" );
+                Unicode.writeUTF(out, "");
             }
             else
             {
-                UTFUtils.writeUTF( out, dn.getNormName() );
+                Unicode.writeUTF(out, dn.getNormName());
             }
         }
         else
@@ -126,10 +126,10 @@ public final class DnSerializer
     public static DN deserialize( ObjectInput in ) throws IOException
     {
         // Read the UPName
-        String upName = UTFUtils.readUTF( in );
+        String upName = Unicode.readUTF(in);
         
         // Read the NormName
-        String normName = UTFUtils.readUTF( in );
+        String normName = Unicode.readUTF(in);
         
         if ( normName.length() == 0 )
         {

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnUtils.java (from r1062251, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DNUtils.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnUtils.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnUtils.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DNUtils.java&r1=1062251&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DNUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnUtils.java Sat Jan 22 22:37:04 2011
@@ -17,20 +17,25 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.ldap.name;
 
 
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 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.Unicode;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Utility class used by the DN Parser.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class DNUtils
+public final class DnUtils
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
@@ -252,12 +257,13 @@ public final class DNUtils
 
     /** "OID." static */
     public static final String OID_UPPER = "OID.";
+    public static final String[] EMPTY_STRING_ARRAY = new String[0];
 
 
     /**
      * Private constructor.
      */
-    private DNUtils()
+    private DnUtils()
     {
     }
 
@@ -732,4 +738,122 @@ public final class DNUtils
             return index;
         }
     }
+
+    /**
+     * Gets the attribute of a single attribute rdn or name component.
+     *
+     * @param rdn the name component
+     * @return the attribute name TODO the name rdn is misused rename refactor
+     *         this method
+     */
+    public static String getRdnAttribute( String rdn )
+    {
+        int index = rdn.indexOf( '=' );
+        return rdn.substring( 0, index );
+    }
+
+    /**
+     * Gets the value of a single name component of a distinguished name.
+     *
+     * @param rdn the name component to get the value from
+     * @return the value of the single name component TODO the name rdn is
+     *         misused rename refactor this method
+     */
+    public static String getRdnValue( String rdn )
+    {
+        int index = rdn.indexOf( '=' );
+        return rdn.substring( index + 1, rdn.length() );
+    }
+
+    /**
+     * Gets the relative name between an ancestor and a potential descendant.
+     * Both name arguments must be normalized. The returned name is also
+     * normalized.
+     *
+     * @param ancestor the normalized distinguished name of the ancestor context
+     * @param descendant the normalized distinguished name of the descendant context
+     * @return the relative normalized name between the ancestor and the
+     *         descendant contexts
+     * @throws org.apache.directory.shared.ldap.exception.LdapInvalidDnException if the contexts are not related in the ancestual sense
+     */
+    public static DN getRelativeName( DN ancestor, DN descendant ) throws LdapInvalidDnException
+    {
+        DN rdn = descendant;
+
+        if ( rdn.isChildOf( ancestor ) )
+        {
+            for ( int ii = 0; ii < ancestor.size(); ii++ )
+            {
+                rdn = rdn.remove( 0 );
+            }
+        }
+        else
+        {
+            LdapInvalidDnException e = new LdapInvalidDnException( I18n.err(I18n.ERR_04417, descendant, ancestor) );
+
+            throw e;
+        }
+
+        return rdn;
+    }
+
+    /**
+     * Gets the '+' appended components of a composite name component.
+     *
+     * @param compositeNameComponent a single name component not a whole name
+     * @return the components of the complex name component in order
+     * @throws org.apache.directory.shared.ldap.exception.LdapInvalidDnException
+     *             if nameComponent is invalid (starts with a +)
+     */
+    public static String[] getCompositeComponents( String compositeNameComponent ) throws LdapInvalidDnException
+    {
+        int lastIndex = compositeNameComponent.length() - 1;
+        List<String> comps = new ArrayList<String>();
+
+        for ( int ii = compositeNameComponent.length() - 1; ii >= 0; ii-- )
+        {
+            if ( compositeNameComponent.charAt( ii ) == '+' )
+            {
+                if ( ii == 0 )
+                {
+                    throw new LdapInvalidDnException( I18n.err( I18n.ERR_04418, compositeNameComponent ) );
+                }
+
+                if ( compositeNameComponent.charAt( ii - 1 ) != '\\' )
+                {
+                    if ( lastIndex == compositeNameComponent.length() - 1 )
+                    {
+                        comps.add( 0, compositeNameComponent.substring( ii + 1, lastIndex + 1 ) );
+                    }
+                    else
+                    {
+                        comps.add( 0, compositeNameComponent.substring( ii + 1, lastIndex ) );
+                    }
+
+                    lastIndex = ii;
+                }
+            }
+
+            if ( ii == 0 )
+            {
+                if ( lastIndex == compositeNameComponent.length() - 1 )
+                {
+                    comps.add( 0, compositeNameComponent );
+                }
+                else
+                {
+                    comps.add( 0, compositeNameComponent.substring( ii, lastIndex ) );
+                }
+
+                lastIndex = 0;
+            }
+        }
+
+        if ( comps.size() == 0 )
+        {
+            comps.add( compositeNameComponent );
+        }
+
+        return comps.toArray( EMPTY_STRING_ARRAY );
+    }
 }

Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=1062285&r1=1062284&r2=1062285&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 Sat Jan 22 22:37:04 2011
@@ -40,7 +40,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.util.UTFUtils;
 import org.apache.directory.shared.util.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -1541,15 +1540,15 @@ public class RDN implements Cloneable, C
     public void writeExternal( ObjectOutput out ) throws IOException
     {
         out.writeInt( nbAtavs );
-        UTFUtils.writeUTF( out, upName );
+        Unicode.writeUTF(out, upName);
 
         if ( upName.equals( normName ) )
         {
-            UTFUtils.writeUTF( out, "" );
+            Unicode.writeUTF(out, "");
         }
         else
         {
-            UTFUtils.writeUTF( out, normName );
+            Unicode.writeUTF(out, normName);
         }
 
         out.writeInt( start );
@@ -1591,10 +1590,10 @@ public class RDN implements Cloneable, C
         nbAtavs = in.readInt();
 
         // Read the UPName
-        upName = UTFUtils.readUTF( in );
+        upName = Unicode.readUTF(in);
 
         // Read the normName
-        normName = UTFUtils.readUTF( in );
+        normName = Unicode.readUTF(in);
 
         if ( Strings.isEmpty(normName) )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java Sat Jan 22 22:37:04 2011
@@ -23,8 +23,8 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.directory.shared.ldap.util.UTFUtils;
 import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,8 +72,8 @@ public final class RdnSerializer
     public static void serialize( RDN rdn, ObjectOutput out ) throws IOException
     {
         out.writeInt( rdn.getNbAtavs() );
-        UTFUtils.writeUTF( out, rdn.getName() );
-        UTFUtils.writeUTF( out, rdn.getNormName() );
+        Unicode.writeUTF(out, rdn.getName());
+        Unicode.writeUTF(out, rdn.getNormName());
         out.writeInt( rdn.getStart() );
         out.writeInt( rdn.getLength() );
         
@@ -114,10 +114,10 @@ public final class RdnSerializer
         int nbAtavs = in.readInt();
         
         // Read the UPName
-        String upName = UTFUtils.readUTF( in );
+        String upName = Unicode.readUTF(in);
         
         // Read the normName
-        String normName = UTFUtils.readUTF( in );
+        String normName = Unicode.readUTF(in);
         
         if ( Strings.isEmpty(normName) )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java Sat Jan 22 22:37:04 2011
@@ -24,7 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.util.exception.NotImplementedException;
 
 
 /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java Sat Jan 22 22:37:04 2011
@@ -19,12 +19,15 @@
  */
 package org.apache.directory.shared.ldap.schema.syntaxCheckers;
 
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.util.Chars;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
+
+import org.apache.directory.shared.util.Strings;
+
 
 /**
  * An UUID syntax checker.
@@ -41,12 +44,6 @@ public class UuidSyntaxChecker extends S
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    // Tells if the byte is alphanumeric
-    private static boolean isHex( byte b )
-    {
-        return Chars.isHex(b);
-    }
-
     
     /**
      * Creates a new instance of UUIDSyntaxChecker.
@@ -74,32 +71,6 @@ public class UuidSyntaxChecker extends S
             return false;
         }
 
-        byte[] b = ((String)value).getBytes();
-        
-        if ( b.length < 36)
-        {
-            return false;
-        }
-        
-        if ( isHex( b[0] ) && isHex( b[1] ) && isHex( b[2] ) && isHex( b[3] )
-            && isHex( b[4] ) && isHex( b[5] ) && isHex( b[6] ) && isHex( b[7] )
-            && b[8] == '-'
-            && isHex( b[9] ) && isHex( b[10] ) && isHex( b[11] ) && isHex( b[12] )
-            && b[13] == '-'
-            && isHex( b[14] ) && isHex( b[15] ) && isHex( b[16] ) && isHex( b[17] )
-            && b[18] == '-'
-            && isHex( b[19] ) && isHex( b[20] ) && isHex( b[21] ) && isHex( b[22] )
-            && b[23] == '-'
-            && isHex( b[24] ) && isHex( b[25] ) && isHex( b[26] ) && isHex( b[27] )
-            && isHex( b[28] ) && isHex( b[29] ) && isHex( b[30] ) && isHex( b[31] )
-            && isHex( b[32] ) && isHex( b[33] ) && isHex( b[34] ) && isHex( b[35] ) )
-        {
-            // There is not that much more we can check.
-            LOG.debug( "Syntax valid for '{}'", value );
-            return true;
-        }
-
-        LOG.debug( "Syntax invalid for '{}'", value );
-        return false;
+        return Strings.isValidUuid((String) value);
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java Sat Jan 22 22:37:04 2011
@@ -30,7 +30,7 @@ import javax.naming.directory.DirContext
 import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.entry.AttributeUtils;
 
 /**
  * A utility class for working with Triggers Execution Administrative Points
@@ -59,7 +59,7 @@ public final class TriggerUtils
         Attributes ap = apCtx.getAttributes( "", new String[] { SchemaConstants.ADMINISTRATIVE_ROLE_AT } );
         Attribute administrativeRole = ap.get( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
         if ( administrativeRole == null
-            || !AttributeUtils.containsValueCaseIgnore( administrativeRole, TRIGGER_EXECUTION_SPECIFIC_AREA_VALUE ) )
+            || !AttributeUtils.containsValueCaseIgnore(administrativeRole, TRIGGER_EXECUTION_SPECIFIC_AREA_VALUE) )
         {
             Attributes changes = new BasicAttributes( SchemaConstants.ADMINISTRATIVE_ROLE_AT, TRIGGER_EXECUTION_SPECIFIC_AREA_VALUE, true );
             apCtx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/AttributeUtilsTest.java (from r1062128, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/AttributeUtilsTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/AttributeUtilsTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/AttributeUtilsTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/AttributeUtilsTest.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/AttributeUtilsTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/AttributeUtilsTest.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.ldap.entry;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -30,14 +30,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.entry.DefaultEntry;
-import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
-import org.apache.directory.shared.ldap.entry.DefaultModification;
-import org.apache.directory.shared.ldap.entry.Entry;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.*;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.junit.Before;
 import org.junit.Test;
@@ -448,7 +441,7 @@ public class AttributeUtilsTest
     public void testEqualsTransitive() throws Exception
     {
         assertTrue( AttributeUtils.equals( byteArrayA, byteArrayACopy ) );
-        assertTrue( AttributeUtils.equals( byteArrayACopy, byteArrayB ) );
+        assertTrue( AttributeUtils.equals(byteArrayACopy, byteArrayB) );
         assertTrue( AttributeUtils.equals( byteArrayA, byteArrayB ) );
     }
 

Propchange: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/AttributeUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/LdapUrlTest.java (from r1062128, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/LdapUrlTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/LdapUrlTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/LdapUrlTest.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.ldap.filter;
 
 
 import static org.junit.Assert.assertEquals;
@@ -32,11 +32,12 @@ import java.util.List;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.exception.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.filter.LdapURL;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.name.DN;
-import org.apache.directory.shared.ldap.util.LdapURL.Extension;
+import org.apache.directory.shared.ldap.filter.LdapURL.Extension;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 

Propchange: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/LdapUrlTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/SubstringNodeTest.java (from r1062128, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/UndefinedNodeTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/SubstringNodeTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/SubstringNodeTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/UndefinedNodeTest.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/UndefinedNodeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/SubstringNodeTest.java Sat Jan 22 22:37:04 2011
@@ -17,85 +17,125 @@
  *   under the License.
  *
  */
-
 package org.apache.directory.shared.ldap.filter;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-
-import java.util.List;
-
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.List;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.*;
+
 
 /**
- * Unit tests class UndefinedNode.
+ * Unit tests class SubstringNode.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith(ConcurrentJunitRunner.class)
+@RunWith( ConcurrentJunitRunner.class )
 @Concurrent()
-public class UndefinedNodeTest
+public class SubstringNodeTest
 {
+    @Test
+    public void testGetRegexpEmpty() throws Exception
+    {
+        Pattern pattern = SubstringNode.getRegex("", new String[]
+                {""}, "");
+
+        boolean b1 = pattern.matcher( "" ).matches();
 
-    ExprNode undefinedNode = UndefinedNode.UNDEFINED_NODE;
+        assertTrue( b1 );
+    }
 
 
     @Test
-    public void testIsLeaf() throws Exception
+    public void testGetRegexpInitial() throws Exception
     {
-        assertFalse( undefinedNode.isLeaf() );
+        Pattern pattern = SubstringNode.getRegex("Test", new String[]
+                {""}, "");
+
+        boolean b1 = pattern.matcher( "Test just a test" ).matches();
+
+        assertTrue( b1 );
+
+        boolean b3 = pattern.matcher( "test just a test" ).matches();
+
+        assertFalse( b3 );
     }
 
 
     @Test
-    public void testIsSchemaAware() throws Exception
+    public void testGetRegexpFinal() throws Exception
     {
-        assertFalse( undefinedNode.isSchemaAware() );
+        Pattern pattern = SubstringNode.getRegex("", new String[]
+                {""}, "Test");
+
+        boolean b1 = pattern.matcher( "test just a Test" ).matches();
+
+        assertTrue( b1 );
+
+        boolean b3 = pattern.matcher( "test just a test" ).matches();
+
+        assertFalse( b3 );
     }
 
 
     @Test
-    public void testAssertationType() throws Exception
+    public void testGetRegexpAny() throws Exception
     {
-        assertEquals( undefinedNode.getAssertionType(), AssertionType.UNDEFINED );
+        Pattern pattern = SubstringNode.getRegex("", new String[]
+                {"just", "a"}, "");
+
+        boolean b1 = pattern.matcher( "test just a Test" ).matches();
+
+        assertTrue( b1 );
+
+        boolean b3 = pattern.matcher( "test just A test" ).matches();
+
+        assertFalse( b3 );
     }
 
 
     @Test
-    public void testAccept() throws Exception
+    public void testGetRegexpFull() throws Exception
     {
-        assertNull( undefinedNode.accept( new FilterVisitor()
-        {
+        Pattern pattern = SubstringNode.getRegex("Test", new String[]
+                {"just", "a"}, "test");
 
-            public Object visit( ExprNode node )
-            {
-                return null;
-            }
+        boolean b1 = pattern.matcher( "Test (this is) just (truly !) a (little) test" ).matches();
 
+        assertTrue( b1 );
 
-            public boolean isPrefix()
-            {
-                return false;
-            }
+        boolean b3 = pattern.matcher( "Test (this is) just (truly !) A (little) test" ).matches();
 
+        assertFalse( b3 );
+    }
 
-            public List<ExprNode> getOrder( BranchNode node, List<ExprNode> children )
-            {
-                return null;
-            }
 
+    /**
+     * Tests StringTools.getRegex() with some LDAP filter special characters.
+     */
+    @Test
+    public void testGetRegexpWithLdapFilterSpecialChars() throws Exception
+    {
+        Pattern[] patterns = new Pattern[]
+            { SubstringNode.getRegex(null, new String[]
+                    {"("}, null), SubstringNode.getRegex(null, new String[]
+                    {")"}, null), SubstringNode.getRegex(null, new String[]
+                    {"*"}, null), SubstringNode.getRegex(null, new String[]
+                    {"\\"}, null), };
 
-            public boolean canVisit( ExprNode node )
-            {
-                return false;
-            }
-        } ) );
-    }
+        for ( Pattern pattern : patterns )
+        {
+            boolean b1 = pattern.matcher( "a(b*c\\d)e" ).matches();
+            assertTrue( b1 );
 
+            boolean b3 = pattern.matcher( "Test test" ).matches();
+            assertFalse( b3 );
+        }
+    }
 }

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnUtilsTest.java (from r1062251, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnUtilsTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnUtilsTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java&r1=1062251&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnUtilsTest.java Sat Jan 22 22:37:04 2011
@@ -17,13 +17,15 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.ldap.name;
 
 
 import static org.junit.Assert.assertEquals;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -31,19 +33,19 @@ import org.junit.runner.RunWith;
 
 
 /**
- * Test the class DNUtils
+ * Test the class DnUtils
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrent()
-public class DNUtilsTest
+public class DnUtilsTest
 {
     // ~ Methods
     // ------------------------------------------------------------------------------------
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsFull()
@@ -54,7 +56,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsDiff()
@@ -65,7 +67,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsEmpty()
@@ -76,7 +78,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsFirstCharDiff()
@@ -87,7 +89,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsMiddleCharDiff()
@@ -98,7 +100,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsLastCharDiff()
@@ -109,7 +111,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsCharByChar()
@@ -125,7 +127,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsTooShort()
@@ -136,7 +138,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsTooShortMiddle()
@@ -147,7 +149,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsLastChar()
@@ -158,7 +160,7 @@ public class DNUtilsTest
 
 
     /**
-     * Test the DNUtils AreEquals method
+     * Test the DnUtils AreEquals method
      */
     @Test
     public void testAreEqualsMiddle()
@@ -166,4 +168,44 @@ public class DNUtilsTest
         // In the middle
         assertEquals( 4, Strings.areEquals("azerty".getBytes(), 2, "er") );
     }
+
+
+    @Test
+    public void testGetCompositeComponents() throws LdapException
+    {
+        String[] args = DnUtils.getCompositeComponents("givenName=Alex+sn=Karasulu");
+        assertEquals( "expecting two parts : ", 2, args.length );
+        assertEquals( "givenName=Alex", args[0] );
+        assertEquals( "sn=Karasulu", args[1] );
+
+        args = DnUtils.getCompositeComponents("givenName=Alex+sn=Karasulu+age=13");
+        assertEquals( "expecting two parts : ", 3, args.length );
+        assertEquals( "givenName=Alex", args[0] );
+        assertEquals( "sn=Karasulu", args[1] );
+        assertEquals( "age=13", args[2] );
+
+        args = DnUtils.getCompositeComponents("cn=One\\+Two");
+        assertEquals( "expecting one part : ", 1, args.length );
+        assertEquals( "cn=One\\+Two", args[0] );
+
+        args = DnUtils.getCompositeComponents("cn=Alex");
+        assertEquals( "expecting one part : ", 1, args.length );
+        assertEquals( "cn=Alex", args[0] );
+    }
+
+
+    @Test
+    public void testGetRelativeName() throws LdapInvalidDnException
+    {
+        // test the basis case first with the root
+        DN ancestor = new DN( "" );
+        DN descendant = new DN( "ou=system" );
+        DN relativeName = DnUtils.getRelativeName(ancestor, descendant);
+        assertEquals( relativeName.toString(), "ou=system" );
+
+        ancestor = new DN( "ou=system" );
+        descendant = new DN( "ou=users,ou=system" );
+        relativeName = DnUtils.getRelativeName(ancestor, descendant);
+        assertEquals( relativeName.toString(), "ou=users" );
+    }
 }

Propchange: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/UuidSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/UuidSyntaxCheckerTest.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/UuidSyntaxCheckerTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/UuidSyntaxCheckerTest.java Sat Jan 22 22:37:04 2011
@@ -25,8 +25,8 @@ import static org.junit.Assert.assertTru
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.UuidSyntaxChecker;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.directory.shared.util.StringConstants;
+import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -73,7 +73,7 @@ public class UuidSyntaxCheckerTest
             array[ i ] = (byte)i;
         }
 
-        assertTrue( checker.isValidSyntax( StringTools.uuidToString( array ) ) );
+        assertTrue( checker.isValidSyntax( Strings.uuidToString(array) ) );
     }
 
 

Modified: directory/shared/trunk/util/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/pom.xml?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/util/pom.xml (original)
+++ directory/shared/trunk/util/pom.xml Sat Jan 22 22:37:04 2011
@@ -59,6 +59,7 @@
               javax.naming,
               javax.net,
               javax.net.ssl,
+              org.slf4j,
               org.apache.directory.shared.i18n
             </Import-Package>
             <Export-Package>

Added: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/KeyValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/KeyValue.java?rev=1062285&view=auto
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/KeyValue.java (added)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/KeyValue.java Sat Jan 22 22:37:04 2011
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.directory.shared.util;
+
+/**
+ * Defines a simple key value pair.
+ * <p>
+ * A Map Entry has considerable additional semantics over and above a simple
+ * key-value pair. This interface defines the minimum key value, with just the
+ * two get methods.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Stephen Colebourne
+ */
+public interface KeyValue {
+
+    /**
+     * Gets the key from the pair.
+     *
+     * @return the key 
+     */
+    Object getKey();
+
+    /**
+     * Gets the value from the pair.
+     *
+     * @return the value
+     */
+    Object getValue();
+
+}

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MethodUtils.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MethodUtils.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MethodUtils.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MethodUtils.java Sat Jan 22 22:37:04 2011
@@ -17,8 +17,7 @@
  *  under the License. 
  *  
  */
-
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,16 +28,16 @@ import java.util.Arrays;
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class DirectoryClassUtils
+public final class MethodUtils
 {
     /** The logger. */
-    private static final Logger LOG = LoggerFactory.getLogger( DirectoryClassUtils.class );
+    private static final Logger LOG = LoggerFactory.getLogger( MethodUtils.class );
 
 
     /**
      * Private constructor.
      */
-    private DirectoryClassUtils()
+    private MethodUtils()
     {
     }
 

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MethodUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/NoDuplicateKeysMap.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NoDuplicateKeysMap.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/NoDuplicateKeysMap.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/NoDuplicateKeysMap.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NoDuplicateKeysMap.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NoDuplicateKeysMap.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/NoDuplicateKeysMap.java Sat Jan 22 22:37:04 2011
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.util.HashMap;

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/NoDuplicateKeysMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PreferencesDictionary.java (from r1062251, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PreferencesDictionary.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PreferencesDictionary.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java&r1=1062251&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PreferencesDictionary.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.util.Dictionary;
@@ -25,9 +25,7 @@ import java.util.Enumeration;
 import java.util.prefs.Preferences;
 import java.util.prefs.BackingStoreException;
 
-import org.apache.commons.lang.exception.NestableRuntimeException;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.util.ArrayEnumeration;
 
 
 /**
@@ -45,7 +43,7 @@ public class PreferencesDictionary exten
     // C O N S T R U C T O R
     // ------------------------------------------------------------------------
 
-    public PreferencesDictionary(Preferences prefs)
+    public PreferencesDictionary( Preferences prefs )
     {
         this.prefs = prefs;
     }
@@ -78,7 +76,7 @@ public class PreferencesDictionary exten
         }
         catch ( BackingStoreException e )
         {
-            throw new NestableRuntimeException( I18n.err( I18n.ERR_04423 ), e );
+            throw new RuntimeException( I18n.err( I18n.ERR_04423 ), e );
         }
     }
 
@@ -91,7 +89,7 @@ public class PreferencesDictionary exten
         }
         catch ( BackingStoreException e )
         {
-            throw new NestableRuntimeException( I18n.err( I18n.ERR_04423 ), e );
+            throw new RuntimeException( I18n.err( I18n.ERR_04423 ), e );
         }
     }
 
@@ -113,7 +111,7 @@ public class PreferencesDictionary exten
         }
         catch ( BackingStoreException e )
         {
-            throw new NestableRuntimeException( I18n.err( I18n.ERR_04423 ), e );
+            throw new RuntimeException( I18n.err( I18n.ERR_04423 ), e );
         }
     }
 
@@ -127,7 +125,7 @@ public class PreferencesDictionary exten
         }
         catch ( BackingStoreException e )
         {
-            throw new NestableRuntimeException( I18n.err( I18n.ERR_04423 ), e );
+            throw new RuntimeException( I18n.err( I18n.ERR_04423 ), e );
         }
     }
 

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PreferencesDictionary.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PropertiesUtils.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PropertiesUtils.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PropertiesUtils.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PropertiesUtils.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.io.File;
@@ -28,7 +28,7 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Properties;
 
-import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.util.exception.NotImplementedException;
 
 
 /**

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/PropertiesUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SequencedHashMap.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SequencedHashMap.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SequencedHashMap.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/SequencedHashMap.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SequencedHashMap.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.io.Externalizable;
@@ -37,7 +37,6 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
 
-import org.apache.commons.collections.KeyValue;
 import org.apache.directory.shared.i18n.I18n;
 
 

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SequencedHashMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java Sat Jan 22 22:37:04 2011
@@ -20,6 +20,9 @@
 package org.apache.directory.shared.util;
 
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
@@ -30,6 +33,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import static org.apache.directory.shared.util.Chars.isHex;
+import static org.apache.directory.shared.util.Hex.encodeHex;
+import static org.apache.directory.shared.util.Hex.getHexValue;
+
 /**
  * Various string manipulation methods that are more efficient then chaining
  * string operations: all is done in the same buffer without creating a bunch of
@@ -39,6 +46,9 @@ import java.util.Set;
  */
 public final class Strings
 {
+    /** A logger for this class */
+    private static final Logger LOG = LoggerFactory.getLogger( Strings.class );
+
     /** The default charset, because it's not provided by JDK 1.5 */
     static String defaultCharset = null;
     
@@ -67,6 +77,7 @@ public final class Strings
         true,  true,  true,  true,  true,  true,  true,  true,  // 'p', 'q', 'r', 's', 't', 'u', 'v', 'w'
         true,  true,  true,  false, false, false, false, false  // 'x', 'y', 'z', ---, ---, ---, ---, ---
         };
+
     public static final char[] TO_LOWER_CASE =
         {
             0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -102,6 +113,7 @@ public final class Strings
             0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
             0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
         };
+
     /** upperCase = 'A' .. 'Z', '0'..'9', '-' */
     public static final char[] UPPER_CASE =
         {
@@ -585,6 +597,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Test if the current character is equal to a specific character.
      * 
@@ -612,6 +625,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Return an UTF-8 encoded String
      *
@@ -636,6 +650,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Return an UTF-8 encoded String
      *
@@ -661,6 +676,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Return an UTF-8 encoded String
      *
@@ -687,6 +703,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Check if a text is present at the current position in a buffer.
      *
@@ -718,6 +735,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Check if a text is present at the current position in a buffer.
      *
@@ -741,6 +759,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Check if a text is present at the current position in a buffer.
      *
@@ -771,6 +790,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Check if a text is present at the current position in a buffer.
      *
@@ -802,6 +822,7 @@ public final class Strings
         }
     }
 
+
     /**
      * <p>
      * Checks if a String is empty ("") or null.
@@ -828,6 +849,7 @@ public final class Strings
         return str == null || str.length() == 0;
     }
 
+
     /**
      * Checks if a bytes array is empty or null.
      *
@@ -839,6 +861,7 @@ public final class Strings
         return bytes == null || bytes.length == 0;
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from both start and ends of this String,
@@ -862,6 +885,7 @@ public final class Strings
         return ( isEmpty( str ) ? "" : str.trim() );
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from both start and ends of this bytes
@@ -907,6 +931,7 @@ public final class Strings
         }
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from start of this String, handling
@@ -943,6 +968,7 @@ public final class Strings
         return ( start == 0 ? str : str.substring( start ) );
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from start of this array, handling
@@ -977,6 +1003,7 @@ public final class Strings
         return pos;
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from a position in this array, handling
@@ -1012,6 +1039,7 @@ public final class Strings
         pos.end = pos.start;
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from a position in this array, handling
@@ -1047,6 +1075,7 @@ public final class Strings
         pos.end = pos.start;
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from start of this array, handling
@@ -1081,6 +1110,7 @@ public final class Strings
         return pos;
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from end of this String, handling
@@ -1122,6 +1152,7 @@ public final class Strings
         return ( end == length ? str : str.substring( 0, end ) );
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from end of this String, handling
@@ -1164,6 +1195,7 @@ public final class Strings
         return ( end == length ? str : str.substring( 0, end ) );
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from end of this array, handling
@@ -1198,6 +1230,7 @@ public final class Strings
         return pos;
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from end of this string, handling
@@ -1237,6 +1270,7 @@ public final class Strings
         return ( pos.end == string.length() ? string : string.substring( 0, pos.end ) );
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from end of this string, handling
@@ -1283,6 +1317,7 @@ public final class Strings
         }
     }
 
+
     /**
      * <p>
      * Removes spaces (char &lt;= 32) from end of this array, handling
@@ -1317,6 +1352,7 @@ public final class Strings
         return pos;
     }
 
+
     /**
      * Get the character at a given position in a string, checking fo limits
      *
@@ -1343,6 +1379,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Thansform an array of ASCII bytes to a string. the byte array should contains
      * only values in [0, 127].
@@ -1367,6 +1404,7 @@ public final class Strings
         return new String( result );
     }
 
+
     /**
      * Return UTF-8 encoded byte[] representation of a String
      *
@@ -1391,6 +1429,7 @@ public final class Strings
         }
     }
 
+
     /**
      * Get the default charset
      *
@@ -1426,6 +1465,7 @@ public final class Strings
         return defaultCharset;
     }
 
+
     /**
      * <p>
      * Compares two Strings, returning <code>true</code> if they are equal.
@@ -1455,6 +1495,7 @@ public final class Strings
         return str1 == null ? str2 == null : str1.equals( str2 );
     }
 
+
     /**
      * Utility method that return a String representation of a list
      *
@@ -1488,6 +1529,7 @@ public final class Strings
         return sb.toString();
     }
 
+
     /**
      * Utility method that return a String representation of a set
      *
@@ -1521,6 +1563,7 @@ public final class Strings
         return sb.toString();
     }
 
+
     /**
      * Utility method that return a String representation of a list
      *
@@ -1547,6 +1590,7 @@ public final class Strings
         return sb.toString();
     }
 
+
     /**
      * Utility method that return a String representation of a map. The elements
      * will be represented as "key = value"
@@ -1582,6 +1626,7 @@ public final class Strings
         return sb.toString();
     }
 
+
     /**
      * Utility method that return a String representation of a map. The elements
      * will be represented as "key = value"
@@ -1610,6 +1655,7 @@ public final class Strings
         return sb.toString();
     }
 
+
     /**
      * Rewrote the toLowercase method to improve performances.
      * In Ldap, attributesType are supposed to use ASCII chars :
@@ -1635,6 +1681,7 @@ public final class Strings
         return new String( chars );
     }
 
+
     /**
      * Rewrote the toLowercase method to improve performances.
      * In Ldap, attributesType are supposed to use ASCII chars :
@@ -1660,6 +1707,7 @@ public final class Strings
         return new String( chars );
     }
 
+
     /**
      * <p>
      * Converts a String to upper case as per {@link String#toUpperCase()}.
@@ -1687,6 +1735,7 @@ public final class Strings
         return str.toUpperCase();
     }
 
+
     /**
      * <p>
      * Converts a String to lower case as per {@link String#toLowerCase()}.
@@ -1714,6 +1763,7 @@ public final class Strings
         return str.toLowerCase();
     }
 
+
     /**
      * Rewrote the toLowercase method to improve performances.
      * In Ldap, attributesType are supposed to use ASCII chars :
@@ -1741,6 +1791,7 @@ public final class Strings
         return new String( chars );
     }
 
+
     /**
      *
      * Check that a String is a valid PrintableString. A PrintableString contains only
@@ -1769,6 +1820,7 @@ public final class Strings
         return true;
     }
 
+
     /**
      * <p>
      * Checks if a String is not empty ("") and not null.
@@ -1790,6 +1842,7 @@ public final class Strings
         return str != null && str.length() > 0;
     }
 
+
     /**
      *
      * Check that a String is a valid IA5String. An IA5String contains only
@@ -1817,4 +1870,111 @@ public final class Strings
 
         return true;
     }
+
+
+    /**
+     * Checks to see if a String is a valid UUID.
+     *
+     * @param uuid the UUID to check for validity
+     * @return true if the UUID is valid, false otherwise
+     */
+    public static boolean isValidUuid( String uuid )
+    {
+        byte[] b = uuid.getBytes();
+
+        if ( b.length < 36)
+        {
+            return false;
+        }
+
+        if ( isHex( b[0] ) && isHex( b[1] ) && isHex( b[2] ) && isHex( b[3] )
+            && isHex( b[4] ) && isHex( b[5] ) && isHex( b[6] ) && isHex( b[7] )
+            && b[8] == '-'
+            && isHex( b[9] ) && isHex( b[10] ) && isHex( b[11] ) && isHex( b[12] )
+            && b[13] == '-'
+            && isHex( b[14] ) && isHex( b[15] ) && isHex( b[16] ) && isHex( b[17] )
+            && b[18] == '-'
+            && isHex( b[19] ) && isHex( b[20] ) && isHex( b[21] ) && isHex( b[22] )
+            && b[23] == '-'
+            && isHex( b[24] ) && isHex( b[25] ) && isHex( b[26] ) && isHex( b[27] )
+            && isHex( b[28] ) && isHex( b[29] ) && isHex( b[30] ) && isHex( b[31] )
+            && isHex( b[32] ) && isHex( b[33] ) && isHex( b[34] ) && isHex( b[35] ) )
+        {
+            // There is not that much more we can check.
+            LOG.debug( "Syntax valid for '{}'", uuid );
+            return true;
+        }
+
+        LOG.debug( "Syntax invalid for '{}'", uuid );
+        return false;
+    }
+
+
+    /**
+     * converts the bytes of a UUID to string
+     *
+     * @param bytes bytes of a UUID
+     * @return UUID in string format
+     */
+    public static String uuidToString( byte[] bytes )
+    {
+        if ( bytes == null || bytes.length != 16 )
+        {
+            return "Invalid UUID";
+        }
+
+        char[] hex = encodeHex(bytes);
+        StringBuffer sb = new StringBuffer();
+        sb.append( hex, 0, 8 );
+        sb.append( '-' );
+        sb.append( hex, 8, 4 );
+        sb.append( '-' );
+        sb.append( hex, 12, 4 );
+        sb.append( '-' );
+        sb.append( hex, 16, 4 );
+        sb.append( '-' );
+        sb.append( hex, 20, 12 );
+
+        return sb.toString().toLowerCase();
+    }
+
+
+    /**
+     * converts the string representation of an UUID to bytes
+     *
+     * @param string the string representation of an UUID
+     * @return the bytes, null if the the syntax is not valid
+     */
+    public static byte[] uuidToBytes( String string )
+    {
+        if ( ! isValidUuid(string) )
+        {
+            return null;
+        }
+
+        char[] chars = string.toCharArray();
+        byte[] bytes = new byte[16];
+        bytes[0] = getHexValue(chars[0], chars[1]);
+        bytes[1] = getHexValue(chars[2], chars[3]);
+        bytes[2] = getHexValue(chars[4], chars[5]);
+        bytes[3] = getHexValue(chars[6], chars[7]);
+
+        bytes[4] = getHexValue(chars[9], chars[10]);
+        bytes[5] = getHexValue(chars[11], chars[12]);
+
+        bytes[6] = getHexValue(chars[14], chars[15]);
+        bytes[7] = getHexValue(chars[16], chars[17]);
+
+        bytes[8] = getHexValue(chars[19], chars[20]);
+        bytes[9] = getHexValue(chars[21], chars[22]);
+
+        bytes[10] = getHexValue(chars[24], chars[25]);
+        bytes[11] = getHexValue(chars[26], chars[27]);
+        bytes[12] = getHexValue(chars[28], chars[29]);
+        bytes[13] = getHexValue(chars[30], chars[31]);
+        bytes[14] = getHexValue(chars[32], chars[33]);
+        bytes[15] = getHexValue(chars[34], chars[35]);
+
+        return bytes;
+    }
 }

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SynchronizedLRUMap.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/SynchronizedLRUMap.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SynchronizedLRUMap.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SynchronizedLRUMap.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/SynchronizedLRUMap.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/SynchronizedLRUMap.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SynchronizedLRUMap.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.io.Externalizable;

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/SynchronizedLRUMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Unicode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Unicode.java?rev=1062285&r1=1062284&r2=1062285&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Unicode.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Unicode.java Sat Jan 22 22:37:04 2011
@@ -20,6 +20,10 @@
 package org.apache.directory.shared.util;
 
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
 /**
  * Various unicode manipulation methods that are more efficient then chaining
  * operations: all is done in the same buffer without creating a bunch of string
@@ -400,4 +404,98 @@ public final class Unicode
     {
         return ( ( c > 127 ) || UnicodeConstants.UNICODE_SUBSET[c] );
     }
+
+    /**
+     *
+     * Writes four bytes of length information to the output stream, followed by the modified UTF-8 representation
+     * of every character in the string str. If str is null, the string value 'null' is written with a length of 0
+     * instead of throwing an NullPointerException. Each character in the string s  is converted to a group of one,
+     * two, or three bytes, depending on the value of the character.
+     *
+     * Due to given restrictions (total number of written bytes in a row can't exceed 65535) the total length is
+     * written in the length information (four bytes (writeInt)) and the string is split into smaller parts
+     * if necessary and written. As each character may be converted to a group of maximum 3 bytes and 65535 bytes
+     * can be written at maximum we're on the save side when writing a chunk of only 21845 (65535/3) characters at
+     * once.
+     *
+     * See also {@link java.io.DataOutput#writeUTF(String)}.
+     *
+     * @param objectOutput The objectOutput to write to
+     * @param str The value to write
+     * @throws java.io.IOException If the value can't be written to the file
+     */
+    public static void writeUTF( ObjectOutput objectOutput, String str ) throws IOException
+    {
+        // Write a 'null' string
+        if ( str == null )
+        {
+            objectOutput.writeInt( 0 );
+            objectOutput.writeUTF( "null" );
+        }
+        else
+        {
+            // Write length of string
+            objectOutput.writeInt( str.length() );
+
+            StringBuffer strBuf = new StringBuffer( str );
+
+            // Write the string in portions not larger than 21845 characters
+            while ( strBuf != null )
+            {
+                if ( strBuf.length() < 21845 )
+                {
+                    objectOutput.writeUTF( strBuf.substring( 0, strBuf.length() ) );
+                    strBuf = null;
+                }
+                else
+                {
+                    objectOutput.writeUTF( strBuf.substring( 0, 21845 ) );
+                    strBuf.delete( 0, 21845 );
+                }
+            }
+        }
+    }
+
+    /**
+     *
+     * Reads in a string that has been encoded using a modified UTF-8  format. The general contract of readUTF  is
+     * that it reads a representation of a Unicode character string encoded in modified UTF-8 format; this string of
+     * characters is then returned as a String.
+     *
+     * First, four bytes are read (readInt) and used to construct an unsigned 16-bit integer in exactly the manner
+     * of the readUnsignedShort  method . This integer value is called the UTF length and specifies the number of
+     * additional bytes to be read. These bytes are then converted to characters by considering them in groups. The
+     * length of each group is computed from the value of the first byte of the group. The byte following a group, if
+     * any, is the first byte of the next group.
+     *
+     *See also {@link java.io.DataInput#readUTF()}.
+     *
+     * @param objectInput The objectInput to read from
+     * @return The read string
+     * @throws java.io.IOException If the value can't be read
+     */
+    public static String readUTF( ObjectInput objectInput ) throws IOException
+    {
+        StringBuffer strBuf = null;
+
+        // Read length of the string
+        int strLength = objectInput.readInt();
+
+        // Start reading the string
+        strBuf = new StringBuffer( objectInput.readUTF() );
+
+        if ( strLength == 0 && strBuf.toString().equals( "null" ) )
+        {
+            // The special case of a 'null' string
+            return null;
+        }
+        else
+        {
+            while ( strLength > strBuf.length() )
+            {
+                strBuf.append( objectInput.readUTF() );
+            }
+            return strBuf.toString();
+        }
+    }
 }

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/Exceptions.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapExceptionUtils.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/Exceptions.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/Exceptions.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapExceptionUtils.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapExceptionUtils.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/Exceptions.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util.exception;
 
 
 import java.util.List;
@@ -31,12 +31,12 @@ import java.util.List;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class LdapExceptionUtils
+public final class Exceptions
 {
     /**
      * Private constructor
      */
-    private LdapExceptionUtils()
+    private Exceptions()
     {
     }
 

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/Exceptions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/MultiException.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/MultiException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/MultiException.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/MultiException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/MultiException.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/MultiException.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/MultiException.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap;
+package org.apache.directory.shared.util.exception;
 
 
 import java.io.PrintStream;

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/MultiException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/NotImplementedException.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/NotImplementedException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/NotImplementedException.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/NotImplementedException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/NotImplementedException.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/NotImplementedException.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/NotImplementedException.java Sat Jan 22 22:37:04 2011
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.shared.ldap;
+package org.apache.directory.shared.util.exception;
 
 
 /**

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/NotImplementedException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/RuntimeMultiException.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/RuntimeMultiException.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/RuntimeMultiException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/RuntimeMultiException.java Sat Jan 22 22:37:04 2011
@@ -17,8 +17,7 @@
  *  under the License. 
  *  
  */
-
-package org.apache.directory.shared.ldap;
+package org.apache.directory.shared.util.exception;
 
 
 import java.io.PrintStream;
@@ -54,13 +53,24 @@ public class RuntimeMultiException exten
 
     /**
      * Constructs an Exception with a detailed message.
-     * 
-     * @param message
-     *            The message associated with the exception.
+     *
+     * @param message The message associated with the exception.
+     */
+    public RuntimeMultiException( String message )
+    {
+        super( message );
+    }
+
+
+    /**
+     * Constructs an Exception with a detailed message.
+     *
+     * @param message The message associated with the exception.
      */
-    public RuntimeMultiException(String message)
+    public RuntimeMultiException( String message, Throwable t )
     {
         super( message );
+        nestedExceptions.add( t );
     }
 
 

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/exception/RuntimeMultiException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/GeneralizedTimeTest.java (from r1062251, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/GeneralizedTimeTest.java?p2=directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/GeneralizedTimeTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java&r1=1062251&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java (original)
+++ directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/GeneralizedTimeTest.java Sat Jan 22 22:37:04 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import static org.junit.Assert.assertEquals;
@@ -31,7 +31,6 @@ import java.util.TimeZone;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.schema.syntax.GeneralizedTimeSyntaxCheckerTest;
 import org.apache.directory.shared.util.GeneralizedTime.Format;
 import org.apache.directory.shared.util.GeneralizedTime.TimeZoneFormat;
 import org.apache.directory.shared.util.GeneralizedTime;
@@ -525,7 +524,7 @@ public class GeneralizedTimeTest
 
 
     /**
-     * Testcases from {@link GeneralizedTimeSyntaxCheckerTest#testCorrectCase()}.
+     * Testcases from GeneralizedTimeSyntaxCheckerTest#testCorrectCase().
      */
     @Test
     public void testGeneralizedTimeSyntaxCheckerTestCorrectCase() throws ParseException
@@ -540,7 +539,7 @@ public class GeneralizedTimeTest
 
 
     /**
-     * Testcases from {@link GeneralizedTimeSyntaxCheckerTest#testErrorCase()}.
+     * Testcases from GeneralizedTimeSyntaxCheckerTest#testErrorCase().
      */
     @Test
     public void testGeneralizedTimeSyntaxCheckerTestErrorCase()

Propchange: directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/GeneralizedTimeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/HexTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/HexTest.java?rev=1062285&view=auto
==============================================================================
--- directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/HexTest.java (added)
+++ directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/HexTest.java Sat Jan 22 22:37:04 2011
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.util;
+
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.naming.NamingException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+/**
+ * Tests the StringTools class methods.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class HexTest
+{
+    @Test
+    public void testDecodeHexString() throws Exception
+    {
+        // weird stuff - corner cases
+        try
+        {
+            assertEquals( "", Hex.decodeHexString( "" ) );
+            fail( "should not get here" );
+        }
+        catch ( NamingException e )
+        {
+        }
+
+        assertEquals( "", Hex.decodeHexString( "#" ) );
+        assertEquals( "F", Hex.decodeHexString( "#46" ) );
+
+        try
+        {
+            assertEquals( "F", Hex.decodeHexString( "46" ) );
+            fail( "should not get here" );
+        }
+        catch ( NamingException e )
+        {
+        }
+
+        assertEquals( "Ferry", Hex.decodeHexString( "#4665727279" ) );
+    }
+}

Copied: directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/MethodUtilsTest.java (from r1062128, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/MethodUtilsTest.java?p2=directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/MethodUtilsTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java&r1=1062128&r2=1062285&rev=1062285&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java (original)
+++ directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/MethodUtilsTest.java Sat Jan 22 22:37:04 2011
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -30,18 +30,19 @@ import java.util.Collection;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.util.MethodUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 
 /**
- * Test case for {@link DirectoryClassUtils}.
+ * Test case for {@link MethodUtils}.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrent()
-public class DirectoryClassUtilsTest
+public class MethodUtilsTest
 {
     private static class TestClass
     {
@@ -79,7 +80,7 @@ public class DirectoryClassUtilsTest
         
         try
         {
-            m2 = DirectoryClassUtils.getAssignmentCompatibleMethod( TestClass.class, "methodA", new Class[] { String.class } );
+            m2 = MethodUtils.getAssignmentCompatibleMethod(TestClass.class, "methodA", new Class[]{String.class});
         }
         catch ( NoSuchMethodException e )
         {
@@ -113,7 +114,7 @@ public class DirectoryClassUtilsTest
         
         try
         {
-            m2 = DirectoryClassUtils.getAssignmentCompatibleMethod( TestClass.class, "methodB", new Class[] { ArrayList.class } );
+            m2 = MethodUtils.getAssignmentCompatibleMethod(TestClass.class, "methodB", new Class[]{ArrayList.class});
         }
         catch ( NoSuchMethodException e )
         {

Propchange: directory/shared/trunk/util/src/test/java/org/apache/directory/shared/util/MethodUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message