directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1062251 [11/13] - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-api/src/main/java/org/apache/directo...
Date Sat, 22 Jan 2011 20:08:59 GMT
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java Sat Jan 22 20:08:48 2011
@@ -50,7 +50,7 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -1579,9 +1579,9 @@ public class DNTest
     @Test
     public void testStringParser() throws Exception
     {
-        String dn = StringTools.utf8ToString( new byte[]
-            { 'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', ( byte ) 0xc3,
-                ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y' } );
+        String dn = Strings.utf8ToString(new byte[]
+                {'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', (byte) 0xc3,
+                        (byte) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y'});
 
         DN name = DnParser.getNameParser().parse( dn );
 
@@ -3320,7 +3320,7 @@ public class DNTest
         AVA atav3 = dn3.getRdn().getAVA();
         assertEquals( "cn", atav3.getUpType() );
         assertEquals( "ABC", atav3.getUpValue().getString() );
-        assertTrue( Arrays.equals( StringTools.getBytesUtf8( "ABC" ), atav3.getNormValue().getBytes() ) );
+        assertTrue( Arrays.equals( Strings.getBytesUtf8("ABC"), atav3.getNormValue().getBytes() ) );
 
         // antlr parser:
         DN dn4 = new DN( " cn = \\41\\42\\43 , ou=system " );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java Sat Jan 22 20:08:48 2011
@@ -24,7 +24,7 @@ import org.apache.directory.junit.tools.
 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.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -285,16 +285,16 @@ public class DnParserTest
         byte[] bytes = DN.getBytes( dn );
 
         assertEquals( 30, bytes.length );
-        assertEquals( "cn=John,ou=People,ou=Marketing", StringTools.utf8ToString( bytes ) );
+        assertEquals( "cn=John,ou=People,ou=Marketing", Strings.utf8ToString(bytes) );
     }
 
 
     @Test
     public void testStringParser() throws LdapException
     {
-        String dn = StringTools.utf8ToString( new byte[]
-            { 'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', ( byte ) 0xc3,
-                ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y' } );
+        String dn = Strings.utf8ToString(new byte[]
+                {'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', (byte) 0xc3,
+                        (byte) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y'});
 
         DnParser dnParser = DnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );
@@ -307,8 +307,8 @@ public class DnParserTest
     @Test
     public void testStringParserShort() throws LdapException
     {
-        String dn = StringTools.utf8ToString( new byte[]
-            { 'C', '=', ' ', 'E', ( byte ) 0xc3, ( byte ) 0xa9, 'c' } );
+        String dn = Strings.utf8ToString(new byte[]
+                {'C', '=', ' ', 'E', (byte) 0xc3, (byte) 0xa9, 'c'});
 
         DnParser dnParser = DnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java Sat Jan 22 20:08:48 2011
@@ -23,7 +23,7 @@ package org.apache.directory.shared.ldap
 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.util.StringTools;
+import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -412,16 +412,16 @@ public class FastDnParserTest
         byte[] bytes = DN.getBytes( dn );
 
         assertEquals( 30, bytes.length );
-        assertEquals( "cn=John,ou=People,ou=Marketing", StringTools.utf8ToString( bytes ) );
+        assertEquals( "cn=John,ou=People,ou=Marketing", Strings.utf8ToString(bytes) );
     }
 
 
     @Test
     public void testStringParser() throws LdapException
     {
-        String dn = StringTools.utf8ToString( new byte[]
-            { 'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', ( byte ) 0xc3,
-                ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y' } );
+        String dn = Strings.utf8ToString(new byte[]
+                {'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', (byte) 0xc3,
+                        (byte) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y'});
 
         FastDnParser dnParser = FastDnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );
@@ -434,8 +434,8 @@ public class FastDnParserTest
     @Test
     public void testStringParserShort() throws LdapException
     {
-        String dn = StringTools.utf8ToString( new byte[]
-            { 'C', '=', ' ', 'E', ( byte ) 0xc3, ( byte ) 0xa9, 'c' } );
+        String dn = Strings.utf8ToString(new byte[]
+                {'C', '=', ' ', 'E', (byte) 0xc3, (byte) 0xa9, 'c'});
 
         FastDnParser dnParser = FastDnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java Sat Jan 22 20:08:48 2011
@@ -36,7 +36,6 @@ import java.util.Iterator;
 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.util.StringTools;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -219,9 +218,9 @@ public class RdnTest
     @Test
     public void testRdnPairCharAttributeValue() throws LdapException
     {
-        String rdn = StringTools.utf8ToString( new byte[]
-            { 'a', '=', '\\', ',', '=', '\\', '+', '\\', '<', '\\', '>', '#', '\\', ';', '\\', '\\', '\\', '"', '\\',
-                'C', '3', '\\', 'A', '9' } );
+        String rdn = Strings.utf8ToString(new byte[]
+                {'a', '=', '\\', ',', '=', '\\', '+', '\\', '<', '\\', '>', '#', '\\', ';', '\\', '\\', '\\', '"', '\\',
+                        'C', '3', '\\', 'A', '9'});
         assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00E9", new RDN( rdn ).getNormName() );
     }
 
@@ -786,7 +785,7 @@ public class RdnTest
     @Test
     public void testEscapeValueString()
     {
-        String res = RDN.escapeValue( StringTools.getBytesUtf8( "azerty" ) );
+        String res = RDN.escapeValue( Strings.getBytesUtf8("azerty") );
 
         assertEquals( "azerty", res );
     }
@@ -795,7 +794,7 @@ public class RdnTest
     @Test
     public void testEscapeValueStringSpecial()
     {
-        String res = RDN.escapeValue( StringTools.getBytesUtf8( "\\#,+;<>=\" " ) );
+        String res = RDN.escapeValue( Strings.getBytesUtf8("\\#,+;<>=\" ") );
 
         assertEquals( "\\\\#\\,\\+\\;\\<\\>\\=\\\"\\ ", res );
     }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/OctetStringSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/OctetStringSyntaxCheckerTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/OctetStringSyntaxCheckerTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/OctetStringSyntaxCheckerTest.java Sat Jan 22 20:08:48 2011
@@ -25,7 +25,7 @@ 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.OctetStringSyntaxChecker;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.StringConstants;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -51,7 +51,7 @@ public class OctetStringSyntaxCheckerTes
     @Test
     public void testEmptyOctetString()
     {
-        assertTrue( checker.isValidSyntax( StringTools.EMPTY_BYTES ) );
+        assertTrue( checker.isValidSyntax( StringConstants.EMPTY_BYTES ) );
     }
 
 

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=1062251&r1=1062250&r2=1062251&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 20:08:48 2011
@@ -26,6 +26,7 @@ import org.apache.directory.junit.tools.
 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.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -51,7 +52,7 @@ public class UuidSyntaxCheckerTest
     @Test
     public void testEmptyUuid()
     {
-        assertFalse( checker.isValidSyntax( StringTools.EMPTY_BYTES ) );
+        assertFalse( checker.isValidSyntax( StringConstants.EMPTY_BYTES ) );
     }
 
 

Modified: 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/util/DNUtilsTest.java?rev=1062251&r1=1062250&r2=1062251&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/util/DNUtilsTest.java Sat Jan 22 20:08:48 2011
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEqu
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -48,7 +49,7 @@ public class DNUtilsTest
     public void testAreEqualsFull()
     {
         // Full compare
-        assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 0, "azerty" ) );
+        assertEquals( 6, Strings.areEquals("azerty".getBytes(), 0, "azerty") );
     }
 
 
@@ -59,7 +60,7 @@ public class DNUtilsTest
     public void testAreEqualsDiff()
     {
         // First character is !=
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "Azerty") );
     }
 
 
@@ -70,7 +71,7 @@ public class DNUtilsTest
     public void testAreEqualsEmpty()
     {
         // Compare to an empty string
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "") );
     }
 
 
@@ -81,7 +82,7 @@ public class DNUtilsTest
     public void testAreEqualsFirstCharDiff()
     {
         // First character is !=
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "Azerty") );
     }
 
 
@@ -92,7 +93,7 @@ public class DNUtilsTest
     public void testAreEqualsMiddleCharDiff()
     {
         // First character is !=
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azeRty" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "azeRty") );
     }
 
 
@@ -103,7 +104,7 @@ public class DNUtilsTest
     public void testAreEqualsLastCharDiff()
     {
         // First character is !=
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azertY" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "azertY") );
     }
 
 
@@ -114,12 +115,12 @@ public class DNUtilsTest
     public void testAreEqualsCharByChar()
     {
         // Index must be incremented after each comparison
-        assertEquals( 1, StringTools.areEquals( "azerty".getBytes(), 0, "a" ) );
-        assertEquals( 2, StringTools.areEquals( "azerty".getBytes(), 1, "z" ) );
-        assertEquals( 3, StringTools.areEquals( "azerty".getBytes(), 2, "e" ) );
-        assertEquals( 4, StringTools.areEquals( "azerty".getBytes(), 3, "r" ) );
-        assertEquals( 5, StringTools.areEquals( "azerty".getBytes(), 4, "t" ) );
-        assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 5, "y" ) );
+        assertEquals( 1, Strings.areEquals("azerty".getBytes(), 0, "a") );
+        assertEquals( 2, Strings.areEquals("azerty".getBytes(), 1, "z") );
+        assertEquals( 3, Strings.areEquals("azerty".getBytes(), 2, "e") );
+        assertEquals( 4, Strings.areEquals("azerty".getBytes(), 3, "r") );
+        assertEquals( 5, Strings.areEquals("azerty".getBytes(), 4, "t") );
+        assertEquals( 6, Strings.areEquals("azerty".getBytes(), 5, "y") );
     }
 
 
@@ -130,7 +131,7 @@ public class DNUtilsTest
     public void testAreEqualsTooShort()
     {
         // length too short
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azertyiop" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "azertyiop") );
     }
 
 
@@ -141,7 +142,7 @@ public class DNUtilsTest
     public void testAreEqualsTooShortMiddle()
     {
         // length too short
-        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "ertyiop" ) );
+        assertEquals( -1, Strings.areEquals("azerty".getBytes(), 0, "ertyiop") );
     }
 
 
@@ -152,7 +153,7 @@ public class DNUtilsTest
     public void testAreEqualsLastChar()
     {
         // last character
-        assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 5, "y" ) );
+        assertEquals( 6, Strings.areEquals("azerty".getBytes(), 5, "y") );
     }
 
 
