directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r812132 [1/2] - in /directory/apacheds/branches/apacheds-schema: core-api/src/main/java/org/apache/directory/server/core/partition/ core-api/src/main/java/org/apache/directory/server/core/schema/ core-api/src/main/java/org/apache/directory/...
Date Mon, 07 Sep 2009 13:31:56 GMT
Author: akarasulu
Date: Mon Sep  7 13:31:55 2009
New Revision: 812132

URL: http://svn.apache.org/viewvc?rev=812132&view=rev
Log:
Decoupled and reassembled schema subsystem. 

 o Removed coupling between partition dao, loader, partition and these 
   MetaChangeHandlers.
 o Created new RegistrySynchronizer interface so the SchemaParition can 
   delegate registry updates to these objects instead of it doing this 
   inline and becoming massive.
 o The dao, loader and these registrySynchronizers are now hidden details
   known only to the SchemaPartition.  The SchemaPartition may now need
   to expose some interfaces to allow for access to SchemaLoader methods
   however toggling the disabled bit of the schema objects in the DIT 
   does this automatically.

Added:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
      - copied, changed from r812031, directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
      - copied, changed from r812031, directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DefaultRegistrySynchronizer.java
Removed:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DefaultRegistrySynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/BootstrapRegistryLoader.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DefaultRegistryFactory.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/JarLdifBootstrapRegistryLoader.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/RegistryFactory.java
Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DirectoryServiceBuilder.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=812132&r1=812131&r2=812132&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Mon Sep  7 13:31:55 2009
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.partition;
 
 
-import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -40,8 +39,6 @@
  */
 public abstract class AbstractPartition implements Partition
 {
-    /** {@link DirectoryService} specified at {@link #initialize()}. */
-    protected DirectoryService directoryService;
     /** <tt>true</tt> if and only if this partition is initialized. */
     protected boolean initialized;
 
@@ -85,7 +82,6 @@
             return;
         }
 
-        this.directoryService = directoryService;
         try
         {
             doInit();
@@ -103,8 +99,9 @@
 
     /**
      * Override this method to put your initialization code.
+     * @throws Exception 
      */
-    protected void doInit() throws InvalidNameException
+    protected void doInit() throws InvalidNameException, Exception
     {
     }
 
@@ -123,7 +120,6 @@
         finally
         {
             initialized = false;
-            directoryService = null;
         }
     }
 
@@ -146,17 +142,6 @@
 
 
     /**
-     * Returns {@link DirectoryService} that is provided from
-     * {@link #initialize()}.
-     * @return return the directory service core
-     */
-    public final DirectoryService getDirectoryService()
-    {
-        return directoryService;
-    }
-
-
-    /**
      * This method does nothing by default.
      */
     public void sync() throws Exception

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=812132&r1=812131&r2=812132&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Mon Sep  7 13:31:55 2009
@@ -107,7 +107,7 @@
         this.partition = partition;
         atRegistry = registries.getAttributeTypeRegistry();
         
-        dao = new SchemaPartitionDao( this.partition, registries );
+        dao = new SchemaPartitionDaoImpl( this.partition, registries );
         mOidAT = atRegistry.lookup( MetaSchemaConstants.M_OID_AT );
         mNameAT = atRegistry.lookup( MetaSchemaConstants.M_NAME_AT );
         cnAT = atRegistry.lookup( SchemaConstants.CN_AT );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java?rev=812132&r1=812131&r2=812132&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java Mon Sep  7 13:31:55 2009
@@ -20,11 +20,17 @@
 package org.apache.directory.server.core.schema;
 
 
-import javax.naming.InvalidNameException;
+import java.util.ArrayList;
+import java.util.List;
 
+import javax.naming.NamingException;
+
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerModification;
 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;
@@ -34,6 +40,7 @@
 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.OperationContext;
 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;
@@ -41,12 +48,16 @@
 import org.apache.directory.server.core.partition.ByPassConstants;
 import org.apache.directory.server.core.partition.NullPartition;
 import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.message.control.CascadeControl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
+import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -106,60 +117,98 @@
     
     /** the registries managed by this SchemaPartition */
     private Registries registries = new Registries();
-
-    private SchemaChangeManager schemaManager;
+    
+    /** schema loader: swapped out after {@link SchemaPartition#initialize()} */
+    private SchemaLoader loader;
+    
+    /** registry synchronizer adaptor */
+    private RegistrySynchronizerAdaptor synchronizer;
     
     
     /**
-     * Creates a new instance of SchemaPartition.
+     * Sets the wrapped {@link Partition} which must be supplied or 
+     * {@link Partition#initialize()} will fail with a NullPointerException.
+     *
+     * @param wrapped the Partition being wrapped
      */
-    public SchemaPartition() throws Exception
-    {
-        // -----------------------------------------------------------------------
-        // Load apachemeta schema from within the ldap-schema Jar with all the
-        // schema it depends on.  This is a minimal mandatory set of schemas.
-        // -----------------------------------------------------------------------
-        SchemaLoader loader = new JarLdifSchemaLoader();
-        loader.loadAllEnabled( registries );  // @TODO remove this once we get the LDIF partition in place
-        SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-    }
-
-    
-    public SchemaChangeManager getSchemaChangeManager()
+    public void setWrappedPartition( Partition wrapped )
     {
-        return schemaManager;
+        if ( this.isInitialized() )
+        {
+            throw new IllegalStateException( "Not allowed to set the wrappedPartition after initialization." );
+        }
+        
+        this.wrapped = wrapped;
     }
     
     
-    public void setSchemaChangeManager( SchemaChangeManager schemaManager )
+    /**
+     * Gets the {@link Partition} being wrapped.
+     *
+     * @return the wrapped Partition
+     */
+    public Partition getWrappedPartition()
     {
-        this.schemaManager= schemaManager ;
+        return wrapped;
     }
-    
-    
+
+
+    /**
+     * Gets the Registries in this {@link SchemaPartition}.  Will be null 
+     * until this partition is initialized.
+     */
     public Registries getRegistries()
     {
         return registries;
     }
     
     
-    public void setWrappedPartition( Partition wrapped )
+    /**
+     * Get's the ID which is fixed: 'schema'.
+     */
+    public final String getId()
     {
-        if ( this.isInitialized() )
-        {
-            throw new IllegalStateException( "Not allowed to set the wrappedPartition after initialization." );
-        }
-        
-        this.wrapped = wrapped;
+        return ID;
     }
     
     
