directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r812154 - in /directory/apacheds/branches/apacheds-schema: core-api/src/main/java/org/apache/directory/server/core/schema/ core-mock/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/schema/...
Date Mon, 07 Sep 2009 14:33:02 GMT
Author: akarasulu
Date: Mon Sep  7 14:33:01 2009
New Revision: 812154

URL: http://svn.apache.org/viewvc?rev=812154&view=rev
Log:
removing old MetaHandlers which are now just RegistrySynchronizers

Added:
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
      - copied, changed from r812129, directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaChangeManager.java
Removed:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaChangeManager.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaChangeManager.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaUtils.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
Modified:
    directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
    directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java

Modified: directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java?rev=812154&r1=812153&r2=812154&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
Mon Sep  7 14:33:01 2009
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core;
 
+
 import java.io.File;
 import java.util.Hashtable;
 import java.util.List;
@@ -36,13 +37,13 @@
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.replication.ReplicationConfiguration;
-import org.apache.directory.server.core.schema.SchemaChangeManager;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.shared.ldap.csn.Csn;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 
+
 public class MockDirectoryService implements DirectoryService
 {
     int count;
@@ -132,17 +133,6 @@
     }
 
 
-    public SchemaChangeManager getSchemaManager()
-    {
-        return null;
-    }
-
-
-    public void setSchemaManager( SchemaChangeManager schemaManager )
-    {
-    }
-
-
     public void startup() throws NamingException
     {
     }

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=812154&r1=812153&r2=812154&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Mon Sep  7 14:33:01 2009
@@ -165,7 +165,7 @@
      */
     private LdapDN schemaModificationAttributesDN;
 
-    private SchemaChangeManager schemaManager;
+    private SchemaSubentryManager schemaManager;
 
     private SchemaService schemaService;
 
@@ -1701,9 +1701,6 @@
         if ( dn.startsWith( schemaBaseDN ) )
         {
             LOG.debug( "Modification attempt on schema partition {}: \n{}", dn, opContext
);
-
-            schemaManager.modify( opContext, opContext.getEntry(), targetEntry, opContext
-                .hasRequestControl( CascadeControl.CONTROL_OID ) );
         }
         else if ( dn.equals( subschemaSubentryDn ) )
         {
@@ -2009,7 +2006,7 @@
                 next.add( addContext );
 
                 // Update the structures now that the schema element has been added
-                String schemaName = MetaSchemaUtils.getSchemaName( name );
+                String schemaName = getSchemaName( name );
                 
                 if ( registries.isSchemaLoaded( schemaName ) )
                 {
@@ -2034,6 +2031,18 @@
             next.add( addContext );
         }
     }
