directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r900835 - in /directory: apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/core/src/main/java...
Date Tue, 19 Jan 2010 16:30:23 GMT
Author: kayyagari
Date: Tue Jan 19 16:30:21 2010
New Revision: 900835

URL: http://svn.apache.org/viewvc?rev=900835&view=rev
Log:
o chaged the UUID syntax to human readable
o updated the UUID syntax checker and comparator to use String instead of byte[]
o added a method in StringTools to convert given byte[] of a UUID to string
o updated the code wherever the entryUUID AT value is set as byte[] to take UUID in String
form
o fixed the test cases

Modified:
    directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
    directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
    directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
    directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
    directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=apache/ou=syntaxes/m-oid=1.3.6.1.1.16.1.ldif
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/UuidSyntaxCheckerTest.java

Modified: directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
(original)
+++ directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
Tue Jan 19 16:30:21 2010
@@ -116,7 +116,7 @@
     private AvlIndex<String, E> entryCsnIdx;
 
     /** a system index on entryUUID attribute */
-    private AvlIndex<byte[], E> entryUuidIdx;
+    private AvlIndex<String, E> entryUuidIdx;
 
     /** a map of attributeType numeric ID to user userIndices */
     private Map<String, AvlIndex<?, E>> userIndices = new HashMap<String,
AvlIndex<?, E>>();
@@ -236,7 +236,7 @@
             throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_VIOLATION
);
         }
         
-        entryUuidIdx.add( entryUuid.getBytes(), id );
+        entryUuidIdx.add( entryUuid.getString(), id );
 
         Long tempId = parentId;
         while ( tempId != null && tempId != 0 && tempId != 1 )
@@ -776,7 +776,7 @@
         if ( entryUuidIdx == null )
         {
             AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_UUID_AT_OID
);
-            entryUuidIdx = new AvlIndex<byte[], E>();
+            entryUuidIdx = new AvlIndex<String, E>();
             entryUuidIdx.setAttributeId( SchemaConstants.ENTRY_UUID_AT_OID );
             entryUuidIdx.initialize( attributeType );
             systemIndices.put( SchemaConstants.ENTRY_UUID_AT_OID, entryUuidIdx );
@@ -2068,7 +2068,7 @@
     }
 
 
-    public Index<byte[], E> getEntryUuidIndex()
+    public Index<String, E> getEntryUuidIndex()
     {
         return entryUuidIdx;
     }
@@ -2144,12 +2144,12 @@
     }
 
 
-    public void setEntryUuidIndex( Index<byte[], E> index ) throws NamingException
+    public void setEntryUuidIndex( Index<String, E> index ) throws NamingException
     {
         protect( "entryUuidIndex" );
         if( index instanceof AvlIndex )
         {
-            this.entryUuidIdx = ( AvlIndex<byte[], E> ) index;
+            this.entryUuidIdx = ( AvlIndex<String, E> ) index;
         }
         else
         {

Modified: directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
(original)
+++ directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
Tue Jan 19 16:30:21 2010
@@ -360,7 +360,7 @@
         entry.add( "commonName",  "Jack Daniels");
         entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( entry );
         
         store.delete( 12L ); // drops the alias indices
@@ -408,7 +408,7 @@
       entry.add( "ou", "Sales" );
       entry.add( "cn",  "Martin King");
       entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+      entry.add( "entryUUID", UUID.randomUUID().toString() );
       store.add( entry );
       
       cursor = idx.forwardCursor( 2L);
@@ -432,7 +432,7 @@
       entry.add( "objectClass", "top", "organizationalUnit" );
       entry.add( "ou", "Marketing" );
       entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+      entry.add( "entryUUID", UUID.randomUUID().toString() );
       store.add( entry );
 
       // dn id 14
@@ -443,7 +443,7 @@
       entry.add( "ou", "Marketing" );
       entry.add( "cn",  "Jimmy Wales");
       entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+      entry.add( "entryUUID", UUID.randomUUID().toString() );
       store.add( entry );
       
       store.move( marketingDn, newParentDn );
@@ -726,7 +726,7 @@
         entry.add( "ou", "Engineering" );
         entry.add( "cn",  "Private Ryan");
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
         
@@ -746,7 +746,7 @@
         entry.add( "ou", "Engineering" );
         entry.add( "cn",  "Private Ryan");
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
         
         store.add( entry );
         
@@ -773,7 +773,7 @@
         childEntry.add( "ou", "Engineering" );
         childEntry.add( "cn",  "Private Ryan");
         childEntry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        childEntry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        childEntry.add( "entryUUID", UUID.randomUUID().toString() );
 
         store.add( childEntry );
 
@@ -906,7 +906,7 @@
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "cn", "Tim B");
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
         
         store.add( entry );
         

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Tue Jan 19 16:30:21 2010
@@ -1115,7 +1115,7 @@
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             TlsKeyGenerator.addKeyPair( serverEntry );
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
@@ -1143,7 +1143,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }
@@ -1169,7 +1169,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }
@@ -1196,7 +1196,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
 