-    public Partition getWrappedPartition()
+    /**
+     * Has no affect: the id is fixed at {@link SchemaPartition#ID}: 'schema'.
+     * A warning is logged.
+     */
+    public final void setId( String id )
     {
-        return this.wrapped;
+        LOG.warn( "This partition's ID is fixed: {}", ID );
     }
+
+
+    /**
+     * Always returns {@link ServerDNConstants#OU_SCHEMA_DN_NORMALIZED}: '2.5.4.11=schema'.
+     */
+    public final LdapDN getSuffixDn()
+    {
+        return wrapped.getSuffixDn();
+    }
+
     
-    
+    /**
+     * Always returns {@link ServerDNConstants#OU_SCHEMA_DN}: 'ou=schema'.
+     */
+    public final String getSuffix()
+    {
+        return ServerDNConstants.OU_SCHEMA_DN;
+    }
+
+
+    /**
+     * Has no affect: just logs a warning.
+     */
+    public final void setSuffix( String suffix )
+    {
+        LOG.warn( "This partition's suffix is fixed: {}", ServerDNConstants.OU_SCHEMA_DN );
+    }
+
+
     // -----------------------------------------------------------------------
     // Partition Interface Method Overrides
     // -----------------------------------------------------------------------
@@ -173,14 +222,26 @@
     
     
     @Override
