You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/08/22 14:32:31 UTC

svn commit: r806845 - in /directory/apacheds/branches/apacheds-schema: core-entry/src/main/java/org/apache/directory/server/core/entry/ core/src/main/java/org/apache/directory/server/core/partition/ core/src/main/java/org/apache/directory/server/core/s...

Author: elecharny
Date: Sat Aug 22 12:32:30 2009
New Revision: 806845

URL: http://svn.apache.org/viewvc?rev=806845&view=rev
Log:
Some fixes for Normalizer and Comparators usage (missing Oid, and such)

Modified:
    directory/apacheds/branches/apacheds-schema/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
    directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
    directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java

Modified: directory/apacheds/branches/apacheds-schema/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java Sat Aug 22 12:32:30 2009
@@ -29,7 +29,6 @@
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
 import org.apache.directory.shared.ldap.schema.AbstractMatchingRule;
-import org.apache.directory.shared.ldap.schema.AbstractSyntax;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
@@ -203,12 +202,8 @@
     {
         S s = new S( "1.1.1.1", true );
 
-        s.setSyntaxChecker( new SyntaxChecker()
+        s.setSyntaxChecker( new SyntaxChecker( "1.1.2.1" )
         {
-            public String getSyntaxOid()
-            {
-                return "1.1.1.1";
-            }
             public boolean isValidSyntax( Object value )
             {
                 if ( !( value instanceof String ) )
@@ -227,14 +222,6 @@
                 }
                 return true;
             }
-
-            public void assertSyntax( Object value ) throws NamingException
-            {
-                if ( ! isValidSyntax( value ) )
-                {
-                    throw new InvalidAttributeValueException();
-                }
-            }
         } );
 
         final MR mr = new MR( "1.1.2.1" );
@@ -302,24 +289,12 @@
 
         S s = new S( "1.1.1", true );
 
-        s.setSyntaxChecker( new SyntaxChecker()
+        s.setSyntaxChecker( new SyntaxChecker( "1.1.2" )
         {
-            public String getSyntaxOid()
-            {
-                return "1.1.1";
-            }
             public boolean isValidSyntax( Object value )
             {
                 return ((String)value == null) || (((String)value).length() < 7) ;
             }
-
-            public void assertSyntax( Object value ) throws NamingException
-            {
-                if ( ! isValidSyntax( value ) )
-                {
-                    throw new InvalidAttributeValueException();
-                }
-            }
         } );
 
         final MR mr = new MR( "1.1.2" );
@@ -334,7 +309,7 @@
             }
         };
         
-        mr.normalizer = new DeepTrimToLowerNormalizer();
+        mr.normalizer = new DeepTrimToLowerNormalizer( mr.getOid());
         
         at.setEquality( mr );
         at.setSyntax( s );
@@ -348,24 +323,12 @@
 
         S s = new S( "1.2.1", true );
 