@@ -163,6 +164,6 @@ public class DNUtilsTest
     public void testAreEqualsMiddle()
     {
         // In the middle
-        assertEquals( 4, StringTools.areEquals( "azerty".getBytes(), 2, "er" ) );
+        assertEquals( 4, Strings.areEquals("azerty".getBytes(), 2, "er") );
     }
 }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java Sat Jan 22 20:08:48 2011
@@ -32,8 +32,9 @@ 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.ldap.util.GeneralizedTime.Format;
-import org.apache.directory.shared.ldap.util.GeneralizedTime.TimeZoneFormat;
+import org.apache.directory.shared.util.GeneralizedTime.Format;
+import org.apache.directory.shared.util.GeneralizedTime.TimeZoneFormat;
+import org.apache.directory.shared.util.GeneralizedTime;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java Sat Jan 22 20:08:48 2011
@@ -36,7 +36,9 @@ import javax.naming.NamingException;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.util.Hex;
 import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -54,12 +56,12 @@ public class StringToolsTest
     public void testDecodeHexString() throws Exception
     {
         // weird stuff - corner cases
-        try{assertEquals( "", StringTools.decodeHexString( "" ) ); fail("should not get here");} catch( NamingException e ){}
-        assertEquals( "", StringTools.decodeHexString( "#" ) );
-        assertEquals( "F", StringTools.decodeHexString( "#46" ) );
-        try{assertEquals( "F", StringTools.decodeHexString( "46" ) ); fail("should not get here");} catch( NamingException e ){}
+        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", StringTools.decodeHexString( "#4665727279" ) );
+        assertEquals( "Ferry", Hex.decodeHexString("#4665727279") );
     }
     
     