@@ -1242,7 +1242,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }
@@ -1264,7 +1264,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }
@@ -1287,7 +1287,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }
@@ -1310,7 +1310,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }
@@ -1336,7 +1336,7 @@
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
             serverEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
-            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            serverEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
 
             partitionNexus.add( new AddOperationContext( adminSession, serverEntry ) );
         }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
Tue Jan 19 16:30:21 2010
@@ -217,7 +217,7 @@
         }
         else
         {
-            entry.put( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+            entry.put( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
         }
             
         if ( entry.containsAttribute( SchemaConstants.ENTRY_CSN_AT ) )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Tue Jan 19 16:30:21 2010
@@ -316,7 +316,7 @@
         systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN
);
         systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         systemEntry.add( SchemaConstants.ENTRY_CSN_AT, directoryService.getCSN().toString()
);
-        systemEntry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+        systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
         systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ),
             NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
         LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Tue Jan 19 16:30:21 2010
@@ -148,7 +148,7 @@
                 }
                 else if ( oid.equals( SchemaConstants.ENTRY_UUID_AT_OID ) )
                 {
-                    store.setEntryUuidIndex( ( Index<byte[],ServerEntry> ) index );
+                    store.setEntryUuidIndex( ( Index<String,ServerEntry> ) index );
                 }
                 else
                 {
@@ -179,7 +179,7 @@
     }
 
     
-    public Index<byte[], ServerEntry> getEntryUuidIndex()
+    public Index<String, ServerEntry> getEntryUuidIndex()
     {
         return store.getEntryUuidIndex();
     }

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Tue Jan 19 16:30:21 2010
@@ -133,7 +133,7 @@
     private JdbmIndex<String,E> entryCsnIdx;
 
     /** a system index on entryUUID attribute */
-    private JdbmIndex<byte[],E> entryUuidIdx;
+    private JdbmIndex<String,E> entryUuidIdx;
     
     /** Static declarations to avoid lookup all over the code */
     private static AttributeType OBJECT_CLASS_AT;
@@ -384,7 +384,7 @@
         
         if ( entryUuidIdx == null )
         {
-            entryUuidIdx = new JdbmIndex<byte[], E>();
+            entryUuidIdx = new JdbmIndex<String, E>();
             entryUuidIdx.setAttributeId( SchemaConstants.ENTRY_UUID_AT_OID );
             systemIndices.put( SchemaConstants.ENTRY_UUID_AT_OID, entryUuidIdx );
             entryUuidIdx.init( schemaManager, schemaManager.lookupAttributeTypeRegistry(
SchemaConstants.ENTRY_UUID_AT_OID ), workingDirectory );
@@ -786,7 +786,7 @@
     /**
      * {@inheritDoc}
      */
-    public Index<byte[],E> getEntryUuidIndex()
+    public Index<String,E> getEntryUuidIndex()
     {
         return entryUuidIdx;
     }
@@ -795,7 +795,7 @@
     /**
      * {@inheritDoc}
      */
-    public void setEntryUuidIndex( Index<byte[],E> index ) throws NamingException
+    public void setEntryUuidIndex( Index<String,E> index ) throws NamingException
     {
         protect( "entryUuidIndex" );
         entryUuidIdx = convertIndex( index );
@@ -1247,7 +1247,7 @@
             throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_VIOLATION
);
         }
         