+    
+    
+    private String getSchemaName( LdapDN dn ) throws NamingException
+    {
+        if ( dn.size() < 2 )
+        {
+            throw new NamingException( "At least two name components are expected for the
dn" );
+        }
+        
+        Rdn rdn = dn.getRdn( 1 );
+        return ( String ) rdn.getValue();
+    }
 
 
     /**

Copied: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
(from r812129, directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaChangeManager.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java?p2=directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java&p1=directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaChangeManager.java&r1=812129&r2=812154&rev=812154&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaChangeManager.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
Mon Sep  7 14:33:01 2009
@@ -20,37 +20,18 @@
 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.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.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerModification;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 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.partition.ByPassConstants;
-import org.apache.directory.shared.ldap.NotImplementedException;
 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;
@@ -67,9 +48,7 @@
 import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
-import org.apache.directory.shared.ldap.util.DateUtils;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -79,21 +58,13 @@
 
 
 /**
- * Central point of control for schemas enforced by the server.  The 
- * following duties are presently performed by this class:
- * 
- * <ul>
- *   <li>Provide central point of access for all registries: global and SAA specific
registries</li>
- *   <li>Manage enabling and disabling schemas</li>
- *   <li>Responding to specific schema object changes</li>
- * </ul>
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DefaultSchemaChangeManager implements SchemaChangeManager
+public class SchemaSubentryManager
 {
-    private static final Logger LOG = LoggerFactory.getLogger( DefaultSchemaChangeManager.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( SchemaSubentryManager.class
);
 
     // indices of handlers and object ids into arrays
     private static final int COMPARATOR_INDEX = 0;
@@ -109,44 +80,11 @@
     private static final int NAME_FORM_INDEX = 10;
 
     private static final Set<String> VALID_OU_VALUES = new HashSet<String>();
-    private static final String[] OP_ATTRS = new String[] {
-        SchemaConstants.COMPARATORS_AT,
-        SchemaConstants.NORMALIZERS_AT,
-        SchemaConstants.SYNTAX_CHECKERS_AT,
-        SchemaConstants.LDAP_SYNTAXES_AT,
-        SchemaConstants.MATCHING_RULES_AT,
-        SchemaConstants.ATTRIBUTE_TYPES_AT,
-        SchemaConstants.OBJECT_CLASSES_AT,
-        SchemaConstants.MATCHING_RULE_USE_AT,
-        SchemaConstants.DIT_STRUCTURE_RULES_AT,
-        SchemaConstants.DIT_CONTENT_RULES_AT,
-        SchemaConstants.NAME_FORMS_AT
-    };
-    private static final String[] META_OBJECT_CLASSES = new String[] {
-        "metaComparator",
-        "metaNormalizer",
-        "metaSyntaxChecker",
-        "metaSyntax",
-        "metaMatchingRule",
-        "metaAttributeType",
-        "metaObjectClass",
-        "metaMatchingRuleUse",
-        "metaDITStructureRule",
-        "metaDITContentRule",
-        "metaNameForm"
-    };
 
-    private final MetaSchemaHandler metaSchemaHandler;
     private final Registries registries;
-    private final AttributeType objectClassAT;
     private final SchemaSubentryModifier subentryModifier;
-    private final SchemaChangeHandler[] schemaObjectHandlers = new SchemaChangeHandler[11];
-
     private final DescriptionParsers parsers;
     
-    private final Map<String, SchemaChangeHandler> opAttr2handlerMap = new HashMap<String,
SchemaChangeHandler>();
-    private final Map<String, SchemaChangeHandler> objectClass2handlerMap = new HashMap<String,
SchemaChangeHandler>();
-    
     /** 
      * Maps the OID of a subschemaSubentry operational attribute to the index of 
      * the handler in the schemaObjectHandlers array.
@@ -155,7 +93,6 @@
     private static final String CASCADING_ERROR =
             "Cascading has not yet been implemented: standard operation is in effect.";
 
-
     static 
     {
         VALID_OU_VALUES.add( SchemaConstants.NORMALIZERS_AT.toLowerCase() );
@@ -172,27 +109,10 @@
     }
 
 
-    public DefaultSchemaChangeManager( Registries registries, PartitionSchemaLoader loader,
SchemaPartitionDao dao )
+    public SchemaSubentryManager( Registries registries, PartitionSchemaLoader loader, SchemaPartitionDao
dao )
         throws Exception
     {
         this.registries = registries;
-        this.objectClassAT = this.registries.getAttributeTypeRegistry()
-            .lookup( SchemaConstants.OBJECT_CLASS_AT );
-        
-        this.metaSchemaHandler = new MetaSchemaHandler( this.registries, loader );
-        
-        this.schemaObjectHandlers[COMPARATOR_INDEX] = new MetaComparatorHandler( registries,
loader ); 
-        this.schemaObjectHandlers[NORMALIZER_INDEX] = new MetaNormalizerHandler( registries,
loader );
-        this.schemaObjectHandlers[SYNTAX_CHECKER_INDEX] = new MetaSyntaxCheckerHandler( registries,
loader );
-        this.schemaObjectHandlers[SYNTAX_INDEX] = new MetaSyntaxHandler( registries, loader,
dao );
-        this.schemaObjectHandlers[MATCHING_RULE_INDEX] = new MetaMatchingRuleHandler( registries,
loader, dao );
-        this.schemaObjectHandlers[ATTRIBUTE_TYPE_INDEX] = new MetaAttributeTypeHandler( registries,
loader, dao );
-        this.schemaObjectHandlers[OBJECT_CLASS_INDEX] = new MetaObjectClassHandler( registries,
loader, dao );
-        this.schemaObjectHandlers[MATCHING_RULE_USE_INDEX] = new MetaMatchingRuleUseHandler(
registries, loader );
-        this.schemaObjectHandlers[DIT_STRUCTURE_RULE_INDEX] = new MetaDitStructureRuleHandler(
registries, loader ); 
-        this.schemaObjectHandlers[DIT_CONTENT_RULE_INDEX] = new MetaDitContentRuleHandler(
registries, loader ); 
-        this.schemaObjectHandlers[NAME_FORM_INDEX] = new MetaNameFormHandler( registries,
loader ); 
-
         this.subentryModifier = new SchemaSubentryModifier( registries, dao );
         this.parsers = new DescriptionParsers( registries, dao );
         
@@ -230,316 +150,6 @@
 
         String nameFormsOid = atRegistry.getOidByName( SchemaConstants.NAME_FORMS_AT );
         opAttr2handlerIndex.put( nameFormsOid, NAME_FORM_INDEX );
-        
-        initHandlerMaps();
-    }
-
-    
-    private void initHandlerMaps() throws NamingException
-    {
-        AttributeTypeRegistry atReg = registries.getAttributeTypeRegistry();
-        for ( int ii = 0; ii < OP_ATTRS.length; ii++ )
-        {
-            AttributeType at = atReg.lookup( OP_ATTRS[ii] );
-            opAttr2handlerMap.put( at.getOid(), schemaObjectHandlers[ii] );
-        }
-
-        ObjectClassRegistry ocReg = registries.getObjectClassRegistry();
-        for ( int ii = 0; ii < META_OBJECT_CLASSES.length; ii++ )
-        {
-            ObjectClass oc = ocReg.lookup( META_OBJECT_CLASSES[ii] );
-            objectClass2handlerMap.put( oc.getOid(), schemaObjectHandlers[ii] );
-        }
-    }
-    
-    
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#getGlobalRegistries()
-     */
-    public Registries getGlobalRegistries()
-    {
-        return registries;
-    }
-    
-    
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#getRegistries(org.apache.directory.shared.ldap.name.LdapDN)
-     */
-    public Registries getRegistries( LdapDN dn )
-    {
-        LOG.error( "Ignoring request for specific registries under dn {}", dn );
-        throw new NotImplementedException();
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#add(org.apache.directory.server.core.interceptor.context.AddOperationContext)
-     */
-    public void add( AddOperationContext opContext ) throws Exception
-    {
-        EntryAttribute oc = opContext.getEntry().get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.add( opContext.getDn(), opContext.getEntry() );
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-        
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            metaSchemaHandler.add( opContext.getDn(), opContext.getEntry() );
-            updateSchemaModificationAttributes( opContext );
-            return;
-        }
-        
-        if ( oc.contains( SchemaConstants.ORGANIZATIONAL_UNIT_OC ) )
-        {
-            if ( opContext.getDn().size() != 3 )
-            {
-                throw new LdapInvalidNameException( 
-                    "Schema entity containers of objectClass organizationalUnit should be
3 name components in length.", 
-                    ResultCodeEnum.NAMING_VIOLATION );
-            }
-            
-            String ouValue = ( String ) opContext.getDn().getRdn().getValue();
-            ouValue = ouValue.trim().toLowerCase();
-            if ( ! VALID_OU_VALUES.contains( ouValue ) )
-            {
-                throw new LdapInvalidNameException( 
-                    "Expecting organizationalUnit with one of the following names: " + VALID_OU_VALUES,

-                    ResultCodeEnum.NAMING_VIOLATION );
-            }
-            return;
-        }
-
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-    
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#delete(org.apache.directory.server.core.interceptor.context.DeleteOperationContext,
org.apache.directory.server.core.entry.ClonedServerEntry, boolean)
-     */
-    public void delete( DeleteOperationContext opContext, ClonedServerEntry entry, boolean
doCascadeDelete ) 
-        throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.delete( opContext.getDn(), entry, doCascadeDelete );
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            metaSchemaHandler.delete( opContext.getDn(), entry, doCascadeDelete );
-            updateSchemaModificationAttributes( opContext );
-            return;
-        }
-        
-        if ( oc.contains( SchemaConstants.ORGANIZATIONAL_UNIT_OC ) )
-        {
-            if ( opContext.getDn().size() != 3 )
-            {
-                throw new LdapNamingException( 
-                    "Only schema entity containers of objectClass organizationalUnit with
3 name components in length" +
-                    " can be deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
-            }
-            
-            String ouValue = ( String ) opContext.getDn().getRdn().getValue();
-            ouValue = ouValue.trim().toLowerCase();
-            if ( ! VALID_OU_VALUES.contains( ouValue ) )
-            {
-                throw new LdapInvalidNameException( 
-                    "Can only delete organizationalUnit entity containers with one of the
following names: " 
-                    + VALID_OU_VALUES, ResultCodeEnum.NAMING_VIOLATION );
-            }
-            return;
-        }
-
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-    
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#modify(org.apache.directory.server.core.interceptor.context.ModifyOperationContext,
org.apache.directory.shared.ldap.entry.ModificationOperation, org.apache.directory.server.core.entry.ServerEntry,
org.apache.directory.server.core.entry.ServerEntry, org.apache.directory.server.core.entry.ServerEntry,
boolean)
-     */
-    public void modify( ModifyOperationContext opContext, ModificationOperation modOp, ServerEntry
mods, 
-        ServerEntry entry, ServerEntry targetEntry, boolean cascade ) throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.modify( opContext.getDn(), modOp, mods, entry, targetEntry, cascade
);
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            metaSchemaHandler.modify( opContext.getDn(), modOp, mods, entry, targetEntry,
cascade );
-            updateSchemaModificationAttributes( opContext );
-            return;
-        }
-        
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#modify(org.apache.directory.server.core.interceptor.context.ModifyOperationContext,
org.apache.directory.server.core.entry.ServerEntry, org.apache.directory.server.core.entry.ServerEntry,
boolean)
-     */
-    public void modify( ModifyOperationContext opContext, ServerEntry entry, 
-        ServerEntry targetEntry, boolean doCascadeModify ) throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.modify( opContext.getDn(), opContext.getModItems(), entry, targetEntry,
doCascadeModify );
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            boolean isSchemaModified = metaSchemaHandler.modify( opContext.getDn(), opContext.getModItems(),
entry, targetEntry, doCascadeModify );
-            
-            if ( isSchemaModified )
-            {
-                updateSchemaModificationAttributes( opContext );
-            }
-            
-            return;
-        }
-
-        LOG.error( String.format( "Unwilling to perform modify on %s:\n\nEntry:\n%s\n\nModifications:\n%s",

-            opContext.getDn(), entry, opContext.getModItems() ) );
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#modifyRn(org.apache.directory.server.core.interceptor.context.RenameOperationContext,
org.apache.directory.server.core.entry.ServerEntry, boolean)
-     */
-    public void modifyRn( RenameOperationContext opContext, ServerEntry entry, boolean doCascadeModify
) 
-        throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.rename( opContext.getDn(), entry, opContext.getNewRdn(), doCascadeModify
);
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            metaSchemaHandler.rename( opContext.getDn(), entry, opContext.getNewRdn(), doCascadeModify
);
-            updateSchemaModificationAttributes( opContext );
-            return;
-        }
-        
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#replace(org.apache.directory.server.core.interceptor.context.MoveOperationContext,
org.apache.directory.server.core.entry.ServerEntry, boolean)
-     */
-    public void replace( MoveOperationContext opContext, ServerEntry entry, boolean cascade
) throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.replace( opContext.getDn(), opContext.getParent(), entry, cascade
);
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            metaSchemaHandler.replace( opContext.getDn(), opContext.getParent(), entry, cascade
);
-            updateSchemaModificationAttributes( opContext );
-            return;
-        }
-        
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#move(org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext,
org.apache.directory.server.core.entry.ServerEntry, boolean)
-     */
-    public void move( MoveAndRenameOperationContext opContext, ServerEntry entry, boolean
cascade ) throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2handlerMap.containsKey( oid ) )
-            {
-                SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
-                handler.move( opContext.getDn(), opContext.getParent(), opContext.getNewRdn(),

-                    opContext.getDelOldDn(), entry, cascade );
-                updateSchemaModificationAttributes( opContext );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            metaSchemaHandler.move( opContext.getDn(), opContext.getParent(), opContext.getNewRdn(),

-                opContext.getDelOldDn(), entry, cascade );
-            updateSchemaModificationAttributes( opContext );
-            return;
-        }
-        
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
     }
 
     
