From commits-return-15043-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Thu Aug 23 16:15:37 2007 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 35164 invoked from network); 23 Aug 2007 16:15:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Aug 2007 16:15:35 -0000 Received: (qmail 52630 invoked by uid 500); 23 Aug 2007 16:15:31 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 52575 invoked by uid 500); 23 Aug 2007 16:15:31 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 52564 invoked by uid 99); 23 Aug 2007 16:15:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2007 09:15:31 -0700 X-ASF-Spam-Status: No, hits=-99.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2007 16:16:13 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 201781A981A; Thu, 23 Aug 2007 09:15:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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/ Date: Thu, 23 Aug 2007 16:15:10 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070823161511.201781A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 ); }