@@ -99,8 +101,8 @@ public class StringToolsTest
     @Test
     public void testOneByteChar()
     {
-        char res = StringTools.bytesToChar( new byte[]
-            { 0x30 } );
+        char res = Unicode.bytesToChar(new byte[]
+                {0x30});
 
         assertEquals( '0', res );
     }
@@ -109,8 +111,8 @@ public class StringToolsTest
     @Test
     public void testOneByteChar00()
     {
-        char res = StringTools.bytesToChar( new byte[]
-            { 0x00 } );
+        char res = Unicode.bytesToChar(new byte[]
+                {0x00});
 
         assertEquals( 0x00, res );
     }
@@ -119,8 +121,8 @@ public class StringToolsTest
     @Test
     public void testOneByteChar7F()
     {
-        char res = StringTools.bytesToChar( new byte[]
-            { 0x7F } );
+        char res = Unicode.bytesToChar(new byte[]
+                {0x7F});
 
         assertEquals( 0x7F, res );
     }
@@ -129,8 +131,8 @@ public class StringToolsTest
     @Test
     public void testTwoBytesChar()
     {
-        char res = StringTools.bytesToChar( new byte[]
-            { ( byte ) 0xCE, ( byte ) 0x91 } );
+        char res = Unicode.bytesToChar(new byte[]
+                {(byte) 0xCE, (byte) 0x91});
 
         assertEquals( 0x0391, res );
     }
@@ -139,8 +141,8 @@ public class StringToolsTest
     @Test
     public void testThreeBytesChar()
     {
-        char res = StringTools.bytesToChar( new byte[]
-            { ( byte ) 0xE2, ( byte ) 0x89, ( byte ) 0xA2 } );
+        char res = Unicode.bytesToChar(new byte[]
+                {(byte) 0xE2, (byte) 0x89, (byte) 0xA2});
 
         assertEquals( 0x2262, res );
     }
