directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1062251 [8/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/director...
Date Sat, 22 Jan 2011 20:08:59 GMT
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Sat Jan 22 20:08:48 2011
@@ -47,6 +47,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
+import org.apache.directory.shared.util.Chars;
+import org.apache.directory.shared.util.Hex;
+import org.apache.directory.shared.util.Position;
 import org.apache.directory.shared.util.Strings;
 
 
@@ -327,7 +330,7 @@ public final class AttributeUtils
                             break;
 
                         case 2:
-                            int high = StringTools.getHexValue( c );
+                            int high = Hex.getHexValue(c);
 
                             if ( high == -1 )
                             {
@@ -340,7 +343,7 @@ public final class AttributeUtils
                             break;
 
                         case 3:
-                            int low = StringTools.getHexValue( c );
+                            int low = Hex.getHexValue(c);
 
                             if ( low == -1 )
                             {
@@ -701,7 +704,7 @@ public final class AttributeUtils
                         }
                         else if ( attr instanceof byte[] )
                         {
-                            String string = StringTools.utf8ToString( ( byte[] ) attr );
+                            String string = Strings.utf8ToString((byte[]) attr);
 
                             sb.append( tabs ).append( "        Val[" ).append( j ).append(
"] : " );
                             sb.append( string ).append( '/' );
@@ -783,7 +786,7 @@ public final class AttributeUtils
             pos.start++;
 
             // We have an option
-            if ( !StringTools.isAlphaDigitMinus( str, pos.start ) )
+            if ( !Chars.isAlphaDigitMinus(str, pos.start) )
             {
                 // We must have at least one keychar
                 throw new ParseException( I18n.err( I18n.ERR_04343 ), pos.start );
@@ -791,7 +794,7 @@ public final class AttributeUtils
 
             pos.start++;
 
-            while ( StringTools.isAlphaDigitMinus( str, pos.start ) )
+            while ( Chars.isAlphaDigitMinus(str, pos.start) )
             {
                 pos.start++;
             }
@@ -809,7 +812,7 @@ public final class AttributeUtils
      */
     private static boolean parseNumber( String filter, Position pos )
     {
-        char c = StringTools.charAt( filter, pos.start );
+        char c = Strings.charAt(filter, pos.start);
 
         switch ( c )
         {
@@ -835,7 +838,7 @@ public final class AttributeUtils
                 return false;
         }
 
-        while ( StringTools.isDigit( filter, pos.start ) )
+        while ( Chars.isDigit(filter, pos.start) )
         {
             pos.start++;
         }
@@ -912,7 +915,7 @@ public final class AttributeUtils
     public static String parseAttribute( String str, Position pos, boolean withOption ) throws
ParseException
     {
         // We must have an OID or an DESCR first
-        char c = StringTools.charAt( str, pos.start );
+        char c = Strings.charAt(str, pos.start);
 
         if ( c == '\0' )
         {
@@ -921,12 +924,12 @@ public final class AttributeUtils
 
         int start = pos.start;
 
-        if ( StringTools.isAlpha( c ) )
+        if ( Chars.isAlpha(c) )
         {
             // A DESCR
             pos.start++;
 
-            while ( StringTools.isAlphaDigitMinus( str, pos.start ) )
+            while ( Chars.isAlphaDigitMinus(str, pos.start) )
             {
                 pos.start++;
             }
@@ -939,7 +942,7 @@ public final class AttributeUtils
 
             return str.substring( start, pos.start );
         }
-        else if ( StringTools.isDigit( c ) )
+        else if ( Chars.isDigit(c) )
         {
             // An OID
             pos.start++;

Modified: 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/util/DNUtils.java?rev=1062251&r1=1062250&r2=1062251&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/util/DNUtils.java
Sat Jan 22 20:08:48 2011
@@ -20,6 +20,11 @@
 package org.apache.directory.shared.ldap.util;
 
 
+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;
+
 /**
  * Utility class used by the DN Parser.
  * 
@@ -323,7 +328,7 @@ public final class DNUtils
         {
             byte b = bytes[index++];
 
-            if ( StringTools.isAlpha( b ) )
+            if ( Chars.isAlpha(b) )
             {
                 return index-1;
             }
@@ -416,9 +421,9 @@ public final class DNUtils
                 {
                     return true;
                 }
-                else if ( StringTools.isHex( bytes, index++ ) )
+                else if ( Chars.isHex(bytes, index++) )
                 {
-                    return StringTools.isHex( bytes, index );
+                    return Chars.isHex(bytes, index);
                 }
                 else
                 {
@@ -466,9 +471,9 @@ public final class DNUtils
                 {
                     return 1;
                 }
-                else if ( StringTools.isHex( bytes, index++ ) )
+                else if ( Chars.isHex(bytes, index++) )
                 {
-                    return StringTools.isHex( bytes, index ) ? 2 : PARSING_ERROR;
+                    return Chars.isHex(bytes, index) ? 2 : PARSING_ERROR;
                 }
                 else
                 {
@@ -504,7 +509,7 @@ public final class DNUtils
             }
             else
             {
-                return StringTools.countBytesPerChar( bytes, index );
+                return Unicode.countBytesPerChar(bytes, index);
             }
         }
     }
@@ -537,7 +542,7 @@ public final class DNUtils
             }
             else
             {
-                return StringTools.countBytesPerChar( bytes, index );
+                return Unicode.countBytesPerChar(bytes, index);
             }
         }
     }
@@ -568,7 +573,7 @@ public final class DNUtils
             }
             else
             {
-                return StringTools.countBytesPerChar( bytes, index );
+                return Unicode.countBytesPerChar(bytes, index);
             }
         }
     }
@@ -584,9 +589,9 @@ public final class DNUtils
      */
     public static int parseHexPair( byte[] bytes, int index )
     {
-        if ( StringTools.isHex( bytes, index ) )
+        if ( Chars.isHex(bytes, index) )
         {
-            if ( StringTools.isHex( bytes, index + 1 ) )
+            if ( Chars.isHex(bytes, index + 1) )
             {
                 return index + 2;
             }
@@ -612,7 +617,7 @@ public final class DNUtils
      */
     private static byte getHexPair( byte[] bytes, int index )
     {
-        return StringTools.getHexValue( bytes[index], bytes[index + 1] );
+        return Hex.getHexValue(bytes[index], bytes[index + 1]);
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
Sat Jan 22 20:08:48 2011
@@ -39,6 +39,10 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.util.Chars;
+import org.apache.directory.shared.util.StringConstants;
+import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 
 
 /**
@@ -165,8 +169,8 @@ public class LdapURL
         int pos = 0;
 
         // The scheme
-        if ( ( ( pos = StringTools.areEquals( chars, 0, LDAP_SCHEME ) ) == StringTools.NOT_EQUAL
)
-            && ( ( pos = StringTools.areEquals( chars, 0, LDAPS_SCHEME ) ) == StringTools.NOT_EQUAL
) )
+        if ( ( ( pos = Strings.areEquals(chars, 0, LDAP_SCHEME) ) == StringConstants.NOT_EQUAL
)
+            && ( ( pos = Strings.areEquals(chars, 0, LDAPS_SCHEME) ) == StringConstants.NOT_EQUAL
) )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04398 ) );
         }
@@ -187,7 +191,7 @@ public class LdapURL
         }
 
         // An optional '/'
-        if ( !StringTools.isCharASCII( chars, pos, '/' ) )
+        if ( !Chars.isCharASCII(chars, pos, '/') )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04400, pos, chars[pos]
) );
         }
@@ -211,7 +215,7 @@ public class LdapURL
         }
 
         // Optionals attributes
-        if ( !StringTools.isCharASCII( chars, pos, '?' ) )
+        if ( !Chars.isCharASCII(chars, pos, '?') )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos]
) );
         }
@@ -229,7 +233,7 @@ public class LdapURL
         }
 
         // Optional scope
-        if ( !StringTools.isCharASCII( chars, pos, '?' ) )
+        if ( !Chars.isCharASCII(chars, pos, '?') )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos]
) );
         }
@@ -247,7 +251,7 @@ public class LdapURL
         }
 
         // Optional filter
-        if ( !StringTools.isCharASCII( chars, pos, '?' ) )
+        if ( !Chars.isCharASCII(chars, pos, '?') )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos]
) );
         }
@@ -270,7 +274,7 @@ public class LdapURL
         }
 
         // Optional extensions
-        if ( !StringTools.isCharASCII( chars, pos, '?' ) )
+        if ( !Chars.isCharASCII(chars, pos, '?') )
         {
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04402, pos, chars[pos]
) );
         }
@@ -332,7 +336,7 @@ public class LdapURL
             throw new LdapURLEncodingException( I18n.err( I18n.ERR_04410 ) );
         }
 
-        string = StringTools.utf8ToString( bytes );
+        string = Strings.utf8ToString(bytes);
 
         this.bytes = new byte[bytes.length];
         System.arraycopy( bytes, 0, this.bytes, 0, bytes.length );
@@ -380,7 +384,7 @@ public class LdapURL
         // the end.
         // We will search the end of the host part, and we will check some
         // elements.
-        if ( StringTools.isCharASCII( chars, pos, '-' ) )
+        if ( Chars.isCharASCII(chars, pos, '-') )
         {
 
             // We can't have a '-' on first position
@@ -390,7 +394,7 @@ public class LdapURL
         while ( ( pos < chars.length ) && ( chars[pos] != ':' ) && ( chars[pos]
!= '/' ) )
         {
 
-            if ( StringTools.isCharASCII( chars, pos, '.' ) )
+            if ( Chars.isCharASCII(chars, pos, '.') )
             {
 
                 if ( ( hadMinus ) || ( hadDot ) )
@@ -420,7 +424,7 @@ public class LdapURL
             else
             {
 
-                if ( hadDot && StringTools.isCharASCII( chars, pos, '-' ) )
+                if ( hadDot && Chars.isCharASCII(chars, pos, '-') )
                 {
 
                     // We can't have a '-' just after a '.'
@@ -430,7 +434,7 @@ public class LdapURL
                 hadDot = false;
             }
 
-            if ( StringTools.isDigit( chars, pos ) )
+            if ( Chars.isDigit(chars, pos) )
             {
 
                 if ( isHostNumber && ( nbDots < 4 ) )
@@ -445,11 +449,11 @@ public class LdapURL
 
                 hadMinus = false;
             }
-            else if ( StringTools.isAlphaDigitMinus( chars, pos ) )
+            else if ( Chars.isAlphaDigitMinus(chars, pos) )
             {
                 isHostNumber = false;
 
-                if ( StringTools.isCharASCII( chars, pos, '-' ) )
+                if ( Chars.isCharASCII(chars, pos, '-') )
                 {
                     hadMinus = true;
                 }
@@ -519,7 +523,7 @@ public class LdapURL
     private int parsePort( char[] chars, int pos )
     {
 
-        if ( !StringTools.isDigit( chars, pos ) )
+        if ( !Chars.isDigit(chars, pos) )
         {
             return -1;
         }
@@ -528,7 +532,7 @@ public class LdapURL
 
         pos++;
 
-        while ( StringTools.isDigit( chars, pos ) )
+        while ( Chars.isDigit(chars, pos) )
         {
             port = ( port * 10 ) + ( chars[pos] - '0' );
 
@@ -565,7 +569,7 @@ public class LdapURL
         }
 
         // We may have a port.
-        if ( StringTools.isCharASCII( chars, pos, ':' ) )
+        if ( Chars.isCharASCII(chars, pos, ':') )
         {
             if ( pos == hostPos )
             {
@@ -681,7 +685,7 @@ public class LdapURL
     {
         if ( bytes == null )
         {
-            return StringTools.EMPTY_BYTES;
+            return StringConstants.EMPTY_BYTES;
         }
 
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@@ -798,7 +802,7 @@ public class LdapURL
             for ( int i = pos; ( i < chars.length ) && ( chars[i] != '?' ); i++
)
             {
 
-                if ( StringTools.isCharASCII( chars, i, ',' ) )
+                if ( Chars.isCharASCII(chars, i, ',') )
                 {
                     hadComma = true;
 
@@ -936,19 +940,19 @@ public class LdapURL
     private int parseScope( char[] chars, int pos )
     {
 
-        if ( StringTools.isCharASCII( chars, pos, 'b' ) || StringTools.isCharASCII( chars,
pos, 'B' ) )
+        if ( Chars.isCharASCII(chars, pos, 'b') || Chars.isCharASCII(chars, pos, 'B') )
         {
             pos++;
 
-            if ( StringTools.isCharASCII( chars, pos, 'a' ) || StringTools.isCharASCII( chars,
pos, 'A' ) )
+            if ( Chars.isCharASCII(chars, pos, 'a') || Chars.isCharASCII(chars, pos, 'A')
)
             {
                 pos++;
 
-                if ( StringTools.isCharASCII( chars, pos, 's' ) || StringTools.isCharASCII(
chars, pos, 'S' ) )
+                if ( Chars.isCharASCII(chars, pos, 's') || Chars.isCharASCII(chars, pos,
'S') )
                 {
                     pos++;
 
-                    if ( StringTools.isCharASCII( chars, pos, 'e' ) || StringTools.isCharASCII(
chars, pos, 'E' ) )
+                    if ( Chars.isCharASCII(chars, pos, 'e') || Chars.isCharASCII(chars, pos,
'E') )
                     {
                         pos++;
                         scope = SearchScope.OBJECT;
@@ -957,15 +961,15 @@ public class LdapURL
                 }
             }
         }
-        else if ( StringTools.isCharASCII( chars, pos, 'o' ) || StringTools.isCharASCII(
chars, pos, 'O' ) )
+        else if ( Chars.isCharASCII(chars, pos, 'o') || Chars.isCharASCII(chars, pos, 'O')
)
         {
             pos++;
 
-            if ( StringTools.isCharASCII( chars, pos, 'n' ) || StringTools.isCharASCII( chars,
pos, 'N' ) )
+            if ( Chars.isCharASCII(chars, pos, 'n') || Chars.isCharASCII(chars, pos, 'N')
)
             {
                 pos++;
 
-                if ( StringTools.isCharASCII( chars, pos, 'e' ) || StringTools.isCharASCII(
chars, pos, 'E' ) )
+                if ( Chars.isCharASCII(chars, pos, 'e') || Chars.isCharASCII(chars, pos,
'E') )
                 {
                     pos++;
 
@@ -974,15 +978,15 @@ public class LdapURL
                 }
             }
         }
-        else if ( StringTools.isCharASCII( chars, pos, 's' ) || StringTools.isCharASCII(
chars, pos, 'S' ) )
+        else if ( Chars.isCharASCII(chars, pos, 's') || Chars.isCharASCII(chars, pos, 'S')
)
         {
             pos++;
 
-            if ( StringTools.isCharASCII( chars, pos, 'u' ) || StringTools.isCharASCII( chars,
pos, 'U' ) )
+            if ( Chars.isCharASCII(chars, pos, 'u') || Chars.isCharASCII(chars, pos, 'U')
)
             {
                 pos++;
 
-                if ( StringTools.isCharASCII( chars, pos, 'b' ) || StringTools.isCharASCII(
chars, pos, 'B' ) )
+                if ( Chars.isCharASCII(chars, pos, 'b') || Chars.isCharASCII(chars, pos,
'B') )
                 {
                     pos++;
 
@@ -991,7 +995,7 @@ public class LdapURL
                 }
             }
         }
-        else if ( StringTools.isCharASCII( chars, pos, '?' ) )
+        else if ( Chars.isCharASCII(chars, pos, '?') )
         {
             // An empty scope. This is valid
             return pos;
@@ -1037,7 +1041,7 @@ public class LdapURL
         {
             for ( int i = pos; ( i < chars.length ); i++ )
             {
-                if ( StringTools.isCharASCII( chars, i, ',' ) )
+                if ( Chars.isCharASCII(chars, i, ',') )
                 {
                     if ( isNewExtension )
                     {
@@ -1067,7 +1071,7 @@ public class LdapURL
                         value = null;
                     }
                 }
-                else if ( StringTools.isCharASCII( chars, i, '=' ) )
+                else if ( Chars.isCharASCII(chars, i, '=') )
                 {
                     if ( hasValue )
                     {
@@ -1087,7 +1091,7 @@ public class LdapURL
                     hasValue = true;
                     start = i + 1;
                 }
-                else if ( StringTools.isCharASCII( chars, i, '!' ) )
+                else if ( Chars.isCharASCII(chars, i, '!') )
                 {
                     if ( hasValue )
                     {
@@ -1304,7 +1308,7 @@ public class LdapURL
                 default:
 
                     // percent encoding
-                    byte[] bytes = StringTools.charToBytes( c );
+                    byte[] bytes = Unicode.charToBytes(c);
                     char[] hex = Hex.encodeHex( bytes );
                     for ( int j = 0; j < hex.length; j++ )
                     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java?rev=1062251&r1=1062250&r2=1062251&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
Sat Jan 22 20:08:48 2011
@@ -27,6 +27,7 @@ import java.util.prefs.BackingStoreExcep
 
 import org.apache.commons.lang.exception.NestableRuntimeException;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.util.ArrayEnumeration;
 
 
 /**



Mime
View raw message