You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/08/23 18:15:10 UTC

svn commit: r569059 - in /directory/apacheds/trunk: core/src/main/java/org/apache/directory/server/core/partition/ core/src/main/java/org/apache/directory/server/core/schema/ protocol-ldap/src/main/java/org/apache/directory/server/ldap/

Author: akarasulu
Date: Thu Aug 23 09:15:09 2007
New Revision: 569059

URL: http://svn.apache.org/viewvc?rev=569059&view=rev
Log:
adding some fixes and preparing to add the logic for cascade deletes/modifies on the schema data

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=569059&r1=569058&r2=569059&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Aug 23 09:15:09 2007
@@ -68,6 +68,7 @@
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
+import org.apache.directory.shared.ldap.message.CascadeControl;
 import org.apache.directory.shared.ldap.message.EntryChangeControl;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -177,6 +178,7 @@
         attr.add( EntryChangeControl.CONTROL_OID );
         attr.add( SubentriesControl.CONTROL_OID );
         attr.add( ManageDsaITControl.CONTROL_OID );
+        attr.add( CascadeControl.CONTROL_OID );
 
         attr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
         rootDSE.put( attr );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?rev=569059&r1=569058&r2=569059&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java Thu Aug 23 09:15:09 2007
@@ -325,7 +325,7 @@
     }
     
 
-    public void delete( LdapDN name, Attributes entry ) throws NamingException
+    public void delete( LdapDN name, Attributes entry, boolean doCascadeDelete ) throws NamingException
     {
         Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
         
@@ -400,8 +400,8 @@
     }
 
 
-    public void modify( LdapDN name, ModificationItemImpl[] mods, Attributes entry, Attributes targetEntry ) 
-        throws NamingException
+    public void modify( LdapDN name, ModificationItemImpl[] mods, Attributes entry, Attributes targetEntry, 
+        boolean doCascadeModify ) throws NamingException
     {
         Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
         
@@ -428,7 +428,8 @@
     }
 
 
