directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r486300 - in /directory/branches/trunks/schema/apacheds: bootstrap-partition/ bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core/src/main/java/org/apache/directory/server/core/schema/ core/src/main/java/o...
Date Tue, 12 Dec 2006 20:30:52 GMT
Author: akarasulu
Date: Tue Dec 12 12:30:50 2006
New Revision: 486300

URL: http://svn.apache.org/viewvc?view=rev&rev=486300
Log:
changes ...

o changed bootstrap plug-in phase to package
o changed bootstrap plug-in goal to load 
o added code that loads machingRules into schema partition
o fixed bug in NameOrNumericIdMatch
o fixed bug in schema lookups of registries


Modified:
    directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml
    directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java
    directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleRegistry.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleRegistry.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java
    directory/branches/trunks/schema/apacheds/core/src/main/schema/apachemeta.schema

Modified: directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml Tue Dec 12 12:30:50
2006
@@ -37,14 +37,14 @@
   	  <plugin>
 	    <groupId>org.apache.directory.server</groupId>
   	    <artifactId>apacheds-bootstrap-plugin</artifactId>
-        <configuration>
-          <indexedAttributes>
-            <indexedAttribute>objectClass</indexedAttribute>
-            <indexedAttribute>ou</indexedAttribute>
-            <indexedAttribute>cn</indexedAttribute>
-            <indexedAttribute>m-oid</indexedAttribute>
-          </indexedAttributes>
-          <bootstrapSchemaClasses>
+            <configuration>
+              <indexedAttributes>
+                <indexedAttribute>objectClass</indexedAttribute>
+                <indexedAttribute>ou</indexedAttribute>
+                <indexedAttribute>cn</indexedAttribute>
+                <indexedAttribute>m-oid</indexedAttribute>
+              </indexedAttributes>
+              <bootstrapSchemaClasses>
           	<bootstrapSchemaClass>org.apache.directory.server.core.schema.bootstrap.ApachednsSchema</bootstrapSchemaClass>
           	<bootstrapSchemaClass>org.apache.directory.server.core.schema.bootstrap.AutofsSchema</bootstrapSchemaClass>
           	<bootstrapSchemaClass>org.apache.directory.server.core.schema.bootstrap.CollectiveSchema</bootstrapSchemaClass>
@@ -62,7 +62,7 @@
         <executions>
           <execution>
             <goals>
-              <goal>generate</goal>
+              <goal>load</goal>
             </goals>
           </execution>
         </executions>

