Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 88713 invoked from network); 10 Apr 2007 13:04:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Apr 2007 13:04:23 -0000 Received: (qmail 83312 invoked by uid 500); 10 Apr 2007 13:04:29 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 83278 invoked by uid 500); 10 Apr 2007 13:04:29 -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 83267 invoked by uid 99); 10 Apr 2007 13:04:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Apr 2007 06:04:29 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME 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; Tue, 10 Apr 2007 06:04:22 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id F1DD31A983E; Tue, 10 Apr 2007 06:04:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r527124 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Date: Tue, 10 Apr 2007 13:04:01 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070410130401.F1DD31A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Tue Apr 10 06:04:00 2007 New Revision: 527124 URL: http://svn.apache.org/viewvc?view=rev&rev=527124 Log: Updated the add method to use a ServiceContext Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=527124&r1=527123&r2=527124 ============================================================================== --- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original) +++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Tue Apr 10 06:04:00 2007 @@ -44,8 +44,12 @@ import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.authn.LdapPrincipal; +import org.apache.directory.server.core.interceptor.context.AddServiceContext; +import org.apache.directory.server.core.interceptor.context.DeleteServiceContext; import org.apache.directory.server.core.interceptor.context.EntryServiceContext; import org.apache.directory.server.core.interceptor.context.LookupServiceContext; +import org.apache.directory.server.core.interceptor.context.ModifyServiceContext; +import org.apache.directory.server.core.interceptor.context.ServiceContext; import org.apache.directory.server.core.partition.PartitionNexusProxy; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.filter.AssertionEnum; @@ -156,14 +160,20 @@ modifyAttributes( new LdapDN( name ), modOp, attrs ); } - /** - * @see javax.naming.directory.DirContext#modifyAttributes( - * javax.naming.Name,int, javax.naming.directory.Attributes) + * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String, + * int, javax.naming.directory.Attributes) */ public void modifyAttributes( Name name, int modOp, Attributes attrs ) throws NamingException { - getNexusProxy().modify( buildTarget( name ), modOp, attrs ); + if ( name instanceof LdapDN ) + { + getNexusProxy().modify( new ModifyServiceContext( (LdapDN)name, modOp, attrs ) ); + } + else + { + getNexusProxy().modify( new ModifyServiceContext( new LdapDN( name ), modOp, attrs ) ); + } } /** @@ -254,7 +264,7 @@ { Attributes clone = ( Attributes ) attrs.clone(); LdapDN target = buildTarget( name ); - getNexusProxy().add( target, clone ); + getNexusProxy().add( new AddServiceContext( target, clone ) ); return; } @@ -274,7 +284,7 @@ attributes.put( ( Attribute ) list.next() ); } } - getNexusProxy().add( target, attributes ); + getNexusProxy().add( new AddServiceContext( target, attributes ) ); return; } @@ -306,7 +316,7 @@ // Serialize object into entry attributes and add it. JavaLdapSupport.serialize( attributes, obj ); - getNexusProxy().add( target, attributes ); + getNexusProxy().add( new AddServiceContext( target, attributes ) ); } else if ( obj instanceof DirContext ) { @@ -321,7 +331,7 @@ } } LdapDN target = buildTarget( name ); - getNexusProxy().add( target, attributes ); + getNexusProxy().add( new AddServiceContext( target, attributes ) ); } else { @@ -349,7 +359,7 @@ LdapDN target = buildTarget( name ); if ( getNexusProxy().hasEntry( new EntryServiceContext( target ) ) ) { - getNexusProxy().delete( target ); + getNexusProxy().delete( new DeleteServiceContext( target ) ); } bind( name, obj, attrs ); } @@ -380,6 +390,7 @@ Rdn rdn = target.getRdn( target.size() - 1 ); Attributes attributes = ( Attributes ) attrs.clone(); + if ( rdn.size() == 1 ) { String rdnAttribute = rdn.getUpType(); @@ -414,7 +425,7 @@ } // Add the new context to the server which as a side effect adds - getNexusProxy().add( target, attributes ); + getNexusProxy().add( new AddServiceContext( target, attributes ) ); // Initialize the new context return new ServerLdapContext( getService(), getPrincipal(), target );