directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r810244 - in /directory: apacheds/branches/apacheds-schema/core-constants/src/main/java/org/apache/directory/server/constants/ apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/ shared/branches/...
Date Tue, 01 Sep 2009 21:23:55 GMT
Author: akarasulu
Date: Tue Sep  1 21:23:36 2009
New Revision: 810244

URL: http://svn.apache.org/viewvc?rev=810244&view=rev
Log:
adding in jar schema ldif loader and cleaning up some code

Added:
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/SchemaPartition.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/JarLdifSchemaLoaderTest.java
Modified:
    directory/apacheds/branches/apacheds-schema/core-constants/src/main/java/org/apache/directory/server/constants/ServerDNConstants.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java
    directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java

Modified: directory/apacheds/branches/apacheds-schema/core-constants/src/main/java/org/apache/directory/server/constants/ServerDNConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-constants/src/main/java/org/apache/directory/server/constants/ServerDNConstants.java?rev=810244&r1=810243&r2=810244&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-constants/src/main/java/org/apache/directory/server/constants/ServerDNConstants.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-constants/src/main/java/org/apache/directory/server/constants/ServerDNConstants.java Tue Sep  1 21:23:36 2009
@@ -53,8 +53,11 @@
     /** The DN for the gloval schema subentry normalized */
     public static final String CN_SCHEMA_DN_NORMALIZED = "2.5.4.3=schema";
    
-    /** the DN for the global schema subentry */
+    /** the DN for the schema in dit area */
     public static final String OU_SCHEMA_DN = "ou=schema";
+
+    /** the normalized DN for the schema in DIT area */
+    public static final String OU_SCHEMA_DN_NORMALIZED = "2.5.4.11=schema";
     
     /** The DN for the schema modification's timestamp */
     public static final String SCHEMA_TIMESTAMP_ENTRY_DN = "cn=schemaModifications,ou=schema";