Modified: directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java
(original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java
Tue Dec 12 12:30:50 2006
@@ -22,7 +22,10 @@
 
 import java.util.Comparator;
 
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -46,6 +49,8 @@
  */
 public class AttributesFactory
 {
+    private static final String META_MATCHING_RULE_OC = "metaMatchingRule";
+
     private static final String META_NORMALIZER_OC = "metaNormalizer";
 
     private static final String META_SYNTAX_OC = "metaSyntax";
@@ -95,6 +100,8 @@
     private static final String M_HUMAN_READIBLE_AT = "m-humanReadible";
 
     private static final Object META_COMPARATOR_OC = "metaComparator";
+
+    private static final String M_SYNTAX_AT = "m-syntax";
     
 /*
     private static final String _AT = "";
@@ -154,10 +161,26 @@
     }
 
     
-    public Attributes getAttributes( MatchingRule matchingRule )
+    public Attributes getAttributes( MatchingRule matchingRule ) throws NamingException
     {
         BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
-        entry.get( OBJECT_CLASS_AT ).add( "" );
+        entry.get( OBJECT_CLASS_AT ).add( META_MATCHING_RULE_OC );
+        entry.put( M_OID_AT, matchingRule.getOid() );
+        entry.put( M_SYNTAX_AT, matchingRule.getSyntax().getOid() );
+        entry.put( M_OBSOLETE_AT, getBoolean( matchingRule.isObsolete() ) );
+
+        Attribute attr = new BasicAttribute( M_NAME_AT );
+        for ( String name: matchingRule.getNames() )
+        {
+            attr.add( name );
+        }
+        entry.put( attr );
+        
+        if ( matchingRule.getDescription() != null )
+        {
+            entry.put( M_DESC_AT, matchingRule.getDescription() );
+        }
+
         return entry;
     }
 

Modified: directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
(original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
Tue Dec 12 12:30:50 2006
@@ -36,6 +36,7 @@
 import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.core.schema.ComparatorRegistry;
+import org.apache.directory.server.core.schema.MatchingRuleRegistry;
 import org.apache.directory.server.core.schema.NormalizerRegistry;
 import org.apache.directory.server.core.schema.Registries;
 import org.apache.directory.server.core.schema.SyntaxCheckerRegistry;
@@ -51,6 +52,7 @@
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
@@ -62,9 +64,9 @@
 /**
  * A plugin used to pre-load meta schema entries into the schema partition.
  *
- * @goal generate
+ * @goal load 
  * @description creates and pre-loads ApacheDS schema partition
- * @phase generate-sources
+ * @phase package
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
@@ -130,6 +132,7 @@
             addSyntaxes();
             addNormalizers();
             addComparators();
+            addMatchingRules();
             
             listEntries();
         }
@@ -150,6 +153,31 @@
     }
 
     
+    private void addMatchingRules() throws NamingException
+    {
+        getLog().info( "------------------------------------------------------------------------"
);
+        getLog().info( " Adding matchingRules" );
+        getLog().info( "------------------------------------------------------------------------"
);
+
+        MatchingRuleRegistry matchingRuleRegistry = registries.getMatchingRuleRegistry();
+        Iterator<MatchingRule> ii = matchingRuleRegistry.iterator();
+        while ( ii.hasNext() )
+        {
+            MatchingRule mr = ii.next();
+            getLog().info( "Adding matchingRule with oid = " + mr.getOid() );
+            String schemaName = matchingRuleRegistry.getSchemaName( mr.getOid() );
+            LdapDN dn = checkCreateSchema( schemaName );
+            dn.add( "ou=matchingRules" );
+            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            checkCreateContainer( dn );
+            Attributes entry = attributesFactory.getAttributes( mr );
+            dn.add( "m-oid=" + mr.getOid() );
+            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            partition.add( dn, entry );
+        }
+    }
+
+
     private void addComparators() throws NamingException
     {
         getLog().info( "------------------------------------------------------------------------"
);

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleRegistry.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleRegistry.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleRegistry.java
Tue Dec 12 12:30:50 2006
@@ -83,5 +83,5 @@
      *
      * @return an iterator over all MatchingRules in registry
      */
-    Iterator list();
+    Iterator<MatchingRule> iterator();
 }

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Tue Dec 12 12:30:50 2006
@@ -303,10 +303,10 @@
         if ( returnAllOperationalAttributes || set.contains( "matchingrules" ) )
         {
             attr = new LockableAttributeImpl( "matchingRules" );
-            Iterator list = registries.getMatchingRuleRegistry().list();
+            Iterator<MatchingRule> list = registries.getMatchingRuleRegistry().iterator();
             while ( list.hasNext() )
             {
-                MatchingRule mr = ( MatchingRule ) list.next();
+                MatchingRule mr = list.next();
                 attr.add( SchemaUtils.render( mr ).toString() );
             }
             attrs.put( attr );

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/ApachemetaMatchingRuleProducer.java
Tue Dec 12 12:30:50 2006
@@ -67,10 +67,10 @@
     {
         MatchingRule matchingRule = null;
         
-        matchingRule = new ObjectClassTypeMatch();
+        matchingRule = new NameOrNumericIdMatch( registries.getOidRegistry() );
         cb.schemaObjectProduced( this, matchingRule.getOid(), matchingRule );
         
-        matchingRule = new NameOrNumericIdMatch( registries.getOidRegistry() );
+        matchingRule = new ObjectClassTypeMatch();
         cb.schemaObjectProduced( this, matchingRule.getOid(), matchingRule );
         
         matchingRule = new NumericOidMatch( registries.getSyntaxRegistry() );

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleRegistry.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleRegistry.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleRegistry.java
Tue Dec 12 12:30:50 2006
@@ -45,9 +45,9 @@
     /** static class logger */
     private final static Logger log = LoggerFactory.getLogger( BootstrapMatchingRuleRegistry.class
);
     /** a map using an OID for the key and a MatchingRule for the value */
-    private final Map byOid;
+    private final Map<String,MatchingRule> byOid;
     /** maps an OID to a schema name*/
-    private final Map oidToSchema;
+    private final Map<String,String> oidToSchema;
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
 
@@ -64,9 +64,9 @@
      */
     public BootstrapMatchingRuleRegistry(OidRegistry oidRegistry)
     {
-        this.oidToSchema = new HashMap();
+        this.oidToSchema = new HashMap<String,String>();
         this.oidRegistry = oidRegistry;
-        this.byOid = new HashMap();
+        this.byOid = new HashMap<String,MatchingRule>();
     }
 
 
@@ -157,7 +157,7 @@
     }
 
 
-    public Iterator list()
+    public Iterator<MatchingRule> iterator()
     {
         return byOid.values().iterator();
     }

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java
Tue Dec 12 12:30:50 2006
@@ -203,7 +203,7 @@
             resolve( at, errors );
         }
 
-        list = matchingRuleRegistry.list();
+        list = matchingRuleRegistry.iterator();
         while ( list.hasNext() )
         {
             MatchingRule mr = ( MatchingRule ) list.next();

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/NameOrNumericIdMatch.java
Tue Dec 12 12:30:50 2006
@@ -56,6 +56,7 @@
     {
         this.normalizer = new NameOrNumericIdNormalizer( registry );
         this.comparator = new NameOrNumericIdComparator( registry );
+        this.syntax = new ApachemetaSyntaxProducer.NameOrNumericIdSyntax();
     }
     
 
@@ -63,6 +64,7 @@
     {
         this.normalizer = new NameOrNumericIdNormalizer( registries.getOidRegistry() );
         this.comparator = new NameOrNumericIdComparator( registries.getOidRegistry() );
+        this.syntax = new ApachemetaSyntaxProducer.NameOrNumericIdSyntax();
     }
 
     

Modified: directory/branches/trunks/schema/apacheds/core/src/main/schema/apachemeta.schema
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/schema/apachemeta.schema?view=diff&rev=486300&r1=486299&r2=486300
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/schema/apachemeta.schema (original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/schema/apachemeta.schema Tue Dec
12 12:30:50 2006
@@ -151,8 +151,8 @@
     DESC 'Meta definition of the MatchingRule object'
     SUP metaTop
     STRUCTURAL
-    MUST m-syntax
-    MAY ( m-obsolete $ m-extensionAttributeType )
+    MUST ( m-oid $ m-syntax $ m-name )
+    MAY ( m-obsolete $ m-description )
 )
 
 # --- MetaDITStructureRule objectclass ----------------------------------------
@@ -335,9 +335,9 @@
     SINGLE-VALUE
 )
 
-# --- m-attributeTypeSyntaxsyntax AttributeType -------------------------------
-attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.14 NAME 'm-attributeTypesyntax'
-    DESC 'The attributeType syntax'
+# --- m-syntax AttributeType -------------------------------
+attributetype ( 1.3.6.1.4.1.18060.0.4.0.2.14 NAME 'm-syntax'
+    DESC 'The syntax OID for attributeTypes and matchingRules'
     EQUALITY nameOrNumericIdMatch
     SYNTAX 1.3.6.1.4.1.18060.0.4.0.0.2
     SINGLE-VALUE



Mime
View raw message