-    protected void doInit() throws InvalidNameException
+    protected void doInit() throws Exception
     {
+        // -----------------------------------------------------------------------
+        // Load apachemeta schema from within the ldap-schema Jar with all the
+        // schema it depends on.  This is a minimal mandatory set of schemas.
+        // -----------------------------------------------------------------------
+        
+        loader = new JarLdifSchemaLoader();
+        loader.loadAllEnabled( registries );  
+        SerializableComparator.setRegistry( registries.getComparatorRegistry() );
+
         wrapped.setId( ID );
         wrapped.setSuffix( ServerDNConstants.OU_SCHEMA_DN );
         
         try
         {
-            wrapped.initialize( );
+            wrapped.initialize();
+            PartitionSchemaLoader partitionLoader = new PartitionSchemaLoader( wrapped, registries );
+            synchronizer = new RegistrySynchronizerAdaptor( registries, partitionLoader );
+            loader = partitionLoader;
             
             if ( wrapped instanceof NullPartition )
             {
@@ -222,8 +283,9 @@
      */
     public void add( AddOperationContext opContext ) throws Exception
     {
-        schemaManager.add( opContext );
+        synchronizer.add( opContext );
         wrapped.add( opContext );
+        updateSchemaModificationAttributes( opContext );
     }
 
 
@@ -241,40 +303,14 @@
      */
     public void delete( DeleteOperationContext opContext ) throws Exception
     {
-        ClonedServerEntry entry = directoryService.getPartitionNexus().lookup( opContext.newLookupContext( opContext.getDn() ) );
-        schemaManager.delete( opContext, entry, opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
+        boolean cascade = opContext.hasRequestControl( CascadeControl.CONTROL_OID );
+        synchronizer.delete( opContext, opContext.getEntry(), cascade );
         wrapped.delete( opContext );
+        updateSchemaModificationAttributes( opContext );
     }
 
-
-    /* (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#getSuffixDN()
-     */
-    public final LdapDN getSuffixDn()
-    {
-        return wrapped.getSuffixDn();
-    }
-    
     
     /* (non-Javadoc)
-     * @see org.apache.directory.server.core.partition.Partition#getSuffix()
-     */
-    public String getSuffix()
-    {
-        return ID;
-    }
-
-
-    /* (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
@@ -297,14 +333,13 @@
      */
     public void modify( ModifyOperationContext opContext ) throws Exception
     {
-        LOG.debug( "Modification attempt on schema partition {}: \n{}", opContext.getDn(), opContext );
-
         ServerEntry targetEntry = ( ServerEntry ) SchemaUtils.getTargetEntry( 
             opContext.getModItems(), opContext.getEntry() );
-
-        schemaManager.modify( opContext, opContext.getEntry(), targetEntry, opContext
-            .hasRequestControl( CascadeControl.CONTROL_OID ) );
+        
+        boolean cascade = opContext.hasRequestControl( CascadeControl.CONTROL_OID );
+        synchronizer.modify( opContext, opContext.getEntry(), targetEntry, cascade );
         wrapped.modify( opContext );
+        updateSchemaModificationAttributes( opContext );
     }
 
 
@@ -313,10 +348,11 @@
      */
     public void move( MoveOperationContext opContext ) throws Exception
     {
-        LdapDN oriChildName = opContext.getDn();
-        ClonedServerEntry entry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
-        schemaManager.replace( opContext, entry, opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
+        boolean cascade = opContext.hasRequestControl( CascadeControl.CONTROL_OID );
+        ClonedServerEntry entry = opContext.lookup( opContext.getDn(), ByPassConstants.LOOKUP_BYPASS );
+        synchronizer.replace( opContext, entry, cascade );
         wrapped.move( opContext );
+        updateSchemaModificationAttributes( opContext );
     }
 
 
@@ -325,10 +361,11 @@
      */
     public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
     {
-        LdapDN oriChildName = opContext.getDn();
-        ClonedServerEntry entry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
-        schemaManager.move( opContext, entry, opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
+        boolean cascade = opContext.hasRequestControl( CascadeControl.CONTROL_OID );
+        ClonedServerEntry entry = opContext.lookup( opContext.getDn(), ByPassConstants.LOOKUP_BYPASS );
+        synchronizer.move( opContext, entry, cascade );
         wrapped.moveAndRename( opContext );
+        updateSchemaModificationAttributes( opContext );
     }
 
 
@@ -337,8 +374,10 @@
      */
     public void rename( RenameOperationContext opContext ) throws Exception
     {
-        schemaManager.modifyRn( opContext, opContext.getEntry(), opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
+        boolean cascade = opContext.hasRequestControl( CascadeControl.CONTROL_OID );
+        synchronizer.modifyRn( opContext, opContext.getEntry(), cascade );
         wrapped.rename( opContext );
+        updateSchemaModificationAttributes( opContext );
     }
 
 
@@ -352,25 +391,6 @@
 
 
     /* (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
@@ -386,4 +406,41 @@
     {
         return wrapped.lookup( lookupContext );
     }
+    
+    
+    /**
+     * Updates the schemaModifiersName and schemaModifyTimestamp attributes of
+     * the schemaModificationAttributes entry for the global schema at 
+     * ou=schema,cn=schemaModifications.  This entry is hardcoded at that 
+     * position for now.
+     * 
+     * The current time is used to set the timestamp and the DN of current user
+     * is set for the modifiersName.
+     * 
+     * @throws NamingException if the update fails
+     */
+    private void updateSchemaModificationAttributes( OperationContext opContext ) throws Exception
+    {
+        String modifiersName = opContext.getSession().getEffectivePrincipal().getJndiName().getNormName();
+        String modifyTimestamp = DateUtils.getGeneralizedTime();
+        
+        List<Modification> mods = new ArrayList<Modification>( 2 );
+        
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, 
+            new DefaultServerAttribute( 
+                ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT,
+                registries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT ),
+                modifyTimestamp ) ) );
+        
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE,
+            new DefaultServerAttribute( 
+                ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, 
+                registries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ),
+                modifiersName ) ) );
+        
+        LdapDN name = new LdapDN( ServerDNConstants.SCHEMA_TIMESTAMP_ENTRY_DN );
+        name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        
+        opContext.modify( name, mods, ByPassConstants.SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
+    }
 }

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=812132&r1=812131&r2=812132&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Mon Sep  7 13:31:55 2009
@@ -1,447 +1,45 @@
-/*
- *  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.schema;
 
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import javax.naming.NamingException;
+
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-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.SearchOperationContext;
-import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.shared.ldap.schema.registries.Schema;
-import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
-import org.apache.directory.shared.ldap.filter.AndNode;
-import org.apache.directory.shared.ldap.filter.BranchNode;
-import org.apache.directory.shared.ldap.filter.EqualityNode;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.OrNode;
-import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.filter.SearchScope;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
-import org.apache.directory.shared.ldap.schema.syntaxCheckers.NumericOidSyntaxChecker;
-import org.apache.directory.shared.ldap.util.DateUtils;
-import org.apache.directory.shared.schema.loader.ldif.SchemaEntityFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
+import org.apache.directory.shared.ldap.schema.registries.Schema;
 
 
-/**
- * A specialized data access object for managing schema objects in the
- * schema partition.  
- * 
- * WARNING:
- * This dao operates directly on a partition.  Hence no interceptors are available
- * to perform the various expected services of respective interceptors.  Take care
- * to normalize all filters and distinguished names.
- * 
- * A single write operation exists for enabling schemas needed for operating indices
- * in partitions and enabling schemas that are dependencies of other schemas that 
- * are enabled.  In both these limited cases there is no need to worry about issues
- * with a lack of replication propagation because these same updates will take place
- * on replicas when the original operation is propagated or when replicas start up.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SchemaPartitionDao
+public interface SchemaPartitionDao
 {
-    /** static class logger */
-    private final Logger LOG = LoggerFactory.getLogger( getClass() );
-    private static final NumericOidSyntaxChecker NUMERIC_OID_CHECKER = new NumericOidSyntaxChecker();
-    private static final String[] SCHEMA_ATTRIBUTES = new String[]
-        { SchemaConstants.CREATORS_NAME_AT_OID, "m-dependencies", SchemaConstants.OBJECT_CLASS_AT_OID, 
-          SchemaConstants.CN_AT_OID, "m-disabled" };
-
-    private final Partition partition;
-    private final SchemaEntityFactory factory;
-    private final AttributeTypeRegistry atRegistry;
-
-    private final String M_NAME_OID;
-    private final String CN_OID;
-    private final String M_OID_OID;
-    private final String OBJECTCLASS_OID;
-    private final String M_SYNTAX_OID;
-    private final String M_ORDERING_OID;
-    private final String M_SUBSTRING_OID;
-    private final String M_EQUALITY_OID;
-    private final String M_SUP_ATTRIBUTE_TYPE_OID;
-    private final String M_MUST_OID;
-    private final String M_MAY_OID;
-    private final String M_AUX_OID;
-    private final String M_OC_OID;
-    private final String M_SUP_OBJECT_CLASS_OID;
-    private final String M_DEPENDENCIES_OID;
 
-    private final Set<AttributeTypeOptions> schemaAttributesToReturn = new HashSet<AttributeTypeOptions>();
-    private final AttributeType disabledAttributeType;
+    public abstract Map<String, Schema> getSchemas() throws Exception;
 
 
-    /**
-     * Creates a schema dao object backing information within a schema partition.
-     * 
-     * @param partition the schema partition
-     * @param registries the bootstrap registries that were used to start up the schema partition
-     * @throws NamingException if there are problems initializing this schema partion dao
-     */
-    public SchemaPartitionDao( Partition partition, Registries registries ) throws Exception
-    {
-        this.partition = partition;
-        this.factory = new SchemaEntityFactory();
-        this.atRegistry = registries.getAttributeTypeRegistry();
-
-        this.M_NAME_OID = atRegistry.getOidByName( MetaSchemaConstants.M_NAME_AT );
-        this.CN_OID = atRegistry.getOidByName( SchemaConstants.CN_AT );
-        this.disabledAttributeType = atRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT );
-        this.M_OID_OID = atRegistry.getOidByName( MetaSchemaConstants.M_OID_AT );
-        this.OBJECTCLASS_OID = atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT );
-        this.M_SYNTAX_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SYNTAX_AT );
-        this.M_ORDERING_OID = atRegistry.getOidByName( MetaSchemaConstants.M_ORDERING_AT );
-        this.M_EQUALITY_OID = atRegistry.getOidByName( MetaSchemaConstants.M_EQUALITY_AT );
-        this.M_SUBSTRING_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SUBSTR_AT );
-        this.M_SUP_ATTRIBUTE_TYPE_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT );
-        this.M_MUST_OID = atRegistry.getOidByName( MetaSchemaConstants.M_MUST_AT );
-        this.M_MAY_OID = atRegistry.getOidByName( MetaSchemaConstants.M_MAY_AT );
-        this.M_AUX_OID = atRegistry.getOidByName( MetaSchemaConstants.M_AUX_AT );
-        this.M_OC_OID = atRegistry.getOidByName( MetaSchemaConstants.M_OC_AT );
-        this.M_SUP_OBJECT_CLASS_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT );
-        this.M_DEPENDENCIES_OID = atRegistry.getOidByName( MetaSchemaConstants.M_DEPENDENCIES_AT );
-        
-        for ( String attrId : SCHEMA_ATTRIBUTES )
-        {
-            AttributeTypeOptions ato = new AttributeTypeOptions( atRegistry.lookup( attrId ) );
-            schemaAttributesToReturn.add( ato );
-        }
-    }
-
-
-    public Map<String, Schema> getSchemas() throws Exception
-    {
-        Map<String, Schema> schemas = new HashMap<String, Schema>();
-        EntryFilteringCursor list = listSchemas();
-
-        while ( list.next() )
-        {
-            ServerEntry sr = list.get();
-            Schema schema = factory.getSchema( sr );
-            schemas.put( schema.getSchemaName(), schema );
-        }
-
-        return schemas;
-    }
-
-
-    public Set<String> getSchemaNames() throws Exception
-    {
-        Set<String> schemaNames = new HashSet<String>();
-        EntryFilteringCursor list = listSchemas();
-
-        while ( list.next() )
-        {
-            ServerEntry sr = list.get();
-            schemaNames.add( sr.get( SchemaConstants.CN_AT ).getString() );
-        }
-
-        return schemaNames;
-    }
-
-
-    private EntryFilteringCursor listSchemas() throws Exception
-    {
-        LdapDN base = new LdapDN( ServerDNConstants.OU_SCHEMA_DN );
-        base.normalize( atRegistry.getNormalizerMapping() );
-        ExprNode filter = new EqualityNode<String>( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ),
-            new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC ) );
-
-        SearchOperationContext searchContext = new SearchOperationContext( null );
-        searchContext.setDn( base );
-        searchContext.setScope( SearchScope.ONELEVEL );
-        searchContext.setReturningAttributes( schemaAttributesToReturn );
-        searchContext.setFilter( filter );
-        return partition.search( searchContext );
-    }
-
-
-    public Schema getSchema( String schemaName ) throws Exception
-    {
-        LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
-        dn.normalize( atRegistry.getNormalizerMapping() );
-        return factory.getSchema( partition.lookup( new LookupOperationContext( null, dn ) ) );
-    }
-
-
-    public boolean hasMatchingRule( String oid ) throws Exception
-    {
-        BranchNode filter = new AndNode();
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue(
-            MetaSchemaConstants.META_MATCHING_RULE_OC ) ) );
-
-        if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
-        {
-            filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) );
-        }
-        else
-        {
-            filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
-        }
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            if ( !cursor.next() )
-            {
-                return false;
-            }
-
-            if ( cursor.next() )
-            {
-                throw new NamingException( "Got more than one matchingRule for oid of " + oid );
-            }
-
-            return true;
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-    }
-
-
-    public boolean hasAttributeType( String oid ) throws Exception
-    {
-        BranchNode filter = new AndNode();
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue(
-            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC ) ) );
-
-        if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
-        {
-            filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) );
-        }
-        else
-        {
-            filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
-        }
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            if ( !cursor.next() )
-            {
-                return false;
-            }
-
-            if ( cursor.next() )
-            {
-                throw new NamingException( "Got more than one attributeType for oid of " + oid );
-            }
-
-            return true;
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-    }
-
-
-    public boolean hasObjectClass( String oid ) throws Exception
-    {
-        BranchNode filter = new AndNode();
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_OBJECT_CLASS_OC ) ) );
-
-        if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
-        {
-            filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) );
-        }
-        else
-        {
-            filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
-        }
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            if ( !cursor.next() )
-            {
-                return false;
-            }
-
-            if ( cursor.next() )
-            {
-                throw new NamingException( "Got more than one attributeType for oid of " + oid );
-            }
-
-            return true;
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-    }
-
-
-    public boolean hasSyntax( String oid ) throws Exception
-    {
-        BranchNode filter = new AndNode();
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-                new ClientStringValue( MetaSchemaConstants.META_SYNTAX_OC ) ) );
-
-        if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
-        {
-            filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) );
-        }
-        else
-        {
-            filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
-        }
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            if ( !cursor.next() )
-            {
-                return false;
-            }
-
-            if ( cursor.next() )
-            {
-                throw new NamingException( "Got more than one syntax for oid of " + oid );
-            }
-
-            return true;
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-    }
-
-
-    public boolean hasSyntaxChecker( String oid ) throws Exception
-    {
-        BranchNode filter = new AndNode();
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_SYNTAX_CHECKER_OC ) ) );
-
-        if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
-        {
-            filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) );
-        }
-        else
-        {
-            filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
-        }
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            if ( !cursor.next() )
-            {
-                return false;
-            }
-
-            if ( cursor.next() )
-            {
-                throw new NamingException( "Got more than one syntaxChecker for oid of " + oid );
-            }
-
-            return true;
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-    }
+    public abstract Set<String> getSchemaNames() throws Exception;
+
+
+    public abstract Schema getSchema( String schemaName ) throws Exception;
+
+
+    public abstract boolean hasMatchingRule( String oid ) throws Exception;
+
+
+    public abstract boolean hasAttributeType( String oid ) throws Exception;
+
+
+    public abstract boolean hasObjectClass( String oid ) throws Exception;
+
+
+    public abstract boolean hasSyntax( String oid ) throws Exception;
+
+
+    public abstract boolean hasSyntaxChecker( String oid ) throws Exception;
 
 
     /**
@@ -458,32 +56,10 @@
      * @throws NamingException if more than one entity has the name, or if there 
      * are underlying data access problems
      */
