directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r482019 - in /directory/trunks: apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ apacheds/core/src/main/schema/ apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ shared/ldap/src/main/java/org...
Date Mon, 04 Dec 2006 02:55:44 GMT
Author: akarasulu
Date: Sun Dec  3 18:55:43 2006
New Revision: 482019

URL: http://svn.apache.org/viewvc?view=rev&rev=482019
Log:
committing some new primites for meta schema along with meta schema changes

Added:
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaComparatorProducer.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaNormalizerProducer.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxCheckerProducer.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxProducer.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdComparator.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdNormalizer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxChecker.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxChecker.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxCheckerTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxCheckerTest.java
Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapProducer.java
    directory/trunks/apacheds/core/src/main/schema/apache.schema
    directory/trunks/apacheds/core/src/main/schema/apachemeta.schema
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapProducer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapProducer.java?view=diff&rev=482019&r1=482018&r2=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapProducer.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapProducer.java Sun Dec  3 18:55:43 2006
@@ -97,12 +97,14 @@
         return new BootstrapObjectClass( oid, registries );
     }
 
+    
     /**
      * A mutable Syntax for the bootstrap phase that uses the
      * syntaxCheckerRegistry to dynamically resolve syntax checkers.
      */
     public static class BootstrapSyntax extends AbstractSyntax
     {
+        private static final long serialVersionUID = 1L;
         final SyntaxCheckerRegistry registry;
 
 
@@ -145,6 +147,7 @@
 
     public static class BootstrapMatchingRule extends AbstractMatchingRule
     {
+        private static final long serialVersionUID = 1L;
         final SyntaxRegistry syntaxRegistry;
         final NormalizerRegistry normalizerRegistry;
         final ComparatorRegistry comparatorRegistry;
@@ -391,6 +394,7 @@
      */
     public static class BootstrapObjectClass extends AbstractSchemaObject implements ObjectClass
     {
+        private static final long serialVersionUID = 1L;
         private final ObjectClassRegistry objectClassRegistry;
         private final AttributeTypeRegistry attributeTypeRegistry;
 

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaComparatorProducer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaComparatorProducer.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaComparatorProducer.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaComparatorProducer.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,124 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+
+/**
+ * A producer of Comparator objects for the apachemeta schema.  This code has been
+ * automatically generated using schema files in the OpenLDAP format along with
+ * the directory plugin for maven.  This has been done to facilitate
+ * OpenLDAP schema interoperability.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ApachemetaComparatorProducer extends AbstractBootstrapProducer
+{
+    public ApachemetaComparatorProducer()
+    {
+        super( ProducerTypeEnum.COMPARATOR_PRODUCER );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * @see BootstrapProducer#produce(BootstrapRegistries, ProducerCallback)
+     */
+    public void produce( BootstrapRegistries registries, ProducerCallback cb )
+        throws NamingException
+    {
+        Comparator comparator = null;
+        
+        comparator = new NameOrNumericIdComparator();
+        cb.schemaObjectProduced( this, "1.3.6.1.4.1.18060.0.4.0.1.0", comparator );
+
+        comparator = new ObjectClassTypeComparator();
+        cb.schemaObjectProduced( this, "1.3.6.1.4.1.18060.0.4.0.1.1", comparator );
+    }
+
+
+    public static class ObjectClassTypeComparator implements Comparator<Object>, Serializable
+    {
+        private static final long serialVersionUID = 1L;
+
+
+        public int compare( Object o1, Object o2 )
+        {
+            String s1 = getString( o1 );
+            String s2 = getString( o2 );
+            
+            if ( s1 == null && s2 == null )
+            {
+                return 0;
+            }
+            
+            if ( s1 == null )
+            {
+                return -1;
+            }
+            
+            if ( s2 == null )
+            {
+                return 1;
+            }
+            
+            return s1.compareTo( s2 );
+        }
+        
+        
+        String getString( Object obj )
+        {
+            String strValue;
+
+            if ( obj == null )
+            {
+                return null;
+            }
+            
+            if ( obj instanceof String )
+            {
+                strValue = ( String ) obj;
+            }
+            else if ( obj instanceof byte[] )
+            {
+                strValue = StringTools.utf8ToString( ( byte[] ) obj ); 
+            }
+            else
+            {
+                strValue = obj.toString();
+            }
+
+            return strValue;
+        }
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,123 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.Syntax;
+
+
+
+/**
+ * A producer of MatchingRule objects for the apachemeta schema.  This code has been
+ * automatically generated using schema files in the OpenLDAP format along with
+ * the directory plugin for maven.  This has been done to facilitate
+ * OpenLDAP schema interoperability.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ApachemetaMatchingRuleProducer extends AbstractBootstrapProducer
+{
+    public ApachemetaMatchingRuleProducer()
+    {
+        super( ProducerTypeEnum.MATCHING_RULE_PRODUCER );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * @see BootstrapProducer#produce(BootstrapRegistries, ProducerCallback)
+     */
+    public void produce( BootstrapRegistries registries, ProducerCallback cb )
+        throws NamingException
+    {
+        MatchingRule matchingRule = null;
+        
+        matchingRule = new ObjectClassTypeMatch();
+        cb.schemaObjectProduced( this, matchingRule.getOid(), matchingRule );
+        
+        matchingRule = new NameOrNumericIdMatch( registries.getOidRegistry() );
+        cb.schemaObjectProduced( this, matchingRule.getOid(), matchingRule );
+    }
+
+    
+    public static class ObjectClassTypeMatch implements MatchingRule
+    {
+        private static final long serialVersionUID = 1L;
+        public static final Comparator COMPARATOR = new ApachemetaComparatorProducer.ObjectClassTypeComparator(); 
+        public static final Normalizer NORMALIZER = new NoOpNormalizer();
+        public static final Syntax SYNTAX = new ApachemetaSyntaxProducer.ObjectClassTypeSyntax();
+        public static final String OID = "1.3.6.1.4.1.18060.0.4.0.1.1";
+        
+        private static final String[] NAMES = new String[] { "objectClassTypeMatch" };
+        
+        public Comparator getComparator() throws NamingException
+        {
+            return COMPARATOR;
+        }
+
+        
+        public Normalizer getNormalizer() throws NamingException
+        {
+            return NORMALIZER;
+        }
+
+        public Syntax getSyntax() throws NamingException
+        {
+            return SYNTAX;
+        }
+
+        public String getDescription()
+        {
+            return "objectClassTypeMatch: for mathing AUXILIARY, STRUCTURAL, ABSTRACT";
+        }
+
+        public String getName()
+        {
+            return NAMES[0];
+        }
+
+        public String[] getNames()
+        {
+            return NAMES;
+        }
+
+        public String getOid()
+        {
+            return OID;
+        }
+
+        public boolean isObsolete()
+        {
+            return false;
+        }
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaNormalizerProducer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaNormalizerProducer.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaNormalizerProducer.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaNormalizerProducer.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+
+
+
+/**
+ * A producer of Normalizer objects for the apachemeta schema.  This code has been
+ * automatically generated using schema files in the OpenLDAP format along with
+ * the directory plugin for maven.  This has been done to facilitate
+ * OpenLDAP schema interoperability.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ApachemetaNormalizerProducer extends AbstractBootstrapProducer
+{
+    public ApachemetaNormalizerProducer()
+    {
+        super( ProducerTypeEnum.NORMALIZER_PRODUCER );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * @see BootstrapProducer#produce(BootstrapRegistries, ProducerCallback)
+     */
+    public void produce( BootstrapRegistries registries, ProducerCallback cb )
+        throws NamingException
+    {
+        Normalizer normalizer = null;
+        
+        normalizer = new NameOrNumericIdNormalizer( registries.getOidRegistry() );
+        cb.schemaObjectProduced( this, "1.3.6.1.4.1.18060.0.4.0.1.0", normalizer );
+
+        normalizer = new NoOpNormalizer();
+        cb.schemaObjectProduced( this, "1.3.6.1.4.1.18060.0.4.0.1.1", normalizer );
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxCheckerProducer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxCheckerProducer.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxCheckerProducer.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxCheckerProducer.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.NameOrNumericIdSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
+
+
+
+/**
+ * A producer of SyntaxChecker objects for the apachemeta schema.  This code has been
+ * automatically generated using schema files in the OpenLDAP format along with
+ * the directory plugin for maven.  This has been done to facilitate
+ * OpenLDAP schema interoperability.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ApachemetaSyntaxCheckerProducer extends AbstractBootstrapProducer
+{
+    public ApachemetaSyntaxCheckerProducer()
+    {
+        super( ProducerTypeEnum.SYNTAX_CHECKER_PRODUCER );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * @see BootstrapProducer#produce(BootstrapRegistries, ProducerCallback)
+     */
+    public void produce( BootstrapRegistries registries, ProducerCallback cb )
+        throws NamingException
+    {
+        SyntaxChecker checker = null;
+        
+        checker = new NameOrNumericIdSyntaxChecker();
+        cb.schemaObjectProduced( this, NameOrNumericIdSyntaxChecker.DEFAULT_OID, checker );
+        
+        checker = new ObjectClassTypeSyntaxChecker();
+        cb.schemaObjectProduced( this, ObjectClassTypeSyntaxChecker.DEFAULT_OID, checker );
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxProducer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxProducer.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxProducer.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaSyntaxProducer.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,153 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.NameOrNumericIdSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
+
+
+
+/**
+ * A producer of Syntax objects for the apachemeta schema.  This code has been
+ * automatically generated using schema files in the OpenLDAP format along with
+ * the directory plugin for maven.  This has been done to facilitate
+ * OpenLDAP schema interoperability.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ApachemetaSyntaxProducer extends AbstractBootstrapProducer
+{
+    public ApachemetaSyntaxProducer()
+    {
+        super( ProducerTypeEnum.SYNTAX_PRODUCER );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * @see BootstrapProducer#produce(BootstrapRegistries, ProducerCallback)
+     */
+    public void produce( BootstrapRegistries registries, ProducerCallback cb )
+        throws NamingException
+    {
+        Syntax syntax = null;
+        
+        syntax = new NameOrNumericIdSyntax();
+        cb.schemaObjectProduced( this, syntax.getOid(), syntax );
+    }
+
+
+    public static class NameOrNumericIdSyntax implements Syntax
+    {
+        private static final long serialVersionUID = 1L;
+        private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.0";
+        private final static SyntaxChecker CHECKER = new NameOrNumericIdSyntaxChecker();
+        private final static String[] NAMES = new String[] { "nameOrOid" };
+        
+        public final SyntaxChecker getSyntaxChecker() throws NamingException
+        {
+            return CHECKER;
+        }
+
+        public final boolean isHumanReadible()
+        {
+            return true;
+        }
+
+        public final String getDescription()
+        {
+            return "The syntax for either numeric ids or names.";
+        }
+
+        public final String getName()
+        {
+            return NAMES[0];
+        }
+
+        public final String[] getNames()
+        {
+            return NAMES;
+        }
+
+        public final String getOid()
+        {
+            return OID;
+        }
+
+        public final boolean isObsolete()
+        {
+            return false;
+        }
+    }
+
+
+    public static class ObjectClassTypeSyntax implements Syntax
+    {
+        private static final long serialVersionUID = 1L;
+        private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.1";
+        private final static SyntaxChecker CHECKER = new ObjectClassTypeSyntaxChecker();
+        private final static String[] NAMES = new String[] { "objectClassType" };
+        
+        public final SyntaxChecker getSyntaxChecker() throws NamingException
+        {
+            return CHECKER;
+        }
+
+        public final boolean isHumanReadible()
+        {
+            return true;
+        }
+
+        public final String getDescription()
+        {
+            return "The syntax for either numeric ids or names.";
+        }
+
+        public final String getName()
+        {
+            return NAMES[0];
+        }
+
+        public final String[] getNames()
+        {
+            return NAMES;
+        }
+
+        public final String getOid()
+        {
+            return OID;
+        }
+
+        public final boolean isObsolete()
+        {
+            return false;
+        }
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdComparator.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdComparator.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdComparator.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdComparator.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,133 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.schema.OidRegistry;
+import org.apache.directory.server.core.schema.Registries;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A comparator that sorts OIDs based on their numeric id value.  Needs a 
+ * OidRegistry to properly do it's job.  Public method to set the oid 
+ * registry will be used by the server after instantiation in deserialization.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NameOrNumericIdComparator implements Comparator, Serializable
+{
+    private static final long serialVersionUID = 1L;
+    private transient OidRegistry registry;
+
+    
+    public NameOrNumericIdComparator( OidRegistry registry )
+    {
+        this.registry = registry;
+    }
+    
+    
+    public NameOrNumericIdComparator()
+    {
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Object o1, Object o2 )
+    {
+        String s1 = getNumericIdString( o1 );
+        String s2 = getNumericIdString( o2 );
+
+        if ( s1 == null && s2 == null )
+        {
+            return 0;
+        }
+        
+        if ( s1 == null )
+        {
+            return -1;
+        }
+        
+        if ( s2 == null )
+        {
+            return 1;
+        }
+        
+        return s1.compareTo( s2 );
+    }
+    
+    
+    public void setRegistries( Registries registries )
+    {
+        registry = registries.getOidRegistry();
+    }
+    
+    
+    String getNumericIdString( Object obj )
+    {
+        String strValue;
+
+        if ( obj == null )
+        {
+            return null;
+        }
+        
+        if ( obj instanceof String )
+        {
+            strValue = ( String ) obj;
+        }
+        else if ( obj instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) obj ); 
+        }
+        else
+        {
+            strValue = obj.toString();
+        }
+        
+        if ( strValue.length() == 0 )
+        {
+            return "";
+        }
+
+        if ( registry.hasOid( strValue ) )
+        {
+            try
+            {
+                return registry.getOid( strValue );
+            }
+            catch ( NamingException e )
+            {
+                e.printStackTrace();
+                throw new RuntimeException( "Failed to lookup OID for " + strValue, e );
+            }
+        }
+        
+        return strValue;
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,139 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.schema.OidRegistry;
+import org.apache.directory.server.core.schema.Registries;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.Syntax;
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NameOrNumericIdMatch implements MatchingRule
+{
+    private static final long serialVersionUID = 1L;
+    
+    private final static String[] NAMES = new String[] { "nameOrNumericIdMatch" }; 
+    private final static String OID = "1.3.6.1.4.1.18060.0.4.0.1.0";
+    private transient Normalizer normalizer;
+    private transient Comparator comparator;
+    private transient Syntax syntax;
+    
+    
+    public NameOrNumericIdMatch()
+    {
+        this.syntax = new ApachemetaSyntaxProducer.NameOrNumericIdSyntax();
+    }
+
+    
+    public NameOrNumericIdMatch( OidRegistry registry )
+    {
+        this.normalizer = new NameOrNumericIdNormalizer( registry );
+        this.comparator = new NameOrNumericIdComparator( registry );
+    }
+    
+
+    public void setRegistries( Registries registries )
+    {
+        this.normalizer = new NameOrNumericIdNormalizer( registries.getOidRegistry() );
+        this.comparator = new NameOrNumericIdComparator( registries.getOidRegistry() );
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.MatchingRule#getComparator()
+     */
+    public Comparator getComparator() throws NamingException
+    {
+        return comparator;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.MatchingRule#getNormalizer()
+     */
+    public Normalizer getNormalizer() throws NamingException
+    {
+        return normalizer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.MatchingRule#getSyntax()
+     */
+    public Syntax getSyntax() throws NamingException
+    {
+        return syntax;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SchemaObject#getDescription()
+     */
+    public String getDescription()
+    {
+        return "A name or numeric id matchingRule";
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SchemaObject#getName()
+     */
+    public String getName()
+    {
+        return NAMES[0];
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SchemaObject#getNames()
+     */
+    public String[] getNames()
+    {
+        return NAMES;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SchemaObject#getOid()
+     */
+    public String getOid()
+    {
+        return OID;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SchemaObject#isObsolete()
+     */
+    public boolean isObsolete()
+    {
+        return false;
+    }
+}

Added: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdNormalizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdNormalizer.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdNormalizer.java (added)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdNormalizer.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,103 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.schema.bootstrap;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.schema.OidRegistry;
+import org.apache.directory.server.core.schema.Registries;
+import org.apache.directory.shared.ldap.exception.LdapNamingException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A name or numeric id normalizer.  Needs an OID registry to operate properly.
+ * The OID registry is injected into this class after instantiation if a 
+ * setRegistries(Registries) method is exposed.
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NameOrNumericIdNormalizer implements Normalizer
+{
+    private static final long serialVersionUID = 1L;
+
+    private transient OidRegistry registry;
+    
+    
+    public NameOrNumericIdNormalizer( OidRegistry registry )
+    {
+        this.registry = registry;
+    }
+    
+    
+    public NameOrNumericIdNormalizer()
+    {
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.Normalizer#normalize(java.lang.Object)
+     */
+    public Object normalize( Object value ) throws NamingException
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return null;
+        }
+        
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value ); 
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return "";
+        }
+        
+        if ( registry.hasOid( strValue ) )
+        {
+            return registry.getOid( strValue );
+        }
+        
+        throw new LdapNamingException( ResultCodeEnum.OTHER );
+    }
+    
+    
+    public void setRegistries( Registries registries )
+    {
+        this.registry = registries.getOidRegistry();
+    }
+}

Modified: directory/trunks/apacheds/core/src/main/schema/apache.schema
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/schema/apache.schema?view=diff&rev=482019&r1=482018&r2=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/schema/apache.schema (original)
+++ directory/trunks/apacheds/core/src/main/schema/apache.schema Sun Dec  3 18:55:43 2006
@@ -212,7 +212,7 @@
     STRUCTURAL
     MUST ( fullyQualifiedJavaClassName $ javaClassByteCode ) )
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.23
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.23
     NAME 'classLoaderDefaultSearchContext'
     DESC 'The default search context for the Ldap Class Loader'
     SUP distinguishedName
@@ -223,19 +223,19 @@
 # Trigger related
 # ===============
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.25 NAME 'prescriptiveTriggerSpecification'
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.25 NAME 'prescriptiveTriggerSpecification'
     DESC 'Trigger specification that applies to a set of entries'
     EQUALITY directoryStringFirstComponentMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.59
     USAGE directoryOperation )
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.26 NAME 'entryTriggerSpecification'
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.26 NAME 'entryTriggerSpecification'
     DESC 'Trigger specification that applies to a single entry'
     EQUALITY directoryStringFirstComponentMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.59
     USAGE directoryOperation )
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.27 NAME 'triggerExecutionSubentries'
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.27 NAME 'triggerExecutionSubentries'
     DESC 'Used to track subentries associated with a trigger area which an entry falls under'
     SUP distinguishedName
     EQUALITY distinguishedNameMatch
@@ -243,7 +243,7 @@
     NO-USER-MODIFICATION
     USAGE directoryOperation )
 
-objectclass ( 1.2.6.1.4.1.18060.1.1.1.3.28 NAME 'triggerExecutionSubentry'
+objectclass ( 1.3.6.1.4.1.18060.0.4.1.2.28 NAME 'triggerExecutionSubentry'
     DESC 'Used to track a subentry associated with trigger areas'
     AUXILIARY
     MUST prescriptiveTriggerSpecification )
@@ -256,7 +256,7 @@
 # Mitosis Related
 # ======================
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.29
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.29
         NAME 'entryUUID'
         DESC 'LCUP/LDUP: UUID of the entry'
         EQUALITY octetStringMatch
@@ -265,7 +265,7 @@
         NO-USER-MODIFICATION 
         USAGE directoryOperation )
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.30
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.30
         NAME 'entryCSN'
         DESC 'LCUP/LDUP: change sequence number of the entry'
         EQUALITY octetStringMatch
@@ -275,7 +275,7 @@
         NO-USER-MODIFICATION 
         USAGE directoryOperation )
 
-attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.31
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.31
         NAME 'entryDeleted'
         DESC 'Whether or not an entry has been deleted.'
         EQUALITY booleanMatch

Modified: directory/trunks/apacheds/core/src/main/schema/apachemeta.schema
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/schema/apachemeta.schema?view=diff&rev=482019&r1=482018&r2=482019
==============================================================================
--- directory/trunks/apacheds/core/src/main/schema/apachemeta.schema (original)
+++ directory/trunks/apacheds/core/src/main/schema/apachemeta.schema Sun Dec  3 18:55:43 2006
@@ -23,8 +23,15 @@
 #              +------------------------------+-----------------------------+
 #              |          Syntax OID          |            name             |
 #              +------------------------------+-----------------------------+
-#              | 1.3.6.1.4.1.18060.0.4.0.0.0  | nameOrOid                   |
-#              | 1.3.6.1.4.1.18060.0.4.0.0.1  | typeObjectClass             |
+#              | 1.3.6.1.4.1.18060.0.4.0.0.0  | nameOrNumericId             |
+#              | 1.3.6.1.4.1.18060.0.4.0.0.1  | objectClassType             |
+#              +------------------------------+-----------------------------+
+#
+#              +------------------------------+-----------------------------+
+#              |       MatchingRule OID       |            name             |
+#              +------------------------------+-----------------------------+
+#              | 1.3.6.1.4.1.18060.0.4.0.1.0  | nameOrNumericIdMatch        |
+#              | 1.3.6.1.4.1.18060.0.4.0.1.1  | objectClassTypeMatch        |
 #              +------------------------------+-----------------------------+
 #
 #              +------------------------------+-----------------------------+
@@ -154,28 +161,28 @@
 # --- m-sup-objectclass AttributeType -----------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.5 NAME 'm-sup-objectclass'
     DESC 'The list of superiors'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
 )
 
 # --- m-must AttributeType ----------------------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.6 NAME 'm-must'
     DESC 'The list of mandatory ATs'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
 )
 
 # --- m-may AttributeType -----------------------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.7 NAME 'm-may'
     DESC 'The list of authorized ATs'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
 )
 
 # --- m-type-object-class AttributeType ---------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.8 NAME 'm-type-object-class'
     DESC 'The objectclass type'
-    EQUALITY typeObjectclassMatch
+    EQUALITY objectClassTypeMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.1
     SINGLE-VALUE
 )
@@ -190,7 +197,7 @@
 # --- m-sup-attribute-type AttributeType --------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.10 NAME 'm-sup-attribute-type'
     DESC 'The list of superior'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
     SINGLE-VALUE
 )
@@ -198,7 +205,7 @@
 # --- m-equality AttributeType ------------------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.11 NAME 'm-equality'
     DESC 'Equality matching rule'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
     SINGLE-VALUE
 )
@@ -206,7 +213,7 @@
 # --- m-ordering AttributeType ------------------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.12 NAME 'm-ordering'
     DESC 'Ordering matching rule'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
     SINGLE-VALUE
 )
@@ -214,7 +221,7 @@
 # --- m-substr AttributeType --------------------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.13 NAME 'm-substr'
     DESC 'Substring matching rule'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
     SINGLE-VALUE
 )
