directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r503986 - in /directory/apacheds/trunk: constants/src/main/java/org/apache/directory/server/constants/ core/src/main/java/org/apache/directory/server/core/schema/ core/src/main/java/org/apache/directory/server/core/schema/subentry/ schema-b...
Date Tue, 06 Feb 2007 05:06:18 GMT
Author: akarasulu
Date: Mon Feb  5 21:06:17 2007
New Revision: 503986

URL: http://svn.apache.org/viewvc?view=rev&rev=503986
Log:
changes ...
 
 o added implementation beands for matchingRuleUse, nameForms and both structure
   rule beans
 o added code to handle entity adds
 o added some doco to apachemeta schema
 o started using more parsers for descriptions 


Added:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitStructureRuleImpl.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleUseImpl.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/NameFormImpl.java
Removed:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/subentry/
Modified:
    directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java
    directory/apacheds/trunk/schema-bootstrap/src/main/schema/apachemeta.schema

Modified: directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java (original)
+++ directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java Mon Feb  5 21:06:17 2007
@@ -36,5 +36,13 @@
     public static final String CREAT_TIMESTAMP_AT = "createTimestamp";
     public static final String MODIFY_TIMESTAMP_AT = "modifyTimestamp";
     public static final String MODIFIERS_NAME_AT = "modifiersName";
-    
+
+    public static final String LDAP_SYNTAXES_AT = "ldapSyntaxes";
+    public static final String MATCHING_RULES_AT = "matchingRules";
+    public static final String ATTRIBUTE_TYPES_AT = "attributeTypes";
+    public static final String OBJECT_CLASSES_AT = "objectClasses";
+    public static final String MATCHING_RULE_USE_AT = "matchingRuleUse";
+    public static final String DIT_STRUCTURE_RULES_AT = "ditStructureRules";
+    public static final String DIT_CONTENT_RULES_AT = "ditContentRules";
+    public static final String NAME_FORMS_AT = "nameForms";
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java Mon Feb  5 21:06:17 2007
@@ -106,6 +106,12 @@
     }
     
     