-    public String findSchema( String entityName ) throws Exception
-    {
-        LdapDN dn = findDn( entityName );
-        if ( dn == null )
-        {
-            return null;
-        }
-
-        Rdn rdn = dn.getRdn( 1 );
-        if ( !rdn.getNormType().equalsIgnoreCase( CN_OID ) )
-        {
-            throw new NamingException( "Attribute of second rdn in dn '" + dn.toNormName()
-                + "' expected to be CN oid of " + CN_OID + " but was " + rdn.getNormType() );
-        }
-
-        return ( String ) rdn.getValue();
-    }
-
-
-    public LdapDN findDn( String entityName ) throws Exception
-    {
-        ServerEntry sr = find( entityName );
-        LdapDN dn = sr.getDn();
-        dn.normalize( atRegistry.getNormalizerMapping() );
-        return dn;
-    }
+    public abstract String findSchema( String entityName ) throws Exception;
+
+
+    public abstract LdapDN findDn( String entityName ) throws Exception;
 
 
     /**
@@ -500,46 +76,7 @@
      * @throws NamingException if more than one entity has the name, or if there 
      * are underlying data access problems
      */
-    public ServerEntry find( String entityName ) throws Exception
-    {
-        BranchNode filter = new OrNode();
-        SimpleNode<String> nameAVA = new EqualityNode<String>( M_NAME_OID, 
-            new ClientStringValue( entityName.toLowerCase() ) );
-        SimpleNode<String> oidAVA = new EqualityNode<String>( M_OID_OID, 
-            new ClientStringValue( entityName.toLowerCase() ) );
-        filter.addNode( nameAVA );
-        filter.addNode( oidAVA );
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            if ( !cursor.next() )
-            {
-                return null;
-            }
-
-            ServerEntry sr = cursor.get();
-            
-            if ( cursor.next() )
-            {
-                throw new NamingException( "Got more than one result for the entity name: " + entityName );
-            }
-
-            return sr;
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-    }
+    public abstract ServerEntry find( String entityName ) throws Exception;
 
 
     /**
@@ -572,40 +109,7 @@
      * @param schemaName the name of the schema to enable
      * @throws NamingException if there is a problem updating the schema entry
      */