-        entryUuidIdx.add( entryUuid.getBytes(), id );
+        entryUuidIdx.add( entryUuid.getString(), id );
         
         Long tempId = parentId;
         

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Tue Jan 19 16:30:21 2010
@@ -382,7 +382,7 @@
         entry.add( "commonName",  "Jack Daniels");
         entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( entry );
         
         store.delete( 12L ); // drops the alias indices
@@ -430,7 +430,7 @@
       entry.add( "ou", "Sales" );
       entry.add( "cn",  "Martin King");
       entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+      entry.add( "entryUUID", UUID.randomUUID().toString() );
       store.add( entry );
       
       cursor = idx.forwardCursor( 2L);
@@ -454,7 +454,7 @@
       entry.add( "objectClass", "top", "organizationalUnit" );
       entry.add( "ou", "Marketing" );
       entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+      entry.add( "entryUUID", UUID.randomUUID().toString() );
       store.add( entry );
 
       // dn id 14
@@ -465,7 +465,7 @@
       entry.add( "ou", "Marketing" );
       entry.add( "cn",  "Jimmy Wales");
       entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+      entry.add( "entryUUID", UUID.randomUUID().toString() );
       store.add( entry );
       
       store.move( marketingDn, newParentDn );
@@ -748,7 +748,7 @@
         entry.add( "ou", "Engineering" );
         entry.add( "cn",  "Private Ryan");
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
         
@@ -768,7 +768,7 @@
         entry.add( "ou", "Engineering" );
         entry.add( "cn",  "Private Ryan");
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
         
         store.add( entry );
         
@@ -795,7 +795,7 @@
         childEntry.add( "ou", "Engineering" );
         childEntry.add( "cn",  "Private Ryan");
         childEntry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        childEntry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        childEntry.add( "entryUUID", UUID.randomUUID().toString() );
 
         store.add( childEntry );
 
@@ -928,7 +928,7 @@
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "cn", "Tim B");
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        entry.add( "entryUUID", UUID.randomUUID().toString() );
         
         store.add( entry );
         

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Tue Jan 19 16:30:21 2010
@@ -239,7 +239,7 @@
 
             if ( contextEntry.get( SchemaConstants.ENTRY_UUID_AT ) == null )
             {
-                byte[] uuid = SchemaUtils.uuidToBytes( UUID.randomUUID() );
+                String uuid = UUID.randomUUID().toString();
                 contextEntry.add( SchemaConstants.ENTRY_UUID_AT, uuid );
             }
             
@@ -489,7 +489,7 @@
                     
                     if ( !serverEntry.containsAttribute( SchemaConstants.ENTRY_UUID_AT )
)
                     {
-                        serverEntry.put( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes(
UUID.randomUUID() ) );
+                        serverEntry.put( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
                     }
 
                     // call add on the wrapped partition not on the self

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
Tue Jan 19 16:30:21 2010
@@ -539,7 +539,7 @@
     }
 
 
-    public Index<byte[], E> getEntryUuidIndex()
+    public Index<String, E> getEntryUuidIndex()
     {
         return wrappedStore.getEntryUuidIndex();
     }
@@ -593,7 +593,7 @@
     }
 
     
-    public void setEntryUuidIndex( Index<byte[], E> index ) throws Exception
+    public void setEntryUuidIndex( Index<String, E> index ) throws Exception
     {
         wrappedStore.setEntryUuidIndex( index );
     }

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
Tue Jan 19 16:30:21 2010
@@ -165,7 +165,7 @@
         ServerEntry entry = new DefaultServerEntry( schemaManager );
         entry.setDn( new LdapDN( dn ).normalize( schemaManager.getNormalizerMapping() ) );
         entry.put( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString()
);
-        entry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+        entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
         
         ClonedServerEntry clonedEntry = new ClonedServerEntry( entry );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
Tue Jan 19 16:30:21 2010
@@ -1241,7 +1241,7 @@
         attrs.add( new LDAPAttribute( "description", descr ) );
 
         UUID uuid = UUID.randomUUID();