+    protected String getSchemaName( LdapDN name ) throws NamingException
+    {
+        return MetaSchemaUtils.getSchemaName( name );
+    }
+    
+    
     protected Schema getSchema( LdapDN name ) throws NamingException
     {
         return loader.getSchema( MetaSchemaUtils.getSchemaName( name ) );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Mon Feb  5 21:06:17 2007
@@ -19,17 +19,44 @@
  */
 package org.apache.directory.server.core.schema;
 
+
 import java.text.ParseException;
+import java.util.List;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.NameForm;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.DITContentRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.DITStructureRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleUseDescription;
+import org.apache.directory.shared.ldap.schema.syntax.NameFormDescription;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 import org.apache.directory.shared.ldap.schema.syntax.parser.AttributeTypeDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.DITContentRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.DITStructureRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.LdapSyntaxDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleUseDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.NameFormDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.parser.ObjectClassDescriptionSchemaParser;
+
 
 /**
  * Document me!
@@ -40,55 +67,359 @@
 public class DescriptionParsers
 {
     private static final String OTHER_SCHEMA = "other";
+    private static final String[] EMPTY = new String[0];
+
+    // TODO put these into an interface in the apacheds-constants project 
     private static final String X_SCHEMA = "X-SCHEMA";
-    private final AttributeTypeDescriptionSchemaParser attributeTypeParser = new AttributeTypeDescriptionSchemaParser();
+    private static final Object X_IS_HUMAN_READABLE = "X-IS-HUMAN-READABLE";
+
     private final Registries globalRegistries;
     
+    private final LdapSyntaxDescriptionSchemaParser syntaxParser =
+        new LdapSyntaxDescriptionSchemaParser();
+    private final MatchingRuleDescriptionSchemaParser matchingRuleParser =
+        new MatchingRuleDescriptionSchemaParser();
+    private final AttributeTypeDescriptionSchemaParser attributeTypeParser = 
+        new AttributeTypeDescriptionSchemaParser();
+    private final ObjectClassDescriptionSchemaParser objectClassParser = 
+        new ObjectClassDescriptionSchemaParser();
+    private final MatchingRuleUseDescriptionSchemaParser matchingRuleUseParser = 
+        new MatchingRuleUseDescriptionSchemaParser();
+    private final DITStructureRuleDescriptionSchemaParser ditStructureRuleParser =
+        new DITStructureRuleDescriptionSchemaParser();
+    private final DITContentRuleDescriptionSchemaParser ditContentRuleParser =
+        new DITContentRuleDescriptionSchemaParser();
+    private final NameFormDescriptionSchemaParser nameFormParser =
+        new NameFormDescriptionSchemaParser();
+    
     
     public DescriptionParsers( Registries globalRegistries )
     {
         this.globalRegistries = globalRegistries;
     }
     
-    private static final String[] EMPTY = new String[0];
-    public AttributeType parseAttributeType( Attribute attr ) throws NamingException
+    
+    public AttributeType[] parseAttributeTypes( Attribute attr ) throws NamingException
+    {
+        AttributeType[] attributeTypes = new AttributeType[attr.size()];
+        
+        for ( int ii = 0; ii < attr.size(); ii++ )
+        {
+            AttributeTypeDescription desc = null;
+            
+            try
+            {
+                desc = attributeTypeParser.parseAttributeTypeDescription( ( String ) attr.get( ii ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the attributeTypeDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            AttributeTypeImpl at = new AttributeTypeImpl( desc.getNumericOid(), globalRegistries );
+            at.setCanUserModify( desc.isUserModifiable() );
+            at.setCollective( desc.isCollective() );
+            at.setEqualityOid( desc.getEqualityMatchingRule() );
+            at.setOrderingOid( desc.getOrderingMatchingRule() );
+            at.setSingleValue( desc.isSingleValued() );
+            at.setSubstrOid( desc.getSubstringsMatchingRule() );
+            at.setSuperiorOid( desc.getSuperType() );
+            at.setSyntaxOid( desc.getSyntax() );
+            at.setUsage( desc.getUsage() );
+            
+            setSchemaObjectProperties( desc, at );
+
+            attributeTypes[ii] = at;
+        }
+        
+        return attributeTypes;
+    }
+    
+    
+    public ObjectClass[] parseObjectClasses( Attribute attr ) throws NamingException
+    {
+        ObjectClass[] objectClasses = new ObjectClass[attr.size()];
+        
+        for ( int ii = 0; ii < attr.size(); ii++ )
+        {
+            ObjectClassDescription desc = null;
+            
+            try
+            {
+                desc = objectClassParser.parseObjectClassDescription( ( String ) attr.get( ii ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the objectClassDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+         
+            ObjectClassImpl oc = new ObjectClassImpl( desc.getNumericOid(), globalRegistries );
+            oc.setMayListOids( desc.getMayAttributeTypes().toArray( EMPTY) );
+            oc.setMustListOids( desc.getMustAttributeTypes().toArray( EMPTY ) );
+            oc.setSuperClassOids( desc.getSuperiorObjectClasses().toArray( EMPTY ) );
+            oc.setType( desc.getKind() );
+            setSchemaObjectProperties( desc, oc );
+            
+            objectClasses[ii] = oc;
+        }
+        
+        return objectClasses;
+    }
+
+
+    public MatchingRuleUse[] parseMatchingRuleUses( Attribute attr ) throws NamingException
+    {
+        MatchingRuleUse[] matchingRuleUses = new MatchingRuleUse[attr.size()];
+        
+        for ( int ii = 0; ii < attr.size(); ii++ )
+        {
+            MatchingRuleUseDescription desc = null;
+            
+            try
+            {
+                desc = matchingRuleUseParser.parseMatchingRuleUseDescription( ( String ) attr.get( ii ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the matchingRuleUseDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            MatchingRuleUseImpl mru = new MatchingRuleUseImpl( desc.getNumericOid(), globalRegistries );
+            mru.setApplicableAttributesOids( desc.getApplicableAttributes().toArray( EMPTY ) );
+            setSchemaObjectProperties( desc, mru );
+            
+            matchingRuleUses[ii] = mru;
+        }
+
+        return matchingRuleUses;
+    }
+
+
+    public Syntax[] parseSyntaxes( Attribute attr ) throws NamingException
+    {
+        Syntax[] syntaxes = new Syntax[attr.size()];
+        
+        for ( int ii = 0; ii < attr.size(); ii++ )
+        {
+            LdapSyntaxDescription desc = null;
+            
+            try
+            {
+                desc = syntaxParser.parseLdapSyntaxDescription( ( String ) attr.get( ii ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the ldapSyntaxDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            SyntaxImpl syntax = new SyntaxImpl( desc.getNumericOid(), globalRegistries.getSyntaxCheckerRegistry() );
+            setSchemaObjectProperties( desc, syntax );
+            syntax.setHumanReadible( isHumanReadable( desc ) );
+            syntaxes[ii] = syntax;
+        }
+        
+        return syntaxes;
+    }
+
+
+    public MatchingRule[] parseMatchingRules( Attribute attr ) throws NamingException
     {
-        AttributeTypeDescription desc = null;
+        MatchingRule[] matchingRules = new MatchingRule[attr.size()];
+
+        for ( int ii = 0; ii < attr.size(); ii++ )
+        {
+            MatchingRuleDescription desc = null;
+
+            try
+            {
+                desc = matchingRuleParser.parseMatchingRuleDescription( ( String ) attr.get( ii ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the matchingRuleDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            MatchingRuleImpl mr = new MatchingRuleImpl( desc.getNumericOid(), desc.getSyntax(), globalRegistries );
+            setSchemaObjectProperties( desc, mr );
+            
+            matchingRules[ii] = mr;
+        }
         
-        try
+        return matchingRules;
+    }
+    
+
+    public DITStructureRule[] parseDitStructureRules( Attribute attr ) throws NamingException
+    {
+        DITStructureRule[] ditStructureRules = new DITStructureRule[attr.size()];
+        
+        for ( int ii = 0; ii < attr.size(); ii++ )
         {
-            desc = attributeTypeParser.parseAttributeTypeDescription( ( String ) attr.get() );
+            DITStructureRuleDescription desc = null;
+     
+            try
+            {
+                desc = ditStructureRuleParser.parseDITStructureRuleDescription( ( String ) attr.get( ii  ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the ditStructureRuleDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            DitStructureRuleImpl dsr = new DitStructureRuleImpl( desc.getNumericOid(), globalRegistries );
+            dsr.setNameFormOid( desc.getForm() );
+            setSchemaObjectProperties( desc, dsr );
+            
+            // got a problem here
+            // dsr.setSuperClassOids( desc.get )
+            
+            ditStructureRules[ii] = dsr;
         }
-        catch ( ParseException e )
+        
+        // return ditStructureRules;
+        
+        throw new NotImplementedException( "Don't know how to convert desc to object - object may be wrong" );
+    }
+
+    
+    public DITContentRule[] parseDitContentRules( Attribute attr ) throws NamingException
+    {
+        DITContentRule[] ditContentRules = new DITContentRule[attr.size()];
+        
+        for ( int ii = 0; ii < attr.size(); ii++ )
         {
-            throw new LdapInvalidAttributeValueException( 
-                "The following does not conform to the attributeTypeDescription syntax: " + attr.get(), 
-                ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+            DITContentRuleDescription desc = null;
+     
+            try
+            {
+                desc = ditContentRuleParser.parseDITContentRuleDescription( ( String ) attr.get( ii  ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the ditContentRuleDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            DitContentRuleImpl dcr = new DitContentRuleImpl( desc.getNumericOid(), globalRegistries );
+            dcr.setAuxObjectClassOids( desc.getAuxiliaryObjectClasses().toArray( EMPTY ) );
+            dcr.setMayNameOids( desc.getMayAttributeTypes().toArray( EMPTY ) );
+            dcr.setMustNameOids( desc.getMustAttributeTypes().toArray( EMPTY ) );
+            dcr.setNotNameOids( desc.getNotAttributeTypes().toArray( EMPTY ) );
+            
+            setSchemaObjectProperties( desc, dcr );
+
+            ditContentRules[ii] = dcr;
         }
         
-        AttributeTypeImpl at = new AttributeTypeImpl( desc.getNumericOid(), globalRegistries );
-        at.setCanUserModify( desc.isUserModifiable() );
-        at.setCollective( desc.isCollective() );
-        at.setDescription( desc.getDescription() );
-        at.setEqualityOid( desc.getEqualityMatchingRule() );
-        at.setNames( ( String [] ) desc.getNames().toArray( EMPTY ) );
-        at.setObsolete( desc.isObsolete() );
-        at.setOrderingOid( desc.getOrderingMatchingRule() );
-        at.setSingleValue( desc.isSingleValued() );
-        at.setSubstrOid( desc.getSubstringsMatchingRule() );
-        at.setSuperiorOid( desc.getSuperType() );
-        at.setSyntaxOid( desc.getSyntax() );
-        at.setUsage( desc.getUsage() );
+        return ditContentRules;
+    }
+
+    
+    public NameForm[] parseNameForms( Attribute attr ) throws NamingException
+    {
+        NameForm[] nameForms = new NameForm[attr.size()];
         
-        if ( desc.getExtensions().get( X_SCHEMA ) != null )
+        for ( int ii = 0; ii < attr.size(); ii++ )
         {
-            at.setSchema( desc.getExtensions().get( X_SCHEMA ).get( 0 ) );
+            NameFormDescription desc = null;
+            
+            try
+            {
+                desc = nameFormParser.parseNameFormDescription( ( String  ) attr.get( ii ) );
+            }
+            catch ( ParseException e )
+            {
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
+                    "The following does not conform to the nameFormDescription syntax: " + attr.get( ii ), 
+                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+                iave.setRootCause( e );
+                throw iave;
+            }
+            
+            NameFormImpl nf = new NameFormImpl( desc.getNumericOid(), globalRegistries );
+            nf.setMayUseOids( desc.getMayAttributeTypes().toArray( EMPTY ) );
+            nf.setMustUseOids( desc.getMustAttributeTypes().toArray( EMPTY ) );
+            nf.setObjectClassOid( desc.getStructuralObjectClass() );
+            
+            setSchemaObjectProperties( desc, nf );
+            
+            nameForms[ii] = nf;
+        }
+        
+        return nameForms;
+    }
+    
+    
+    private void setSchemaObjectProperties( AbstractSchemaDescription desc, MutableSchemaObject obj )
+    {
+        obj.setDescription( desc.getDescription() );
+        obj.setObsolete( desc.isObsolete() );
+        obj.setSchema( getSchema( desc ) );
+        obj.setNames( desc.getNames().toArray( EMPTY ) );
+    }
+    
+    
+    private boolean isHumanReadable( LdapSyntaxDescription desc )
+    {
+        List<String> values = desc.getExtensions().get( X_IS_HUMAN_READABLE );
+        
+        if ( values == null || values.size() == 0 )
+        {
+            return false;
         }
         else
         {
-            at.setSchema( OTHER_SCHEMA );
+            String value = values.get( 0 );
+            if ( value.equals( "TRUE" ) )
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
         }
+    }
+    
+    
+    String getSchema( AbstractSchemaDescription desc ) 
+    {
+        List<String> values = desc.getExtensions().get( X_SCHEMA );
         
-        return at;
+        if ( values == null )
+        {
+            return OTHER_SCHEMA;
+        }
+        else 
+        {
+            return values.get( 0 );
+        }
     }
 }

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java?view=auto&rev=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitContentRuleImpl.java Mon Feb  5 21:06:17 2007
@@ -0,0 +1,236 @@
+/*
+ *  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;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.AbstractSchemaObject;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+
+
+/**
+ * A DitContentRule bean implementation that uses a registries object to dynamically
+ * resolve it's dependencies.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DitContentRuleImpl extends AbstractSchemaObject implements MutableSchemaObject, DITContentRule
+{
+    private static final long serialVersionUID = 1L;
+    private static final String[] EMPTY_STR_ARRAY = new String[0];
+    private static final ObjectClass[] EMPTY_OC_ARRAY = new ObjectClass[0];
+    private static final AttributeType[] EMPTY_ATTR_ARRAY = new AttributeType[0];
+
+    private final Registries registries;
+    
+    private String[] auxObjectClassOids = EMPTY_STR_ARRAY;
+    private ObjectClass[] auxObjectClasses = EMPTY_OC_ARRAY;
+    
+    private String[] mustNameOids = EMPTY_STR_ARRAY;
+    private AttributeType[] mustNames = EMPTY_ATTR_ARRAY;
+    
+    private String[] mayNameOids = EMPTY_STR_ARRAY;
+    private AttributeType[] mayNames = EMPTY_ATTR_ARRAY;
+    
+    private String[] notNameOids = EMPTY_STR_ARRAY;
+    private AttributeType[] notNames = EMPTY_ATTR_ARRAY;
+    
+    
+    protected DitContentRuleImpl( String oid, Registries registries )
+    {
+        super( oid );
+        this.registries = registries;
+    }
+
+    
+    public void setAuxObjectClassOids( String[] auxObjectClassOids )
+    {
+        if ( auxObjectClassOids == null )
+        {
+            this.auxObjectClassOids = EMPTY_STR_ARRAY;
+            this.auxObjectClasses = EMPTY_OC_ARRAY;
+        }
+        else
+        {
+            this.auxObjectClassOids = auxObjectClassOids;
+            this.auxObjectClasses = new ObjectClass[auxObjectClassOids.length];
+        }
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITContentRule#getAuxObjectClasses()
+     */
+    public ObjectClass[] getAuxObjectClasses() throws NamingException
+    {
+        if ( auxObjectClassOids == null || auxObjectClassOids.length == 0 )
+        {
+            return EMPTY_OC_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < auxObjectClassOids.length; ii++ )
+        {
+            auxObjectClasses[ii] = registries.getObjectClassRegistry().lookup( auxObjectClassOids[ii] );
+        }
+        
+        return auxObjectClasses;
+    }
+
+    
+    public void setMayNameOids( String[] mayNameOids )
+    {
+        if ( mayNameOids == null )
+        {
+            this.mayNameOids = EMPTY_STR_ARRAY;
+            this.mayNames = EMPTY_ATTR_ARRAY;
+        }
+        else
+        {
+            this.mayNameOids = mayNameOids;
+            this.mayNames = new AttributeType[mayNameOids.length];
+        }
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITContentRule#getMayNames()
+     */
+    public AttributeType[] getMayNames() throws NamingException
+    {
+        if ( mayNameOids == null || mayNameOids.length == 0 )
+        {
+            return EMPTY_ATTR_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < mayNameOids.length; ii++ )
+        {
+            mayNames[ii] = registries.getAttributeTypeRegistry().lookup( mayNameOids[ii] );
+        }
+        
+        return mayNames;
+    }
+
+    
+    public void setMustNameOids( String[] mustNameOids )
+    {
+        if ( mustNameOids == null )
+        {
+            this.mustNameOids = EMPTY_STR_ARRAY;
+            this.mustNames = EMPTY_ATTR_ARRAY;
+        }
+        else
+        {
+            this.mustNameOids = mustNameOids;
+            this.mustNames = new AttributeType[mustNameOids.length];
+        }
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITContentRule#getMustNames()
+     */
+    public AttributeType[] getMustNames() throws NamingException
+    {
+        if ( mustNameOids == null || mustNameOids.length == 0 )
+        {
+            return EMPTY_ATTR_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < mustNameOids.length; ii++ )
+        {
+            mustNames[ii] = registries.getAttributeTypeRegistry().lookup( mustNameOids[ii] );
+        }
+        
+        return mustNames;
+    }
+
+
+    public void setNotNameOids( String[] notNameOids )
+    {
+        if ( notNameOids == null )
+        {
+            this.notNameOids = EMPTY_STR_ARRAY;
+            this.notNames = EMPTY_ATTR_ARRAY;
+        }
+        else
+        {
+            this.notNameOids = notNameOids;
+            this.notNames = new AttributeType[notNameOids.length];
+        }
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITContentRule#getNotNames()
+     */
+    public AttributeType[] getNotNames() throws NamingException
+    {
+        if ( notNameOids == null || notNameOids.length == 0 )
+        {
+            return EMPTY_ATTR_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < notNameOids.length; ii++ )
+        {
+            notNames[ii] = registries.getAttributeTypeRegistry().lookup( notNameOids[ii] );
+        }
+        
+        return notNames;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITContentRule#getObjectClass()
+     */
+    public ObjectClass getObjectClass() throws NamingException
+    {
+        return registries.getObjectClassRegistry().lookup( getOid() );
+    }
+
+
+    public void setDescription( String description )
+    {
+        super.setDescription( description );
+    }
+    
+    
+    public void setObsolete( boolean obsolete )
+    {
+        super.setObsolete( obsolete );
+    }
+    
+    
+    public void setNames( String[] names )
+    {
+        super.setNames( names );
+    }
+    
+    
+    public void setSchema( String schema )
+    {
+        super.setSchema( schema );
+    }
+}

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitStructureRuleImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitStructureRuleImpl.java?view=auto&rev=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitStructureRuleImpl.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DitStructureRuleImpl.java Mon Feb  5 21:06:17 2007
@@ -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.server.core.schema;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.AbstractSchemaObject;
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.NameForm;
+
+
+/**
+ * A ditStructureRule bean implementation which dynamically looks up dependencies using 
+ * a resgistries object.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DitStructureRuleImpl extends AbstractSchemaObject implements DITStructureRule, MutableSchemaObject
+{
+    private static final long serialVersionUID = 1L;
+    private final String[] EMPTY_STR_ARRAY = new String[0];
+    private final DITStructureRule[] EMPTY_DSR_ARRAY = new DITStructureRule[0];
+
+    private final Registries registries;
+    private String nameFormOid;
+    private String[] superClassOids;
+    private DITStructureRule[] superClasses;
+    
+    
+    public DitStructureRuleImpl( String oid, Registries registries )
+    {
+        super( oid );
+        this.registries = registries;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITStructureRule#getNameForm()
+     */
+    public NameForm getNameForm() throws NamingException
+    {
+        return registries.getNameFormRegistry().lookup( nameFormOid );
+    }
+
+    
+    public void setNameFormOid( String nameFormOid )
+    {
+        this.nameFormOid = nameFormOid;
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.DITStructureRule#getSuperClasses()
+     */
+    public DITStructureRule[] getSuperClasses() throws NamingException
+    {
+        if ( this.superClassOids == null )
+        {
+            return EMPTY_DSR_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < superClassOids.length; ii++ )
+        {
+            superClasses[ii] = registries.getDitStructureRuleRegistry().lookup( superClassOids[ii] );
+        }
+        
+        return superClasses;
+    }
+    
+    
+    public void setSuperClassOids( String[] superClassOids )
+    {
+        if ( superClassOids == null )
+        {
+            this.superClassOids = EMPTY_STR_ARRAY;
+            this.superClasses = EMPTY_DSR_ARRAY;
+        }
+        else
+        {
+            this.superClassOids = superClassOids;
+            this.superClasses = new DITStructureRule[superClassOids.length];
+        }
+    }
+    
+    
+    public void setObsolete( boolean obsolete )
+    {
+        super.setObsolete( obsolete );
+    }
+    
+    
+    public void setNames( String[] names )
+    {
+        super.setNames( names );
+    }
+    
+    
+    public void setSchema( String schema )
+    {
+        super.setSchema( schema );
+    }
+    
+    
+    public void setDescription( String description )
+    {
+        super.setDescription( description );
+    }
+}

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleUseImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleUseImpl.java?view=auto&rev=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleUseImpl.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleUseImpl.java Mon Feb  5 21:06:17 2007
@@ -0,0 +1,148 @@
+/*
+ *  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;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.AbstractSchemaObject;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+
+
+/**
+ * A machingRuleUse implementation which dynamically pull applicable attributeTypes 
+ * and it's matchingRule from the registries associated with it.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MatchingRuleUseImpl extends AbstractSchemaObject implements MatchingRuleUse, MutableSchemaObject
+{
+    private static final long serialVersionUID = 1L;
+
+    private static final AttributeType[] EMPTY_ATTRIBUTES = new AttributeType[0];
+    private static final String[] EMPTY_STRINGS = new String[0];
+
+    private final Registries registries;
+    private AttributeType[] applicableAttributes = EMPTY_ATTRIBUTES;
+    private String[] applicableAttributesOids;
+    
+
+    /**
+     * Creates a new matchingRuleUse.
+     * 
+     * @param oid the numeric oid of the matchingRule associated with this matchingRuleUse
+     * @param registries the registries used to resolve the matchingRule and the applicable attributes
+     */
+    protected MatchingRuleUseImpl( String oid, Registries registries )
+    {
+        super( oid );
+        this.registries = registries;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.MatchingRuleUse#getMatchingRule()
+     */
+    public MatchingRule getMatchingRule() throws NamingException
+    {
+        return registries.getMatchingRuleRegistry().lookup( getOid() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.MatchingRuleUse#getApplicableAttributes()
+     */
+    public AttributeType[] getApplicableAttributes() throws NamingException
+    {
+        if ( applicableAttributesOids == null || applicableAttributesOids == EMPTY_STRINGS )
+        {
+            return EMPTY_ATTRIBUTES;
+        }
+        
+        for ( int ii = 0; ii < applicableAttributesOids.length; ii++ )
+        {
+            applicableAttributes[ii] = registries.getAttributeTypeRegistry().lookup( applicableAttributesOids[ii] );
+        }
+        
+        return applicableAttributes;
+    }
+    
+    
+    /**
+     * Sets the oids used to look up the applicable AttributeTypes.
+     * 
+     * @param applicableAttributesOids the String[] of attributeType oids
+     */
+    public void setApplicableAttributesOids( final String[] applicableAttributesOids )
+    {
+        this.applicableAttributesOids = applicableAttributesOids;
+        if ( applicableAttributesOids == null )
+        {
+            this.applicableAttributesOids = EMPTY_STRINGS;
+            this.applicableAttributes = EMPTY_ATTRIBUTES;
+        }
+        else
+        {
+            this.applicableAttributesOids = applicableAttributesOids;
+            this.applicableAttributes = new AttributeType[applicableAttributesOids.length];
+        }
+    }
+    
+    
+    /**
+     * Sets the names associated with this matchingRuleUse.
+     */
+    public void setNames( String[] names )
+    {
+        super.setNames( names );
+    }
+    
+    
+    /**
+     * Sets the description associated with this matchingRuleUse.
+     */
+    public void setDescription( String description )
+    {
+        super.setDescription( description );
+    }
+    
+    
+    /**
+     * Sets whether or not this matchingRuleUse is obsolete.
+     */
+    public void setObsolete( boolean obsolete )
+    {
+        super.setObsolete( obsolete );
+    }
+    
+    
+    /**
+     * Sets the schema this matchingRuleUse is defined under.
+     */
+    public void setSchema( String schemaName )
+    {
+        super.setSchema( schemaName );
+    }
+}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java Mon Feb  5 21:06:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DITContentRule;
 
 
 /**
@@ -102,5 +103,11 @@
     {
         // TODO Auto-generated method stub
 
+    }
+
+
+    public void add( DITContentRule dcr )
+    {
+        // TODO Auto-generated method stub
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java Mon Feb  5 21:06:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
 
 
 /**
@@ -102,5 +103,11 @@
     {
         // TODO Auto-generated method stub
 
+    }
+
+
+    public void add( DITStructureRule dsr )
+    {
+        // TODO Auto-generated method stub
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java Mon Feb  5 21:06:17 2007
@@ -83,17 +83,9 @@
         parentDn.remove( parentDn.size() - 1 );
         checkNewParent( parentDn );
         
-        Schema schema = getSchema( name );
-        MatchingRule mr = factory.getMatchingRule( entry, targetRegistries, schema.getSchemaName() );
-        
-        if ( ! schema.isDisabled() )
-        {
-            matchingRuleRegistry.register( mr );
-        }
-        else
-        {
-            registerOids( mr );
-        }
+        String schemaName = getSchemaName( name );
+        MatchingRule mr = factory.getMatchingRule( entry, targetRegistries, schemaName );
+        add( mr );
     }
 
 
@@ -243,6 +235,21 @@
             throw new LdapInvalidNameException( 
                 "The parent entry of a syntax should have a relative name of ou=matchingRules.", 
                 ResultCodeEnum.NAMING_VIOLATION );
+        }
+    }
+
+
+    public void add( MatchingRule mr ) throws NamingException
+    {
+        Schema schema = loader.getSchema( mr.getSchema() );
+        
+        if ( ! schema.isDisabled() )
+        {
+            matchingRuleRegistry.register( mr );
+        }
+        else
+        {
+            registerOids( mr );
         }
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java Mon Feb  5 21:06:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
 
 
 /**
@@ -50,7 +51,6 @@
     protected void modify( LdapDN name, Attributes entry, Attributes targetEntry ) throws NamingException
     {
         // TODO Auto-generated method stub
-
     }
 
 
@@ -60,7 +60,6 @@
     public void add( LdapDN name, Attributes entry ) throws NamingException
     {
         // TODO Auto-generated method stub
-
     }
 
 
@@ -70,7 +69,6 @@
     public void delete( LdapDN name, Attributes entry ) throws NamingException
     {
         // TODO Auto-generated method stub
-
     }
 
 
@@ -81,7 +79,6 @@
         throws NamingException
     {
         // TODO Auto-generated method stub
-
     }
 
 
@@ -91,7 +88,6 @@
     public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
     {
         // TODO Auto-generated method stub
-
     }
 
 
@@ -101,6 +97,11 @@
     public void rename( LdapDN name, Attributes entry, String newRdn ) throws NamingException
     {
         // TODO Auto-generated method stub
+    }
+
 
+    public void add( MatchingRuleUse mru )
+    {
+        // TODO Auto-generated method stub
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java Mon Feb  5 21:06:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.NameForm;
 
 
 /**
@@ -102,5 +103,11 @@
     {
         // TODO Auto-generated method stub
 
+    }
+
+
+    public void add( NameForm nf )
+    {
+        // TODO Auto-generated method stub
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java Mon Feb  5 21:06:17 2007
@@ -83,17 +83,9 @@
         parentDn.remove( parentDn.size() - 1 );
         checkNewParent( parentDn );
         
-        Schema schema = getSchema( name );
-        ObjectClass oc = factory.getObjectClass( entry, targetRegistries, schema.getSchemaName() );
-        
-        if ( ! schema.isDisabled() )
-        {
-            objectClassRegistry.register( oc );
-        }
-        else
-        {
-            registerOids( oc );
-        }
+        String schemaName = getSchemaName( name );
+        ObjectClass oc = factory.getObjectClass( entry, targetRegistries, schemaName );
+        add( oc );
     }
 
 
@@ -244,6 +236,20 @@
             throw new LdapInvalidNameException( 
                 "The parent entry of a attributeType should have a relative name of ou=objectClasses.", 
                 ResultCodeEnum.NAMING_VIOLATION );
+        }
+    }
+
+
+    public void add( ObjectClass oc ) throws NamingException
+    {
+        Schema schema = loader.getSchema( oc.getSchema() );
+        if ( ! schema.isDisabled() )
+        {
+            objectClassRegistry.register( oc );
+        }
+        else
+        {
+            registerOids( oc );
         }
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java Mon Feb  5 21:06:17 2007
@@ -83,18 +83,9 @@
         parentDn.remove( parentDn.size() - 1 );
         checkNewParent( parentDn );
         
-        Schema schema = getSchema( name );
-        Syntax syntax = factory.getSyntax( entry, targetRegistries, schema.getSchemaName() );
-        
-        if ( ! schema.isDisabled() )
-        {
-            syntaxRegistry.register( syntax );
-        }
-        else
-        {
-            // even for disabled schemas add OIDs
-            registerOids( syntax );
-        }
+        String schemaName = getSchemaName( name );
+        Syntax syntax = factory.getSyntax( entry, targetRegistries, schemaName );
+        add( syntax );
     }
 
 
@@ -255,6 +246,30 @@
             throw new LdapInvalidNameException( 
                 "The parent entry of a syntax should have a relative name of ou=syntaxes.", 
                 ResultCodeEnum.NAMING_VIOLATION );
+        }
+    }
+
+
+    /**
+     * Adds a syntax to this handler's registries if it's schema is enabled.  The
+     * OID is always registered with the OidRegistry regardless of the enabled state
+     * of the schema.   
+     * 
+     * @param syntax the syntax that is to be added to this handler's registries
+     * @throws NamingException if there are problems access schema data
+     */
+    public void add( Syntax syntax ) throws NamingException
+    {
+        Schema schema = loader.getSchema( syntax.getSchema() );
+        
+        if ( ! schema.isDisabled() )
+        {
+            syntaxRegistry.register( syntax );
+        }
+        else
+        {
+            // even for disabled schemas add OIDs
+            registerOids( syntax );
         }
     }
 }

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/NameFormImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/NameFormImpl.java?view=auto&rev=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/NameFormImpl.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/NameFormImpl.java Mon Feb  5 21:06:17 2007
@@ -0,0 +1,173 @@
+/*
+ *  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;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.AbstractSchemaObject;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.NameForm;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+
+
+/**
+ * A nameForm bean implementation that uses a set of registries to dynamically
+ * resolve it's dependencies.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NameFormImpl extends AbstractSchemaObject implements NameForm, MutableSchemaObject
+{
+    private static final long serialVersionUID = 1L;
+    private static final String[] EMPTY_STR_ARRAY = new String[0];
+    private static final AttributeType[] EMPTY_ATTR_ARRAY = new AttributeType[0];
+
+    
+    private final Registries registries;
+    
+    private String objectClassOid;
+
+    private String[] mayUseOids = EMPTY_STR_ARRAY;
+    private AttributeType[] mayUse = EMPTY_ATTR_ARRAY;
+    
+    private String[] mustUseOids = EMPTY_STR_ARRAY;
+    private AttributeType[] mustUse = EMPTY_ATTR_ARRAY;
+    
+
+    /**
+     * @param oid
+     */
+    public NameFormImpl( String oid, Registries registries )
+    {
+        super( oid );
+        this.registries = registries;
+    }
+
+    
+    public void setMayUseOids( String[] mayUseOids )
+    {
+        if ( mayUseOids == null )
+        {
+            this.mayUse = EMPTY_ATTR_ARRAY;
+            this.mayUseOids = EMPTY_STR_ARRAY;
+        }
+        else
+        {
+            this.mayUse = new AttributeType[mayUseOids.length];
+            this.mayUseOids = mayUseOids;
+        }
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.NameForm#getMaytUse()
+     */
+    public AttributeType[] getMayUse() throws NamingException
+    {
+        if ( mayUseOids == null || mayUseOids.length == 0 )
+        {
+            return EMPTY_ATTR_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < mayUseOids.length; ii++ )
+        {
+            mayUse[ii] = registries.getAttributeTypeRegistry().lookup( mayUseOids[ii] );
+        }
+        
+        return mayUse;
+    }
+
+
+    public void setMustUseOids( String[] mustUseOids )
+    {
+        if ( mustUseOids == null )
+        {
+            this.mustUse = EMPTY_ATTR_ARRAY;
+            this.mustUseOids = EMPTY_STR_ARRAY;
+        }
+        else
+        {
+            this.mustUse = new AttributeType[mustUseOids.length];
+            this.mustUseOids = mustUseOids;
+        }
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.NameForm#getMustUse()
+     */
+    public AttributeType[] getMustUse() throws NamingException
+    {
+        if ( mustUseOids == null || mustUseOids.length == 0 )
+        {
+            return EMPTY_ATTR_ARRAY;
+        }
+        
+        for ( int ii = 0; ii < mustUseOids.length; ii++ )
+        {
+            mustUse[ii] = registries.getAttributeTypeRegistry().lookup( mustUseOids[ii] );
+        }
+        
+        return mustUse;
+    }
+    
+    
+    public void setObjectClassOid( String objectClassOid )
+    {
+        this.objectClassOid = objectClassOid;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.NameForm#getObjectClass()
+     */
+    public ObjectClass getObjectClass() throws NamingException
+    {
+        return registries.getObjectClassRegistry().lookup( objectClassOid );
+    }
+
+    
+    public void setDescription( String description )
+    {
+        super.setDescription( description );
+    }
+    
+    
+    public void setObsolete( boolean obsolete )
+    {
+        super.setObsolete( obsolete );
+    }
+    
+    
+    public void setNames( String[] names )
+    {
+        super.setNames( names );
+    }
+    
+    
+    public void setSchema( String schema )
+    {
+        super.setSchema( schema );
+    }
+}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java Mon Feb  5 21:06:17 2007
@@ -35,6 +35,7 @@
 import org.apache.directory.server.constants.SystemSchemaConstants;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
+import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
@@ -44,7 +45,13 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
+import org.apache.directory.shared.ldap.schema.NameForm;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 
@@ -63,8 +70,20 @@
  */
 public class SchemaManager
 {
+    // indices of handlers and object ids into arrays
+    private static final int COMPARATOR_INDEX = 0;
+    private static final int NORMALIZER_INDEX = 1;
+    private static final int SYNTAX_CHECKER_INDEX = 2;
+    private static final int SYNTAX_INDEX = 3;
+    private static final int MATCHING_RULE_INDEX = 4;
+    private static final int ATTRIBUTE_TYPE_INDEX = 5;
+    private static final int OBJECT_CLASS_INDEX = 6;
+    private static final int MATCHING_RULE_USE_INDEX = 7;
+    private static final int DIT_STRUCTURE_RULE_INDEX = 8;
+    private static final int DIT_CONTENT_RULE_INDEX = 9;
+    private static final int NAME_FORM_INDEX = 10;
+
     private static final Set<String> VALID_OU_VALUES = new HashSet<String>();
-//    private static final Set<String> SCHEMA_OBJECT_OIDS = new HashSet<String>();
     private static final String[] opAttrs = new String[] {
         "comparators",
         "normalizers",
@@ -98,12 +117,31 @@
     private final AttributeType objectClassAT;
     private final SchemaSubentryModifier subentryModifier;
     private final SchemaChangeHandler[] schemaObjectHandlers = new SchemaChangeHandler[11];
+
+//    private final String comparatorsOid;
+//    private final String normalizersOid;
+//    private final String syntaxCheckersOid;
+
+    private final String ldapSyntaxesOid;
+    private final String matchingRulesOid;
     private final String attributeTypesOid;
+    private final String objectClassesOid;
+    private final String matchingRuleUseOid;
+    private final String nameFormsOid;
+    private final String ditContentRulesOid;
+    private final String ditStructureRulesOid;
+    
     private final DescriptionParsers parsers;
     
     private final Map<String, SchemaChangeHandler> opAttr2handlerMap = new HashMap<String, SchemaChangeHandler>();
     private final Map<String, SchemaChangeHandler> objectClass2handlerMap = new HashMap<String, SchemaChangeHandler>();
     
+    /** 
+     * Maps the OID of a subschemaSubentry operational attribute to the index of 
+     * the handler in the schemaObjectHandlers array.
+     */ 
+    private final Map<String, Integer> opAttr2handlerIndex = new HashMap<String, Integer>( 11 );
+    
     static 
     {
         VALID_OU_VALUES.add( "normalizers" );
@@ -111,6 +149,7 @@
         VALID_OU_VALUES.add( "syntaxcheckers" );
         VALID_OU_VALUES.add( "syntaxes" );
         VALID_OU_VALUES.add( "matchingrules" );
+        VALID_OU_VALUES.add( "matchingruleuse" );
         VALID_OU_VALUES.add( "attributetypes" );
         VALID_OU_VALUES.add( "objectclasses" );
         VALID_OU_VALUES.add( "nameforms" );
@@ -129,31 +168,45 @@
         
         this.metaSchemaHandler = new MetaSchemaHandler( this.globalRegistries, this.loader );
         
-        this.schemaObjectHandlers[0] =  new MetaComparatorHandler( globalRegistries, loader ); 
-        this.schemaObjectHandlers[1] =  new MetaNormalizerHandler( globalRegistries, loader );
-        this.schemaObjectHandlers[2] =  new MetaSyntaxCheckerHandler( globalRegistries, loader );
-        this.schemaObjectHandlers[3] =  new MetaSyntaxHandler( globalRegistries, loader, dao );
-        this.schemaObjectHandlers[4] =  new MetaMatchingRuleHandler( globalRegistries, loader, dao );
-        this.schemaObjectHandlers[5] =  new MetaAttributeTypeHandler( globalRegistries, loader, dao );
-        this.schemaObjectHandlers[6] =  new MetaObjectClassHandler( globalRegistries, loader, dao );
-        this.schemaObjectHandlers[7] =  new MetaMatchingRuleUseHandler( globalRegistries, loader );
-        this.schemaObjectHandlers[8] =  new MetaDitStructureRuleHandler( globalRegistries, loader ); 
-        this.schemaObjectHandlers[9] =  new MetaDitContentRuleHandler( globalRegistries, loader ); 
-        this.schemaObjectHandlers[10] = new MetaNameFormHandler( globalRegistries, loader ); 
+        this.schemaObjectHandlers[COMPARATOR_INDEX] = new MetaComparatorHandler( globalRegistries, loader ); 
+        this.schemaObjectHandlers[NORMALIZER_INDEX] = new MetaNormalizerHandler( globalRegistries, loader );
+        this.schemaObjectHandlers[SYNTAX_CHECKER_INDEX] = new MetaSyntaxCheckerHandler( globalRegistries, loader );
+        this.schemaObjectHandlers[SYNTAX_INDEX] = new MetaSyntaxHandler( globalRegistries, loader, dao );
+        this.schemaObjectHandlers[MATCHING_RULE_INDEX] = new MetaMatchingRuleHandler( globalRegistries, loader, dao );
+        this.schemaObjectHandlers[ATTRIBUTE_TYPE_INDEX] = new MetaAttributeTypeHandler( globalRegistries, loader, dao );
+        this.schemaObjectHandlers[OBJECT_CLASS_INDEX] = new MetaObjectClassHandler( globalRegistries, loader, dao );
+        this.schemaObjectHandlers[MATCHING_RULE_USE_INDEX] = new MetaMatchingRuleUseHandler( globalRegistries, loader );
+        this.schemaObjectHandlers[DIT_STRUCTURE_RULE_INDEX] = new MetaDitStructureRuleHandler( globalRegistries, loader ); 
+        this.schemaObjectHandlers[DIT_CONTENT_RULE_INDEX] = new MetaDitContentRuleHandler( globalRegistries, loader ); 
+        this.schemaObjectHandlers[NAME_FORM_INDEX] = new MetaNameFormHandler( globalRegistries, loader ); 
 
         this.subentryModifier = new SchemaSubentryModifier( dao );
         this.parsers = new DescriptionParsers( globalRegistries );
         
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "ldapSyntaxes" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "matchingRules" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "matchingRuleUse" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "attributeTypes" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "objectClasses" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "ditContentRules" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "ditStructureRules" ) );
-//        this.SCHEMA_OBJECT_OIDS.add( globalRegistries.getOidRegistry().getOid( "nameForms" ) );
+        OidRegistry oidRegistry = globalRegistries.getOidRegistry();
+        ldapSyntaxesOid = oidRegistry.getOid( SystemSchemaConstants.LDAP_SYNTAXES_AT );
+        opAttr2handlerIndex.put( ldapSyntaxesOid, new Integer( SYNTAX_INDEX ) );
         
-        attributeTypesOid = globalRegistries.getOidRegistry().getOid( "attributeTypes" );
+        matchingRulesOid = oidRegistry.getOid( SystemSchemaConstants.MATCHING_RULES_AT );
+        opAttr2handlerIndex.put( matchingRulesOid, new Integer( MATCHING_RULE_INDEX ) );
+
+        attributeTypesOid = oidRegistry.getOid( SystemSchemaConstants.ATTRIBUTE_TYPES_AT );
+        opAttr2handlerIndex.put( attributeTypesOid, new Integer( ATTRIBUTE_TYPE_INDEX ) );
+
+        objectClassesOid = oidRegistry.getOid( SystemSchemaConstants.OBJECT_CLASSES_AT );
+        opAttr2handlerIndex.put( objectClassesOid, new Integer( OBJECT_CLASS_INDEX ) );
+        
+        matchingRuleUseOid = oidRegistry.getOid( SystemSchemaConstants.MATCHING_RULE_USE_AT );
+        opAttr2handlerIndex.put( matchingRuleUseOid, new Integer( MATCHING_RULE_USE_INDEX ) );
+
+        ditStructureRulesOid = oidRegistry.getOid( SystemSchemaConstants.DIT_STRUCTURE_RULES_AT );
+        opAttr2handlerIndex.put( ditStructureRulesOid, new Integer( DIT_STRUCTURE_RULE_INDEX ) );
+
+        ditContentRulesOid = oidRegistry.getOid( SystemSchemaConstants.DIT_CONTENT_RULES_AT );
+        opAttr2handlerIndex.put( ditContentRulesOid, new Integer( DIT_CONTENT_RULE_INDEX ) );
+
+        nameFormsOid = oidRegistry.getOid( SystemSchemaConstants.NAME_FORMS_AT );
+        opAttr2handlerIndex.put( nameFormsOid, new Integer( NAME_FORM_INDEX ) );
         
         initHandlerMaps();
     }
@@ -426,10 +479,7 @@
             switch ( mod.getModificationOp() )
             {
                 case( DirContext.ADD_ATTRIBUTE ):
-                    if ( opAttrOid.equals( attributeTypesOid ) )
-                    {
-                        addAttributeType( mod );
-                    }
+                    modifyAddOperation( opAttrOid, mod );
                     break;
                 case( DirContext.REMOVE_ATTRIBUTE ):
                     break; 
@@ -440,18 +490,106 @@
             }
         }
     }
-    
-    
-    private void addAttributeType( ModificationItemImpl mod ) throws NamingException
+
+
+    private void modifyAddOperation( String opAttrOid, ModificationItemImpl mod ) throws NamingException
     {
-        String opAttrOid = globalRegistries.getOidRegistry().getOid( mod.getAttribute().getID() );
-        AttributeType at = parsers.parseAttributeType( mod.getAttribute() );
-        subentryModifier.addSchemaObject( at );
-        MetaAttributeTypeHandler handler = ( MetaAttributeTypeHandler ) opAttr2handlerMap.get( opAttrOid );
-        handler.add( at );
+        int index = opAttr2handlerIndex.get( opAttrOid ).intValue();
+        SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
+        switch( index )
+        {
+            case( COMPARATOR_INDEX ):
+                break;
+            case( NORMALIZER_INDEX ):
+                break;
+            case( SYNTAX_CHECKER_INDEX ):
+                break;
+            case( SYNTAX_INDEX ):
+                MetaSyntaxHandler syntaxHandler = ( MetaSyntaxHandler ) handler;
+                Syntax[] syntaxes = parsers.parseSyntaxes( mod.getAttribute() );
+                
+                for ( Syntax syntax : syntaxes )
+                {
+                    syntaxHandler.add( syntax );
+                    subentryModifier.addSchemaObject( syntax );
+                }
+                break;
+            case( MATCHING_RULE_INDEX ):
+                MetaMatchingRuleHandler matchingRuleHandler = ( MetaMatchingRuleHandler ) handler;
+                MatchingRule[] mrs = parsers.parseMatchingRules( mod.getAttribute() );
+                
+                for ( MatchingRule mr : mrs )
+                {
+                    matchingRuleHandler.add( mr );
+                    subentryModifier.addSchemaObject( mr );
+                }
+                break;
+            case( ATTRIBUTE_TYPE_INDEX ):
+                MetaAttributeTypeHandler atHandler = ( MetaAttributeTypeHandler ) handler;
+                AttributeType[] ats = parsers.parseAttributeTypes( mod.getAttribute() );
+                
+                for ( AttributeType at : ats )
+                {
+                    atHandler.add( at );
+                    subentryModifier.addSchemaObject( at );
+                }
+                break;
+            case( OBJECT_CLASS_INDEX ):
+                MetaObjectClassHandler ocHandler = ( MetaObjectClassHandler ) handler;
+                ObjectClass[] ocs = parsers.parseObjectClasses( mod.getAttribute() );
+
+                for ( ObjectClass oc : ocs )
+                {
+                    ocHandler.add( oc );
+                    subentryModifier.addSchemaObject( oc );
+                }
+                break;
+            case( MATCHING_RULE_USE_INDEX ):
+                MetaMatchingRuleUseHandler mruHandler = ( MetaMatchingRuleUseHandler ) handler;
+                MatchingRuleUse[] mrus = parsers.parseMatchingRuleUses( mod.getAttribute() );
+                
+                for ( MatchingRuleUse mru : mrus )
+                {
+                    mruHandler.add( mru );
+                    subentryModifier.addSchemaObject( mru );
+                }
+                break;
+            case( DIT_STRUCTURE_RULE_INDEX ):
+                MetaDitStructureRuleHandler dsrHandler = ( MetaDitStructureRuleHandler ) handler;
+                DITStructureRule[] dsrs = parsers.parseDitStructureRules( mod.getAttribute() );
+                
+                for ( DITStructureRule dsr : dsrs )
+                {
+                    dsrHandler.add( dsr );
+                    subentryModifier.addSchemaObject( dsr );
+                }
+                break;
+            case( DIT_CONTENT_RULE_INDEX ):
+                MetaDitContentRuleHandler dcrHandler = ( MetaDitContentRuleHandler ) handler;
+                DITContentRule[] dcrs = parsers.parseDitContentRules( mod.getAttribute() );
+                
+                for ( DITContentRule dcr : dcrs )
+                {
+                    dcrHandler.add( dcr );
+                    subentryModifier.addSchemaObject( dcr );
+                }
+                break;
+            case( NAME_FORM_INDEX ):
+                MetaNameFormHandler nfHandler = ( MetaNameFormHandler ) handler;
+                NameForm[] nfs = parsers.parseNameForms( mod.getAttribute() );
+                
+                for ( NameForm nf : nfs )
+                {
+                    nfHandler.add( nf );
+                    subentryModifier.addSchemaObject( nf );
+                }
+                break;
+            default:
+                throw new IllegalStateException( "Unknown index into handler array: " + index );
+        }
     }
     
-
+    
     /**
      * Translates modify operations on schema subentries into one or more operations 
      * on meta schema entities within the ou=schema partition and updates the registries

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Mon Feb  5 21:06:17 2007
@@ -119,13 +119,12 @@
     }
     
 
-    public LdapDN addSchemaObject( SchemaObject obj ) throws NamingException
+    public void addSchemaObject( SchemaObject obj ) throws NamingException
     {
         PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
         Schema schema = dao.getSchema( obj.getSchema() );
         LdapDN dn = getDn( obj );
         Attributes attrs = factory.getAttributes( obj, schema );
         proxy.add( dn, attrs, BYPASS );
-        return dn;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java Mon Feb  5 21:06:17 2007
@@ -24,10 +24,11 @@
 
 import org.apache.directory.server.schema.registries.SyntaxCheckerRegistry;
 import org.apache.directory.shared.ldap.schema.AbstractSyntax;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
 
 
-class SyntaxImpl extends AbstractSyntax
+class SyntaxImpl extends AbstractSyntax implements MutableSchemaObject
 {
     private static final long serialVersionUID = 1L;
     private final SyntaxCheckerRegistry registry;
@@ -61,5 +62,17 @@
     public void setSchema( String schema )
     {
         super.setSchema( schema );
+    }
+    
+    
+    public void setObsolete( boolean obsolete )
+    {
+        super.setObsolete( obsolete );
+    }
+    
+    
+    public void setNames( String[] names )
+    {
+        super.setNames( names );
     }
 }

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/schema/apachemeta.schema
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/schema/apachemeta.schema?view=diff&rev=503986&r1=503985&r2=503986
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/schema/apachemeta.schema (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/schema/apachemeta.schema Mon Feb  5 21:06:17 2007
@@ -73,6 +73,9 @@
 #         | 1.3.6.1.4.1.18060.0.4.0.2.34 | x-humanReadible             |
 #         | 1.3.6.1.4.1.18060.0.4.0.2.37 | m-disabled                  |
 #         | 1.3.6.1.4.1.18060.0.4.0.2.38 | m-dependencies              |
+#         | 1.3.6.1.4.1.18060.0.4.0.2.39 | comparators                 |
+#         | 1.3.6.1.4.1.18060.0.4.0.2.40 | normalizers                 |
+#         | 1.3.6.1.4.1.18060.0.4.0.2.41 | syntaxCheckers              |
 #         +------------------------------+-----------------------------+
 #
 #         +------------------------------+-----------------------------+



Mime
View raw message