-    public void enableSchema( String schemaName ) throws Exception
-    {
-        LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
-        dn.normalize( atRegistry.getNormalizerMapping() );
-        ServerEntry entry = partition.lookup( new LookupOperationContext( null, dn ) );
-        EntryAttribute disabledAttr = entry.get( disabledAttributeType );
-        List<Modification> mods = new ArrayList<Modification>( 3 );
-
-        if ( disabledAttr == null )
-        {
-            LOG.warn( "Does not make sense: you're trying to enable {} schema which is already enabled", schemaName );
-            return;
-        }
-
-        boolean isDisabled = disabledAttr.contains( "TRUE" );
-        if ( !isDisabled )
-        {
-            LOG.warn( "Does not make sense: you're trying to enable {} schema which is already enabled", schemaName );
-            return;
-        }
-
-        mods.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
-            MetaSchemaConstants.M_DISABLED_AT, atRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT ) ) ) );
-
-        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
-            SchemaConstants.MODIFIERS_NAME_AT, atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ),
-            ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
-
-        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
-            SchemaConstants.MODIFY_TIMESTAMP_AT, atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
-                .getGeneralizedTime() ) ) );
-
-        partition.modify( new ModifyOperationContext( null, dn, mods ) );
-    }
+    public abstract void enableSchema( String schemaName ) throws Exception;
 
 
     /**
@@ -616,175 +120,16 @@
      * @return the set of matchingRules and attributeTypes depending on a syntax
      * @throws NamingException if the dao fails to perform search operations
      */
-    public Set<ServerEntry> listSyntaxDependents( String numericOid ) throws Exception
-    {
-        Set<ServerEntry> set = new HashSet<ServerEntry>();
-        BranchNode filter = new AndNode();
-
-        // subfilter for (| (objectClass=metaMatchingRule) (objectClass=metaAttributeType))  
-        BranchNode or = new OrNode();
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_MATCHING_RULE_OC.toLowerCase() ) ) );
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) ) );
-
-        filter.addNode( or );
-        filter.addNode( new EqualityNode<String>( M_SYNTAX_OID, new ClientStringValue( numericOid.toLowerCase() ) ) );
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-            
-            while ( cursor.next() )
-            {
-                set.add( cursor.get() );
-            }
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-
-        return set;
-    }
-
-
-    public Set<ServerEntry> listMatchingRuleDependents( MatchingRule mr ) throws Exception
-    {
-        Set<ServerEntry> set = new HashSet<ServerEntry>();
-        BranchNode filter = new AndNode();
-
-        // ( objectClass = metaAttributeType )
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue(
-            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) ) );
-
-        BranchNode or = new OrNode();
-        or.addNode( new EqualityNode<String>( M_ORDERING_OID, new ClientStringValue( mr.getOid() ) ) );
-        or.addNode( new EqualityNode<String>( M_SUBSTRING_OID, new ClientStringValue( mr.getOid() ) ) );
-        or.addNode( new EqualityNode<String>( M_EQUALITY_OID, new ClientStringValue( mr.getOid() ) ) );
-        filter.addNode( or );
-
-        List<String> names = mr.getNames();
-        
-        if ( ( names != null ) || ( names.size() > 0 ) )
-        {
-            for ( String name : names )
-            {
-                or.addNode( new EqualityNode<String>( M_ORDERING_OID, new ClientStringValue( name.toLowerCase() ) ) );
-                or.addNode( new EqualityNode<String>( M_SUBSTRING_OID, new ClientStringValue( name.toLowerCase() ) ) );
-                or.addNode( new EqualityNode<String>( M_EQUALITY_OID, new ClientStringValue( name.toLowerCase() ) ) );
-            }
-        }
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-            
-            while ( cursor.next() )
-            {
-                set.add( cursor.get() );
-            }
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-
-        return set;
-    }
-
-
-    public EntryFilteringCursor listAllNames() throws Exception
-    {
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        BranchNode filter = new AndNode();
-
-        // (& (m-oid=*) (m-name=*) )
-        filter.addNode( new PresenceNode( M_OID_OID ) );
-        filter.addNode( new PresenceNode( M_NAME_OID ) );
-        return partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-            AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-    }
-
-
-    public Set<ServerEntry> listAttributeTypeDependents( AttributeType at ) throws Exception
-    {
-        /*
-         * Right now the following inefficient filter is being used:
-         * 
-         * ( & 
-         *      ( | ( objectClass = metaAttributeType ) ( objectClass = metaObjectClass ) )
-         *      ( | ( m-oid = $oid ) ( m-must = $oid ) ( m-supAttributeType = $oid ) )
-         * )
-         * 
-         * the reason why this is inefficient is because the or terms have large scan counts
-         * and several loops are going to be required.  The following search is better because
-         * it constrains the results better:
-         * 
-         * ( |
-         *      ( & ( objectClass = metaAttributeType ) ( m-supAttributeType = $oid ) )
-         *      ( & ( objectClass = metaObjectClass ) ( | ( m-may = $oid ) ( m-must = $oid ) ) )
-         * )
-         */
-
-        Set<ServerEntry> set = new HashSet<ServerEntry>();
-        BranchNode filter = new AndNode();
-
-        // ( objectClass = metaAttributeType )
-        BranchNode or = new OrNode();
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) ) );
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase() ) ) );
-        filter.addNode( or );
-
-        or = new OrNode();
-        or.addNode( new EqualityNode<String>( M_MAY_OID, new ClientStringValue( at.getOid() ) ) );
-        or.addNode( new EqualityNode<String>( M_MUST_OID, new ClientStringValue( at.getOid() ) ) );
-        or.addNode( new EqualityNode<String>( M_SUP_ATTRIBUTE_TYPE_OID, new ClientStringValue( at.getOid() ) ) );
-        filter.addNode( or );
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-            
-            while ( cursor.next() )
-            {
-                set.add( cursor.get() );
-            }
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
+    public abstract Set<ServerEntry> listSyntaxDependents( String numericOid ) throws Exception;
+
 