-    public void modifyRn( LdapDN name, String newRdn, boolean deleteOldRn, Attributes entry ) throws NamingException
+    public void modifyRn( LdapDN name, String newRdn, boolean deleteOldRn, Attributes entry, boolean doCascadeModify ) 
+        throws NamingException
     {
         Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
         
@@ -522,7 +523,7 @@
      * @param targetSubentry the target subentry after being modified
      */
     public void modifySchemaSubentry( LdapDN name, ModificationItemImpl[] mods, Attributes subentry, 
-        Attributes targetSubentry ) throws NamingException 
+        Attributes targetSubentry, boolean doCascadeModify ) throws NamingException 
     {
         for ( ModificationItemImpl mod : mods )
         {
@@ -530,10 +531,10 @@
             switch ( mod.getModificationOp() )
             {
                 case( DirContext.ADD_ATTRIBUTE ):
-                    modifyAddOperation( opAttrOid, mod.getAttribute() );
+                    modifyAddOperation( opAttrOid, mod.getAttribute(), doCascadeModify );
                     break;
                 case( DirContext.REMOVE_ATTRIBUTE ):
-                    modifyRemoveOperation( opAttrOid, mod.getAttribute() );
+                    modifyRemoveOperation( opAttrOid, mod.getAttribute(), doCascadeModify );
                     break; 
                 case( DirContext.REPLACE_ATTRIBUTE ):
                     throw new LdapOperationNotSupportedException( 
@@ -566,7 +567,7 @@
      * @param targetSubentry the target subentry after being modified
      */
     public void modifySchemaSubentry( LdapDN name, int modOp, Attributes mods, Attributes subentry, 
-        Attributes targetSubentry ) throws NamingException
+        Attributes targetSubentry, boolean doCascadeModify ) throws NamingException
     {
         NamingEnumeration<String> ids = mods.getIDs();
         switch ( modOp )
@@ -576,7 +577,8 @@
                 {
                     String id = ids.next();
                     AttributeType opAttrAT = globalRegistries.getAttributeTypeRegistry().lookup( id );
-                    modifyAddOperation( opAttrAT.getOid(), AttributeUtils.getAttribute( mods, opAttrAT ) );
+                    modifyAddOperation( opAttrAT.getOid(), 
+                        AttributeUtils.getAttribute( mods, opAttrAT ), doCascadeModify );
                 }
                 break;
             case( DirContext.REMOVE_ATTRIBUTE ):
@@ -584,7 +586,8 @@
                 {
                     String id = ids.next();
                     AttributeType opAttrAT = globalRegistries.getAttributeTypeRegistry().lookup( id );
-                    modifyRemoveOperation( opAttrAT.getOid(), AttributeUtils.getAttribute( mods, opAttrAT ) );
+                    modifyRemoveOperation( opAttrAT.getOid(), 
+                        AttributeUtils.getAttribute( mods, opAttrAT ), doCascadeModify );
                 }
                 break;
             case( DirContext.REPLACE_ATTRIBUTE ):
@@ -620,7 +623,8 @@
      * @throws NamingException if there are problems updating the registries and the 
      * schema partition
      */
-    private void modifyRemoveOperation( String opAttrOid, Attribute mods ) throws NamingException
+    private void modifyRemoveOperation( String opAttrOid, Attribute mods, boolean doCascadeModify ) 
+        throws NamingException
     {
         int index = opAttr2handlerIndex.get( opAttrOid ).intValue();
         SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
@@ -750,7 +754,7 @@
      * @throws NamingException if there are problems updating the registries and the 
      * schema partition
      */
-    private void modifyAddOperation( String opAttrOid, Attribute mods ) throws NamingException
+    private void modifyAddOperation( String opAttrOid, Attribute mods, boolean doCascadeModify ) throws NamingException
     {
         int index = opAttr2handlerIndex.get( opAttrOid ).intValue();
         SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=569059&r1=569058&r2=569059&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Thu Aug 23 09:15:09 2007
@@ -1219,7 +1219,8 @@
 
         if ( name.startsWith( schemaBaseDN ) )
         {
-            schemaManager.modifyRn( name, newRdn, deleteOldRn, entry );
+            // @TODO DIRSERVER-1030 make this conditional based on the presence of the CascadeControl
+            schemaManager.modifyRn( name, newRdn, deleteOldRn, entry, false );
         }
         
         next.rename( opContext );
@@ -1531,11 +1532,13 @@
         
         if ( name.startsWith( schemaBaseDN ) )
         {
-            schemaManager.modify( name, mods, entry, targetEntry );
+            // @TODO DIRSERVER-1030 make this conditional based on the presence of the CascadeControl
+            schemaManager.modify( name, mods, entry, targetEntry, false );
         }
         else if ( subschemaSubentryDnNorm.equals( name.getNormName() ) )
         {
-            schemaManager.modifySchemaSubentry( name, mods, entry, targetEntry );
+            // @TODO DIRSERVER-1030 make this conditional based on the presence of the CascadeControl
+            schemaManager.modifySchemaSubentry( name, mods, entry, targetEntry, false );
             return;
         }
         
@@ -1796,7 +1799,8 @@
         
         if ( name.startsWith( schemaBaseDN ) )
         {
-            schemaManager.delete( name, entry );
+            // @TODO DIRSERVER-1030 make this conditional based on the presence of the CascadeControl
+            schemaManager.delete( name, entry, false );
         }
         
         next.delete( opContext );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java?rev=569059&r1=569058&r2=569059&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java Thu Aug 23 09:15:09 2007
@@ -49,6 +49,7 @@
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.message.BindRequest;
 import org.apache.directory.shared.ldap.message.BindRequestImpl;
+import org.apache.directory.shared.ldap.message.CascadeControl;
 import org.apache.directory.shared.ldap.message.CompareRequest;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.Control;
@@ -160,6 +161,7 @@
         set.add( PersistentSearchControl.CONTROL_OID );
         set.add( EntryChangeControl.CONTROL_OID );
         set.add( ManageDsaITControl.CONTROL_OID );
+        set.add( CascadeControl.CONTROL_OID );
         SUPPORTED_CONTROLS = Collections.unmodifiableSet( set );
     }