directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r808483 - in /directory: apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/ apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/ apacheds/branches/apa...
Date Thu, 27 Aug 2009 16:12:17 GMT
Author: akarasulu
Date: Thu Aug 27 16:12:05 2009
New Revision: 808483

URL: http://svn.apache.org/viewvc?rev=808483&view=rev
Log:
moved SchemaEntityFactory and started using Entry instead of ServerEntry to marshall schema
data into SchemaObject instances

Added:
    directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/AttributeClassLoader.java
      - copied, changed from r808371, directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
    directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/SchemaEntityFactory.java
      - copied, changed from r808371, directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
Removed:
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
Modified:
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/branches/apacheds-schema/schema-loader/pom.xml
    directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
    directory/project/branches/project-schema/resources/dictionary
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
Thu Aug 27 16:12:05 2009
@@ -25,6 +25,8 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.integ.CiRunner;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
+
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getRootContext;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
Thu Aug 27 16:12:05 2009
@@ -22,6 +22,7 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
Thu Aug 27 16:12:05 2009
@@ -27,6 +27,7 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
Thu Aug 27 16:12:05 2009
@@ -27,6 +27,7 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
Thu Aug 27 16:12:05 2009
@@ -24,6 +24,7 @@
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
Thu Aug 27 16:12:05 2009
@@ -27,6 +27,7 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
Thu Aug 27 16:12:05 2009
@@ -42,6 +42,7 @@
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.AbstractSchemaLoader;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
@@ -336,7 +337,7 @@
             dao.enableSchema( schema.getSchemaName() );
         }
         
