directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1378571 - in /directory/shared/branches/shared-mvbt: ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/ ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/syntaxCheckers/ ldap/schema/dat...
Date Wed, 29 Aug 2012 14:19:33 GMT
Author: elecharny
Date: Wed Aug 29 14:19:32 2012
New Revision: 1378571

URL: http://svn.apache.org/viewvc?rev=1378571&view=rev
Log:
Moved from Long to UUID :
o Changed the OneAlias and SubAlias AT to use UUIDMatch instead of IntegerMatch
o Added a Strings.getUUID( Long ) method that return a UUID String from a least significant
bits
o Fixed the UuidSyntaxChecker to return true if we pass an UUID
o Changed the UuidComparator to take an UUID parameter instead of a String

Modified:
    directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
    directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/syntaxCheckers/UuidSyntaxChecker.java
    directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.5.ldif
    directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.6.ldif
    directory/shared/branches/shared-mvbt/util/src/main/java/org/apache/directory/shared/util/Strings.java

Modified: directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java?rev=1378571&r1=1378570&r2=1378571&view=diff
==============================================================================
--- directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
(original)
+++ directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
Wed Aug 29 14:19:32 2012
@@ -20,7 +20,8 @@
 package org.apache.directory.shared.ldap.model.schema.comparators;
 
 
-import org.apache.directory.shared.ldap.model.schema.LdapComparator;
+import java.util.UUID;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,7 +31,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class UuidComparator extends LdapComparator<String>
+public class UuidComparator extends SerializableComparator<UUID>
 {
     /** The serial version UID */
     private static final long serialVersionUID = 2L;
@@ -38,6 +39,8 @@ public class UuidComparator extends Ldap
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( UuidComparator.class );
 
+    public static UuidComparator INSTANCE = new UuidComparator( "1.3.6.1.1.16.4" );
+
 
     /**
      * The UUIDComparator constructor. Its OID is the UUIDMatch matching
@@ -71,4 +74,28 @@ public class UuidComparator extends Ldap
 
         return uuid1.compareTo( uuid2 );
     }
+
+
+    /**
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( UUID uuid1, UUID uuid2 )
+    {
+        LOG.debug( "comparing UUID objects '{}' with '{}'", uuid1, uuid2 );
+
+        // -------------------------------------------------------------------
+        // Handle some basis cases
+        // -------------------------------------------------------------------
+        if ( uuid1 == null )
+        {
+            return ( uuid2 == null ) ? 0 : -1;
+        }
+
+        if ( uuid2 == null )
+        {
+            return 1;
+        }
+
+        return uuid1.compareTo( uuid2 );
+    }
 }

Modified: directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/syntaxCheckers/UuidSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/syntaxCheckers/UuidSyntaxChecker.java?rev=1378571&r1=1378570&r2=1378571&view=diff
==============================================================================
--- directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/syntaxCheckers/UuidSyntaxChecker.java
(original)
+++ directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/syntaxCheckers/UuidSyntaxChecker.java
Wed Aug 29 14:19:32 2012
@@ -20,6 +20,8 @@
 package org.apache.directory.shared.ldap.model.schema.syntaxCheckers;
 
 
+import java.util.UUID;
+
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.shared.util.Strings;
@@ -61,6 +63,11 @@ public class UuidSyntaxChecker extends S
             return false;
         }
 
+        if ( value instanceof UUID )
+        {
+            return true;
+        }
+
         if ( !( value instanceof String ) )
         {
             LOG.debug( "Syntax invalid for '{}'", value );

Modified: directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.5.ldif
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou%3Dschema/cn%3Dapache/ou%3Dattributetypes/m-oid%3D1.3.6.1.4.1.18060.0.4.1.2.5.ldif?rev=1378571&r1=1378570&r2=1378571&view=diff
==============================================================================
--- directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.5.ldif
(original)
+++ directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.5.ldif
Wed Aug 29 14:19:32 2012
@@ -9,8 +9,8 @@ m-nousermodification: TRUE
 objectclass: metaAttributeType
 objectclass: metaTop
 objectclass: top
-m-syntax: 1.3.6.1.4.1.1466.115.121.1.27
+m-syntax: 1.3.6.1.1.16.1
 m-usage: DSA_OPERATION
 m-name: apacheOneAlias
 creatorsname: uid=admin,ou=system
-m-equality: integerMatch
+m-equality: uuidMatch

Modified: directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.6.ldif
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou%3Dschema/cn%3Dapache/ou%3Dattributetypes/m-oid%3D1.3.6.1.4.1.18060.0.4.1.2.6.ldif?rev=1378571&r1=1378570&r2=1378571&view=diff
==============================================================================
--- directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.6.ldif
(original)
+++ directory/shared/branches/shared-mvbt/ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.6.ldif
Wed Aug 29 14:19:32 2012
@@ -9,8 +9,8 @@ m-nousermodification: TRUE
 objectclass: metaAttributeType
 objectclass: metaTop
 objectclass: top
-m-syntax: 1.3.6.1.4.1.1466.115.121.1.27
+m-syntax: 1.3.6.1.1.16.1
 m-usage: DSA_OPERATION
 m-name: apacheSubAlias
 creatorsname: uid=admin,ou=system
-m-equality: integerMatch
+m-equality: uuidMatch

Modified: directory/shared/branches/shared-mvbt/util/src/main/java/org/apache/directory/shared/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mvbt/util/src/main/java/org/apache/directory/shared/util/Strings.java?rev=1378571&r1=1378570&r2=1378571&view=diff
==============================================================================
--- directory/shared/branches/shared-mvbt/util/src/main/java/org/apache/directory/shared/util/Strings.java
(original)
+++ directory/shared/branches/shared-mvbt/util/src/main/java/org/apache/directory/shared/util/Strings.java
Wed Aug 29 14:19:32 2012
@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.slf4j.Logger;
@@ -2183,4 +2184,16 @@ public final class Strings
     {
         return getString( data, 0, data.length, charset );
     }
+
+
+    /**
+     * Create a new UUID using a long as the least significant bits
+     * 
+     * @param value The least significant bits.
+     * @return
+     */
+    public static UUID getUUID( long value )
+    {
+        return new UUID( 0, value );
+    }
 }



Mime
View raw message