From commits-return-13195-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Thu Apr 05 17:14:39 2007 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 33417 invoked from network); 5 Apr 2007 17:14:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Apr 2007 17:14:37 -0000 Received: (qmail 78249 invoked by uid 500); 5 Apr 2007 17:14:44 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 78209 invoked by uid 500); 5 Apr 2007 17:14:44 -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 78198 invoked by uid 99); 5 Apr 2007 17:14:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2007 10:14:44 -0700 X-ASF-Spam-Status: No, hits=-98.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,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; Thu, 05 Apr 2007 10:14:36 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 8DE431A9838; Thu, 5 Apr 2007 10:14:16 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r525896 - /directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Date: Thu, 05 Apr 2007 17:14:16 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070405171416.8DE431A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Thu Apr 5 10:14:15 2007 New Revision: 525896 URL: http://svn.apache.org/viewvc?view=rev&rev=525896 Log: Modified the lookup() methods Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=525896&r1=525895&r2=525896 ============================================================================== --- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java (original) +++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Thu Apr 5 10:14:15 2007 @@ -56,6 +56,8 @@ import org.apache.directory.server.core.interceptor.BaseInterceptor; import org.apache.directory.server.core.interceptor.Interceptor; import org.apache.directory.server.core.interceptor.NextInterceptor; +import org.apache.directory.server.core.interceptor.context.LookupServiceContext; +import org.apache.directory.server.core.interceptor.context.ServiceContext; import org.apache.directory.server.core.invocation.InvocationStack; import org.apache.directory.server.core.partition.PartitionNexus; import org.apache.directory.server.schema.registries.AttributeTypeRegistry; @@ -354,7 +356,7 @@ LdapDN name = it.next(); try { - Attributes entry = nexus.lookup( name ); + Attributes entry = nexus.lookup( new LookupServiceContext( name ) ); log.info( "Purge: " + name + " (" + entry + ')' ); nexus.delete( name ); } @@ -428,7 +430,7 @@ // Check DELETED attribute. try { - Attributes entry = nextInterceptor.lookup( name ); + Attributes entry = nextInterceptor.lookup( new LookupServiceContext( name ) ); hasEntry = !isDeleted( entry ); } catch ( NameNotFoundException e ) @@ -442,39 +444,38 @@ } - public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException + public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException { - Attributes result = nextInterceptor.lookup( name ); - ensureNotDeleted( name, result ); - return result; - } - - - public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException - { - boolean found = false; + LookupServiceContext ctx = ((LookupServiceContext)lookupContext); - // Look for 'entryDeleted' attribute is in attrIds. - for ( int i = 0; i < attrIds.length; i++ ) + if ( ctx.getAttrsId() != null ) { - if ( Constants.ENTRY_DELETED.equals( attrIds[i] ) ) + boolean found = false; + + String[] attrIds = ctx.getAttrsIdArray(); + + // Look for 'entryDeleted' attribute is in attrIds. + for ( String attrId:attrIds ) { - found = true; - break; + if ( Constants.ENTRY_DELETED.equals( attrId ) ) + { + found = true; + break; + } + } + + // If not exists, add one. + if ( !found ) + { + String[] newAttrIds = new String[attrIds.length + 1]; + System.arraycopy( attrIds, 0, newAttrIds, 0, attrIds.length ); + newAttrIds[attrIds.length] = Constants.ENTRY_DELETED; + ctx.setAttrsId( newAttrIds ); } } - - // If not exists, add one. - if ( !found ) - { - String[] newAttrIds = new String[attrIds.length + 1]; - System.arraycopy( attrIds, 0, newAttrIds, 0, attrIds.length ); - newAttrIds[attrIds.length] = Constants.ENTRY_DELETED; - attrIds = newAttrIds; - } - - Attributes result = nextInterceptor.lookup( name, attrIds ); - ensureNotDeleted( name, result ); + + Attributes result = nextInterceptor.lookup( lookupContext ); + ensureNotDeleted( ctx.getDn(), result ); return result; }