@@ -149,29 +151,29 @@ public class StringToolsTest
     @Test
     public void testcharToBytesOne()
     {
-        assertEquals( "0x00 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0000)) );
-        assertEquals( "0x61 ", Strings.dumpBytes(StringTools.charToBytes('a')) );
-        assertEquals( "0x7F ", Strings.dumpBytes(StringTools.charToBytes((char) 0x007F)) );
+        assertEquals( "0x00 ", Strings.dumpBytes(Unicode.charToBytes((char) 0x0000)) );
+        assertEquals( "0x61 ", Strings.dumpBytes(Unicode.charToBytes('a')) );
+        assertEquals( "0x7F ", Strings.dumpBytes(Unicode.charToBytes((char) 0x007F)) );
     }
 
 
     @Test
     public void testcharToBytesTwo()
     {
-        assertEquals( "0xC2 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0080)) );
-        assertEquals( "0xC3 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0x00FF)) );
-        assertEquals( "0xC4 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0100)) );
-        assertEquals( "0xDF 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0x07FF)) );
+        assertEquals( "0xC2 0x80 ", Strings.dumpBytes(Unicode.charToBytes((char) 0x0080)) );
+        assertEquals( "0xC3 0xBF ", Strings.dumpBytes(Unicode.charToBytes((char) 0x00FF)) );
+        assertEquals( "0xC4 0x80 ", Strings.dumpBytes(Unicode.charToBytes((char) 0x0100)) );
+        assertEquals( "0xDF 0xBF ", Strings.dumpBytes(Unicode.charToBytes((char) 0x07FF)) );
     }
 
 
     @Test
     public void testcharToBytesThree()
     {
-        assertEquals( "0xE0 0xA0 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0800)) );
-        assertEquals( "0xE0 0xBF 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0FFF)) );
-        assertEquals( "0xE1 0x80 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x1000)) );
-        assertEquals( "0xEF 0xBF 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0xFFFF)) );
+        assertEquals( "0xE0 0xA0 0x80 ", Strings.dumpBytes(Unicode.charToBytes((char) 0x0800)) );
+        assertEquals( "0xE0 0xBF 0xBF ", Strings.dumpBytes(Unicode.charToBytes((char) 0x0FFF)) );
+        assertEquals( "0xE1 0x80 0x80 ", Strings.dumpBytes(Unicode.charToBytes((char) 0x1000)) );
+        assertEquals( "0xEF 0xBF 0xBF ", Strings.dumpBytes(Unicode.charToBytes((char) 0xFFFF)) );
     }
 
 
@@ -184,7 +186,7 @@ public class StringToolsTest
         list.add( "elem2" );
         list.add( "elem3" );
 
-        assertEquals( "elem1, elem2, elem3", StringTools.listToString( list ) );
+        assertEquals( "elem1, elem2, elem3", Strings.listToString(list) );
     }
 
 
@@ -217,7 +219,7 @@ public class StringToolsTest
         map.put( "elem2", new Value( "name2", 2 ) );
         map.put( "elem3", new Value( "name3", 3 ) );
 
-        String result = StringTools.mapToString( map );
+        String result = Strings.mapToString(map);
 
         boolean res = "elem1 = '[name1, 1]', elem2 = '[name2, 2]', elem3 = '[name3, 3]'".equals( result )
             || "elem1 = '[name1, 1]', elem3 = '[name3, 3]', elem2 = '[name2, 2]'".equals( result )
@@ -351,37 +353,37 @@ public class StringToolsTest
     @Test
     public void testTrim()
     {
-        assertEquals( "", StringTools.trim( (String)null ) );
-        assertEquals( "", StringTools.trim( "" ) );
-        assertEquals( "", StringTools.trim( " " ) );
-        assertEquals( "", StringTools.trim( "  " ) );
-        assertEquals( "a", StringTools.trim( "a  " ) );
-        assertEquals( "a", StringTools.trim( "  a" ) );
-        assertEquals( "a", StringTools.trim( "  a  " ) );
+        assertEquals( "", Strings.trim((String) null) );
+        assertEquals( "", Strings.trim("") );
+        assertEquals( "", Strings.trim(" ") );
+        assertEquals( "", Strings.trim("  ") );
+        assertEquals( "a", Strings.trim("a  ") );
+        assertEquals( "a", Strings.trim("  a") );
+        assertEquals( "a", Strings.trim("  a  ") );
     }
 
     @Test
     public void testTrimLeft()
     {
-        assertEquals( "", StringTools.trimLeft( (String)null ) );
-        assertEquals( "", StringTools.trimLeft( "" ) );
-        assertEquals( "", StringTools.trimLeft( " " ) );
-        assertEquals( "", StringTools.trimLeft( "  " ) );
-        assertEquals( "a  ", StringTools.trimLeft( "a  " ) );
-        assertEquals( "a", StringTools.trimLeft( "  a" ) );
-        assertEquals( "a  ", StringTools.trimLeft( "  a  " ) );
+        assertEquals( "", Strings.trimLeft((String) null) );
+        assertEquals( "", Strings.trimLeft("") );
+        assertEquals( "", Strings.trimLeft(" ") );
+        assertEquals( "", Strings.trimLeft("  ") );
+        assertEquals( "a  ", Strings.trimLeft("a  ") );
+        assertEquals( "a", Strings.trimLeft("  a") );
+        assertEquals( "a  ", Strings.trimLeft("  a  ") );
     }
 
     @Test
     public void testTrimRight()
     {
-        assertEquals( "", StringTools.trimRight( (String)null ) );
-        assertEquals( "", StringTools.trimRight( "" ) );
-        assertEquals( "", StringTools.trimRight( " " ) );
-        assertEquals( "", StringTools.trimRight( "  " ) );
-        assertEquals( "a", StringTools.trimRight( "a  " ) );
-        assertEquals( "  a", StringTools.trimRight( "  a" ) );
-        assertEquals( "  a", StringTools.trimRight( "  a  " ) );
+        assertEquals( "", Strings.trimRight((String) null) );
+        assertEquals( "", Strings.trimRight("") );
+        assertEquals( "", Strings.trimRight(" ") );
+        assertEquals( "", Strings.trimRight("  ") );
+        assertEquals( "a", Strings.trimRight("a  ") );
+        assertEquals( "  a", Strings.trimRight("  a") );
+        assertEquals( "  a", Strings.trimRight("  a  ") );
     }
 
 

Modified: directory/shared/trunk/util/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/pom.xml?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/util/pom.xml (original)
+++ directory/shared/trunk/util/pom.xml Sat Jan 22 20:08:48 2011
@@ -56,9 +56,15 @@
           <instructions>
             <Bundle-SymbolicName>${project.groupId}.util</Bundle-SymbolicName>
             <Import-Package>
+              javax.naming,
+              javax.net,
+              javax.net.ssl,
               org.apache.directory.shared.i18n
             </Import-Package>
             <Export-Package>
+              javax.naming,
+              javax.net,
+              javax.net.ssl,
               org.apache.directory.shared.util,
               org.apache.directory.shared.util.exception
             </Export-Package>

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

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

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

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

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Base32.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Base32.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Base32.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java&r1=1062128&r2=1062251&rev=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Base32.java Sat Jan 22 20:08:48 2011
@@ -18,9 +18,11 @@
  *  
  */
 
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
+import org.apache.directory.shared.util.Strings;
+
 /**
  * decoding of base32 characters to raw bytes.
  * 
@@ -54,12 +56,12 @@ public final class Base32
      */
     public static String encode( String str )
     {
-        if ( StringTools.isEmpty( str ) )
+        if ( Strings.isEmpty(str) )
         {
             return "";
         }
         
-        byte[] data = StringTools.getBytesUtf8( str );
+        byte[] data = Strings.getBytesUtf8(str);
         int dataLength = data.length;
         int newLength = ( ( dataLength << 3 ) / 5 ) + ( ( dataLength % 5 ) == 0 ? 0 : 1 );
         newLength += ( ( newLength % 8 == 0 ) ? 0 : 8 - newLength % 8 );
@@ -153,6 +155,6 @@ public final class Base32
                 break;
         }
         
-        return StringTools.utf8ToString( out );
+        return Strings.utf8ToString(out);
     }
 }

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

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

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

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/ByteBuffer.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/ByteBuffer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/ByteBuffer.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/ByteBuffer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/ByteBuffer.java&r1=1062128&r2=1062251&rev=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/ByteBuffer.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/ByteBuffer.java Sat Jan 22 20:08:48 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 import org.apache.directory.shared.i18n.I18n;
 

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

Added: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/CharConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/CharConstants.java?rev=1062251&view=auto
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/CharConstants.java (added)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/CharConstants.java Sat Jan 22 20:08:48 2011
@@ -0,0 +1,30 @@
+/*
+ *  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;
+
+
+/**
+ * Various Character constants are kept here.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface CharConstants
+{
+}

Added: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Chars.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Chars.java?rev=1062251&view=auto
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Chars.java (added)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Chars.java Sat Jan 22 20:08:48 2011
@@ -0,0 +1,861 @@
+/*
+ *  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;
+
+
+/**
+ * Various Character methods are kept here.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class Chars
+{
+    /** &lt;alpha> ::= [0x41-0x5A] | [0x61-0x7A] */
+    public static final boolean[] ALPHA =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false
+        };
+    /** &lt;alpha-lower-case> ::= [0x61-0x7A] */
+    public static final boolean[] ALPHA_LOWER_CASE =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false
+        };
+    /** &lt;alpha-upper-case> ::= [0x41-0x5A] */
+    public static final boolean[] ALPHA_UPPER_CASE =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+        };
+    /** &lt;alpha-digit> | &lt;digit> */
+    public static final boolean[] ALPHA_DIGIT =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false
+        };
+    /** &lt;alpha> | &lt;digit> | '-' */
+    public static final boolean[] CHAR =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, true,  false, false,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  true,  false, false, false, false, false
+        };
+    /** '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' */
+    public static final boolean[] DIGIT =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false
+        };
+    /** &lt;hex> ::= [0x30-0x39] | [0x41-0x46] | [0x61-0x66] */
+    public static final boolean[] HEX =
+        {
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            true,  true,  true,  true,  true,  true,  true,  true,
+            true,  true,  false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, true,  true,  true,  true,  true,  true,  false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false };
+
+    /* *
+    * Test if the current character is equal to a specific character.
+    *
+    * @param chars The buffer which contains the data
+    * @param index
+    *            Current position in the buffer
+    * @param car The character we want to compare with the current buffer position
+    * @return <code>true</code> if the current character equals the given character.
+    */
+    public static boolean isCharASCII( char[] chars, int index, char car )
+    {
+        if ( ( chars == null ) || ( chars.length == 0 ) || ( index < 0 ) || ( index >= chars.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( chars[index] == car ) ? true : false );
+        }
+    }
+
+    /**
+     * Test if the current character is equal to a specific character.
+     *
+     * @param string The String which contains the data
+     * @param index Current position in the string
+     * @param car The character we want to compare with the current string
+     *            position
+     * @return <code>true</code> if the current character equals the given
+     *         character.
+     */
+    public static boolean isCharASCII( String string, int index, char car )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            return string.charAt( index ) == car;
+        }
+    }
+
+    /**
+     * Test if the current character is equal to a specific character.
+     *
+     * @param string The String which contains the data
+     * @param index Current position in the string
+     * @param car The character we want to compare with the current string
+     *            position
+     * @return <code>true</code> if the current character equals the given
+     *         character.
+     */
+    public static boolean isICharASCII( String string, int index, char car )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( string.charAt( index ) | 0x20 ) & car ) == car;
+        }
+    }
+
+    /**
+     * Test if the current character is equal to a specific character.
+     *
+     * @param bytes The String which contains the data
+     * @param index Current position in the string
+     * @param car The character we want to compare with the current string
+     *            position
+     * @return <code>true</code> if the current character equals the given
+     *         character.
+     */
+    public static boolean isICharASCII( byte[] bytes, int index, char car )
+    {
+        if ( bytes == null )
+        {
+            return false;
+        }
+
+        int length = bytes.length;
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( bytes[ index ] | 0x20 ) & car ) == car;
+        }
+    }
+
+    /**
+     * Test if the current byte is an Alpha character :
+     * &lt;alpha> ::= [0x41-0x5A] | [0x61-0x7A]
+     *
+     * @param c The byte to test
+     *
+     * @return <code>true</code> if the byte is an Alpha
+     *         character
+     */
+    public static boolean isAlpha( byte c )
+    {
+        return ( ( c > 0 ) && ( c <= 127 ) && ALPHA[c] );
+    }
+
+    /**
+     * Test if the current character is an Alpha character :
+     * &lt;alpha> ::= [0x41-0x5A] | [0x61-0x7A]
+     *
+     * @param c The char to test
+     *
+     * @return <code>true</code> if the character is an Alpha
+     *         character
+     */
+    public static boolean isAlpha( char c )
+    {
+        return ( ( c > 0 ) && ( c <= 127 ) && ALPHA[c] );
+    }
+
+    /**
+     * Test if the current character is an Alpha character : &lt;alpha> ::=
+     * [0x41-0x5A] | [0x61-0x7A]
+     *
+     * @param bytes The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return <code>true</code> if the current character is an Alpha
+     *         character
+     */
+    public static boolean isAlphaASCII( byte[] bytes, int index )
+    {
+        if ( ( bytes == null ) || ( bytes.length == 0 ) || ( index < 0 ) || ( index >= bytes.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            byte c = bytes[index];
+
+            if ( ( ( c | 0x7F ) != 0x7F ) || ( ALPHA[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Test if the current character is an Alpha character : &lt;alpha> ::=
+     * [0x41-0x5A] | [0x61-0x7A]
+     *
+     * @param chars The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return <code>true</code> if the current character is an Alpha
+     *         character
+     */
+    public static boolean isAlphaASCII( char[] chars, int index )
+    {
+        if ( ( chars == null ) || ( chars.length == 0 ) || ( index < 0 ) || ( index >= chars.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = chars[index];
+
+            if ( ( c > 127 ) || ( ALPHA[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Test if the current character is an Alpha character : &lt;alpha> ::=
+     * [0x41-0x5A] | [0x61-0x7A]
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return <code>true</code> if the current character is an Alpha
+     *         character
+     */
+    public static boolean isAlphaASCII( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt( index );
+
+            if ( ( c > 127 ) || ( ALPHA[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Test if the current character is a lowercased Alpha character : <br/>
+     * &lt;alpha> ::= [0x61-0x7A]
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return <code>true</code> if the current character is a lower Alpha
+     *         character
+     */
+    public static boolean isAlphaLowercaseASCII( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt( index );
+
+            if ( ( c > 127 ) || ( ALPHA_LOWER_CASE[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Test if the current character is a uppercased Alpha character : <br/>
+     * &lt;alpha> ::= [0x61-0x7A]
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return <code>true</code> if the current character is a lower Alpha
+     *         character
+     */
+    public static boolean isAlphaUppercaseASCII( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt( index );
+
+            if ( ( c > 127 ) || ( ALPHA_UPPER_CASE[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Check if the current character is an 7 bits ASCII CHAR (between 0 and
+     * 127).
+     * &lt;char> ::= &lt;alpha> | &lt;digit>
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return The position of the next character, if the current one is a CHAR.
+     */
+    public static boolean isAlphaDigit( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt( index );
+
+            if ( ( c > 127 ) || ( ALPHA_DIGIT[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Check if the current character is an 7 bits ASCII CHAR (between 0 and
+     * 127). &lt;char> ::= &lt;alpha> | &lt;digit> | '-'
+     *
+     * @param bytes The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return The position of the next character, if the current one is a CHAR.
+     */
+    public static boolean isAlphaDigitMinus( byte[] bytes, int index )
+    {
+        if ( ( bytes == null ) || ( bytes.length == 0 ) || ( index < 0 ) || ( index >= bytes.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            byte c = bytes[index];
+
+            if ( ( ( c | 0x7F ) != 0x7F ) || ( CHAR[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Check if the current character is an 7 bits ASCII CHAR (between 0 and
+     * 127). &lt;char> ::= &lt;alpha> | &lt;digit> | '-'
+     *
+     * @param chars The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return The position of the next character, if the current one is a CHAR.
+     */
+    public static boolean isAlphaDigitMinus( char[] chars, int index )
+    {
+        if ( ( chars == null ) || ( chars.length == 0 ) || ( index < 0 ) || ( index >= chars.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = chars[index];
+
+            if ( ( c > 127 ) || ( CHAR[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Check if the current character is an 7 bits ASCII CHAR (between 0 and
+     * 127). &lt;char> ::= &lt;alpha> | &lt;digit> | '-'
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return The position of the next character, if the current one is a CHAR.
+     */
+    public static boolean isAlphaDigitMinus( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt( index );
+
+            if ( ( c > 127 ) || ( CHAR[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Test if the current character is a bit, ie 0 or 1.
+     *
+     * @param string
+     *            The String which contains the data
+     * @param index
+     *            Current position in the string
+     * @return <code>true</code> if the current character is a bit (0 or 1)
+     */
+    public static boolean isBit( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c =  string.charAt(  index );
+            return ( ( c == '0' ) || ( c == '1' ) );
+        }
+    }
+
+    /**
+     * Test if the current character is a digit &lt;digit> ::= '0' | '1' | '2' |
+     * '3' | '4' | '5' | '6' | '7' | '8' | '9'
+     *
+     * @param bytes The buffer which contains the data
+     * @return <code>true</code> if the current character is a Digit
+     */
+    public static boolean isDigit( byte[] bytes )
+    {
+        if ( ( bytes == null ) || ( bytes.length == 0 ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( ( ( bytes[0] | 0x7F ) != 0x7F ) || !DIGIT[bytes[0]] ) ? false : true );
+        }
+    }
+
+    /**
+     * Test if the current character is a digit &lt;digit> ::= '0' | '1' | '2' |
+     * '3' | '4' | '5' | '6' | '7' | '8' | '9'
+     *
+     * @param car the character to test
+     *
+     * @return <code>true</code> if the character is a Digit
+     */
+    public static boolean isDigit( char car )
+    {
+        return ( car >= '0' ) && ( car <= '9' );
+    }
+
+    /**
+     * Test if the current character is a digit &lt;digit> ::= '0' | '1' | '2' |
+     * '3' | '4' | '5' | '6' | '7' | '8' | '9'
+     *
+     * @param bytes The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return <code>true</code> if the current character is a Digit
+     */
+    public static boolean isDigit( byte[] bytes, int index )
+    {
+        if ( ( bytes == null ) || ( bytes.length == 0 ) || ( index < 0 ) || ( index >= bytes.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( ( ( bytes[index] | 0x7F ) !=  0x7F ) || !DIGIT[bytes[index]] ) ? false : true );
+        }
+    }
+
+    /**
+     * Test if the current character is a digit &lt;digit> ::= '0' | '1' | '2' |
+     * '3' | '4' | '5' | '6' | '7' | '8' | '9'
+     *
+     * @param chars The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return <code>true</code> if the current character is a Digit
+     */
+    public static boolean isDigit( char[] chars, int index )
+    {
+        if ( ( chars == null ) || ( chars.length == 0 ) || ( index < 0 ) || ( index >= chars.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( ( chars[index] > 127 ) || !DIGIT[chars[index]] ) ? false : true );
+        }
+    }
+
+    /**
+     * Test if the current character is a digit &lt;digit> ::= '0' | '1' | '2' |
+     * '3' | '4' | '5' | '6' | '7' | '8' | '9'
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return <code>true</code> if the current character is a Digit
+     */
+    public static boolean isDigit( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt(  index  );
+            return ( ( ( c > 127 ) || !DIGIT[c] ) ? false : true );
+        }
+    }
+
+    /**
+     * Test if the current character is a digit &lt;digit> ::= '0' | '1' | '2' |
+     * '3' | '4' | '5' | '6' | '7' | '8' | '9'
+     *
+     * @param chars The buffer which contains the data
+     * @return <code>true</code> if the current character is a Digit
+     */
+    public static boolean isDigit( char[] chars )
+    {
+        if ( ( chars == null ) || ( chars.length == 0 ) )
+        {
+            return false;
+        }
+        else
+        {
+            return ( ( ( chars[0] > 127 ) || !DIGIT[chars[0]] ) ? false : true );
+        }
+    }
+
+    /**
+     * Check if the current byte is an Hex Char
+     * &lt;hex> ::= [0x30-0x39] | [0x41-0x46] | [0x61-0x66]
+     *
+     * @param b The byte we want to check
+     * @return <code>true</code> if the current byte is a Hex byte
+     */
+    public static boolean isHex( byte b )
+    {
+        return ( ( b | 0x7F ) == 0x7F ) || HEX[b];
+    }
+
+    /**
+     * Check if the current character is an Hex Char &lt;hex> ::= [0x30-0x39] |
+     * [0x41-0x46] | [0x61-0x66]
+     *
+     * @param bytes The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return <code>true</code> if the current character is a Hex Char
+     */
+    public static boolean isHex( byte[] bytes, int index )
+    {
+        if ( ( bytes == null ) || ( bytes.length == 0 ) || ( index < 0 ) || ( index >= bytes.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            byte c = bytes[index];
+
+            if ( ( ( c | 0x7F ) != 0x7F ) || ( HEX[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Check if the current character is an Hex Char &lt;hex> ::= [0x30-0x39] |
+     * [0x41-0x46] | [0x61-0x66]
+     *
+     * @param chars The buffer which contains the data
+     * @param index Current position in the buffer
+     * @return <code>true</code> if the current character is a Hex Char
+     */
+    public static boolean isHex( char[] chars, int index )
+    {
+        if ( ( chars == null ) || ( chars.length == 0 ) || ( index < 0 ) || ( index >= chars.length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = chars[index];
+
+            if ( ( c > 127 ) || ( HEX[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Check if the current character is an Hex Char &lt;hex> ::= [0x30-0x39] |
+     * [0x41-0x46] | [0x61-0x66]
+     *
+     * @param string The string which contains the data
+     * @param index Current position in the string
+     * @return <code>true</code> if the current character is a Hex Char
+     */
+    public static boolean isHex( String string, int index )
+    {
+        if ( string == null )
+        {
+            return false;
+        }
+
+        int length = string.length();
+
+        if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+        {
+            return false;
+        }
+        else
+        {
+            char c = string.charAt( index );
+
+            if ( ( c > 127 ) || ( HEX[c] == false ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+}

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

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

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/DateUtils.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/DateUtils.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/DateUtils.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java&r1=1062128&r2=1062251&rev=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/DateUtils.java Sat Jan 22 20:08:48 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.text.SimpleDateFormat;

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

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

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

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

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

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/GeneralizedTime.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/GeneralizedTime.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/GeneralizedTime.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/GeneralizedTime.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/GeneralizedTime.java&r1=1062128&r2=1062251&rev=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/GeneralizedTime.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/GeneralizedTime.java Sat Jan 22 20:08:48 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
 import java.text.DecimalFormat;

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

Added: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Hex.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Hex.java?rev=1062251&view=auto
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Hex.java (added)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Hex.java Sat Jan 22 20:08:48 2011
@@ -0,0 +1,219 @@
+/*
+ *  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.shared.i18n.I18n;
+
+import javax.naming.InvalidNameException;
+
+
+/**
+ * Various hex and string manipulation methods that are more efficient then
+ * chaining operations: all is done in the same buffer without creating a bunch
+ * of intermediate String objects.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class Hex
+{
+    /** &lt;hex> ::= [0x30-0x39] | [0x41-0x46] | [0x61-0x66] */
+    public static final byte[] HEX_VALUE =
+        {
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 00 -> 0F
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 -> 1F
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20 -> 2F
+             0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1, // 30 -> 3F ( 0, 1,2, 3, 4,5, 6, 7, 8, 9 )
+            -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 40 -> 4F ( A, B, C, D, E, F )
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 50 -> 5F
+            -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1  // 60 -> 6F ( a, b, c, d, e, f )
+        };
+    /** Used to build output as Hex */
+    public static final char[] HEX_CHAR =
+        { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+    /**
+     * Translate two chars to an hex value. The chars must be
+     * in [a-fA-F0-9]
+     *
+     * @param high The high value
+     * @param low The low value
+     * @return A byte representation of the two chars
+     */
+    public static byte getHexValue( char high, char low )
+    {
+        if ( ( high > 127 ) || ( low > 127 ) || ( high < 0 ) | ( low < 0 ) )
+        {
+            return -1;
+        }
+
+        return (byte)( ( HEX_VALUE[high] << 4 ) | HEX_VALUE[low] );
+    }
+
+    /**
+     * Translate two bytes to an hex value. The bytes must be
+     * in [0-9a-fA-F]
+     *
+     * @param high The high value
+     * @param low The low value
+     * @return A byte representation of the two bytes
+     */
+    public static byte getHexValue( byte high, byte low )
+    {
+        if ( ( high > 127 ) || ( low > 127 ) || ( high < 0 ) | ( low < 0 ) )
+        {
+            return -1;
+        }
+
+        return (byte)( ( HEX_VALUE[high] << 4 ) | HEX_VALUE[low] );
+    }
+
+    /**
+     * Return an hex value from a sinle char
+     * The char must be in [0-9a-fA-F]
+     *
+     * @param c The char we want to convert
+     * @return A byte between 0 and 15
+     */
+    public static byte getHexValue( char c )
+    {
+        if ( ( c > 127 ) || ( c < 0 ) )
+        {
+            return -1;
+        }
+
+        return HEX_VALUE[c];
+    }
+
+
+    /**
+     * Decodes values of attributes in the DN encoded in hex into a UTF-8
+     * String.  RFC2253 allows a DN's attribute to be encoded in hex.
+     * The encoded value starts with a # then is followed by an even
+     * number of hex characters.
+     *
+     * @param str the string to decode
+     * @return the decoded string
+     * @throws InvalidNameException
+     */
+    public static String decodeHexString( String str ) throws InvalidNameException
+    {
+        if ( str == null || str.length() == 0 )
+        {
+            throw new InvalidNameException( I18n.err( I18n.ERR_04431 ) );
+        }
+
+        char[] chars = str.toCharArray();
+
+        if ( chars[0] != '#' )
+        {
+            throw new InvalidNameException( I18n.err( I18n.ERR_04432, str ) );
+        }
+
+        // the bytes representing the encoded string of hex
+        // this should be ( length - 1 )/2 in size
+        byte[] decoded = new byte[ ( chars.length - 1 ) >> 1 ];
+
+        for ( int ii = 1, jj = 0 ; ii < chars.length; ii+=2, jj++ )
+        {
+            int ch = ( HEX_VALUE[chars[ii]] << 4 )
+                 + HEX_VALUE[chars[ii + 1]];
+            decoded[jj] = ( byte ) ch;
+        }
+
+        return Strings.utf8ToString(decoded);
+    }
+
+
+    /**
+     * Convert an escaoed list of bytes to a byte[]
+     *
+     * @param str the string containing hex escapes
+     * @return the converted byte[]
+     */
+    public static byte[] convertEscapedHex( String str ) throws InvalidNameException
+    {
+        if ( str == null )
+        {
+            throw new InvalidNameException( I18n.err( I18n.ERR_04433 ) );
+        }
+
+        int length = str.length();
+
+        if ( length == 0 )
+        {
+            throw new InvalidNameException( I18n.err( I18n.ERR_04434 ) );
+        }
+
+        // create buffer and add everything before start of scan
+        byte[] buf = new byte[ str.length()/3];
+        int pos = 0;
+
+        // start scaning until we find an escaped series of bytes
+        for ( int i = 0; i < length; i++ )
+        {
+            char c = str.charAt( i );
+
+            if ( c == '\\' )
+            {
+                // we have the start of a hex escape sequence
+                if ( Chars.isHex(str, i + 1) && Chars.isHex(str, i + 2) )
+                {
+                    byte value = ( byte ) ( ( HEX_VALUE[str.charAt( i + 1 )] << 4 )
+                        + HEX_VALUE[str.charAt( i + 2 )] );
+
+                    i+=2;
+                    buf[pos++] = value;
+                }
+            }
+            else
+            {
+                throw new InvalidNameException( I18n.err( I18n.ERR_04435 ) );
+            }
+        }
+
+        return buf;
+    }
+
+    /**
+     * Converts an array of bytes into an array of characters representing the
+     * hexidecimal values of each byte in order. The returned array will be
+     * double the length of the passed array, as it takes two characters to
+     * represent any given byte.
+     *
+     * @param data a byte[] to convert to Hex characters
+     * @return A char[] containing hexidecimal characters
+     */
+    public static char[] encodeHex( byte[] data )
+    {
+        int l = data.length;
+
+        char[] out = new char[l << 1];
+
+        // two characters form the hex value.
+        for ( int i = 0, j = 0; i < l; i++ )
+        {
+            out[j++] = HEX_CHAR[( 0xF0 & data[i] ) >>> 4];
+            out[j++] = HEX_CHAR[0x0F & data[i]];
+        }
+
+        return out;
+    }
+}

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

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

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

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

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MandatoryComponentsMonitor.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/MandatoryComponentsMonitor.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MandatoryComponentsMonitor.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MandatoryComponentsMonitor.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/MandatoryComponentsMonitor.java&r1=1062128&r2=1062251&rev=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/MandatoryComponentsMonitor.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/MandatoryComponentsMonitor.java Sat Jan 22 20:08:48 2011
@@ -18,9 +18,11 @@
  *  
  */
 
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
+import org.apache.directory.shared.util.AbstractSimpleComponentsMonitor;
+
 /**
  * A components monitor for manadatory components.
  *

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

Copied: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/OptionalComponentsMonitor.java (from r1062128, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/OptionalComponentsMonitor.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/OptionalComponentsMonitor.java?p2=directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/OptionalComponentsMonitor.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/OptionalComponentsMonitor.java&r1=1062128&r2=1062251&rev=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/OptionalComponentsMonitor.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/OptionalComponentsMonitor.java Sat Jan 22 20:08:48 2011
@@ -18,9 +18,11 @@
  *  
  */
 
-package org.apache.directory.shared.ldap.util;
+package org.apache.directory.shared.util;
 
 
+import org.apache.directory.shared.util.AbstractSimpleComponentsMonitor;
+
 /**
  * A components monitor for optional components.
  *

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

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

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



Mime
View raw message