-        attrs.add( new LDAPAttribute( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes(
uuid ) ) );
+        attrs.add( new LDAPAttribute( SchemaConstants.ENTRY_UUID_AT, uuid.toString() ) );
 
         CsnFactory csnFac = new CsnFactory( 0 );
         Csn csn = csnFac.newInstance();
@@ -1259,7 +1259,7 @@
         LDAPAttribute attr = addedEntry.getAttribute( SchemaConstants.ENTRY_UUID_AT );
         assertNotNull( attr );
         
-        assertEquals( uuid, getUUIDFromBytes( attr.getByteValueArray()[0] ) );
+        assertEquals( uuid.toString(), attr.getStringValueArray()[0] );
 
         attr = addedEntry.getAttribute( SchemaConstants.ENTRY_CSN_AT );
         assertNotNull( attr );

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
Tue Jan 19 16:30:21 2010
@@ -335,14 +335,14 @@
     /**
      * @return The EntryUUID system index
      */
-    Index<byte[],E> getEntryUuidIndex();
+    Index<String,E> getEntryUuidIndex();
 
     /**
      * Set the EntryUUID index
      * @param index The EntryUUID index
      * @throws Exception If the addition failed
      */
-    void setEntryUuidIndex( Index<byte[],E> index ) throws Exception;
+    void setEntryUuidIndex( Index<String,E> index ) throws Exception;
 
     
     /**

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
Tue Jan 19 16:30:21 2010
@@ -636,7 +636,7 @@
         attrs.add( "cn", "jane doe" );
         attrs.add( "sn", "doe" );
         attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        attrs.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( attrs );
 
         indexEntry.setId( 12L );

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
Tue Jan 19 16:30:21 2010
@@ -678,7 +678,7 @@
         attrs.add( "cn", "jane doe" );
         attrs.add( "sn", "doe" );
         attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        attrs.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( attrs );
 
         indexEntry.setId( 12L );

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
Tue Jan 19 16:30:21 2010
@@ -679,7 +679,7 @@
         attrs.add( "cn", "jd" );
         attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
         attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        attrs.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( attrs );
 
         dn = new LdapDN(
@@ -694,7 +694,7 @@
         attrs.add( "cn", "jdoe" );
         attrs.add( "sn", "doe" );
         attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        attrs.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( attrs );
 
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
Tue Jan 19 16:30:21 2010
@@ -646,7 +646,7 @@
         attrs.add( "cn", "jd" );
         attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
         attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        attrs.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( attrs );
 
         dn = new LdapDN(
@@ -661,7 +661,7 @@
         attrs.add( "cn", "jdoe" );
         attrs.add( "sn", "doe" );
         attrs.add( "entryCSN", new CsnFactory( 1  ).newInstance().toString() );
-        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
+        attrs.add( "entryUUID", UUID.randomUUID().toString() );
         store.add( attrs );
 
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,

Modified: directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
(original)
+++ directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
Tue Jan 19 16:30:21 2010
@@ -296,7 +296,7 @@
     public static void injectEntryInStore( Store<ServerEntry> store, ServerEntry entry
) throws Exception
     {
         entry.add( SchemaConstants.ENTRY_CSN_AT, CSN_FACTORY.newInstance().toString() );
-        entry.add( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID()
) );
+        entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
         
         store.add( entry );
     }

Modified: directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=apache/ou=syntaxes/m-oid=1.3.6.1.1.16.1.ldif
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/resources/schema/ou%3Dschema/cn%3Dapache/ou%3Dsyntaxes/m-oid%3D1.3.6.1.1.16.1.ldif?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=apache/ou=syntaxes/m-oid=1.3.6.1.1.16.1.ldif
(original)
+++ directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=apache/ou=syntaxes/m-oid=1.3.6.1.1.16.1.ldif
Tue Jan 19 16:30:21 2010
@@ -2,7 +2,7 @@
 dn: m-oid=1.3.6.1.1.16.1,ou=syntaxes,cn=apache,ou=schema
 createtimestamp: 20090818022727Z
 m-oid: 1.3.6.1.1.16.1
-x-humanreadable: FALSE
+x-humanreadable: TRUE
 m-obsolete: FALSE
 entrycsn: 20090818052727.133000Z#000000#000#000000
 m-description: a syntax for UUID values

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
Tue Jan 19 16:30:21 2010
@@ -32,7 +32,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class UUIDComparator extends LdapComparator<byte[]>
+public class UUIDComparator extends LdapComparator<String>
 {
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( UUIDComparator.class );
@@ -53,10 +53,9 @@
     /**
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( byte[] uuid1, byte[] uuid2 )
+    public int compare( String uuid1, String uuid2 )
     {
-        LOG.debug( "comparing UUID objects '{}' with '{}'", 
-            StringTools.dumpBytes( uuid1 ), StringTools.dumpBytes( uuid2 ) );
+        LOG.debug( "comparing UUID objects '{}' with '{}'", uuid1, uuid2 );
 
         // -------------------------------------------------------------------
         // Handle some basis cases
@@ -71,32 +70,6 @@
             return 1;
         }
         
-        if ( uuid1.length < uuid2.length )
-        {
-            return -1;
-        }
-        else if ( uuid1.length > uuid2.length )
-        { 
-            return 1;
-        }
-        
-        for ( int pos = 0; pos < uuid1.length; pos++ )
-        {
-            if ( uuid1[pos] == uuid2[pos ] )
-            {
-                continue;
-            }
-            
-            if ( uuid1[pos] < uuid2[pos] )
-            {
-                return -1;
-            }
-            else
-            {
-                return 1;
-            }
-        }
-        
-        return 0;
+        return uuid1.compareTo( uuid2 );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.java
Tue Jan 19 16:30:21 2010
@@ -41,6 +41,8 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
+    private static final String UUID_REGEX = "^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$";
+    
     /**
      * Creates a new instance of UUIDSyntaxChecker.
      */