@@ -222,7 +229,7 @@
 # --- m-syntax AttributeType --------------------------------------------------
 attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.14 NAME 'm-syntax'
     DESC 'The attribute syntax'
-    EQUALITY nameOrOidMatch
+    EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.0
     SINGLE-VALUE
 )

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=482019&r1=482018&r2=482019
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java (original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Sun Dec  3 18:55:43 2006
@@ -123,9 +123,8 @@
 {
     private static final Logger log = LoggerFactory.getLogger( ReplicationService.class );
 
-    /** TODO these OID's need to be switched from safehaus to apache enterprise numbers */
-    private static final String ENTRY_CSN_OID = "1.2.6.1.4.1.18060.1.1.1.3.30";
-    private static final String ENTRY_DELETED_OID = "1.2.6.1.4.1.18060.1.1.1.3.31";
+    private static final String ENTRY_CSN_OID = "1.3.6.1.4.1.18060.0.4.1.2.30";
+    private static final String ENTRY_DELETED_OID = "1.3.6.1.4.1.18060.0.4.1.2.31";
 
     private DirectoryServiceConfiguration directoryServiceConfiguration;
     private ReplicationConfiguration configuration;

Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxChecker.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxChecker.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxChecker.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,143 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema;
+
+
+import javax.naming.NamingException;
+
+
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A SyntaxChecker which verifies that a value is either a name or a numeric id 
+ * according to RFC 4512.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NameOrNumericIdSyntaxChecker implements SyntaxChecker
+{
+    public static final String DEFAULT_OID = "1.3.6.1.4.1.18060.0.4.0.0.0";
+    private final String oid;
+    
+    
+    public NameOrNumericIdSyntaxChecker( String oid )
+    {
+        this.oid = oid;
+    }
+    
+    
+    public NameOrNumericIdSyntaxChecker()
+    {
+        this.oid = DEFAULT_OID;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#assertSyntax(java.lang.Object)
+     */
+    public void assertSyntax( Object value ) throws NamingException
+    {
+        if ( ! isValidSyntax( value ) )
+        {
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#getSyntaxOid()
+     */
+    public String getSyntaxOid()
+    {
+        return oid;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#isValidSyntax(java.lang.Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return false;
+        }
+        
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value ); 
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return false;
+        }
+        
+        // if the first character is a digit it's an attempt at an OID and must be
+        // checked to make sure there are no other chars except '.' and digits.
+        if ( Character.isDigit( strValue.charAt( 0 ) ) )
+        {
+            if ( ! org.apache.directory.shared.asn1.primitives.OID.isOID( strValue ) )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+
+        // here we just need to make sure that we have the right characters in the 
+        // string and that it starts with a letter.
+        if ( Character.isLetter( strValue.charAt( 0 ) ) )
+        {
+            final int limit = strValue.length();
+            for ( int ii = 0; ii < limit; ii++ )
+            {
+                char ch = strValue.charAt( ii );
+                
+                if ( ! Character.isLetter( ch ) && ! Character.isDigit( ch ) && ! ( '-' == ch ) )
+                {
+                    return false;
+                }
+            }
+        }
+        else
+        {
+            return false;
+        }
+        
+        return true;
+    }
+}

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java?view=diff&rev=482019&r1=482018&r2=482019
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java Sun Dec  3 18:55:43 2006
@@ -20,6 +20,8 @@
 package org.apache.directory.shared.ldap.schema;
 
 
+import java.io.Serializable;
+
 import javax.naming.NamingException;
 
 
@@ -29,7 +31,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface Normalizer
+public interface Normalizer extends Serializable
 {
     /**
      * Gets the normalized value.

Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxChecker.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxChecker.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxChecker.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,129 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A syntax checker which checks to see if an objectClass' type is either: 
+ * AUXILIARY, STRUCTURAL, or ABSTRACT.  The case is NOT ignored.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ObjectClassTypeSyntaxChecker implements SyntaxChecker
+{
+    public static final String DEFAULT_OID = "1.3.6.1.4.1.18060.0.4.0.0.1";
+    private final String oid;
+ 
+    
+    public ObjectClassTypeSyntaxChecker( String oid )
+    {
+        this.oid = oid;
+    }
+    
+    
+    public ObjectClassTypeSyntaxChecker()
+    {
+        this.oid = DEFAULT_OID;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#assertSyntax(java.lang.Object)
+     */
+    public void assertSyntax( Object value ) throws NamingException
+    {
+        if ( ! isValidSyntax( value ) )
+        {
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#getSyntaxOid()
+     */
+    public String getSyntaxOid()
+    {
+        return oid;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#isValidSyntax(java.lang.Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return false;
+        }
+        
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value ); 
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return false;
+        }
+
+        if ( strValue.length() < 8 || strValue.length() > 10 )
+        {
+            return false;
+        }
+        
+        char ch = strValue.charAt( 0 );
+        switch( ch )
+        {
+            case( 'A' ):
+                if ( strValue.equals( "AUXILIARY" ) || strValue.equals( "ABSTRACT" ) )
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            case( 'S' ):
+                return strValue.equals( "STRUCTURAL" );
+            default:
+                return false;
+        }
+    }
+}

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java?view=diff&rev=482019&r1=482018&r2=482019
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java Sun Dec  3 18:55:43 2006
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.shared.ldap.schema;
 
+import java.io.Serializable;
+
 
 /**
  * Most schema objects have some common attributes. This super interface
@@ -27,7 +29,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface SchemaObject
+public interface SchemaObject extends Serializable
 {
     /**
      * Gets whether or not this SchemaObject has been inactivated. All

Added: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxCheckerTest.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxCheckerTest.java (added)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NameOrNumericIdSyntaxCheckerTest.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,77 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema;
+
+
+import junit.framework.TestCase;
+
+
+/**
+ * A test case for the NameOrNumericId test.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NameOrNumericIdSyntaxCheckerTest extends TestCase
+{
+    NameOrNumericIdSyntaxChecker checker = new NameOrNumericIdSyntaxChecker( "1.1" );
+
+
+    public void testNullString()
+    {
+        assertFalse( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertFalse( checker.isValidSyntax( "" ) );
+    }
+
+
+    public void testOneCharString()
+    {
+        assertFalse( checker.isValidSyntax( "0" ) );
+        assertFalse( checker.isValidSyntax( "." ) );
+        assertTrue( checker.isValidSyntax( "a" ) );
+        assertFalse( checker.isValidSyntax( "-" ) );
+    }
+    
+    
+    public void testNumericIds()
+    {
+        assertFalse( checker.isValidSyntax( "111" ) );
+        assertFalse( checker.isValidSyntax( "11.a" ) );
+        assertFalse( checker.isValidSyntax( "11.1a" ) );
+        assertTrue( checker.isValidSyntax( "1.1" ) );
+        assertTrue( checker.isValidSyntax( "1.3.6.1.2.67.3.2" ) );
+    }
+    
+    
+    public void testNames()
+    {
+        assertFalse( checker.isValidSyntax( "asdf$" ) );
+        assertTrue( checker.isValidSyntax( "asdf-asdf" ) );
+        assertFalse( checker.isValidSyntax( "-asdf-asdf" ) );
+        assertTrue( checker.isValidSyntax( "A-asdf-asdf" ) );
+        assertFalse( checker.isValidSyntax( "0-asdf-asdf" ) );
+        assertTrue( checker.isValidSyntax( "A-asdf0a234sdf" ) );
+    }
+}

Added: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxCheckerTest.java?view=auto&rev=482019
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxCheckerTest.java (added)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeSyntaxCheckerTest.java Sun Dec  3 18:55:43 2006
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for ObjectClassTypeSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ObjectClassTypeSyntaxCheckerTest extends TestCase
+{
+    ObjectClassTypeSyntaxChecker checker = new ObjectClassTypeSyntaxChecker( "1.1" );
+
+
+    public void testNullString()
+    {
+        assertFalse( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertFalse( checker.isValidSyntax( "" ) );
+    }
+
+
+    public void testOneCharString()
+    {
+        assertFalse( checker.isValidSyntax( "0" ) );
+        assertFalse( checker.isValidSyntax( "." ) );
+        assertFalse( checker.isValidSyntax( "a" ) );
+        assertFalse( checker.isValidSyntax( "-" ) );
+    }
+    
+    
+    public void testWrongCase()
+    {
+        assertFalse( checker.isValidSyntax( "auxiliary" ) );
+        assertFalse( checker.isValidSyntax( "abstract" ) );
+        assertFalse( checker.isValidSyntax( "structural" ) );
+    }
+    
+    
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "AUXILIARY" ) );
+        assertTrue( checker.isValidSyntax( "ABSTRACT" ) );
+        assertTrue( checker.isValidSyntax( "STRUCTURAL" ) );
+    }
+}



Mime
View raw message