-        return set;
-    }
+    public abstract Set<ServerEntry> listMatchingRuleDependents( MatchingRule mr ) throws Exception;
+
+
+    public abstract EntryFilteringCursor listAllNames() throws Exception;
+
+
+    public abstract Set<ServerEntry> listAttributeTypeDependents( AttributeType at ) throws Exception;
 
 
     /**
@@ -794,46 +139,7 @@
      * @return a set of SearchResults over the schemas whose m-dependency attribute contains schemaName
      * @throws NamingException if there is a problem while searching the schema partition
      */
-    public Set<ServerEntry> listSchemaDependents( String schemaName ) throws Exception
-    {
-        /*
-         * The following filter is being used:
-         * 
-         * ( & ( objectClass = metaSchema ) ( m-dependencies = $schemaName ) )
-         */
-
-        Set<ServerEntry> set = new HashSet<ServerEntry>();
-        BranchNode filter = new AndNode();
-
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, 
-            new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) ) );
-        filter.addNode( new EqualityNode<String>( M_DEPENDENCIES_OID, 
-            new ClientStringValue( schemaName.toLowerCase() ) ) );
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-            
-            while ( cursor.next() )
-            {
-                set.add( cursor.get() );
-            }
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-
-        return set;
-    }
+    public abstract Set<ServerEntry> listSchemaDependents( String schemaName ) throws Exception;
 
 
     /**
@@ -843,118 +149,9 @@
      * @return a set of SearchResults over the schemas whose m-dependency attribute contains schemaName
      * @throws NamingException if there is a problem while searching the schema partition
      */
-    public Set<ServerEntry> listEnabledSchemaDependents( String schemaName ) throws Exception
-    {
-        Set<ServerEntry> set = new HashSet<ServerEntry>();
-        BranchNode filter = new AndNode();
-
-        filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue( 
-            MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) ) );
-        filter.addNode( new EqualityNode<String>( M_DEPENDENCIES_OID, new ClientStringValue( 
-            schemaName.toLowerCase() ) ) );
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
-            while ( cursor.next() )
-            {
-                ServerEntry sr = cursor.get();
-                EntryAttribute disabled = sr.get( disabledAttributeType );
-
-                if ( disabled == null )
-                {
-                    set.add( sr );
-                }
-                else if ( disabled.get().equals( "FALSE" ) )
-                {
-                    set.add( sr );
-                }
-            }
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-
-        return set;
-    }
-
-
-    public Set<ServerEntry> listObjectClassDependents( ObjectClass oc ) throws Exception
-    {
-        /*
-         * Right now the following inefficient filter is being used:
-         * 
-         * ( & 
-         *      ( | ( objectClass = metaObjectClass ) ( objectClass = metaDITContentRule ) 
-         *          ( objectClass = metaNameForm ) )
-         *      ( | ( m-oc = $oid ) ( m-aux = $oid ) ( m-supObjectClass = $oid ) )
-         * )
-         * 
-         * The reason why this is inefficient is because the or terms have large scan counts
-         * and several loops are going to be required.  For example all the objectClasses and 
-         * all the metaDITContentRules and all the metaNameForm candidates will be a massive 
-         * number.  This is probably going to be bigger than the 2nd term where a candidate 
-         * satisfies one of the terms.
-         * 
-         * The following search is better because it constrains the results better:
-         * 
-         * ( |
-         *      ( & ( objectClass = metaNameForm ) ( m-oc = $oid ) )
-         *      ( & ( objectClass = metaObjectClass ) ( m-supObjectClass = $oid ) )
-         *      ( & ( objectClass = metaDITContentRule ) ( m-aux = $oid ) )
-         * )
-         */
-
-        Set<ServerEntry> set = new HashSet<ServerEntry>();
-        BranchNode filter = new AndNode();
-
-        BranchNode or = new OrNode();
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_NAME_FORM_OC
-            .toLowerCase() ) ) );
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_OBJECT_CLASS_OC
-            .toLowerCase() ) ) );
-        or.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue(
-            MetaSchemaConstants.META_DIT_CONTENT_RULE_OC.toLowerCase() ) ) );
-        filter.addNode( or );
-
-        or = new OrNode();
-        or.addNode( new EqualityNode<String>( M_AUX_OID, new ClientStringValue( oc.getOid() ) ) );
-        or.addNode( new EqualityNode<String>( M_OC_OID, new ClientStringValue( oc.getOid() ) ) );
-        or.addNode( new EqualityNode<String>( M_SUP_OBJECT_CLASS_OID, new ClientStringValue( oc.getOid() ) ) );
-        filter.addNode( or );
-
-        SearchControls searchControls = new SearchControls();
-        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        EntryFilteringCursor cursor = null;
-
-        try
-        {
-            cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(),
-                AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-            
-            while ( cursor.next() )
-            {
-                set.add( cursor.get() );
-            }
-        }
-        finally
-        {
-            if ( cursor != null )
-            {
-                cursor.close();
-            }
-        }
-
-        return set;
-    }
-}
+    public abstract Set<ServerEntry> listEnabledSchemaDependents( String schemaName ) throws Exception;
+
+
+    public abstract Set<ServerEntry> listObjectClassDependents( ObjectClass oc ) throws Exception;
+
+}
\ No newline at end of file