@@ -558,7 +168,6 @@
             switch ( mod.getOperation() )
             {
                 case ADD_ATTRIBUTE :
-
                     modifyAddOperation( opContext, opAttrOid, serverAttribute, doCascadeModify
);
                     break;
                     
@@ -578,11 +187,6 @@
                     throw new IllegalStateException( "Undefined modify operation: " + mod.getOperation()
);
             }
         }
-        
-        if ( opContext.getModItems().size() > 0 )
-        {
-            updateSchemaModificationAttributes( opContext );
-        }
     }
     
     
@@ -625,8 +229,6 @@
             default:
                 throw new IllegalStateException( "Undefined modify operation: " + modOp );
         }
-        
-        updateSchemaModificationAttributes( opContext );
     }
 
     
@@ -658,117 +260,94 @@
         EntryAttribute mods, boolean doCascadeModify ) throws Exception
     {
         int index = opAttr2handlerIndex.get( opAttrOid );
-        SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
         
         switch( index )
         {
             case( COMPARATOR_INDEX ):
-                MetaComparatorHandler comparatorHandler = ( MetaComparatorHandler ) handler;
                 LdapComparatorDescription[] comparatorDescriptions = parsers.parseComparators(
mods );
                 
                 for ( LdapComparatorDescription comparatorDescription : comparatorDescriptions
)
                 {
-                    comparatorHandler.delete( comparatorDescription.getOid(), doCascadeModify
);
                     subentryModifier.delete( opContext, comparatorDescription );
                 }
                 break;
             case( NORMALIZER_INDEX ):
-                MetaNormalizerHandler normalizerHandler = ( MetaNormalizerHandler ) handler;
                 NormalizerDescription[] normalizerDescriptions = parsers.parseNormalizers(
mods );
                 
                 for ( NormalizerDescription normalizerDescription : normalizerDescriptions
)
                 {
-                    normalizerHandler.delete( normalizerDescription.getOid(), doCascadeModify
);
                     subentryModifier.delete( opContext, normalizerDescription );
                 }
                 break;
             case( SYNTAX_CHECKER_INDEX ):
-                MetaSyntaxCheckerHandler syntaxCheckerHandler = ( MetaSyntaxCheckerHandler
) handler;
                 SyntaxCheckerDescription[] syntaxCheckerDescriptions = parsers.parseSyntaxCheckers(
mods );
                 
                 for ( SyntaxCheckerDescription syntaxCheckerDescription : syntaxCheckerDescriptions
)
                 {
-                    syntaxCheckerHandler.delete( syntaxCheckerDescription.getOid(), doCascadeModify
);
                     subentryModifier.delete( opContext, syntaxCheckerDescription );
                 }
                 break;
             case( SYNTAX_INDEX ):
-                MetaSyntaxHandler syntaxHandler = ( MetaSyntaxHandler ) handler;
                 LdapSyntax[] syntaxes = parsers.parseLdapSyntaxes( mods );
                 
                 for ( LdapSyntax syntax : syntaxes )
                 {
-                    syntaxHandler.delete( syntax, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, syntax );
                 }
                 break;
             case( MATCHING_RULE_INDEX ):
-                MetaMatchingRuleHandler matchingRuleHandler = ( MetaMatchingRuleHandler )
handler;
                 MatchingRule[] mrs = parsers.parseMatchingRules( mods );
                 
                 for ( MatchingRule mr : mrs )
                 {
-                    matchingRuleHandler.delete( mr, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, mr );
                 }
                 break;
             case( ATTRIBUTE_TYPE_INDEX ):
-                MetaAttributeTypeHandler atHandler = ( MetaAttributeTypeHandler ) handler;
                 AttributeType[] ats = parsers.parseAttributeTypes( mods );
                 
                 for ( AttributeType at : ats )
                 {
-                    atHandler.delete( at, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, at );
                 }
                 break;
             case( OBJECT_CLASS_INDEX ):
-                MetaObjectClassHandler ocHandler = ( MetaObjectClassHandler ) handler;
                 ObjectClass[] ocs = parsers.parseObjectClasses( mods );
 
                 for ( ObjectClass oc : ocs )
                 {
-                    ocHandler.delete( oc, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, oc );
                 }
                 break;
             case( MATCHING_RULE_USE_INDEX ):
-                MetaMatchingRuleUseHandler mruHandler = ( MetaMatchingRuleUseHandler ) handler;
                 MatchingRuleUse[] mrus = parsers.parseMatchingRuleUses( mods );
                 
                 for ( MatchingRuleUse mru : mrus )
                 {
-                    mruHandler.delete( mru, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, mru );
                 }
                 break;
             case( DIT_STRUCTURE_RULE_INDEX ):
-                MetaDitStructureRuleHandler dsrHandler = ( MetaDitStructureRuleHandler )
handler;
                 DITStructureRule[] dsrs = parsers.parseDitStructureRules( mods );
                 
                 for ( DITStructureRule dsr : dsrs )
                 {
-                    dsrHandler.delete( dsr, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, dsr );
                 }
                 break;
             case( DIT_CONTENT_RULE_INDEX ):
-                MetaDitContentRuleHandler dcrHandler = ( MetaDitContentRuleHandler ) handler;
                 DITContentRule[] dcrs = parsers.parseDitContentRules( mods );
                 
                 for ( DITContentRule dcr : dcrs )
                 {
-                    dcrHandler.delete( dcr, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, dcr );
                 }
                 break;
             case( NAME_FORM_INDEX ):
-                MetaNameFormHandler nfHandler = ( MetaNameFormHandler ) handler;
                 NameForm[] nfs = parsers.parseNameForms( mods );
                 
                 for ( NameForm nf : nfs )
                 {
-                    nfHandler.delete( nf, doCascadeModify );
                     subentryModifier.deleteSchemaObject( opContext, nf );
                 }
                 break;
@@ -797,117 +376,94 @@
         }
 
         int index = opAttr2handlerIndex.get( opAttrOid );
-        SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
         
         switch( index )
         {
             case( COMPARATOR_INDEX ):
-                MetaComparatorHandler comparatorHandler = ( MetaComparatorHandler ) handler;
-            LdapComparatorDescription[] comparatorDescriptions = parsers.parseComparators(
mods );
+                LdapComparatorDescription[] comparatorDescriptions = parsers.parseComparators(
mods );
                 
                 for ( LdapComparatorDescription comparatorDescription : comparatorDescriptions
)
                 {
-                    comparatorHandler.add( comparatorDescription );
                     subentryModifier.add( opContext, comparatorDescription );
                 }
                 break;
             case( NORMALIZER_INDEX ):
-                MetaNormalizerHandler normalizerHandler = ( MetaNormalizerHandler ) handler;
                 NormalizerDescription[] normalizerDescriptions = parsers.parseNormalizers(
mods );
                 
                 for ( NormalizerDescription normalizerDescription : normalizerDescriptions
)
                 {
-                    normalizerHandler.add( normalizerDescription );
                     subentryModifier.add( opContext, normalizerDescription );
                 }
                 break;
             case( SYNTAX_CHECKER_INDEX ):
-                MetaSyntaxCheckerHandler syntaxCheckerHandler = ( MetaSyntaxCheckerHandler
) handler;
                 SyntaxCheckerDescription[] syntaxCheckerDescriptions = parsers.parseSyntaxCheckers(
mods );
                 
                 for ( SyntaxCheckerDescription syntaxCheckerDescription : syntaxCheckerDescriptions
)
                 {
-                    syntaxCheckerHandler.add( syntaxCheckerDescription );
                     subentryModifier.add( opContext, syntaxCheckerDescription );
                 }
                 break;
             case( SYNTAX_INDEX ):
-                MetaSyntaxHandler syntaxHandler = ( MetaSyntaxHandler ) handler;
                 LdapSyntax[] syntaxes = parsers.parseLdapSyntaxes( mods );
                 
                 for ( LdapSyntax syntax : syntaxes )
                 {
-                    syntaxHandler.add( syntax );
                     subentryModifier.addSchemaObject( opContext, syntax );
                 }
                 break;
             case( MATCHING_RULE_INDEX ):
-                MetaMatchingRuleHandler matchingRuleHandler = ( MetaMatchingRuleHandler )
handler;
                 MatchingRule[] mrs = parsers.parseMatchingRules( mods );
                 
                 for ( MatchingRule mr : mrs )
                 {
-                    matchingRuleHandler.add( mr );
                     subentryModifier.addSchemaObject( opContext, mr );
                 }
                 break;
             case( ATTRIBUTE_TYPE_INDEX ):
-                MetaAttributeTypeHandler atHandler = ( MetaAttributeTypeHandler ) handler;
                 AttributeType[] ats = parsers.parseAttributeTypes( mods );
                 
                 for ( AttributeType at : ats )
                 {
-                    atHandler.add( at );
                     subentryModifier.addSchemaObject( opContext, at );
                 }
                 break;
             case( OBJECT_CLASS_INDEX ):
-                MetaObjectClassHandler ocHandler = ( MetaObjectClassHandler ) handler;
                 ObjectClass[] ocs = parsers.parseObjectClasses( mods );
 
                 for ( ObjectClass oc : ocs )
                 {
-                    ocHandler.add( oc );
                     subentryModifier.addSchemaObject( opContext, oc );
                 }
                 break;
             case( MATCHING_RULE_USE_INDEX ):
-                MetaMatchingRuleUseHandler mruHandler = ( MetaMatchingRuleUseHandler ) handler;
                 MatchingRuleUse[] mrus = parsers.parseMatchingRuleUses( mods );
                 
                 for ( MatchingRuleUse mru : mrus )
                 {
-                    mruHandler.add( mru );
                     subentryModifier.addSchemaObject( opContext, mru );
                 }
                 break;
             case( DIT_STRUCTURE_RULE_INDEX ):
-                MetaDitStructureRuleHandler dsrHandler = ( MetaDitStructureRuleHandler )
handler;
                 DITStructureRule[] dsrs = parsers.parseDitStructureRules( mods );
                 
                 for ( DITStructureRule dsr : dsrs )
                 {
-                    dsrHandler.add( dsr );
                     subentryModifier.addSchemaObject( opContext, dsr );
                 }
                 break;
             case( DIT_CONTENT_RULE_INDEX ):
-                MetaDitContentRuleHandler dcrHandler = ( MetaDitContentRuleHandler ) handler;
                 DITContentRule[] dcrs = parsers.parseDitContentRules( mods );
                 
                 for ( DITContentRule dcr : dcrs )
                 {
-                    dcrHandler.add( dcr );
                     subentryModifier.addSchemaObject( opContext, dcr );
                 }
                 break;
             case( NAME_FORM_INDEX ):
-                MetaNameFormHandler nfHandler = ( MetaNameFormHandler ) handler;
                 NameForm[] nfs = parsers.parseNameForms( mods );
                 
                 for ( NameForm nf : nfs )
                 {
-                    nfHandler.add( nf );
                     subentryModifier.addSchemaObject( opContext, nf );
                 }
                 break;
@@ -915,41 +471,4 @@
                 throw new IllegalStateException( "Unknown index into handler array: " + index
);
         }
     }