-        if ( targetRegistries.getLoadedSchemas().containsKey( schema.getSchemaName() ) )
+        if ( targetRegistries.isSchemaLoaded( schema.getSchemaName() ) )
         {
             LOG.debug( "schema {} already seems to be loaded", schema.getSchemaName() );
             return;
@@ -357,7 +358,7 @@
         
         // order does matter here so some special trickery is needed
         // we cannot load a DSR before the DSRs it depends on are loaded?
-        // TODO need ot confirm this ( or we must make the class for this and use deferred

+        // TODO need to confirm this ( or we must make the class for this and use deferred

         // resolution until everything is available?
         
         loadDitStructureRules( schema, targetRegistries );

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
Thu Aug 27 16:12:05 2009
@@ -37,6 +37,7 @@
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.schema.loader.ldif.SchemaEntityFactory;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;

Modified: directory/apacheds/branches/apacheds-schema/schema-loader/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-loader/pom.xml?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-loader/pom.xml (original)
+++ directory/apacheds/branches/apacheds-schema/schema-loader/pom.xml Thu Aug 27 16:12:05
2009
@@ -34,4 +34,12 @@
     Initial schema loader used during server bootstrapping to populate 
     registries.
   </description>
+  
+  <dependencies>
+    <dependency>
+      <artifactId>apacheds-core-constants</artifactId>
+      <groupId>${pom.groupId}</groupId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
 </project>

Copied: directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/AttributeClassLoader.java
(from r808371, directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/AttributeClassLoader.java?p2=directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/AttributeClassLoader.java&p1=directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java&r1=808371&r2=808483&rev=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/AttributeClassLoader.java
Thu Aug 27 16:12:05 2009
@@ -19,7 +19,7 @@
  */
 
 
-package org.apache.directory.server.core.schema;
+package org.apache.directory.server.schema.loader.ldif;
 
 
 import javax.naming.NamingException;

Modified: directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
Thu Aug 27 16:12:05 2009
@@ -20,14 +20,14 @@
 package org.apache.directory.server.schema.loader.ldif;
 
 
+import org.apache.directory.shared.ldap.schema.LdapComparator;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
 import org.apache.directory.shared.ldap.schema.registries.AbstractSchemaLoader;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
-import org.apache.directory.shared.ldap.schema.registries.DefaultSchema;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.Value;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,19 +46,35 @@
  */
 public class LdifSchemaLoader extends AbstractSchemaLoader
 {
+    /** ldif file extension used */
+    private static final String LDIF_EXT = "ldif";
+    
+    /** ou=schema LDIF file name */
+    private static final String OU_SCHEMA_LDIF = "schema." + LDIF_EXT;
+    
     /** static class logger */
     private static final Logger LOG = LoggerFactory.getLogger( LdifSchemaLoader.class );
 
     /** Speedup for DEBUG mode */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
+    /** name of directory containing LdapComparators */
+    private static final String COMPARATORS_DIRNAME = "comparators";
+    
+    /** name of directory containing SyntaxCheckers */
+    private static final String SYNTAX_CHECKERS_DIRNAME = "syntaxCheckers";
+
+    /** name of the directory containing Normalizers */
+    private static final String NORMALIZERS_DIRNAME = "normalizers";
+
+    private final SchemaEntityFactory factory = new SchemaEntityFactory();
     private final File baseDirectory;
     private final Map<String,Schema> schemaMap = new HashMap<String,Schema>();
     private final FilenameFilter ldifFilter = new FilenameFilter()
     {
         public boolean accept( File file, String name )
         {
-            return name.endsWith( "ldif" );
+            return name.endsWith( LDIF_EXT );
         }
     };
 
@@ -82,7 +98,7 @@
                     baseDirectory.getAbsolutePath() + "' does not exist." );
         }
 
-        File schemaLdif = new File( baseDirectory, "schema.ldif" );
+        File schemaLdif = new File( baseDirectory, OU_SCHEMA_LDIF );
         if ( ! schemaLdif.exists() )
         {
             throw new FileNotFoundException( "Expecting to find a schema.ldif file in provided
baseDirectory " +
@@ -118,7 +134,7 @@
         {
             LdifReader reader = new LdifReader( new File( schemaDirectory, ldifFiles[ii]
) );
             LdifEntry entry = reader.next();
-            Schema schema = ldifToSchema( entry );
+            Schema schema = factory.getSchema( entry.getEntry() );
             schemaMap.put( schema.getSchemaName(), schema );
             
             if ( IS_DEBUG )
@@ -129,50 +145,109 @@
     }
 
 
-    private Schema ldifToSchema( LdifEntry entry ) throws Exception
+    public Schema getSchema( String schemaName ) throws Exception
     {
-        String name = entry.get( SchemaConstants.CN_AT ).getString();
+        return this.schemaMap.get( schemaName );
+    }
 
-        boolean isDisabled = false;
-        if ( entry.get( "m-disabled" ) != null )
-        {
-            isDisabled = Boolean.getBoolean( entry.get( "m-disabled" ).getString() );
-        }
 
-        String[] dependencies = null;
-        if ( entry.get( "m-dependencies" ) != null )
+    public void loadWithDependencies( Collection<Schema> schemas, Registries registries
) throws Exception
+    {
+        Map<String,Schema> notLoaded = new HashMap<String,Schema>();
+        
+        for ( Schema schema : schemas )
         {
-            dependencies = new String[ entry.get( "m-dependencies" ).size() ];
-            int ii = 0;
-            Iterator<Value<?>> list = entry.get( "m-dependencies" ).getAll();
-            while ( list.hasNext() )
+            if ( ! registries.isSchemaLoaded( schema.getSchemaName() ) )
             {
-                dependencies[ii] = list.next().getString();
-                ii++;
+                notLoaded.put( schema.getSchemaName(), schema );
             }
         }
-
-        return new DefaultSchema( name, null, dependencies, isDisabled );
+        
+        for ( Schema schema : notLoaded.values() )
+        {
+            Stack<String> beenthere = new Stack<String>();
+            super.loadDepsFirst( schema, beenthere, notLoaded, schema, registries );
+        }
     }
 
 
-    public Schema getSchema( String schemaName ) throws Exception
+    public void loadWithDependencies( Schema schema, Registries registries ) throws Exception
     {
-        return this.schemaMap.get( schemaName );
+        Stack<String> beenthere = new Stack<String>();
+        Map<String,Schema> notLoaded = new HashMap<String,Schema>();
+        notLoaded.put( schema.getSchemaName(), schema );
+        super.loadDepsFirst( schema, beenthere, notLoaded, schema, registries );
     }
 
 
-    public void loadWithDependencies( Collection<Schema> schemas, Registries registries
) throws Exception
+    public void load( Schema schema, Registries registries, boolean isDepLoad ) throws Exception
     {
+        if ( registries.isSchemaLoaded( schema.getSchemaName() ) )
+        {
+            LOG.info( "Will not attempt to load already loaded '{}' " +
+            		"schema: \n{}", schema.getSchemaName(), schema );
+            return;
+        }
+        
+        LOG.info( "Loading {} schema: \n{}", schema.getSchemaName(), schema );
+        
+        loadSyntaxCheckers( schema, registries );
+        loadComparators( schema, registries );
+        loadNormalizers( schema, registries );
+    }
+    
+    
+    private File getSchemaDirectory( Schema schema )
+    {
+        return new File( new File( baseDirectory, "schema" ), 
+            schema.getSchemaName() );
+    }
+    
+    
+    private void loadComparators( Schema schema, Registries targetRegistries ) throws Exception
+    {
+        File comparatorsDirectory = new File( getSchemaDirectory( schema ), 
+            COMPARATORS_DIRNAME );
+        File[] comparators = comparatorsDirectory.listFiles( ldifFilter );
+        for ( File ldifFile : comparators )
+        {
+            LdifReader reader = new LdifReader( ldifFile );
+            LdifEntry entry = reader.next();
+            LdapComparator<?> comparator = 
+                factory.getLdapComparator( entry.getEntry(), targetRegistries );
+            targetRegistries.getComparatorRegistry().register( comparator );
+        }
     }
-
-
-    public void loadWithDependencies( Schema schemas, Registries registries ) throws Exception
+    
+    
+    private void loadSyntaxCheckers( Schema schema, Registries targetRegistries ) throws
Exception
     {
+        File syntaxCheckersDirectory = new File( getSchemaDirectory( schema ), 
+            SYNTAX_CHECKERS_DIRNAME );
+        File[] syntaxCheckerFiles = syntaxCheckersDirectory.listFiles( ldifFilter );
+        for ( File ldifFile : syntaxCheckerFiles )
+        {
+            LdifReader reader = new LdifReader( ldifFile );
+            LdifEntry entry = reader.next();
+            SyntaxChecker syntaxChecker = 
+                factory.getSyntaxChecker( entry.getEntry(), targetRegistries );
+            targetRegistries.getSyntaxCheckerRegistry().register( syntaxChecker );
+        }
     }
-
-
-    public void load( Schema schema, Registries registries, boolean isDepLoad ) throws Exception
+    
+    
+    private void loadNormalizers( Schema schema, Registries targetRegistries ) throws Exception
     {
+        File normalizersDirectory = new File( getSchemaDirectory( schema ), 
+            NORMALIZERS_DIRNAME );
+        File[] normalizerFiles = normalizersDirectory.listFiles( ldifFilter );
+        for ( File ldifFile : normalizerFiles )
+        {
+            LdifReader reader = new LdifReader( ldifFile );
+            LdifEntry entry = reader.next();
+            Normalizer normalizer =
+                factory.getNormalizer( entry.getEntry(), targetRegistries );
+            targetRegistries.getNormalizerRegistry().register( normalizer );
+        }
     }
 }

Copied: directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/SchemaEntityFactory.java
(from r808371, directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/SchemaEntityFactory.java?p2=directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/SchemaEntityFactory.java&p1=directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java&r1=808371&r2=808483&rev=808483&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/SchemaEntityFactory.java
Thu Aug 27 16:12:05 2009
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.core.schema;
+package org.apache.directory.server.schema.loader.ldif;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -29,13 +29,12 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.core.entry.DefaultServerAttribute;
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -73,24 +72,17 @@
     private static final List<String> EMPTY_LIST = new ArrayList<String>();
     private static final String[] EMPTY_ARRAY = new String[] {};
     
-    /** Used for dependency injection of Registries via setter into schema objects */
-    private final Registries bootstrapRegistries;
     /** A special ClassLoader that loads a class from the bytecode attribute */
     private final AttributeClassLoader classLoader;
-    private final AttributeType oidAT;
-    private final AttributeType byteCodeAT;
     
     
-    public SchemaEntityFactory( Registries bootstrapRegistries ) throws NamingException
+    public SchemaEntityFactory() throws NamingException
     {
-        this.bootstrapRegistries = bootstrapRegistries;
         this.classLoader = new AttributeClassLoader();
-        this.oidAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_OID_AT
);
-        this.byteCodeAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_BYTECODE_AT
);
     }
 
     
-    public Schema getSchema( ServerEntry entry ) throws NamingException
+    public Schema getSchema( Entry entry ) throws NamingException
     {
         String name;
         String owner;
@@ -201,7 +193,7 @@
      * @return the loaded SyntaxChecker
      * @throws NamingException if anything fails during loading
      */
-    public SyntaxChecker getSyntaxChecker( ServerEntry entry, Registries targetRegistries
) throws NamingException
+    public SyntaxChecker getSyntaxChecker( Entry entry, Registries targetRegistries ) throws
NamingException
     {
         if ( entry == null )
         {
@@ -215,22 +207,21 @@
         }
 
         String className = entry.get( MetaSchemaConstants.M_FQCN_AT ).get().getString();
-        String syntaxOid = entry.get( oidAT ).get().getString();
-        return getSyntaxChecker( syntaxOid, className, entry.get( byteCodeAT ), 
-            targetRegistries );
+        String syntaxOid = entry.get( MetaSchemaConstants.M_OID_AT ).get().getString();
+        return getSyntaxChecker( syntaxOid, className, entry.get( 
+            MetaSchemaConstants.M_BYTECODE_AT ), targetRegistries );
     }
     
     
     public SyntaxChecker getSyntaxChecker( SyntaxCheckerDescription syntaxCheckerDescription,

         Registries targetRegistries ) throws NamingException
     {
-        ServerAttribute attr = null;
+        EntryAttribute attr = null;
         
         if ( syntaxCheckerDescription.getBytecode() != null )
         {
             byte[] bytecode = Base64.decode( syntaxCheckerDescription.getBytecode().toCharArray()
);
-            AttributeType byteCodeAT = targetRegistries.getAttributeTypeRegistry().lookup(
MetaSchemaConstants.M_BYTECODE_AT );
-            attr = new DefaultServerAttribute( byteCodeAT, bytecode );
+            attr = new DefaultClientAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode
);
         }
         
         return getSyntaxChecker( syntaxCheckerDescription.getOid(), 
@@ -302,13 +293,12 @@
     public LdapComparator<?> getLdapComparator( LdapComparatorDescription comparatorDescription,
Registries targetRegistries ) 
         throws NamingException
     {
-        ServerAttribute attr = null;
+        EntryAttribute attr = null;
         
         if ( comparatorDescription.getBytecode() != null )
         { 
             byte[] bytecode = Base64.decode( comparatorDescription.getBytecode().toCharArray()
);
-            AttributeType byteCodeAT = targetRegistries.getAttributeTypeRegistry().lookup(
MetaSchemaConstants.M_BYTECODE_AT );
-            attr = new DefaultServerAttribute( byteCodeAT, bytecode );
+            attr = new DefaultClientAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode
);
         }
         
         return getLdapComparator( comparatorDescription.getFqcn(), attr, targetRegistries
);
@@ -322,7 +312,7 @@
      * @return the loaded Comparator
      * @throws NamingException if anything fails during loading
      */
-    public LdapComparator<?> getLdapComparator( ServerEntry entry, Registries targetRegistries
) throws NamingException
+    public LdapComparator<?> getLdapComparator( Entry entry, Registries targetRegistries
) throws NamingException
     {
         if ( entry == null )
         {
@@ -395,13 +385,12 @@
     public Normalizer getNormalizer( NormalizerDescription normalizerDescription, Registries
targetRegistries )
         throws NamingException
     {
-        ServerAttribute attr = null;
+        EntryAttribute attr = null;
         
         if ( normalizerDescription.getBytecode() != null )
         {
             byte[] bytecode = Base64.decode( normalizerDescription.getBytecode().toCharArray()
);
-            AttributeType byteCodeAT = targetRegistries.getAttributeTypeRegistry().lookup(
MetaSchemaConstants.M_BYTECODE_AT );
-            attr = new DefaultServerAttribute( byteCodeAT, bytecode );
+            attr = new DefaultClientAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode
);
         }
         
         return getNormalizer( normalizerDescription.getFqcn(), attr, targetRegistries );
@@ -415,7 +404,7 @@
      * @return the loaded Normalizer
      * @throws NamingException if anything fails during loading
      */
-    public Normalizer getNormalizer( ServerEntry entry, Registries targetRegistries ) throws
NamingException
+    public Normalizer getNormalizer( Entry entry, Registries targetRegistries ) throws NamingException
     {
         if ( entry == null )
         {
@@ -453,7 +442,7 @@
                 return;
             }
             
-            Object[] args = new Object[] { this.bootstrapRegistries };
+            Object[] args = new Object[] { targetRegistries };
             method.invoke( obj, args );
         }
         catch ( SecurityException e )
@@ -549,7 +538,7 @@
     }
 
 
-    public LdapSyntax getSyntax( ServerEntry entry, Registries targetRegistries, String schema
) throws NamingException
+    public LdapSyntax getSyntax( Entry entry, Registries targetRegistries, String schema
) throws NamingException
     {
         String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         LdapSyntax syntax = new LdapSyntax( oid );
@@ -570,7 +559,7 @@
     }
 
     
-    public MatchingRule getMatchingRule( ServerEntry entry, Registries targetRegistries,
String schema ) throws NamingException
+    public MatchingRule getMatchingRule( Entry entry, Registries targetRegistries, String
schema ) throws NamingException
     {
         String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         String syntaxOid = entry.get( MetaSchemaConstants.M_SYNTAX_AT ).getString();
@@ -601,7 +590,7 @@
     }
     
     
-    public ObjectClass getObjectClass( ServerEntry entry, Registries targetRegistries, String
schema ) throws NamingException
+    public ObjectClass getObjectClass( Entry entry, Registries targetRegistries, String schema
) throws Exception
     {
         String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         ObjectClass oc = new ObjectClass( oid );
@@ -639,7 +628,7 @@
     }
     
     
-    public AttributeType getAttributeType( ServerEntry entry, Registries targetRegistries,
String schema ) throws NamingException
+    public AttributeType getAttributeType( Entry entry, Registries targetRegistries, String
schema ) throws NamingException
     {
         String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         AttributeType at = new AttributeType( oid );
@@ -700,7 +689,7 @@
     }
     
 
-    private void setSchemaObjectProperties( SchemaObject so, ServerEntry entry ) throws NamingException
+    private void setSchemaObjectProperties( SchemaObject so, Entry entry ) throws NamingException
     {
         if ( entry.get( MetaSchemaConstants.M_OBSOLETE_AT ) != null )
         {

Modified: directory/project/branches/project-schema/resources/dictionary
URL: http://svn.apache.org/viewvc/directory/project/branches/project-schema/resources/dictionary?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/project/branches/project-schema/resources/dictionary (original)
+++ directory/project/branches/project-schema/resources/dictionary Thu Aug 27 16:12:05 2009
@@ -120,3 +120,6 @@
 pamarcelot
 szoerner
 seelmann
+@directory.apache.org
+bytecode
+ou

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java?rev=808483&r1=808482&r2=808483&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
Thu Aug 27 16:12:05 2009
@@ -87,7 +87,7 @@
      * failure results while loading, producing and or registering schema objects
      */
     protected final void loadDepsFirst( Schema rootAncestor, Stack<String> beenthere,
Map<String, Schema> notLoaded,
-                                        Schema schema, Registries registries, Properties
props ) throws Exception
+                                        Schema schema, Registries registries ) throws Exception
     {
         if ( registries.isSchemaLoaded( schema.getSchemaName() ) )
         {
@@ -140,7 +140,7 @@
             if ( dep == null )
             {
                 // try to load dependency with the provided properties default
-                dep = getSchema( depName, props );
+                dep = getSchema( depName );
             }
 
             if ( beenthere.contains( dep.getSchemaName() ) )



Mime
View raw message