directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r883160 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/
Date Sun, 22 Nov 2009 22:28:11 GMT
Author: elecharny
Date: Sun Nov 22 22:28:10 2009
New Revision: 883160

URL: http://svn.apache.org/viewvc?rev=883160&view=rev
Log:
o Comparator constructor now can have an OID as a parameter
o Removed the INSTANCE elements
o Renamed the NameAndOptionalOIDComparator to UniqueMemberComparator

Added:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java
      - copied, changed from r882556, directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java
Removed:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameAndOptionalUIDComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java
Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/BooleanComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ByteArrayComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ComparableComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnSidComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimCachingNormalizingComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimToLowerCachingNormalizingComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/IntegerOrderingComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/LongComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NormalizingComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectClassTypeComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierFirstComponentComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/SerializableComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/StringComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/TelephoneNumberComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/BooleanComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/BooleanComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/BooleanComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/BooleanComparator.java
Sun Nov 22 22:28:10 2009
@@ -19,9 +19,6 @@
  */
 package org.apache.directory.shared.ldap.schema.comparators;
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,16 +38,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new BooleanComparator();
-
     /**
      * The BooleanComparator constructor. Its OID is the BooleanMatch matching
      * rule OID.
      */
-    public BooleanComparator()
+    public BooleanComparator( String oid )
     {
-        super( SchemaConstants.BOOLEAN_MATCH_MR_OID );
+        super( oid );
     }
 
     /**

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ByteArrayComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ByteArrayComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ByteArrayComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ByteArrayComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -43,16 +40,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<byte[]> INSTANCE = new ByteArrayComparator();
-
     /**
      * The ByteArrayComparator constructor. Its OID is the OctetStringMatch matching
      * rule OID.
      */
-    public ByteArrayComparator()
+    public ByteArrayComparator( String oid )
     {
-        super( SchemaConstants.OCTET_STRING_MATCH_MR_OID );
+        super( oid );
     }
 
     /**

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ComparableComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ComparableComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ComparableComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ComparableComparator.java
Sun Nov 22 22:28:10 2009
@@ -42,15 +42,6 @@
     private static final long serialVersionUID = 1L;
 
     /**
-     * The ComparableComparator constructor. The OID has to be created later.
-     */
-    public ComparableComparator()
-    {
-        super( null );
-    }
-
-    
-    /**
      * The BooleanComparator constructor. Its OID is the BooleanMatch matching
      * rule OID.
      */

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.csn.Csn;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.slf4j.Logger;
@@ -49,17 +46,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new CsnComparator();
-    
-    
     /**
      * The CsnComparator constructor. Its OID is the CsnMatch matching
      * rule OID.
      */
-    public CsnComparator()
+    public CsnComparator( String oid )
     {
-        super( SchemaConstants.CSN_MATCH_MR_OID );
+        super( oid );
     }
 
 

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnSidComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnSidComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnSidComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/CsnSidComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,17 +41,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new CsnSidComparator();
-    
-    
     /**
      * The CsnSidComparator constructor. Its OID is the CsnSidMatch matching
      * rule OID.
      */
-    public CsnSidComparator()
+    public CsnSidComparator( String oid )
     {
-        super( SchemaConstants.CSN_SID_MATCH_MR_OID );
+        super( oid );
     }
     
     

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimCachingNormalizingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimCachingNormalizingComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimCachingNormalizingComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimCachingNormalizingComparator.java
Sun Nov 22 22:28:10 2009
@@ -35,9 +35,9 @@
     private static final long serialVersionUID = -3462901701103045845L;
 
     
-    public DeepTrimCachingNormalizingComparator()
+    public DeepTrimCachingNormalizingComparator( String oid )
     {
-        super( new CachingNormalizer( new DeepTrimNormalizer(), 10 ), 
-            new ComparableComparator() );
+        super( oid, new CachingNormalizer( new DeepTrimNormalizer( oid ), 10 ), 
+            new ComparableComparator( oid ) );
     }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimToLowerCachingNormalizingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimToLowerCachingNormalizingComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimToLowerCachingNormalizingComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DeepTrimToLowerCachingNormalizingComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.normalizers.CachingNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 
@@ -35,9 +36,20 @@
     private static final long serialVersionUID = -3462901701103045845L;
 
     
-    public DeepTrimToLowerCachingNormalizingComparator()
+    public DeepTrimToLowerCachingNormalizingComparator( String oid )
     {
-        super( new CachingNormalizer( new DeepTrimToLowerNormalizer(), 10 ), 
-            new ComparableComparator() );
+        super( oid, new CachingNormalizer( new DeepTrimToLowerNormalizer( oid ), 10 ), 
+            new ComparableComparator( oid ) );
     }
