Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 14261 invoked from network); 12 Dec 2006 18:45:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2006 18:45:55 -0000 Received: (qmail 48126 invoked by uid 500); 12 Dec 2006 18:46:03 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 48103 invoked by uid 500); 12 Dec 2006 18:46:02 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 48092 invoked by uid 99); 12 Dec 2006 18:46:02 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 10:46:02 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 10:45:36 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id C974E1A981D; Tue, 12 Dec 2006 10:44:36 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r486272 - 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:44:36 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061212184436.C974E1A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: akarasulu Date: Tue Dec 12 10:44:35 2006 New Revision: 486272 URL: http://svn.apache.org/viewvc?view=rev&rev=486272 Log: added code for loading in normalizers 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/NormalizerRegistry.java directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNormalizerRegistry.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=486272&r1=486271&r2=486272 ============================================================================== --- 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:44:35 2006 @@ -46,6 +46,10 @@ */ public class AttributesFactory { + private static final String META_NORMALIZER_OC = "metaNormalizer"; + + private static final String META_SYNTAX_OC = "metaSyntax"; + private static final String META_SYNTAX_CHECKER_OC = "metaSyntaxChecker"; private static final String OBJECT_CLASS_AT = "objectClass"; @@ -111,23 +115,10 @@ } - private final String getBoolean( boolean value ) - { - if ( value ) - { - return "TRUE"; - } - else - { - return "FALSE"; - } - } - - public Attributes getAttributes( Syntax syntax ) { BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true ); - entry.get( OBJECT_CLASS_AT ).add( "metaSyntax" ); + entry.get( OBJECT_CLASS_AT ).add( META_SYNTAX_OC ); entry.put( M_OID_AT, syntax.getOid() ); entry.put( M_OBSOLETE_AT, getBoolean( syntax.isObsolete() ) ); entry.put( M_HUMAN_READIBLE_AT, getBoolean( syntax.isHumanReadible() ) ); @@ -141,15 +132,17 @@ } - public Attributes getAttributes( Normalizer normalizer ) + public Attributes getAttributes( String oid, Normalizer normalizer ) { BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true ); - entry.get( OBJECT_CLASS_AT ).add( "" ); + entry.get( OBJECT_CLASS_AT ).add( META_NORMALIZER_OC ); + entry.put( M_OID_AT, oid ); + entry.put( M_FQCN_AT, normalizer.getClass().getName() ); return entry; } - public Attributes getAttributes( Comparator comparator ) + public Attributes getAttributes( String oid, Comparator comparator ) { BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true ); entry.get( OBJECT_CLASS_AT ).add( "" ); @@ -210,5 +203,18 @@ BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true ); entry.get( OBJECT_CLASS_AT ).add( "" ); return entry; + } + + + private final String getBoolean( boolean value ) + { + if ( value ) + { + return "TRUE"; + } + else + { + return "FALSE"; + } } } 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=486272&r1=486271&r2=486272 ============================================================================== --- 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:44:35 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.NormalizerRegistry; import org.apache.directory.server.core.schema.Registries; import org.apache.directory.server.core.schema.SyntaxCheckerRegistry; import org.apache.directory.server.core.schema.SyntaxRegistry; @@ -49,6 +50,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.Normalizer; import org.apache.directory.shared.ldap.schema.Syntax; import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker; import org.apache.maven.plugin.AbstractMojo; @@ -125,6 +127,7 @@ addSyntaxCheckers(); addSyntaxes(); + addNormalizers(); listEntries(); } @@ -145,6 +148,31 @@ } + private void addNormalizers() throws NamingException + { + getLog().info( "------------------------------------------------------------------------" ); + getLog().info( " Adding normalizers" ); + getLog().info( "------------------------------------------------------------------------" ); + + NormalizerRegistry normalizerRegistry = registries.getNormalizerRegistry(); + Iterator ii = normalizerRegistry.oidIterator(); + while ( ii.hasNext() ) + { + String oid = ii.next(); + getLog().info( "Adding normalizer with oid = " + oid ); + String schemaName = normalizerRegistry.getSchemaName( oid ); + LdapDN dn = checkCreateSchema( schemaName ); + dn.add( "ou=normalizers" ); + dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); + checkCreateContainer( dn ); + Attributes entry = attributesFactory.getAttributes( oid, normalizerRegistry.lookup( oid ) ); + dn.add( "m-oid=" + oid ); + dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); + partition.add( dn, entry ); + } + } + + private void addSyntaxes() throws NamingException { getLog().info( "------------------------------------------------------------------------" ); Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/NormalizerRegistry.java URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/NormalizerRegistry.java?view=diff&rev=486272&r1=486271&r2=486272 ============================================================================== --- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/NormalizerRegistry.java (original) +++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/NormalizerRegistry.java Tue Dec 12 10:44:35 2006 @@ -20,6 +20,8 @@ package org.apache.directory.server.core.schema; +import java.util.Iterator; + import javax.naming.NamingException; import org.apache.directory.shared.ldap.schema.Normalizer; @@ -74,4 +76,13 @@ * otherwise */ boolean hasNormalizer( String oid ); + + /** + * Used to iterate through all normalizers. We have to iterate over the + * OID String keys because these objects do not associate a matchingRule OID + * with them as a class member. + * + * @return an Iterator over the set of OID Strings in this registry + */ + Iterator oidIterator(); } Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNormalizerRegistry.java URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNormalizerRegistry.java?view=diff&rev=486272&r1=486271&r2=486272 ============================================================================== --- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNormalizerRegistry.java (original) +++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNormalizerRegistry.java Tue Dec 12 10:44:35 2006 @@ -21,6 +21,7 @@ import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import javax.naming.NamingException; @@ -42,9 +43,9 @@ /** static class logger */ private final static Logger log = LoggerFactory.getLogger( BootstrapNormalizerRegistry.class ); /** a map of Normalizers looked up by OID */ - private final Map byOid; + private final Map byOid; /** maps an OID to a schema name*/ - private final Map oidToSchema; + private final Map oidToSchema; // ------------------------------------------------------------------------ @@ -56,8 +57,8 @@ */ public BootstrapNormalizerRegistry() { - this.byOid = new HashMap(); - this.oidToSchema = new HashMap(); + this.byOid = new HashMap(); + this.oidToSchema = new HashMap(); } @@ -108,7 +109,7 @@ public String getSchemaName( String oid ) throws NamingException { - if ( Character.isDigit( oid.charAt( 0 ) ) ) + if ( ! Character.isDigit( oid.charAt( 0 ) ) ) { throw new NamingException( "Looks like the arg is not a numeric OID" ); } @@ -119,5 +120,11 @@ } throw new NamingException( "OID " + oid + " not found in oid to " + "schema name map!" ); + } + + + public Iterator oidIterator() + { + return byOid.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=486272&r1=486271&r2=486272 ============================================================================== --- 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:44:35 2006 @@ -93,6 +93,7 @@ # | 1.3.6.1.4.1.18060.0.4.0.3.9 | metaDITContentRule | # | 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 | # +------------------------------+-----------------------------+ # # ============================================================================= @@ -209,6 +210,16 @@ SUP metaTop STRUCTURAL MUST cn +) + +# --- metaNormalizer objectclass ------------------------------------------ +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 ) # =============================================================================