Added: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/SchemaPartition.java?rev=810244&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/SchemaPartition.java (added)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/SchemaPartition.java Tue Sep  1 21:23:36 2009
@@ -0,0 +1,366 @@
+/*
+ *   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.partition;
+
+
+import java.net.URL;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A special partition designed to contain the portion of the DIT where schema
+ * information for the server is stored.
+ * 
+ * In an effort to make sure that all Partition implementations are equal 
+ * citizens to ApacheDS we want to be able to swap in and out any kind of 
+ * Partition to store schema.  This also has the added advantage of making
+ * sure the core, and hence the server is not dependent on any specific 
+ * partition, which reduces coupling in the server's modules.
+ * 
+ * The SchemaPartition achieves this by not really being a backing store 
+ * itself for the schema entries.  It instead delegates to another Partition
+ * via containment.  It delegates all calls to this contained Partition. While
+ * doing so it also manages certain things:
+ * 
+ * <ol>
+ *   <li>Checks that schema changes are valid.</li>
+ *   <li>Updates the schema Registries on valid schema changes making sure
+ *       the schema on disk is in sync with the schema in memory.
+ *   </li>
+ *   <li>Will eventually manage transaction based changes to schema where 
+ *       between some sequence of operations the schema may be inconsistent.
+ *   </li>
+ *   <li>Delegates read/write operations to contained Partition.</li>
+ *   <li>
+ *       Responsible for initializing schema for the entire server.  ApacheDS
+ *       cannot start up other partitions until this Partition is started 
+ *       without having access to the Registries.  This Partition supplies the
+ *       Registries on initialization for the server.  That's one of it's core
+ *       responsibilities.
+ *   </li>
+ *   
+ * So by containing another Partition, we abstract the storage mechanism away 
+ * from the management responsibilities while decoupling the server from a
+ * specific partition implementation and removing complexity in the Schema 
+ * interceptor service which before managed synchronization.
+ * </ol>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public final class SchemaPartition extends AbstractPartition implements Partition
+{
+    /** the logger */
+    private static final Logger LOG = LoggerFactory.getLogger( SchemaPartition.class );
+    
+    /** the fixed id: 'schema' */
+    private static final String ID = "schema";
+    
+    /** the wrapped Partition */
+    private Partition wrapped;
+    
+    /** the user provided suffix DN for this Partition */
+    private LdapDN upSuffixDn = new LdapDN();
+    
+    /** the normalized suffix DN for this Partition */
+    private LdapDN normSuffixDn = new LdapDN();
+    
+    /** the registries managed by this SchemaPartition */
+    private Registries registries = new Registries();
+    
+    
+    /**
+     * Creates a new instance of SchemaPartition.
+     */
+    public SchemaPartition() throws Exception
+    {
+        upSuffixDn.add( ServerDNConstants.OU_SCHEMA_DN );
+        normSuffixDn.add( ServerDNConstants.OU_SCHEMA_DN_NORMALIZED );
+        
+        // -----------------------------------------------------------------------
+        // Load apachemeta schema from within the ldap-schema Jar with all the
+        // schema it depends on.  This is a minimal mandatory set of schemas.
+        // -----------------------------------------------------------------------
+        
+        // @TODO - load apachemeta into registries
+        
+        URL url = SchemaLdifExtractor.getUniqueResource( "schema.ldif", "the base schema.ldif file" );
+        LOG.debug( "Found schema.ldif file in jar: {}", url );
+    }
+
+    
+    public Registries getRegistries()
+    {
+        return registries;
+    }
+    
+    
+    // -----------------------------------------------------------------------
+    // Partition Interface Method Overrides
+    // -----------------------------------------------------------------------
+
+    
+    @Override
+    public void sync() throws Exception
+    {
+        wrapped.sync();
+    }
+    
+    
+    @Override
+    protected void doInit()
+    {
+        getDirectoryService().setRegistries( registries );
+        wrapped.setId( ID );
+        wrapped.setSuffix( ServerDNConstants.OU_SCHEMA_DN );
+        
+        try
+        {
+            wrapped.init( getDirectoryService() );
+        }
+        catch ( Exception e )
+        {
+            LOG.error( "Failed to initialize wrapped partition.", e );
+            throw new RuntimeException( e );
+        }
+    }
+    
+    
+    @Override
+    protected void doDestroy()
+    {
+        try
+        {
+            wrapped.destroy();
+        }
+        catch ( Exception e )
+        {
+            LOG.error( "Attempt to destroy wrapped partition failed.", e );
+            throw new RuntimeException( e );
+        }
+    }
+    
+    
+    // -----------------------------------------------------------------------
+    // Partition Interface Methods
+    // -----------------------------------------------------------------------
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#add(org.apache.directory.server.core.interceptor.context.AddOperationContext)
+     */
+    public void add( AddOperationContext opContext ) throws Exception
+    {
+        wrapped.add( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#bind(org.apache.directory.server.core.interceptor.context.BindOperationContext)
+     */
+    public void bind( BindOperationContext opContext ) throws Exception
+    {
+        wrapped.bind( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#delete(org.apache.directory.server.core.interceptor.context.DeleteOperationContext)
+     */
+    public void delete( DeleteOperationContext opContext ) throws Exception
+    {
+        wrapped.delete( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#getCacheSize()
+     */
+    public int getCacheSize()
+    {
+        return wrapped.getCacheSize();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#getId()
+     */
+    public final String getId()
+    {
+        return ID;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#getSuffix()
+     */
+    public final String getSuffix()
+    {
+        return ServerDNConstants.CN_SCHEMA_DN;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#getSuffixDn()
+     */
+    public LdapDN getSuffixDn() throws Exception
+    {
+        return normSuffixDn;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#getUpSuffixDn()
+     */
+    public LdapDN getUpSuffixDn() throws Exception
+    {
+        return upSuffixDn;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#list(org.apache.directory.server.core.interceptor.context.ListOperationContext)
+     */
+    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
+    {
+        return wrapped.list( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#lookup(java.lang.Long)
+     */
+    public ClonedServerEntry lookup( Long id ) throws Exception
+    {
+        return wrapped.lookup( id );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#modify(org.apache.directory.server.core.interceptor.context.ModifyOperationContext)
+     */
+    public void modify( ModifyOperationContext opContext ) throws Exception
+    {
+        wrapped.modify( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#move(org.apache.directory.server.core.interceptor.context.MoveOperationContext)
+     */
+    public void move( MoveOperationContext opContext ) throws Exception
+    {
+        wrapped.move( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#moveAndRename(org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext)
+     */
+    public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
+    {
+        wrapped.moveAndRename( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#rename(org.apache.directory.server.core.interceptor.context.RenameOperationContext)
+     */
+    public void rename( RenameOperationContext opContext ) throws Exception
+    {
+        wrapped.rename( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#search(org.apache.directory.server.core.interceptor.context.SearchOperationContext)
+     */
+    public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
+    {
+        return wrapped.search( opContext );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#setCacheSize(int)
+     */
+    public void setCacheSize( int cacheSize )
+    {
+        wrapped.setCacheSize( cacheSize );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#setId(java.lang.String)
+     */
+    public void setId( String id )
+    {
+        throw new UnsupportedOperationException( "This partition's ID is fixed: " + ID );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#setSuffix(java.lang.String)
+     */
+    public void setSuffix( String suffix )
+    {
+        throw new UnsupportedOperationException( "This partition's suffix is fixed: " + 
+            ServerDNConstants.OU_SCHEMA_DN );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#unbind(org.apache.directory.server.core.interceptor.context.UnbindOperationContext)
+     */
+    public void unbind( UnbindOperationContext opContext ) throws Exception
+    {
+        wrapped.unbind( opContext );
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.partition.Partition#lookup(org.apache.directory.server.core.interceptor.context.LookupOperationContext)
+     */
+    public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
+    {
+        return wrapped.lookup( lookupContext );
+    }
+}

Added: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java?rev=810244&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java (added)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java Tue Sep  1 21:23:36 2009
@@ -0,0 +1,868 @@
+/*
+ *  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.shared.schema.loader.ldif;
+
+
+import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
+import org.apache.directory.shared.ldap.NotImplementedException;
+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.LdapComparator;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
+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.Normalizer;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.ResourceMap;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+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.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+import java.util.regex.Pattern;
+
+
+/**
+ * Loads schema data from LDIF files containing entries representing schema
+ * objects, using the meta schema format.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision$
+ */
+public class JarLdifSchemaLoader extends AbstractSchemaLoader
+{
+    /** ldif file extension used */
+    private static final String LDIF_EXT = "ldif";
+    
+    /** static class logger */
+    private static final Logger LOG = LoggerFactory.getLogger( JarLdifSchemaLoader.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";
+
+    /** name of the directory containing syntaxes */
+    private static final String SYNTAXES_DIRNAME = "syntaxes";
+    
+    /** name of the directory containing attributeTypes */
+    private static final String ATTRIBUTE_TYPES_DIRNAME = "attributeTypes";
+    
+    /** name of the directory containing matchingRules */
+    private final static String MATCHING_RULES_DIRNAME = "matchingRules";
+
+    /** name of the directory containing objectClasses */
+    private static final String OBJECT_CLASSES_DIRNAME = "objectClasses";
+    
+    /** name of the directory containing ditStructureRules */
+    private static final String DIT_STRUCTURE_RULES_DIRNAME = "ditStructureRules";
+    
+    /** name of the directory containing ditContentRules */
+    private static final String DIT_CONTENT_RULES_DIRNAME = "ditContentRules";
+    
+    /** name of the directory containing nameForms */
+    private static final String NAME_FORMS_DIRNAME = "nameForms";
+    
+    /** name of the directory containing matchingRuleUses */
+    private static final String MATCHING_RULE_USES_DIRNAME = "matchingRuleUse";
+
+    /** the factory that generates respective SchemaObjects from LDIF entries */
+    private final SchemaEntityFactory factory = new SchemaEntityFactory();
+    
+    /** a map of all the resources in this jar */
+    private static final Map<String,Boolean> RESOURCE_MAP = ResourceMap.getResources( Pattern.compile( ".*schema/schema.*" ) );
+
+    
+    /**
+     * Creates a new LDIF based SchemaLoader. The constructor checks to make
+     * sure the supplied base directory exists and contains a schema.ldif file
+     * and if not complains about it.
+     *
+     * @param baseDirectory the schema LDIF base URL
+     * @throws Exception if the base directory does not exist or does not
+     * a valid schema.ldif file
+     */
+    public JarLdifSchemaLoader() throws Exception
+    {
+        for ( String url : RESOURCE_MAP.keySet() )
+        {
+            System.out.println( url );
+        }
+
+        initializeSchemas();
+    }
+
+
+    /**
+     * Scans for LDIF files just describing the various schema contained in
+     * the schema repository.
+     *
+     * @throws Exception
+     */
+    private void initializeSchemas() throws Exception
+    {
+        if ( IS_DEBUG )
+        {
+            LOG.debug( "Initializing schema" );
+        }
+        
+        for ( String file : RESOURCE_MAP.keySet() )
+        {
+            Pattern pat = Pattern.compile( "schema/schema/[a-z]*/" );
+            if ( pat.matcher( file ).matches() )
+            {
+                String[] split = file.split( "/" );
+                String schemaName = split[split.length-1];
+                String resourcePath = "schema/schema/" + schemaName + "." + LDIF_EXT;
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema ldif file" );
+                try
+                {
+                    LdifReader reader = new LdifReader( resource.openStream() );
+                    LdifEntry entry = reader.next();
+                    Schema schema = factory.getSchema( entry.getEntry() );
+                    schemaMap.put( schema.getSchemaName(), schema );
+                    
+                    if ( IS_DEBUG )
+                    {
+                        LOG.debug( "Schema Initialized ... \n{}", schema );
+                    }
+                }
+                catch ( Exception e )
+                {
+                    LOG.error( "Failed to load schema LDIF file " + file, e );
+                    throw e;
+                }
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Schema getSchema( String schemaName ) throws Exception
+    {
+        return this.schemaMap.get( schemaName );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void loadWithDependencies( Collection<Schema> schemas, Registries registries ) throws Exception
+    {
+        Map<String,Schema> notLoaded = new HashMap<String,Schema>();
+        
+        for ( Schema schema : schemas )
+        {
+            if ( ! registries.isSchemaLoaded( schema.getSchemaName() ) )
+            {
+                notLoaded.put( schema.getSchemaName(), schema );
+            }
+        }
+        
+        for ( Schema schema : notLoaded.values() )
+        {
+            Stack<String> beenthere = new Stack<String>();
+            super.loadDepsFirst( schema, beenthere, notLoaded, schema, registries );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void loadWithDependencies( Schema schema, Registries registries ) throws Exception
+    {
+        Stack<String> beenthere = new Stack<String>();
+        Map<String,Schema> notLoaded = new HashMap<String,Schema>();
+        
+        for ( Schema candidate : schemaMap.values() )
+        {
+            if ( ! registries.isSchemaLoaded( candidate.getSchemaName() ) )
+            {
+                notLoaded.put( candidate.getSchemaName(), candidate );
+            }
+        }
+        
+        super.loadDepsFirst( schema, beenthere, notLoaded, schema, registries );
+    }
+
+
+    /**
+     * Loads a single schema if it has not been loaded already.  If the schema
+     * load request was made because some other schema depends on this one then
+     * the schema is checked to see if it is disabled.  If disabled it is 
+     * enabled with a write to disk and then loaded. Listeners are notified that
+     * the schema has been loaded.
+     * 
+     * {@inheritDoc}
+     */
+    public void load( Schema schema, Registries registries, boolean isDepLoad ) throws Exception
+    {
+        // if we're loading a dependency and it has not been enabled on 
+        // disk then we cannot enable on disk from within a jar.  So the
+        // enableSchema method just marks the Schema as enabled.
+        if ( schema.isDisabled() && isDepLoad )
+        {
+            schema.enable();
+        }
+        
+        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 );
+        
+        loadComparators( schema, registries );
+        loadNormalizers( schema, registries );
+        loadSyntaxCheckers( schema, registries );
+        loadSyntaxes( schema, registries );
+        loadMatchingRules( schema, registries );
+        loadAttributeTypes( schema, registries );
+        loadObjectClasses( schema, registries );
+        loadMatchingRuleUses( schema, registries );
+        loadDitContentRules( schema, registries );
+        loadNameForms( schema, registries );
+        loadDitStructureRules( schema, registries );
+
+        notifyListenerOrRegistries( schema, registries );
+    }
+
+    
+    /**
+     * Utility method to get the path for a schema directory.
+     *
+     * @param schema the schema to get the path for
+     * @return the path for the specific schema directory
+     */
+    private final String getSchemaDirectory( Schema schema )
+    {
+        return "schema/schema/" + schema.getSchemaName();
+    }
+    
+    
+    /**
+     * Loads the Comparators from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which comparators are loaded
+     * @param registries the registries which are loaded with comparators
+     * @throws Exception if there are failures accessing comparator information
+     * stored in LDIF files
+     */
+    private void loadComparators( Schema schema, Registries registries ) throws Exception
+    {
+        String comparatorsDirectory = getSchemaDirectory( schema ) 
+            + "/" + COMPARATORS_DIRNAME;
+        
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( comparatorsDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF comparator" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                LdapComparator<?> comparator = 
+                    factory.getLdapComparator( entry.getEntry(), registries );
+                comparator.setOid( entry.get( MetaSchemaConstants.M_OID_AT ).getString() );
+                registries.getComparatorRegistry().register( comparator );
+            }
+        }
+    }
+    
+    
+    /**
+     * Loads the SyntaxCheckers from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which syntaxCheckers are loaded
+     * @param targetRegistries the registries which are loaded with syntaxCheckers
+     * @throws Exception if there are failures accessing syntaxChecker 
+     * information stored in LDIF files
+     */
+    private void loadSyntaxCheckers( Schema schema, Registries registries ) throws Exception
+    {
+        String syntaxCheckersDirectory = getSchemaDirectory( schema ) 
+            +  "/" + SYNTAX_CHECKERS_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( syntaxCheckersDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF syntaxChecker" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                SyntaxChecker syntaxChecker = 
+                    factory.getSyntaxChecker( entry.getEntry(), registries );
+                registries.getSyntaxCheckerRegistry().register( syntaxChecker );
+            }
+        }
+    }
+    
+    
+    /**
+     * Loads the Normalizers from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which normalizers are loaded
+     * @param registries the registries which are loaded with normalizers
+     * @throws Exception if there are failures accessing normalizer information
+     * stored in LDIF files
+     */
+    private void loadNormalizers( Schema schema, Registries registries ) throws Exception
+    {
+        String normalizersDirectory = getSchemaDirectory( schema )
+            + "/" + NORMALIZERS_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( normalizersDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF normalizer" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                Normalizer normalizer =
+                    factory.getNormalizer( entry.getEntry(), registries );
+                registries.getNormalizerRegistry().register( normalizer );
+            }
+        }
+    }
+    
+    
+    /**
+     * Loads the MatchingRules from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which matchingRules are loaded
+     * @param registries the registries which are loaded with matchingRules
+     * @throws Exception if there are failures accessing matchingRule 
+     * information stored in LDIF files
+     */
+    private void loadMatchingRules( Schema schema, Registries registries ) throws Exception
+    {
+        String matchingRulesDirectory = getSchemaDirectory( schema )
+            + "/" + MATCHING_RULES_DIRNAME;
+        
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( matchingRulesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF matchingRule" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                MatchingRule matchingRule = factory.getMatchingRule( 
+                    entry.getEntry(), registries, schema.getSchemaName() );
+                registries.getMatchingRuleRegistry().register( matchingRule );
+            }
+        }
+    }
+    
+    
+    /**
+     * Loads the Syntaxes from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which syntaxes are loaded
+     * @param registries the registries which are loaded with syntaxes
+     * @throws Exception if there are failures accessing comparator information
+     * stored in LDIF files
+     */
+    private void loadSyntaxes( Schema schema, Registries registries ) throws Exception
+    {
+        String syntaxesDirectory = getSchemaDirectory( schema )
+            + "/" + SYNTAXES_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( syntaxesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF syntax" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                LdapSyntax syntax = factory.getSyntax( 
+                    entry.getEntry(), registries, schema.getSchemaName() );
+                registries.getLdapSyntaxRegistry().register( syntax );
+            }
+        }
+    }
+
+    
+    /**
+     * Loads the AttributeTypes from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which attributeTypes are loaded
+     * @param registries the registries which are loaded with attributeTypes
+     * @throws Exception if there are failures accessing attributeTypes 
+     * information stored in LDIF files
+     */
+    private void loadAttributeTypes( Schema schema, Registries registries ) throws Exception
+    {
+    	/*
+    	 * AT's can depend on another AT via the superior relationship.  
+    	 * Because we separate each schema object into its own LDIF file and
+    	 * the file system scan producing the listing of files used to order
+    	 * the LDIF loads does not consider these dependencies we can have
+    	 * a situation where the superior may not be loaded when a dependent
+    	 * AT is loaded.
+    	 * 
+    	 * For this reason we must defer the loading of some LDIF entries 
+    	 * until their superior AT is actually loaded.  This hash stores
+    	 * LDIF entries keyed by the name of their superior AT.  When the
+    	 * superior is loaded, the deferred entries depending on that superior
+    	 * are loaded and the list of dependent entries are removed from this 
+    	 * hash map.
+    	 * 
+    	 * NOTE: Because we don't have an OID and must use a potentially 
+    	 * case varying String as the key in this map, we reduce the String to
+    	 * it's lower cased cannonical form.
+    	 */
+    	Map<String,List<LdifEntry>> deferredEntries = new HashMap<String, List<LdifEntry>>();
+
+    	// check that the attributeTypes directory exists for the schema
+        String attributeTypesDirectory = getSchemaDirectory( schema )
+            + "/" + ATTRIBUTE_TYPES_DIRNAME;
+        
+        // get list of attributeType LDIF schema files in attributeTypes
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( attributeTypesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF attributeType" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                loadAttributeType( schema, deferredEntries, entry, registries );
+            }
+        }
+
+        
+        if ( ! deferredEntries.isEmpty() )
+        {
+        	for ( String missingSuperior : deferredEntries.keySet() )
+        	{
+        		if ( registries.getObjectClassRegistry().containsName( missingSuperior ) )
+        		{
+        			for ( LdifEntry entry : deferredEntries.get( missingSuperior ) )
+        			{
+        				if ( loadAttributeType( schema, deferredEntries, entry, registries ) )
+        				{
+        					LOG.error( "Still failed to load schema entry: {}", entry );
+        				}
+        			}
+        		}
+        	}
+        }
+    }
+    
+    
+    /**
+     * Recursive method that loads an AT, and other deferred ATs that depend
+     * on it.  This is separated from and used by 
+     * {@link #loadAttributeTypes(Schema, Registries)} to enter into this 
+     * method.
+     * 
+     * If the AT being loaded has deferred entries waiting on it to be loaded,
+     * then the AT is loaded then it's deferred entries are loaded by making a
+     * recursive call to this method.  This begins the process a new making 
+     * sure all deferred descendants in the AT hierarchy are load.
+     * 
+     * @param schema the schema we are loading
+     * @param deferredEntries map of deferred AT LDIF entries
+     * @param entry the AT LDIF entry to load
+     * @param registries the registries the schema objects are loaded into
+     * @return true if the AT is loaded, false otherwise
+     * @throws Exception if there any failures looking up or registering
+     */
+    private boolean loadAttributeType( Schema schema, Map<String,List<LdifEntry>> deferredEntries, LdifEntry entry,
+    		Registries registries ) throws Exception
+    {
+        // get superior name and if exists check if loaded, defer if not
+        EntryAttribute superior = entry.getEntry().get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT );
+        if ( superior != null )
+        {
+        	String superiorName = superior.getString().toLowerCase();
+        	
+        	if ( ! registries.getAttributeTypeRegistry().containsName( superiorName ) )
+        	{
+        		List<LdifEntry> dependents = deferredEntries.get( superiorName );
+        		if ( dependents == null )
+        		{
+        			dependents = new ArrayList<LdifEntry>();
+        			deferredEntries.put( superiorName, dependents );
+        		}
+
+        		dependents.add( entry );
+        		return false;  // - return false if deferred, true when loaded
+        	}
+        }
+        
+        AttributeType attributeType = factory.getAttributeType( entry.getEntry(), registries, schema.getSchemaName() );
+        registries.getAttributeTypeRegistry().register( attributeType );
+
+        // after registering AT check if any deferred entries depend on it
+        if ( attributeType.getNames() != null )
+        {
+        	for ( String name : attributeType.getNames() )
+        	{
+        		if ( deferredEntries.containsKey( name.toLowerCase() ) )
+        		{
+        			List<LdifEntry> deferredList = deferredEntries.get( name.toLowerCase() );
+        			List<LdifEntry> copiedList = new ArrayList<LdifEntry>( deferredList );
+        			for ( LdifEntry deferred : copiedList )
+        			{
+        				if ( loadAttributeType( schema, deferredEntries, deferred, registries ) )
+        				{
+        					deferredList.remove( deferred );
+        				}
+        			}
+        			
+        			if ( deferredList.isEmpty() )
+        			{
+        				deferredEntries.remove( name.toLowerCase() );
+        			}
+        		}
+        	}
+        }
+        
+        return true;
+    }
+
+
+    /**
+     * Loads the MatchingRuleUses from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which matchingRuleUses are loaded
+     * @param registries the registries which are loaded with matchingRuleUses
+     * @throws Exception if there are failures accessing matchingRuleUse 
+     * information stored in LDIF files
+     */
+    private void loadMatchingRuleUses( Schema schema, Registries registries ) throws Exception
+    {
+        String matchingRuleUsesDirectory = getSchemaDirectory( schema )
+            + "/" + MATCHING_RULE_USES_DIRNAME;
+        
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( matchingRuleUsesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF matchingRuleUse" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                MatchingRuleUse matchingRuleUse = null;
+            
+                // TODO add factory method to generate the matchingRuleUse
+                if ( true )
+                {
+                    throw new NotImplementedException( "Need to implement factory " +
+                    		"method for creating a matchingRuleUse" );
+                }
+                
+                registries.getMatchingRuleUseRegistry().register( matchingRuleUse );
+            }
+        }
+    }
+
+
+    /**
+     * Loads the NameForms from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which nameForms are loaded
+     * @param registries the registries which are loaded with nameForms
+     * @throws Exception if there are failures accessing nameForm information
+     * stored in LDIF files
+     */
+    private void loadNameForms( Schema schema, Registries registries ) throws Exception
+    {
+        String nameFormsDirectory = getSchemaDirectory( schema ) + "/" + NAME_FORMS_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( nameFormsDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF nameForm" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                NameForm nameForm = null;
+
+                // TODO add factory method to generate the nameForm
+                if ( true )
+                {
+                    throw new NotImplementedException( "Need to implement factory " +
+                            "method for creating a nameForm" );
+                }
+                
+                registries.getNameFormRegistry().register( nameForm );
+            }
+        }
+    }
+
+
+    /**
+     * Loads the DitContentRules from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which ditContentRules are loaded
+     * @param registries the registries which are loaded with ditContentRules
+     * @throws Exception if there are failures accessing ditContentRules 
+     * information stored in LDIF files
+     */
+    private void loadDitContentRules( Schema schema, Registries registries ) throws Exception
+    {
+        String ditContentRulesDirectory = getSchemaDirectory( schema ) + "/" + DIT_CONTENT_RULES_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( ditContentRulesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF ditContentRule" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                DITContentRule ditContentRule = null;
+                
+                // TODO add factory method to generate the ditContentRule
+                if ( true )
+                {
+                    throw new NotImplementedException( "Need to implement factory " +
+                            "method for creating a ditContentRule" );
+                }
+                
+                registries.getDitContentRuleRegistry().register( ditContentRule );
+            }
+        }
+    }
+
+
+    /**
+     * Loads the ditStructureRules from LDIF files in the supplied schema into 
+     * the supplied registries.
+     *
+     * @param schema the schema for which ditStructureRules are loaded
+     * @param registries the registries which are loaded with ditStructureRules
+     * @throws Exception if there are failures accessing ditStructureRule 
+     * information stored in LDIF files
+     */
+    private void loadDitStructureRules( Schema schema, Registries registries ) throws Exception
+    {
+        String ditStructureRulesDirectory = getSchemaDirectory( schema )
+            + "/" + DIT_STRUCTURE_RULES_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( ditStructureRulesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF ditStructureRule" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+            
+                LdifEntry entry = reader.next();
+                DITStructureRule ditStructureRule = null;
+            
+                // TODO add factory method to generate the ditContentRule
+                if ( true )
+                {
+                    throw new NotImplementedException( "Need to implement factory " +
+                            "method for creating a ditStructureRule" );
+                }
+                
+                registries.getDitStructureRuleRegistry().register( ditStructureRule );
+            }
+        }
+    }
+
+
+    /**
+     * Loads the ObjectClasses from LDIF files in the supplied schema into the 
+     * supplied registries.
+     *
+     * @param schema the schema for which objectClasses are loaded
+     * @param registries the registries which are loaded with objectClasses
+     * @throws Exception if there are failures accessing objectClass information
+     * stored in LDIF files
+     */
+    private void loadObjectClasses( Schema schema, Registries registries ) throws Exception
+    {
+    	/*
+    	 * OC's can depend on other OCs via their list of superior OCs.  
+    	 * Because we separate each schema object into its own LDIF file and
+    	 * the file system scan producing the listing of files used to order
+    	 * the LDIF loads does not consider these dependencies we can have
+    	 * a situation where the superiors may not be loaded when a dependent
+    	 * OC is loaded.
+    	 * 
+    	 * For this reason we must defer the loading of some LDIF entries 
+    	 * until their superior OCs are actually loaded.  This hash stores
+    	 * LDIF entries keyed by the name of their superior OCs.  When a
+    	 * superior is loaded, the deferred entries depending on that superior
+    	 * are loaded and the list of dependent entries are removed from this 
+    	 * hash map.
+    	 * 
+    	 * NOTE: Because we don't have an OID and must use a potentially 
+    	 * case varying String as the key in this map, we reduce the String to
+    	 * it's lower cased cannonical form.
+    	 */
+    	Map<String,List<LdifEntry>> deferredEntries = new HashMap<String, List<LdifEntry>>();
+
+    	// get objectClasses directory, check if exists, return if not
+    	String objectClassesDirectory = getSchemaDirectory( schema ) + "/" + OBJECT_CLASSES_DIRNAME;
+
+        for ( String resourcePath : RESOURCE_MAP.keySet() )
+        {
+            Pattern regex = Pattern.compile( objectClassesDirectory + "/.*\\." + LDIF_EXT );
+            if ( regex.matcher( resourcePath ).matches() )
+            {
+                URL resource = SchemaLdifExtractor.getUniqueResource( resourcePath, "schema LDIF objectClass" );
+                LdifReader reader = new LdifReader( resource.openStream() );
+                LdifEntry entry = reader.next();
+                loadObjectClass( schema, deferredEntries, entry, registries );
+            }
+            
+            if ( ! deferredEntries.isEmpty() )
+            {
+            	for ( String missingSuperior : deferredEntries.keySet() )
+            	{
+            		if ( registries.getObjectClassRegistry().containsName( missingSuperior ) )
+            		{
+            			for ( LdifEntry entry : deferredEntries.get( missingSuperior ) )
+            			{
+            				if ( loadObjectClass( schema, deferredEntries, entry, registries ) )
+            				{
+            					LOG.error( "Still failed to load schema entry: {}", entry );
+            				}
+            			}
+            		}
+            	}
+            }
+        }
+    }
+    
+    
+    /**
+     * Recursive method that loads an OC, and other deferred OCs that may
+     * depend on the initial OC loaded.  This is separated from and used by
+     * {@link #loadObjectClasses(Schema, Registries)} to enter into this 
+     * method.
+     * 
+     * If the OC being loaded has deferred entries waiting on it to be loaded,
+     * then the OC is loaded then it's deferred entries are loaded by making a
+     * recursive call to this method.  This begins the process a new making 
+     * sure all deferred descendants in the OC hierarchy are load.
+     * 
+     * @param schema the schema we are loading
+     * @param deferredEntries map of deferred OC LDIF entries
+     * @param entry the OC LDIF entry to load
+     * @param registries the registries the schema objects are loaded into
+     * @return true if the OC is loaded, false otherwise
+     * @throws Exception if there any failures looking up or registering
+     */
+    private boolean loadObjectClass( Schema schema, Map<String,List<LdifEntry>> deferredEntries, LdifEntry entry, 
+    		Registries registries ) throws Exception
+	{
+        // get superior name and if exists check if loaded, defer if not
+        EntryAttribute superiors = entry.getEntry().get( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT );
+        if ( superiors != null )
+        {
+        	for ( Value<?> value : superiors )
+        	{
+        		String superiorName = value.getString().toLowerCase();
+            	if ( ! registries.getObjectClassRegistry().containsName( superiorName ) )
+            	{
+            		List<LdifEntry> dependents = deferredEntries.get( superiorName );
+            		if ( dependents == null )
+            		{
+            			dependents = new ArrayList<LdifEntry>();
+            			deferredEntries.put( superiorName, dependents );
+            		}
+
+            		dependents.add( entry );
+            		return false;  // - return false if deferred, true when loaded
+            	}
+        	}
+        }
+        
+        ObjectClass objectClass = factory.getObjectClass( entry.getEntry(), registries, schema.getSchemaName() );
+        registries.getObjectClassRegistry().register( objectClass );
+
+        // after registering AT check if any deferred entries depend on it
+        if ( objectClass.getNames() != null )
+        {
+        	for ( String name : objectClass.getNames() )
+        	{
+        		if ( deferredEntries.containsKey( name.toLowerCase() ) )
+        		{
+        			List<LdifEntry> deferredList = deferredEntries.get( name.toLowerCase() );
+        			List<LdifEntry> copiedList = new ArrayList<LdifEntry>( deferredList );
+        			for ( LdifEntry deferred : copiedList )
+        			{
+        				if ( loadObjectClass( schema, deferredEntries, deferred, registries ) )
+        				{
+        					deferredList.remove( deferred );
+        				}
+        			}
+        			
+        			if ( deferredList.isEmpty() )
+        			{
+        				deferredEntries.remove( name.toLowerCase() );
+        			}
+        		}
+        	}
+        }
+        
+        return true;
+    }
+}

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java?rev=810244&r1=810243&r2=810244&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java Tue Sep  1 21:23:36 2009
@@ -63,7 +63,7 @@
 
 
 /**
- * Loads schema data from an LDIF files containing entries representing schema
+ * Loads schema data from LDIF files containing entries representing schema
  * objects, using the meta schema format.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>

Added: directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/JarLdifSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/JarLdifSchemaLoaderTest.java?rev=810244&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/JarLdifSchemaLoaderTest.java (added)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/JarLdifSchemaLoaderTest.java Tue Sep  1 21:23:36 2009
@@ -0,0 +1,43 @@
+/*
+ *  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.schema.loader.ldif;
+
+
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
+import org.junit.Test;
+
+
+/**
+ * Tests the LdifSchemaLoader.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision$
+ */
+public class JarLdifSchemaLoaderTest
+{
+    @Test
+    public void testJarLdifSchemaLoader() throws Exception
+    {
+        Registries registries = new Registries();
+        JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
+        loader.loadWithDependencies( loader.getSchema( "apachemeta" ), registries );
+    }
+}

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java?rev=810244&r1=810243&r2=810244&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java Tue Sep  1 21:23:36 2009
@@ -39,12 +39,12 @@
     @Test
     public void testLoader() throws Exception
     {
-        File workingDirectory = new File( System.getProperty( "workingDirectory" ) );
-        SchemaLdifExtractor extractor = new SchemaLdifExtractor( workingDirectory );
-        extractor.extractOrCopy();
-        
-        LdifSchemaLoader loader = new LdifSchemaLoader( new File( workingDirectory, "schema" ) );
-        Registries registries = new Registries();
-        loader.loadAllEnabled( registries );
+//        File workingDirectory = new File( System.getProperty( "workingDirectory" ) );
+//        SchemaLdifExtractor extractor = new SchemaLdifExtractor( workingDirectory );
+//        extractor.extractOrCopy();
+//        
+//        LdifSchemaLoader loader = new LdifSchemaLoader( new File( workingDirectory, "schema" ) );
+//        Registries registries = new Registries();
+//        loader.loadAllEnabled( registries );
     }
 }

Modified: directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java?rev=810244&r1=810243&r2=810244&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java Tue Sep  1 21:23:36 2009
@@ -234,7 +234,7 @@
      * @return the URL to the resource in the Jar file
      * @throws IOException if there is an IO error
      */
-    static URL getUniqueResource( String resourceName, String resourceDescription )
+    public static URL getUniqueResource( String resourceName, String resourceDescription )
             throws IOException
     {
         Enumeration<URL> resources = SchemaLdifExtractor.class.getClassLoader().getResources( resourceName );



Mime
View raw message