+    
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSchemaManager( SchemaManager schemaManager )
+    {
+        super.setSchemaManager( schemaManager );
+    }
+    
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java
Sun Nov 22 22:28:10 2009
@@ -25,6 +25,7 @@
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -35,11 +36,18 @@
  */
 public class DnComparator extends LdapComparator<Object>
 {
-    public DnComparator()
+    /** A reference to the schema manager */ 
+    private transient SchemaManager schemaManager;
+    
+    public DnComparator( String oid )
     {
+        super( oid );
     }
     
     
+    /**
+     * {@inheritDoc}
+     */
     public int compare( Object obj0, Object obj1 ) 
     {
         LdapDN dn0 = null;
@@ -88,4 +96,13 @@
         
         return dn;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSchemaManager( SchemaManager schemaManager )
+    {
+        this.schemaManager = schemaManager;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/IntegerOrderingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/IntegerOrderingComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/IntegerOrderingComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/IntegerOrderingComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,11 +20,7 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
-import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,17 +38,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new IntegerOrderingComparator();
-    
-
     /**
      * The IntegerOrderingComparator constructor. Its OID is the IntegerOrderingMatch matching
      * rule OID.
      */
-    public IntegerOrderingComparator()
+    public IntegerOrderingComparator( String oid )
     {
-        super( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        super( oid );
     }
 
     
@@ -97,15 +89,4 @@
         // are dealing with booleans.
         return ( b1 > b2 ? 1 : -1 );
     }
-    
-    
-    /**
-     * Sets the SchemaManager
-     * 
-     * @param schemaManager The SchemaManager
-     */
-    public void setSchemaManager( SchemaManager schemaManager )
-    {
-        super.setSchemaManager( schemaManager ); 
-    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/LongComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/LongComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/LongComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/LongComparator.java
Sun Nov 22 22:28:10 2009
@@ -31,13 +31,19 @@
  */
 public class LongComparator extends LdapComparator<Long>
 {
-    /** A instance of this comparator */
-    public static final LongComparator INSTANCE = new LongComparator();
-
     /**
      * Version id for serialization.
      */
     static final long serialVersionUID = 1L;
+    
+    /**
+     * The LongComparator constructor. Its OID is the IntegerOrderingMatch matching
+     * rule OID.
+     */
+    public LongComparator( String oid )
+    {
+        super( oid );
+    }
 
 
     /**

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NormalizingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NormalizingComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NormalizingComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NormalizingComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,12 +20,12 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator; 
+import java.util.Comparator;
+
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,7 +37,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class NormalizingComparator extends LdapComparator<String>
+/* no qualifier*/ class NormalizingComparator extends LdapComparator<String>
 {
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( NormalizingComparator.class
);
@@ -58,8 +58,9 @@
      * @param normalizer the Normalizer to normalize values with before comparing
      * @param comparator the underlying comparator to use for comparisons
      */
-    public NormalizingComparator( Normalizer normalizer, LdapComparator<String> comparator
)
+    public NormalizingComparator( String oid, Normalizer normalizer, LdapComparator<String>
comparator )
     {
+        super( oid );
         this.normalizer = normalizer;
         this.comparator = comparator;
     }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectClassTypeComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectClassTypeComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectClassTypeComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectClassTypeComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,6 +20,11 @@
     private static final long serialVersionUID = 1L;
 
     
+    public ObjectClassTypeComparator( String oid )
+    {
+        super( oid );
+    }
+    
     public int compare( T o1, T o2 )
     {
         String s1 = getString( o1 );

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,18 +39,14 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-
-    /** A static instance of this comparator */
-    public static final Comparator<Object> INSTANCE = new ObjectIdentifierComparator();
-    
     
     /**
      * The ObjectIdentifierComparator constructor. Its OID is the ObjectIdentifierMatch matching
      * rule OID.
      */
-    public ObjectIdentifierComparator()
+    public ObjectIdentifierComparator( String oid )
     {
-        super( SchemaConstants.OBJECT_IDENTIFIER_MATCH_MR_OID );
+        super( oid );
     }
 
     

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierFirstComponentComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierFirstComponentComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierFirstComponentComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierFirstComponentComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,10 +20,7 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
 import org.apache.directory.shared.asn1.primitives.OID;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -44,17 +41,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new ObjectIdentifierFirstComponentComparator();
-    
-    
     /**
      * The ObjectIdentifierFirstComponentComparator constructor. Its OID is the 
      * ObjectIdentifierFirstComponentMatch matching rule OID.
      */
-    public ObjectIdentifierFirstComponentComparator()
+    public ObjectIdentifierFirstComponentComparator( String oid )
     {
-        super( SchemaConstants.OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCH_MR_OID );
+        super( oid );
     }
 
     

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/SerializableComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/SerializableComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/SerializableComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/SerializableComparator.java
Sun Nov 22 22:28:10 2009
@@ -45,12 +45,16 @@
     
     /** the transient wrapped comparator */
     private transient Comparator<E> wrapped;
+
+    /** A reference to the schema manager */ 
+    private transient SchemaManager schemaManager;
     
     // ------------------------------------------------------------------------
     // C O N T R U C T O R S
     // ------------------------------------------------------------------------
     public SerializableComparator( String matchingRuleOid )
     {
+        super( matchingRuleOid );
         this.matchingRuleOid = matchingRuleOid;
     }
 

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/StringComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/StringComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/StringComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/StringComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,16 +39,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new StringComparator();
-
     /**
      * The StringComparator constructor. Its OID is the StringMatch matching
      * rule OID.
      */
-    public StringComparator()
+    public StringComparator( String oid )
     {
-        super( SchemaConstants.CASE_EXACT_MATCH_MR_OID );
+        super( oid );
     }
 
     /**

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/TelephoneNumberComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/TelephoneNumberComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/TelephoneNumberComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/TelephoneNumberComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,17 +42,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<String> INSTANCE = new TelephoneNumberComparator();
-    
-    
     /**
      * The TelephoneNumberComparator constructor. Its OID is the TelephoneNumberMatch matching
      * rule OID.
      */
-    public TelephoneNumberComparator()
+    public TelephoneNumberComparator( String oid )
     {
-        super( SchemaConstants.TELEPHONE_NUMBER_MATCH_MR_OID );
+        super( oid );
     }
 
     

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java?rev=883160&r1=883159&r2=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UUIDComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import java.util.Comparator;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -43,17 +40,13 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A static instance of this comparator */
-    public static final Comparator<byte[]> INSTANCE = new UUIDComparator();
-    
-    
     /**
      * The UUIDComparator constructor. Its OID is the UUIDMatch matching
      * rule OID.
      */
-    public UUIDComparator()
+    public UUIDComparator( String oid )
     {
-        super( SchemaConstants.UUID_MATCH_MR_OID );
+        super( oid );
     }
 
     

Copied: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java
(from r882556, directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java?p2=directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java&p1=directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java&r1=882556&r2=883160&rev=883160&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java
Sun Nov 22 22:28:10 2009
@@ -20,9 +20,10 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.ldap.schema.LdapComparator;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -36,36 +37,25 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class NameOrNumericIdComparator extends LdapComparator<String>
+public class UniqueMemberComparator extends LdapComparator<String>
 {
     /** A logger for this class */
-    private static final Logger LOG = LoggerFactory.getLogger( NameOrNumericIdComparator.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( UniqueMemberComparator.class
);
 
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** A reference to the global registries */ 
-    private transient Registries registries;
+    /** A reference to the schema manager */ 
+    private transient SchemaManager schemaManager;
 
     
     /**
      * The IntegerOrderingComparator constructor. Its OID is the IntegerOrderingMatch matching
      * rule OID.
      */
-    public NameOrNumericIdComparator( Registries registries )
-    {
-        super( SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID );
-        this.registries = registries;
-    }
-    
-    
-    /**
-     * The IntegerOrderingComparator constructor. Its OID is the IntegerOrderingMatch matching
-     * rule OID.
-     */
-    public NameOrNumericIdComparator()
+    public UniqueMemberComparator( String oid )
     {
-        super( SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID );
+        super( oid );
     }
     
     
@@ -94,15 +84,18 @@
         
         return s1.compareTo( s2 );
     }
-    
-    
-    public void setRegistries( Registries registries )
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSchemaManager( SchemaManager schemaManager )
     {
-        this.registries = registries;
+        this.schemaManager = schemaManager;
     }
+
     
-    
-    String getNumericIdString( Object obj )
+    private String getNumericIdString( Object obj )
     {
         String strValue;
 
@@ -129,7 +122,96 @@
             return "";
         }
 
-        String oid = registries.getOid( strValue );
+        String oid = null;
+        
+        // First check in the global OID
+        if ( schemaManager.getOidRegistry().hasOid( oid ) )
+        {
+            oid = strValue;
+        }
+        else
+        {
+            // Now check in all the registries
+            // The AttributeType registry
+            try
+            {
+                oid = schemaManager.getAttributeTypeRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+
+            // The DITContentRule registry
+            try
+            {
+                oid = schemaManager.getDITContentRuleRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+
+            // The DITStructureRule registry
+            try
+            {
+                oid = schemaManager.getDITStructureRuleRegistry().getOidByName( strValue
);
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+        
+            // The MatchingRule registry
+            try
+            {
+                oid = schemaManager.getMatchingRuleRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+
+            // The MatchingRuleUse registry
+            try
+            {
+                oid = schemaManager.getMatchingRuleUseRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+
+            // The NameForm registry
+            try
+            {
+                oid = schemaManager.getNameFormRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+
+            // The ObjectClass registry
+            try
+            {
+                oid = schemaManager.getObjectClassRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+
+            // The Syntax registry
+            try
+            {
+                oid = schemaManager.getLdapSyntaxRegistry().getOidByName( strValue );
+            }
+            catch ( NamingException ne )
+            {
+                // Not found...
+            }
+        }
         
         if ( oid != null )
         {



Mime
View raw message