directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r486275 - in /directory/branches/trunks/schema/apacheds: 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/org/apache/directory/s...
Date Tue, 12 Dec 2006 18:53:57 GMT
Author: akarasulu
Date: Tue Dec 12 10:53:56 2006
New Revision: 486275

URL: http://svn.apache.org/viewvc?view=rev&rev=486275
Log:
added code for loading in comparators into bootstrap partition

Modified:
    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/ComparatorRegistry.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapComparatorRegistry.java
    directory/branches/trunks/schema/apacheds/core/src/main/schema/apachemeta.schema

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=486275&r1=486274&r2=486275
==============================================================================
--- 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 10:53:56 2006
@@ -93,6 +93,8 @@
     private static final String M_BYTECODE_AT = "m-bytecode";
 
     private static final String M_HUMAN_READIBLE_AT = "m-humanReadible";
+
+    private static final Object META_COMPARATOR_OC = "metaComparator";
     
 /*
     private static final String _AT = "";
@@ -142,10 +144,12 @@
     }
 
     
-    public Attributes getAttributes( String oid, Comparator<Object> comparator )
+    public Attributes getAttributes( String oid, Comparator comparator )
     {
         BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
-        entry.get( OBJECT_CLASS_AT ).add( "" );
+        entry.get( OBJECT_CLASS_AT ).add( META_COMPARATOR_OC );
+        entry.put( M_OID_AT, oid );
+        entry.put( M_FQCN_AT, comparator.getClass().getName() );
         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=486275&r1=486274&r2=486275
==============================================================================
--- 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 10:53:56 2006
@@ -35,6 +35,7 @@
 import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 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.NormalizerRegistry;
 import org.apache.directory.server.core.schema.Registries;
 import org.apache.directory.server.core.schema.SyntaxCheckerRegistry;
@@ -128,6 +129,7 @@
             addSyntaxCheckers();
             addSyntaxes();
             addNormalizers();
+            addComparators();
             
             listEntries();
         }
@@ -148,6 +150,31 @@
     }
 
     
+    private void addComparators() throws NamingException
+    {
+        getLog().info( "------------------------------------------------------------------------"
);
+        getLog().info( " Adding comparators" );
+        getLog().info( "------------------------------------------------------------------------"
);
+
+        ComparatorRegistry comparatorRegistry = registries.getComparatorRegistry();
+        Iterator<String> ii = comparatorRegistry.oidIterator();
+        while ( ii.hasNext() )
+        {
+            String oid = ii.next();
+            getLog().info( "Adding comparator with oid = " + oid );
+            String schemaName = comparatorRegistry.getSchemaName( oid );
+            LdapDN dn = checkCreateSchema( schemaName );
+            dn.add( "ou=comparators" );
+            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            checkCreateContainer( dn );
+            Attributes entry = attributesFactory.getAttributes( oid, comparatorRegistry.lookup(
oid ) );
+            dn.add( "m-oid=" + oid );
+            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            partition.add( dn, entry );
+        }
+    }
+
+
     private void addNormalizers() throws NamingException
     {
         getLog().info( "------------------------------------------------------------------------"
);

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ComparatorRegistry.java?view=diff&rev=486275&r1=486274&r2=486275
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ComparatorRegistry.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ComparatorRegistry.java
Tue Dec 12 10:53:56 2006
@@ -21,6 +21,7 @@
 
 
 import java.util.Comparator;
+import java.util.Iterator;
 
 import javax.naming.NamingException;
 
@@ -75,4 +76,12 @@
      *      otherwise
      */
     boolean hasComparator( String oid );
+
+
+    /**
+     * Iterates over the numeric OID strings of this registry.
+     * 
+     * @return Iterator of numeric OID strings 
+     */
+    Iterator<String> oidIterator();
 }

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapComparatorRegistry.java?view=diff&rev=486275&r1=486274&r2=486275
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapComparatorRegistry.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapComparatorRegistry.java
Tue Dec 12 10:53:56 2006
@@ -22,6 +22,7 @@
 
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import javax.naming.NamingException;
@@ -44,9 +45,9 @@
     /** static class logger */
     private final static Logger log = LoggerFactory.getLogger( BootstrapComparatorRegistry.class
);
     /** the comparators in this registry */
-    private final Map comparators;
+    private final Map<String,Comparator> comparators;
     /** maps an OID to a schema name*/
-    private final Map oidToSchema;
+    private final Map<String,String> oidToSchema;
 
 
     // ------------------------------------------------------------------------
@@ -59,8 +60,8 @@
      */
     public BootstrapComparatorRegistry()
     {
-        this.oidToSchema = new HashMap();
-        this.comparators = new HashMap();
+        this.oidToSchema = new HashMap<String,String>();
+        this.comparators = new HashMap<String, Comparator>();
         SerializableComparator.setRegistry( this );
     }
 
@@ -112,7 +113,7 @@
 
     public String getSchemaName( String oid ) throws NamingException
     {
-        if ( !Character.isDigit( oid.charAt( 0 ) ) )
+        if ( ! Character.isDigit( oid.charAt( 0 ) ) )
         {
             throw new NamingException( "OID " + oid + " is not a numeric OID" );
         }
@@ -123,5 +124,11 @@
         }
 
         throw new NamingException( "OID " + oid + " not found in oid to " + "schema name
map!" );
+    }
+
+
+    public Iterator<String> oidIterator()
+    {
+        return comparators.keySet().iterator();
     }
 }

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=486275&r1=486274&r2=486275
==============================================================================
--- 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 10:53:56 2006
@@ -94,6 +94,7 @@
 #         | 1.3.6.1.4.1.18060.0.4.0.3.10 | metaSyntaxChecker           |
 #         | 1.3.6.1.4.1.18060.0.4.0.3.11 | metaSchema                  |
 #         | 1.3.6.1.4.1.18060.0.4.0.3.12 | metaNormalizer              |
+#         | 1.3.6.1.4.1.18060.0.4.0.3.13 | metaComparator              |
 #         +------------------------------+-----------------------------+
 #
 # =============================================================================
@@ -216,6 +217,16 @@
 objectclass ( 1.3.6.1.4.1.18060.0.4.0.3.12
     NAME 'metaNormalizer'
     DESC 'Meta definition of a Normalizer object'
+    SUP metaTop
+    STRUCTURAL
+    MUST ( m-oid $ m-fqcn )
+    MAY m-bytecode
+)
+
+# --- metaNormalizer objectclass ------------------------------------------
+objectclass ( 1.3.6.1.4.1.18060.0.4.0.3.13
+    NAME 'metaComparator'
+    DESC 'Meta definition of a Comparator object'
     SUP metaTop
     STRUCTURAL
     MUST ( m-oid $ m-fqcn )



Mime
View raw message