Copied: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java (from r812031, directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java?p2=directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java&p1=directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java&r1=812031&r2=812132&rev=812132&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java Mon Sep  7 13:31:55 2009
@@ -88,7 +88,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SchemaPartitionDao
+public class SchemaPartitionDaoImpl implements SchemaPartitionDao
 {
     /** static class logger */
     private final Logger LOG = LoggerFactory.getLogger( getClass() );
@@ -128,7 +128,7 @@
      * @param registries the bootstrap registries that were used to start up the schema partition
      * @throws NamingException if there are problems initializing this schema partion dao
      */
-    public SchemaPartitionDao( Partition partition, Registries registries ) throws Exception
+    public SchemaPartitionDaoImpl( Partition partition, Registries registries ) throws Exception
     {
         this.partition = partition;
         this.factory = new SchemaEntityFactory();
@@ -159,6 +159,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#getSchemas()
+     */
     public Map<String, Schema> getSchemas() throws Exception
     {
         Map<String, Schema> schemas = new HashMap<String, Schema>();
@@ -175,6 +178,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#getSchemaNames()
+     */
     public Set<String> getSchemaNames() throws Exception
     {
         Set<String> schemaNames = new HashSet<String>();
@@ -206,6 +212,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#getSchema(java.lang.String)
+     */
     public Schema getSchema( String schemaName ) throws Exception
     {
         LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
@@ -214,6 +223,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#hasMatchingRule(java.lang.String)
+     */
     public boolean hasMatchingRule( String oid ) throws Exception
     {
         BranchNode filter = new AndNode();
@@ -260,6 +272,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#hasAttributeType(java.lang.String)
+     */
     public boolean hasAttributeType( String oid ) throws Exception
     {
         BranchNode filter = new AndNode();
@@ -306,6 +321,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#hasObjectClass(java.lang.String)
+     */
     public boolean hasObjectClass( String oid ) throws Exception
     {
         BranchNode filter = new AndNode();
@@ -352,6 +370,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#hasSyntax(java.lang.String)
+     */
     public boolean hasSyntax( String oid ) throws Exception
     {
         BranchNode filter = new AndNode();
@@ -398,6 +419,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#hasSyntaxChecker(java.lang.String)
+     */
     public boolean hasSyntaxChecker( String oid ) throws Exception
     {
         BranchNode filter = new AndNode();
@@ -444,19 +468,8 @@
     }
 
 
-    /**
-     * Given the non-normalized name (alias) or the OID for a schema entity.  This 
-     * method finds the schema under which that entity is located. 
-     * 
-     * NOTE: this method presumes that all alias names across schemas are unique.  
-     * This should be the case for LDAP but this can potentially be violated so 
-     * we should make sure this is a unique name.
-     * 
-     * @param entityName one of the names of the entity or it's numeric id
-     * @return the name of the schema that contains that entity or null if no entity with 
-     * that alias name exists
-     * @throws NamingException if more than one entity has the name, or if there 
-     * are underlying data access problems
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#findSchema(java.lang.String)
      */
     public String findSchema( String entityName ) throws Exception
     {
@@ -477,6 +490,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#findDn(java.lang.String)
+     */
     public LdapDN findDn( String entityName ) throws Exception
     {
         ServerEntry sr = find( entityName );
@@ -486,19 +502,8 @@
     }
 
 
-    /**
-     * Given the non-normalized name (alias) or the OID for a schema entity.  This 
-     * method finds the entry of the schema entity. 
-     * 
-     * NOTE: this method presumes that all alias names across schemas are unique.  
-     * This should be the case for LDAP but this can potentially be violated so 
-     * we should make sure this is a unique name.
-     * 
-     * @param entityName one of the names of the entity or it's numeric id
-     * @return the search result for the entity or null if no such entity exists with 
-     * that alias or numeric oid
-     * @throws NamingException if more than one entity has the name, or if there 
-     * are underlying data access problems
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#find(java.lang.String)
      */
     public ServerEntry find( String entityName ) throws Exception
     {
@@ -542,35 +547,8 @@
     }
 
 
-    /**
-     * Enables a schema by removing it's m-disabled attribute if present.
-     * 
-     * NOTE:
-     * This is a write operation and great care must be taken to make sure it
-     * is used in a limited capacity.  This method is called in two places 
-     * currently.  
-     * 
-     * (1) Within the initialization sequence to enable schemas required
-     *     for the correct operation of indices in other partitions.
-     * (2) Within the partition schema loader to auto enable schemas that are
-     *     depended on by other schemas which are enabled.
-     * 
-     * In both cases, the modifier is effectively the administrator since the 
-     * server is performing the operation directly or on behalf of a user.  In 
-     * case (1) during intialization there is no other user involved so naturally
-     * the modifier is the administrator.  In case (2) when a user enables a 
-     * schema with a dependency that is not enabled the server enables that 
-     * dependency on behalf of the user.  Again effectively it is the server that
-     * is modifying the schema entry and hence the admin is the modifier.
-     * 
-     * No need to worry about a lack of replication propagation in both cases.  In 
-     * case (1) all replicas will enable these schemas anyway on startup.  In case
-     * (2) the original operation that enabled the schema depending on the on that
-     * enableSchema() is called for itself will be replicated.  Hence the same chain 
-     * reaction will occur in a replica.
-     * 
-     * @param schemaName the name of the schema to enable
-     * @throws NamingException if there is a problem updating the schema entry
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#enableSchema(java.lang.String)
      */
     public void enableSchema( String schemaName ) throws Exception
     {
@@ -608,13 +586,8 @@
     }
 
 
-    /**
-     * Returns the set of matchingRules and attributeTypes which depend on the 
-     * provided syntax.
-     *
-     * @param numericOid the numeric identifier for the entity
-     * @return the set of matchingRules and attributeTypes depending on a syntax
-     * @throws NamingException if the dao fails to perform search operations
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listSyntaxDependents(java.lang.String)
      */
     public Set<ServerEntry> listSyntaxDependents( String numericOid ) throws Exception
     {
@@ -657,6 +630,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listMatchingRuleDependents(org.apache.directory.shared.ldap.schema.MatchingRule)
+     */
     public Set<ServerEntry> listMatchingRuleDependents( MatchingRule mr ) throws Exception
     {
         Set<ServerEntry> set = new HashSet<ServerEntry>();
@@ -710,6 +686,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listAllNames()
+     */
     public EntryFilteringCursor listAllNames() throws Exception
     {
         SearchControls searchControls = new SearchControls();
@@ -724,6 +703,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listAttributeTypeDependents(org.apache.directory.shared.ldap.schema.AttributeType)
+     */
     public Set<ServerEntry> listAttributeTypeDependents( AttributeType at ) throws Exception
     {
         /*
@@ -787,12 +769,8 @@
     }
 
 
-    /**
-     * Lists the SearchResults of metaSchema objects that depend on a schema.
-     * 
-     * @param schemaName the name of the schema to search for dependees
-     * @return a set of SearchResults over the schemas whose m-dependency attribute contains schemaName
-     * @throws NamingException if there is a problem while searching the schema partition
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listSchemaDependents(java.lang.String)
      */
     public Set<ServerEntry> listSchemaDependents( String schemaName ) throws Exception
     {
@@ -836,12 +814,8 @@
     }
 
 
-    /**
-     * Lists the SearchResults of metaSchema objects that depend on a schema.
-     * 
-     * @param schemaName the name of the schema to search for dependencies
-     * @return a set of SearchResults over the schemas whose m-dependency attribute contains schemaName
-     * @throws NamingException if there is a problem while searching the schema partition
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listEnabledSchemaDependents(java.lang.String)
      */
     public Set<ServerEntry> listEnabledSchemaDependents( String schemaName ) throws Exception
     {
@@ -889,6 +863,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.schema.SchemaPartitionDao#listObjectClassDependents(org.apache.directory.shared.ldap.schema.ObjectClass)
+     */
     public Set<ServerEntry> listObjectClassDependents( ObjectClass oc ) throws Exception
     {
         /*

Copied: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java (from r812031, directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DefaultRegistrySynchronizer.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java?p2=directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java&p1=directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DefaultRegistrySynchronizer.java&r1=812031&r2=812132&rev=812132&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DefaultRegistrySynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java Mon Sep  7 13:31:55 2009
@@ -22,7 +22,6 @@
 
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -35,19 +34,15 @@
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.schema.PartitionSchemaLoader;
-import org.apache.directory.server.core.schema.SchemaPartitionDao;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
@@ -71,9 +66,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DefaultRegistrySynchronizer implements RegistrySynchronizer
+public class RegistrySynchronizerAdaptor
 {
-    private static final Logger LOG = LoggerFactory.getLogger( DefaultRegistrySynchronizer.class );
+    private static final Logger LOG = LoggerFactory.getLogger( RegistrySynchronizerAdaptor.class );
 
     // indices of handlers and object ids into arrays
     private static final int COMPARATOR_INDEX = 0;
@@ -90,17 +85,17 @@
 
     private static final Set<String> VALID_OU_VALUES = new HashSet<String>();
     private static final String[] META_OBJECT_CLASSES = new String[] {
-        "metaComparator",
-        "metaNormalizer",
-        "metaSyntaxChecker",
-        "metaSyntax",
-        "metaMatchingRule",
-        "metaAttributeType",
-        "metaObjectClass",
-        "metaMatchingRuleUse",
-        "metaDITStructureRule",
-        "metaDITContentRule",
-        "metaNameForm"
+        MetaSchemaConstants.META_COMPARATOR_OC,
+        MetaSchemaConstants.META_NORMALIZER_OC,
+        MetaSchemaConstants.META_SYNTAX_CHECKER_OC,
+        MetaSchemaConstants.META_SYNTAX_OC,
+        MetaSchemaConstants.META_MATCHING_RULE_OC,
+        MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC,
+        MetaSchemaConstants.META_OBJECT_CLASS_OC,
+        MetaSchemaConstants.META_MATCHING_RULE_USE_OC,
+        MetaSchemaConstants.META_DIT_STRUCTURE_RULE_OC,
+        MetaSchemaConstants.META_DIT_CONTENT_RULE_OC,
+        MetaSchemaConstants.META_NAME_FORM_OC
     };
 
     private final Registries registries;
@@ -125,11 +120,10 @@
     }
 
 
-    public DefaultRegistrySynchronizer( Registries registries, PartitionSchemaLoader loader, SchemaPartitionDao dao )
-        throws Exception
+    public RegistrySynchronizerAdaptor( Registries registries, PartitionSchemaLoader loader ) throws Exception
     {
         this.registries = registries;
-        this.schemaSynchronizer = new SchemaSynchronizer( registries );
+        this.schemaSynchronizer = new SchemaSynchronizer( registries, loader );
         this.objectClassAT = this.registries.getAttributeTypeRegistry()
             .lookup( SchemaConstants.OBJECT_CLASS_AT );
         
@@ -418,52 +412,4 @@
         
         return MetaSchemaConstants.SCHEMA_OTHER;
     }
-
-
-    public void add( LdapDN name, ServerEntry entry ) throws Exception
-    {
-        // TODO Auto-generated method stub
-    }
-
-
-    public void delete( LdapDN name, ServerEntry entry, boolean cascaded ) throws Exception
-    {
-        // TODO Auto-generated method stub
-    }
-
-
-    public boolean modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry,
-        ServerEntry targetEntry, boolean cascaded ) throws Exception
-    {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    public boolean modify( LdapDN name, List<Modification> mods, ServerEntry entry, ServerEntry targetEntry,
-        boolean cascaded ) throws Exception
-    {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, ServerEntry entry,
-        boolean cascaded ) throws Exception
-    {
-        // TODO Auto-generated method stub
-    }
-
-
-    public void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascaded ) throws Exception
-    {
-        // TODO Auto-generated method stub
-    }
-
-
-    public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascaded )
-        throws Exception
-    {
-        // TODO Auto-generated method stub
-    }
 }



Mime
View raw message