-    
-    
-    /**
-     * 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/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=812154&r1=812153&r2=812154&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
Mon Sep  7 14:33:01 2009
@@ -70,17 +70,11 @@
     static
     {
         Set<String> c = new HashSet<String>();
-//        c.add( NormalizationInterceptor.class.getName() );
         c.add( AuthenticationInterceptor.class.getName() );
         c.add( AciAuthorizationInterceptor.class.getName() );
         c.add( DefaultAuthorizationInterceptor.class.getName() );
         c.add( ExceptionInterceptor.class.getName() );
-//        c.add( OperationalAttributeInterceptor.class.getName() );
         c.add( SchemaInterceptor.class.getName() );
-//        c.add( SubentryInterceptor.class.getName() );
-//        c.add( CollectiveAttributeInterceptor.class.getName() );
-//        c.add( EventInterceptor.class.getName() );
-//        c.add( TriggerInterceptor.class.getName() );
         BYPASS = Collections.unmodifiableCollection( c );
     }
     

Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=812154&r1=812153&r2=812154&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Mon Sep  7 14:33:01 2009
@@ -59,7 +59,6 @@
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.DefaultPartitionNexus;
 import org.apache.directory.server.core.replication.ReplicationConfiguration;
-import org.apache.directory.server.core.schema.SchemaChangeManager;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.aci.ACITuple;
@@ -553,17 +552,6 @@
         }
 
 
-        public SchemaChangeManager getSchemaManager()
-        {
-            return null;
-        }
-
-
-        public void setSchemaManager( SchemaChangeManager schemaManager )
-        {
-        }
-
-
         public void startup() throws NamingException
         {
         }

Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=812154&r1=812153&r2=812154&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Mon Sep  7 14:33:01 2009
@@ -36,7 +36,6 @@
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.DefaultPartitionNexus;
 import org.apache.directory.server.core.replication.ReplicationConfiguration;
-import org.apache.directory.server.core.schema.SchemaChangeManager;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.csn.Csn;
@@ -349,17 +348,6 @@
         }
 
 
-        public SchemaChangeManager getSchemaManager()
-        {
-            return null;
-        }
-
-
-        public void setSchemaManager( SchemaChangeManager schemaManager )
-        {
-        }
-
-
         public void startup() throws NamingException
         {
         }



Mime
View raw message