-        s.setSyntaxChecker( new SyntaxChecker()
+        s.setSyntaxChecker( new SyntaxChecker( "1.2.1" )
         {
-            public String getSyntaxOid()
-            {
-                return "1.2.1";
-            }
             public boolean isValidSyntax( Object value )
             {
                 return ( value == null ) || ( ((byte[])value).length < 5 );
             }
-
-            public void assertSyntax( Object value ) throws NamingException
-            {
-                if ( ! isValidSyntax( value ) )
-                {
-                    throw new InvalidAttributeValueException();
-                }
-            }
         } );
 
         final MR mr = new MR( "1.2.2" );

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java Sat Aug 22 12:32:30 2009
@@ -38,6 +38,7 @@
 import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -84,13 +85,21 @@
         {
             Map<String, OidNormalizer> oidsMap = new HashMap<String, OidNormalizer>();
             
-            oidsMap.put( SchemaConstants.UID_AT, new OidNormalizer( SchemaConstants.UID_AT_OID, new NoOpNormalizer() ) );
-            oidsMap.put( SchemaConstants.USER_ID_AT, new OidNormalizer( SchemaConstants.UID_AT_OID, new NoOpNormalizer() ) );
-            oidsMap.put( SchemaConstants.UID_AT_OID, new OidNormalizer( SchemaConstants.UID_AT_OID, new NoOpNormalizer() ) );
+            // UID normalizer
+            OidNormalizer uidOidNormalizer = new OidNormalizer( "uid",
+                new NoOpNormalizer( SchemaConstants.UID_AT_OID ) );
             
-            oidsMap.put( SchemaConstants.OU_AT, new OidNormalizer( SchemaConstants.OU_AT_OID, new NoOpNormalizer()  ) );
-            oidsMap.put( SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT, new OidNormalizer( SchemaConstants.OU_AT_OID, new NoOpNormalizer()  ) );
-            oidsMap.put( SchemaConstants.OU_AT_OID, new OidNormalizer( SchemaConstants.OU_AT_OID, new NoOpNormalizer()  ) );
+            oidsMap.put( SchemaConstants.UID_AT, uidOidNormalizer );
+            oidsMap.put( SchemaConstants.USER_ID_AT, uidOidNormalizer );
+            oidsMap.put( SchemaConstants.UID_AT_OID, uidOidNormalizer );
+            
+            // OU normalizer
+            OidNormalizer ouOidNormalizer = new OidNormalizer( "ou",
+                new DeepTrimToLowerNormalizer( SchemaConstants.OU_AT_OID ) );
+            
+            oidsMap.put( SchemaConstants.OU_AT, ouOidNormalizer );
+            oidsMap.put( SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT, ouOidNormalizer );
+            oidsMap.put( SchemaConstants.OU_AT_OID,ouOidNormalizer );
 
             adminDn.normalize( oidsMap );
         }

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java Sat Aug 22 12:32:30 2009
@@ -36,7 +36,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DitContentRuleImpl extends AbstractSchemaObject implements MutableSchemaObject, DITContentRule
+public class DitContentRuleImpl extends AbstractSchemaObject implements SchemaObject, DITContentRule
 {
     private static final long serialVersionUID = 1L;
     private static final String[] EMPTY_STR_ARRAY = new String[0];

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java Sat Aug 22 12:32:30 2009
@@ -129,7 +129,7 @@
         checkNewParent( parentDn );
         checkOidIsUniqueForComparator( entry );
         
-        LdapComparator<?> comparator = factory.getComparator( entry, targetRegistries );
+        LdapComparator<?> comparator = factory.getLdapComparator( entry, targetRegistries );
         Schema schema = getSchema( name );
         
         if ( ! schema.isDisabled() )
@@ -142,7 +142,7 @@
     
     public void add( LdapComparatorDescription comparatorDescription ) throws Exception
     {
-        LdapComparator<?> comparator = factory.getComparator( comparatorDescription, targetRegistries );
+        LdapComparator<?> comparator = factory.getLdapComparator( comparatorDescription, targetRegistries );
         String schemaName = MetaSchemaConstants.SCHEMA_OTHER;
         
         if ( comparatorDescription.getExtensions().get( MetaSchemaConstants.X_SCHEMA ) != null )
@@ -201,7 +201,7 @@
         
         if ( ! schema.isDisabled() )
         {
-            LdapComparator<?> comparator = factory.getComparator( entry, targetRegistries );
+            LdapComparator<?> comparator = factory.getLdapComparator( entry, targetRegistries );
             comparatorRegistry.unregister( oldOid );
             LdapComparatorDescription comparatorDescription = getLdapComparatorDescription( schema.getSchemaName(), entry );
             comparatorDescription.changeOid( oid );
@@ -230,7 +230,7 @@
         Schema oldSchema = getSchema( oriChildName );
         Schema newSchema = getSchema( newParentName );
         
-        LdapComparator<?> comparator = factory.getComparator( entry, targetRegistries );
+        LdapComparator<?> comparator = factory.getLdapComparator( entry, targetRegistries );
 
         if ( ! oldSchema.isDisabled() )
         {
@@ -263,7 +263,7 @@
         Schema oldSchema = getSchema( oriChildName );
         Schema newSchema = getSchema( newParentName );
         
-        LdapComparator<?> comparator = factory.getComparator( entry, targetRegistries );
+        LdapComparator<?> comparator = factory.getLdapComparator( entry, targetRegistries );
         
         if ( ! oldSchema.isDisabled() )
         {

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java Sat Aug 22 12:32:30 2009
@@ -78,8 +78,7 @@
     
     private NormalizerDescription getNormalizerDescription( String schemaName, ServerEntry entry ) throws Exception
     {
-        NormalizerDescription description = new NormalizerDescription();
-        description.setNumericOid( getOid( entry ) );
+        NormalizerDescription description = new NormalizerDescription( getOid( entry ) );
         List<String> values = new ArrayList<String>();
         values.add( schemaName );
         description.addExtension( MetaSchemaConstants.X_SCHEMA, values );
@@ -207,7 +206,7 @@
             normalizerRegistry.unregister( oldOid );
             
             NormalizerDescription normalizerDescription = getNormalizerDescription( schema.getSchemaName(), entry );
-            normalizerDescription.setNumericOid( oid );
+            normalizerDescription.changeOid( oid );
             normalizerRegistry.register( normalizerDescription, normalizer );
         }
     }
@@ -243,7 +242,7 @@
         if ( ! newSchema.isDisabled() )
         {
             NormalizerDescription normalizerDescription = getNormalizerDescription( newSchema.getSchemaName(), entry );
-            normalizerDescription.setNumericOid( oid );
+            normalizerDescription.changeOid( oid );
             normalizerRegistry.register( normalizerDescription, normalizer );
         }
     }

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Sat Aug 22 12:32:30 2009
@@ -752,8 +752,7 @@
     
     private NormalizerDescription getNormalizerDescription( String schemaName, ServerEntry entry ) throws Exception
     {
-        NormalizerDescription description = new NormalizerDescription();
-        description.setNumericOid( getOid( entry ) );
+        NormalizerDescription description = new NormalizerDescription( getOid( entry ) );
         List<String> values = new ArrayList<String>();
         values.add( schemaName );
         description.addExtension( MetaSchemaConstants.X_SCHEMA, values );

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Sat Aug 22 12:32:30 2009
@@ -50,7 +50,6 @@
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.Syntax;
-import org.apache.directory.shared.ldap.schema.parsers.AbstractSchemaDescription;
 import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
 import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
@@ -163,7 +162,7 @@
     public void add( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
     {
         String schemaName = getSchema( normalizerDescription );
-        LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn=" 
+        LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getOid() + ",ou=normalizers,cn=" 
             + schemaName + ",ou=schema" );
         Entry entry = getEntry( dn, normalizerDescription );
 

Modified: directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java (original)
+++ directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java Sat Aug 22 12:32:30 2009
@@ -30,6 +30,7 @@
 import org.apache.directory.server.schema.bootstrap.ProducerTypeEnum;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator;
 import org.apache.directory.shared.ldap.schema.comparators.ComparableComparator;
 import org.apache.directory.shared.ldap.schema.comparators.IntegerOrderingComparator;
@@ -57,9 +58,9 @@
     
     public static class DeepTrimToLowerCachingNormalizingComparator extends NormalizingComparator
     {
-        public DeepTrimToLowerCachingNormalizingComparator()        
+        public DeepTrimToLowerCachingNormalizingComparator( String oid )        
         {
-            super( new CachingNormalizer( new DeepTrimToLowerNormalizer() ), new ComparableComparator() );
+            super( new CachingNormalizer( oid, new DeepTrimToLowerNormalizer( oid ) ), new ComparableComparator() );
         }
     }
 

Modified: directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java?rev=806845&r1=806844&r2=806845&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java (original)
+++ directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java Sat Aug 22 12:32:30 2009
@@ -57,9 +57,9 @@
     {
         private static final long serialVersionUID = 1L;
 
-        public CachingDeepTrimToLowerNormalizer()
+        public CachingDeepTrimToLowerNormalizer( String oid )
         {
-            super( new DeepTrimToLowerNormalizer() );
+            super( oid, new DeepTrimToLowerNormalizer( oid) );
         }
     }
     
@@ -68,9 +68,9 @@
     {
         private static final long serialVersionUID = 1L;
 
-        public CachingDeepTrimNormalizer()
+        public CachingDeepTrimNormalizer( String oid )
         {
-            super( new DeepTrimNormalizer() );
+            super( oid, new DeepTrimNormalizer( oid ) );
         }
     }
     
@@ -83,9 +83,9 @@
         private final static Class<?>[] parameterTypes = new Class<?>[] { Registries.class };
 
         
-        public CachingDnNormalizer()
+        public CachingDnNormalizer( String oid )
         {
-            super( DnNormalizer.INSTANCE );
+            super( oid, DnNormalizer.INSTANCE );
         }