@@ -60,17 +62,15 @@
             LOG.debug( "Syntax invalid for '{}'", value );
             return false;
         }
-        
-        if ( ! ( value instanceof byte[] ) )
+ 
+        if ( ! ( value instanceof String ) )
         {
             LOG.debug( "Syntax invalid for '{}'", value );
             return false;
         }
-        
-        byte[] uuid = (byte[])value;
-        
-        // The UUID must have a length of 16 bytes
-        if ( uuid.length != 16 )
+
+        String uuid = ( String ) value;
+        if ( ! uuid.matches( UUID_REGEX ) )
         {
             LOG.debug( "Syntax invalid for '{}'", value );
             return false;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?rev=900835&r1=900834&r2=900835&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
Tue Jan 19 16:30:21 2010
@@ -36,6 +36,7 @@
 
 import javax.naming.InvalidNameException;
 
+import org.apache.directory.shared.asn1.codec.binary.Hex;
 import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 
@@ -3721,4 +3722,34 @@
     {
         return ( ( c > 127 ) || UNICODE_SUBSET[c] );
     }
+
+
+    /**
+     * converts the bytes of a UUID to string
+     *  
+     * @param bytes bytes of a UUID
+     * @return UUID in string format
+     */
+    public static String uuidToString( byte[] bytes )
+    {
+        if ( bytes == null || bytes.length != 16 )
+        {
+            return "Invalid UUID";
+        }
+
+        char[] hex = Hex.encodeHex( bytes );
+        StringBuffer sb = new StringBuffer();
+        sb.append( hex, 0, 8 );
+        sb.append( '-' );
+        sb.append( hex, 8, 4 );
+        sb.append( '-' );
+        sb.append( hex, 12, 4 );
+        sb.append( '-' );
+        sb.append( hex, 16, 4 );
+        sb.append( '-' );
+        sb.append( hex, 20, 12 );
+
+        return sb.toString().toLowerCase();
+    }
+
 }

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=900835&r1=900834&r2=900835&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
Tue Jan 19 16:30:21 2010
@@ -69,7 +69,7 @@
             array[ i ] = (byte)i;
         }
 
-        assertTrue( checker.isValidSyntax( array ) );
+        assertTrue( checker.isValidSyntax( StringTools.uuidToString( array ) ) );
     }
 
 



Mime
View raw message