Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CEC009059 for ; Sat, 3 Mar 2012 00:20:47 +0000 (UTC) Received: (qmail 33035 invoked by uid 500); 3 Mar 2012 00:20:47 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 32986 invoked by uid 500); 3 Mar 2012 00:20:47 -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 32979 invoked by uid 99); 3 Mar 2012 00:20:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2012 00:20:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2012 00:20:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1B304238890D for ; Sat, 3 Mar 2012 00:20:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1296527 [2/4] - in /directory/apacheds/branches/apacheds-txns: ./ apache-felix/ core-annotations/src/main/java/org/apache/directory/server/core/factory/ core-integ/src/test/java/org/apache/directory/server/core/configuration/ core-integ/sr... Date: Sat, 03 Mar 2012 00:20:12 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120303002015.1B304238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original) +++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Sat Mar 3 00:20:10 2012 @@ -29,9 +29,9 @@ import java.util.List; import java.util.UUID; import org.apache.directory.server.core.api.interceptor.context.AddOperationContext; -import org.apache.directory.server.i18n.I18n; import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory; import org.apache.directory.server.core.shared.txn.TxnManagerFactory; +import org.apache.directory.server.i18n.I18n; import org.apache.directory.shared.ldap.model.constants.SchemaConstants; import org.apache.directory.shared.ldap.model.entry.DefaultEntry; import org.apache.directory.shared.ldap.model.entry.Entry; @@ -128,7 +128,7 @@ public class LdifPartition extends Abstr if ( !initialized ) { File partitionDir = new File( getPartitionPath() ); - + // Initialize the suffixDirectory : it's a composition // of the workingDirectory followed by the suffix if ( ( suffixDn == null ) || ( suffixDn.isEmpty() ) ) @@ -137,20 +137,20 @@ public class LdifPartition extends Abstr LOG.error( msg ); throw new LdapInvalidDnException( msg ); } - + if ( !suffixDn.isSchemaAware() ) { suffixDn.apply( schemaManager ); } - + String suffixDirName = getFileName( suffixDn ); suffixDirectory = new File( partitionDir, suffixDirName ); - + super.doInit(); - + // Create the master table master = new LdifMasterTable( this ); - + // Create the context entry now, if it does not exists, or load the // existing entries if ( suffixDirectory.exists() ) @@ -170,29 +170,29 @@ public class LdifPartition extends Abstr LOG.error( msg ); throw se; } - + // And create the context entry too File contextEntryFile = new File( suffixDirectory + CONF_FILE_EXTN ); - + LOG.info( "ldif file doesn't exist {}, creating it.", contextEntryFile.getAbsolutePath() ); - + if ( contextEntryFile.exists() ) { LdifReader reader = new LdifReader( contextEntryFile ); Entry contextEntry = new DefaultEntry( schemaManager, reader.next().getEntry() ); reader.close(); - + if ( contextEntry.get( SchemaConstants.ENTRY_CSN_AT ) == null ) { contextEntry.add( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString() ); } - + if ( contextEntry.get( SchemaConstants.ENTRY_UUID_AT ) == null ) { String uuid = UUID.randomUUID().toString(); contextEntry.add( SchemaConstants.ENTRY_UUID_AT, uuid ); } - + // And add this entry to the underlying partition AddOperationContext addContext = new AddOperationContext( schemaManager, contextEntry ); add( addContext ); @@ -201,7 +201,7 @@ public class LdifPartition extends Abstr } } - + /** * {@inheritDoc} */ @@ -210,7 +210,7 @@ public class LdifPartition extends Abstr return true; } - + //------------------------------------------------------------------------- // Operations //------------------------------------------------------------------------- @@ -290,23 +290,24 @@ public class LdifPartition extends Abstr } } } - - - /** No protection */ void writeEntry( Entry entry ) throws Exception + + + /** No protection */ + void writeEntry( Entry entry ) throws Exception { Dn dn = entry.getDn(); - + if ( dn == null || dn.isEmpty() ) { throw new IllegalStateException( "LdifPartition: Entry's dn is not set" + entry ); } - + File entryFile = getFile( dn ); - + File shadowFile = new File( entryFile.getPath() + CONF_SHADOW_FILE_EXTN ); - + boolean shadowFileExists = !shadowFile.createNewFile(); - + if ( shadowFileExists ) { // Truncate the file @@ -315,65 +316,65 @@ public class LdifPartition extends Abstr raf.seek( 0 ); raf.close(); } - + FileWriter fw = new FileWriter( shadowFile ); fw.write( LdifUtils.convertToLdif( entry ) ); fw.close(); - + // Now rename to the entry's file boolean succeeded = shadowFile.renameTo( entryFile ); - + if ( succeeded == false ) { throw new LdapException( "LdiPartition: Rename of File did not succeed" ); } } - - - /** No protection */ void deleteEntry( Entry entry ) throws Exception + + + /** No protection */ + void deleteEntry( Entry entry ) throws Exception { Dn dn = entry.getDn(); - + if ( dn == null || dn.isEmpty() ) { throw new IllegalStateException( "LdifPartition: Entry's dn is not set" + entry ); } - + File entryFile = getFile( dn ); - + // If file to be deleted doesnt exist then just return - + if ( entryFile.exists() == false ) { return; } - + File shadowFile = new File( entryFile.getPath() + CONF_SHADOW_FILE_EXTN ); - + // Now rename to the shadow file boolean succeeded = entryFile.renameTo( shadowFile ); - + if ( succeeded == false ) { throw new LdapException( "LdiPartition: Rename of File did not succeed" ); } - + boolean deleted; - + // Try to delete the shadow file deleted = shadowFile.delete(); LOG.debug( "deleted file {} {}", shadowFile.getAbsoluteFile(), deleted ); - - + // If parent directory does not have any children, then try to delete it File parentFile = entryFile.getParentFile(); - + while ( parentFile.listFiles().length == 0 ) { deleted = parentFile.delete(); LOG.debug( "deleted file {} {}", parentFile.getAbsoluteFile(), deleted ); - + parentFile = parentFile.getParentFile(); } } @@ -418,7 +419,7 @@ public class LdifPartition extends Abstr // We have to create the entry if it does not have a parent if ( !dir.mkdirs() ) { - throw new LdapException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dir ) ); + throw new LdapException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dir ) ); } } @@ -439,7 +440,7 @@ public class LdifPartition extends Abstr StringBuilder fileName = new StringBuilder( "" ); Iterator iterator = rdn.iterator(); - + while ( iterator.hasNext() ) { Ava ava = iterator.next(); @@ -568,7 +569,7 @@ public class LdifPartition extends Abstr case ']': // 0x5D case '|': // 0x7C sb.append( "%" ).append( Strings.dumpHex( ( byte ) ( c >> 4 ) ) ) - .append( Strings.dumpHex( ( byte ) ( c & 0xF ) ) ); + .append( Strings.dumpHex( ( byte ) ( c & 0xF ) ) ); break; default: @@ -579,7 +580,7 @@ public class LdifPartition extends Abstr return Strings.toLowerCase( sb.toString() ); } - + /** * Recursively delete an entry and all of its children. If the entry is a directory, Modified: directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java (original) +++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java Sat Mar 3 00:20:10 2012 @@ -33,11 +33,11 @@ import java.util.UUID; import javax.naming.InvalidNameException; import org.apache.directory.server.core.api.interceptor.context.AddOperationContext; -import org.apache.directory.server.i18n.I18n; import org.apache.directory.server.core.api.partition.index.IndexCursor; import org.apache.directory.server.core.api.partition.index.IndexEntry; import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory; import org.apache.directory.server.core.shared.txn.TxnManagerFactory; +import org.apache.directory.server.i18n.I18n; import org.apache.directory.shared.ldap.model.constants.SchemaConstants; import org.apache.directory.shared.ldap.model.entry.DefaultEntry; import org.apache.directory.shared.ldap.model.entry.Entry; @@ -61,7 +61,7 @@ public class SingleFileLdifPartition ext { /** the LDIF file holding the partition's data */ private File partitionFile; - + /** Shadow File */ private String ldifShadowFile; @@ -96,18 +96,18 @@ public class SingleFileLdifPartition ext { throw new IllegalArgumentException( "Partition path cannot be null" ); } - + partitionFile = new File( getPartitionPath() ); - + if ( partitionFile.exists() && !partitionFile.isFile() ) { throw new IllegalArgumentException( "Partition path must be a LDIF file" ); } - + ldifShadowFile = partitionFile.getPath() + CONF_SHADOW_FILE_EXTN; - + LOG.debug( "id is : {}", getId() ); - + // Initialize the suffixDirectory : it's a composition // of the workingDirectory followed by the suffix if ( ( suffixDn == null ) || ( suffixDn.isEmpty() ) ) @@ -116,14 +116,14 @@ public class SingleFileLdifPartition ext LOG.error( msg ); throw new LdapInvalidDnException( msg ); } - + if ( !suffixDn.isSchemaAware() ) { suffixDn.apply( schemaManager ); } - + super.doInit(); - + loadEntries(); } } @@ -169,7 +169,7 @@ public class SingleFileLdifPartition ext addMandatoryOpAt( entry ); AddOperationContext addContext = new AddOperationContext( schemaManager, entry ); - executionManager.add( this, addContext ); + executionManager.add( this, addContext ); } parser.close(); @@ -179,7 +179,7 @@ public class SingleFileLdifPartition ext //--------------------------------------------------------------------------------------------- // Operations //--------------------------------------------------------------------------------------------- - + /** * writes the partition's data to the file if {@link #enableRewriting} is set to true * and partition was modified since the last write or {@link #dirty} data. @@ -193,32 +193,30 @@ public class SingleFileLdifPartition ext RandomAccessFile ldifFile = null; IndexCursor cursor = null; - + try { File shadowFile = new File( ldifShadowFile ); - + if ( shadowFile.exists() == false ) { if ( shadowFile.createNewFile() == false ) { - throw new LdapException( "SingleFileLdifPartition: failed to create shadow file" ); + throw new LdapException( "SingleFileLdifPartition: failed to create shadow file" ); } } - + ldifFile = new RandomAccessFile( shadowFile, "rw" ); ldifFile.setLength( 0 ); // wipe the file clean UUID suffixId = getEntryId( suffixDn ); - if( suffixId == null ) + if ( suffixId == null ) { return; } - - - cursor = getOneLevelIndex().forwardCursor( suffixId ); + cursor = getOneLevelIndex().forwardCursor( suffixId ); appendLdif( lookup( suffixId ), ldifFile ); @@ -232,10 +230,10 @@ public class SingleFileLdifPartition ext appendRecursive( childId, null, ldifFile ); } - + // Finally rename to the partition file boolean succeeded = shadowFile.renameTo( partitionFile ); - + if ( succeeded == false ) { throw new LdapException( "SingleFileLdifPartition: reanme of shadow file to partition file failed" ); @@ -258,13 +256,13 @@ public class SingleFileLdifPartition ext { ldifFile.close(); } - + if ( cursor != null ) { cursor.close(); } } - catch( Exception e ) + catch ( Exception e ) { throw new LdapException( e ); } @@ -280,7 +278,8 @@ public class SingleFileLdifPartition ext * @param cursorMap the open cursor map * @throws Exception */ - private void appendRecursive( UUID entryId, Map> cursorMap, RandomAccessFile ldifFile ) throws Exception + private void appendRecursive( UUID entryId, Map> cursorMap, RandomAccessFile ldifFile ) + throws Exception { synchronized ( lock ) { @@ -337,7 +336,7 @@ public class SingleFileLdifPartition ext synchronized ( lock ) { String ldif = LdifUtils.convertToLdif( entry ); - ldifFile.write( Strings.getBytesUtf8(ldif + "\n") ); + ldifFile.write( Strings.getBytesUtf8( ldif + "\n" ) ); } } @@ -349,7 +348,8 @@ public class SingleFileLdifPartition ext private long len; RandomAccessFile ldifFile; - + + public RandomAccessLdifReader() throws LdapException { try @@ -360,7 +360,7 @@ public class SingleFileLdifPartition ext { throw new LdapException( e.getMessage(), e ); } - + try { len = ldifFile.length(); @@ -386,7 +386,8 @@ public class SingleFileLdifPartition ext return ldifFile.readLine(); } - + + @Override public void close() throws IOException { @@ -394,7 +395,7 @@ public class SingleFileLdifPartition ext { ldifFile.close(); } - + super.close(); } } @@ -417,7 +418,7 @@ public class SingleFileLdifPartition ext } } - + /** * enable/disable the re-writing of partition data. * This method internally calls the @see {@link #rewritePartitionData()} to save any dirty data if present @@ -432,7 +433,8 @@ public class SingleFileLdifPartition ext // save data if found dirty rewritePartitionData(); } - + + /** * {@inheritDoc} */ Propchange: directory/apacheds/branches/apacheds-txns/protocol-changepw/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Mar 3 00:20:10 2012 @@ -4,5 +4,5 @@ /directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw:1040956-1043765 /directory/apacheds/branches/milestones/protocol-changepw:1072812-1075328 /directory/apacheds/trunk/interceptors/protocol-changepw:1183435-1186974 -/directory/apacheds/trunk/protocol-changepw:1066126-1067785,1068026-1072718,1072800-1075329,1209070-1214194 +/directory/apacheds/trunk/protocol-changepw:1066126-1067785,1068026-1072718,1072800-1075329,1177663-1183434,1209070-1214194 /directory/studio/trunk/protocol-changepw:1067786-1067997 Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java (original) +++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java Sat Mar 3 00:20:10 2012 @@ -151,7 +151,8 @@ public class BindHandler extends LdapReq { LOG.info( "The {} principalDN cannot be found in the server : bind failure.", bindRequest.getName() ); } - else if ( ( ( ClonedServerEntry ) principalEntry ).getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT, + else if ( ( ( ClonedServerEntry ) principalEntry ).getOriginalEntry().contains( + SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.REFERRAL_OC ) ) { LOG.info( "Bind principalDn points to referral." ); @@ -204,7 +205,7 @@ public class BindHandler extends LdapReq code = ResultCodeEnum.UNWILLING_TO_PERFORM; result.setResultCode( code ); } - else if ( e instanceof LdapInvalidDnException) + else if ( e instanceof LdapInvalidDnException ) { code = ResultCodeEnum.INVALID_DN_SYNTAX; result.setResultCode( code ); @@ -225,7 +226,7 @@ public class BindHandler extends LdapReq Dn dn = null; - if ( e instanceof LdapAuthenticationException) + if ( e instanceof LdapAuthenticationException ) { dn = ( ( LdapAuthenticationException ) e ).getResolvedDn(); } @@ -455,7 +456,7 @@ public class BindHandler extends LdapReq String saslMechanism = bindRequest.getSaslMechanism(); // The empty mechanism is also a request for a new Bind session - if ( Strings.isEmpty(saslMechanism) + if ( Strings.isEmpty( saslMechanism ) || !ldapSession.getSaslProperty( SaslConstants.SASL_MECH ).equals( saslMechanism ) ) { sendAuthMethNotSupported( ldapSession, bindRequest ); @@ -539,28 +540,28 @@ public class BindHandler extends LdapReq { // get out ! sendAuthMethNotSupported( ldapSession, bindRequest ); - + return; } - + // Store the mechanism in the ldap session ldapSession.putSaslProperty( SaslConstants.SASL_MECH, saslMechanism ); - + // Get the handler for this mechanism MechanismHandler mechanismHandler = handlers.get( saslMechanism ); - + // Store the mechanism handler in the salsProperties ldapSession.putSaslProperty( SaslConstants.SASL_MECH_HANDLER, mechanismHandler ); - + // Initialize the mechanism specific data mechanismHandler.init( ldapSession ); - + // Get the SaslServer instance which manage the C/R exchange SaslServer ss = mechanismHandler.handleMechanism( ldapSession, bindRequest ); - + // We have to generate a challenge generateSaslChallengeOrComplete( ldapSession, ss, bindRequest ); - + // And get back return; } @@ -602,7 +603,7 @@ public class BindHandler extends LdapReq ldapSession.getIoSession().write( bindRequest.getResultResponse() ); return; } - + // Deal with the two kinds of authentication : Simple and SASL if ( bindRequest.isSimple() ) { Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original) +++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Sat Mar 3 00:20:10 2012 @@ -34,7 +34,6 @@ import org.apache.directory.server.core. import org.apache.directory.server.core.api.event.NotificationCriteria; import org.apache.directory.server.core.api.filtering.EntryFilteringCursor; import org.apache.directory.server.core.api.partition.PartitionNexus; -import org.apache.directory.server.core.api.txn.TxnHandle; import org.apache.directory.server.i18n.I18n; import org.apache.directory.server.ldap.LdapSession; import org.apache.directory.server.ldap.handlers.controls.PagedSearchContext; @@ -539,7 +538,7 @@ public class SearchHandler extends LdapR pagedContext.incrementCurrentPosition( pageCount ); // Suspend the current txn - // TxnHandle txnHandle = txnManager.suspendCurTxn(); + // TxnHandle txnHandle = txnManager.suspendCurTxn(); //pagedContext.setTxnHandle( txnHandle ); return; Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java (original) +++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java Sat Mar 3 00:20:10 2012 @@ -51,36 +51,37 @@ public class SimpleMechanismHandler impl /** The logger instance */ private static final Logger LOG = LoggerFactory.getLogger( SimpleMechanismHandler.class ); - + public SaslServer handleMechanism( LdapSession ldapSession, BindRequest bindRequest ) throws Exception { // create a new Bind context, with a null session, as we don't have // any context yet. BindOperationContext bindContext = new BindOperationContext( null ); - + // Stores the Dn of the user to check, and its password bindContext.setDn( bindRequest.getName() ); bindContext.setCredentials( bindRequest.getCredentials() ); - bindContext.setInterceptors( ldapSession.getLdapServer().getDirectoryService().getInterceptors( OperationEnum.BIND ) ); + bindContext.setInterceptors( ldapSession.getLdapServer().getDirectoryService() + .getInterceptors( OperationEnum.BIND ) ); // Stores the request controls into the operation context LdapProtocolUtils.setRequestControls( bindContext, bindRequest ); - + try { CoreSession adminSession = ldapSession.getLdapServer().getDirectoryService().getAdminSession(); // And call the OperationManager bind operation. adminSession.getDirectoryService().getOperationManager().bind( bindContext ); - + // As a result, store the created session in the Core Session ldapSession.setCoreSession( bindContext.getSession() ); - + // Return the successful response BindResponse response = ( BindResponse ) bindRequest.getResultResponse(); response.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS ); LdapProtocolUtils.setResponseControls( bindContext, response ); - + // Write it back to the client ldapSession.getIoSession().write( response ); LOG.debug( "Returned SUCCESS message: {}.", response ); @@ -93,7 +94,7 @@ public class SimpleMechanismHandler impl if ( e instanceof LdapOperationException ) { - code = ( (LdapOperationException) e ).getResultCode(); + code = ( ( LdapOperationException ) e ).getResultCode(); result.setResultCode( code ); } else @@ -111,12 +112,12 @@ public class SimpleMechanismHandler impl } Dn name = null; - - if ( e instanceof LdapAuthenticationException) + + if ( e instanceof LdapAuthenticationException ) { - name = ((LdapAuthenticationException)e).getResolvedDn(); + name = ( ( LdapAuthenticationException ) e ).getResolvedDn(); } - + if ( ( name != null ) && ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM ) || ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ) ) ) @@ -127,11 +128,11 @@ public class SimpleMechanismHandler impl result.setDiagnosticMessage( msg ); ldapSession.getIoSession().write( bindRequest.getResultResponse() ); } - + return null; } - - + + /** * {@inheritDoc} */ Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java (original) +++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java Sat Mar 3 00:20:10 2012 @@ -19,6 +19,7 @@ */ package org.apache.directory.server.ldap.handlers.controls; + import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; @@ -34,6 +35,7 @@ import org.apache.directory.shared.ldap. import org.apache.directory.shared.ldap.model.schema.SchemaManager; import org.apache.directory.shared.util.Strings; + /** * The structure which stores the informations relative to the pagedSearch control. * They are associated to a cookie, stored into the session and associated to an @@ -57,10 +59,11 @@ public class PagedSearchContext /** The associated cursor for the current search request */ private EntryFilteringCursor cursor; - + /** Suspended txn..Not null if a txn is suspended */ TxnHandle txnHandle; + /** * Creates a new instance of this class, storing the SearchRequest into it. */ @@ -120,7 +123,7 @@ public class PagedSearchContext Set requestSet = new HashSet(); // Build the set of attributeType from the attributes - for ( String attribute:request.getAttributes() ) + for ( String attribute : request.getAttributes() ) { try { @@ -131,8 +134,8 @@ public class PagedSearchContext { // Deal with special attributes : '*', '+' and '1.1' if ( attribute.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) || - attribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) || - attribute.equals( SchemaConstants.NO_ATTRIBUTE ) ) + attribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) || + attribute.equals( SchemaConstants.NO_ATTRIBUTE ) ) { requestSet.add( attribute ); } @@ -144,6 +147,7 @@ public class PagedSearchContext return requestSet; } + /** * Compare the previous search request and the new one, and return * true if they are equal. We compare every field but the MessageID. @@ -219,7 +223,7 @@ public class PagedSearchContext return false; } - for ( String attribute:requestSet ) + for ( String attribute : requestSet ) { previousRequestSet.remove( attribute ); } @@ -309,8 +313,8 @@ public class PagedSearchContext { this.cursor = cursor; } - - + + /** * Set suspendedn txn Handle */ @@ -318,8 +322,8 @@ public class PagedSearchContext { txnHandle = handle; } - - + + public TxnHandle getTxnHandle() { return txnHandle; @@ -334,7 +338,7 @@ public class PagedSearchContext StringBuilder sb = new StringBuilder(); sb.append( "PagedSearch context : <" ); - sb.append( Strings.dumpBytes(cookie) ); + sb.append( Strings.dumpBytes( cookie ) ); sb.append( ", " ); sb.append( currentPosition ); sb.append( ">" ); Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java (original) +++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java Sat Mar 3 00:20:10 2012 @@ -20,7 +20,7 @@ package org.apache.directory.server.ldap.handlers.extended; -import java.util.Collections; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -41,7 +41,7 @@ import org.apache.directory.shared.ldap. * * @author Apache Directory Project */ -public class CertGenerationRequestHandler +public class CertGenerationRequestHandler implements ExtendedOperationHandler { private static final Set EXTENSION_OIDS; Modified: directory/apacheds/branches/apacheds-txns/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java (original) +++ directory/apacheds/branches/apacheds-txns/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java Sat Mar 3 00:20:10 2012 @@ -35,6 +35,8 @@ import java.util.Map.Entry; import java.util.Stack; import java.util.regex.Pattern; +import javax.management.RuntimeErrorException; + import org.apache.directory.server.i18n.I18n; import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor; import org.apache.directory.shared.ldap.schemaextractor.impl.ResourceMap; Modified: directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java (original) +++ directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java Sat Mar 3 00:20:10 2012 @@ -61,434 +61,433 @@ import org.junit.runner.RunWith; * * @author Apache Directory Project */ -@RunWith ( FrameworkRunner.class ) -@CreateLdapServer ( +@RunWith(FrameworkRunner.class) +@CreateLdapServer( transports = - { - @CreateTransport( protocol = "LDAP" ) + { + @CreateTransport(protocol = "LDAP") }) -@ApplyLdifs( { - "dn: ou=actors,ou=system", - "objectClass: top", - "objectClass: organizationalUnit", - "ou: actors", - - "dn: uid=jblack,ou=actors,ou=system", - "objectClass: top", - "objectClass: person", - "objectClass: organizationalPerson", - "objectClass: uidObject", - "uid: jblack", - "ou: comedy", - "ou: adventure", - "cn: Jack Black", - "userPassword: secret", - "sn: Black", - - "dn: uid=bpitt,ou=actors,ou=system", - "objectClass: top", - "objectClass: person", - "objectClass: organizationalPerson", - "objectClass: uidObject", - "uid: bpitt", - "ou: drama", - "ou: adventure", - "userPassword: secret", - "cn: Brad Pitt", - "sn: Pitt", - - "dn: uid=gcloony,ou=actors,ou=system", - "objectClass: top", - "objectClass: person", - "objectClass: organizationalPerson", - "objectClass: uidObject", - "uid: gcloony", - "ou: drama", - "userPassword: secret", - "cn: Goerge Cloony", - "sn: Cloony", - - "dn: uid=jnewbie,ou=actors,ou=system", - "objectClass: top", - "objectClass: person", - "objectClass: organizationalPerson", - "objectClass: uidObject", - "uid: jnewbie", - "userPassword: secret", - "cn: Joe Newbie", - "sn: Newbie" -} - ) +@ApplyLdifs( + { + "dn: ou=actors,ou=system", + "objectClass: top", + "objectClass: organizationalUnit", + "ou: actors", + + "dn: uid=jblack,ou=actors,ou=system", + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "objectClass: uidObject", + "uid: jblack", + "ou: comedy", + "ou: adventure", + "cn: Jack Black", + "userPassword: secret", + "sn: Black", + + "dn: uid=bpitt,ou=actors,ou=system", + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "objectClass: uidObject", + "uid: bpitt", + "ou: drama", + "ou: adventure", + "userPassword: secret", + "cn: Brad Pitt", + "sn: Pitt", + + "dn: uid=gcloony,ou=actors,ou=system", + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "objectClass: uidObject", + "uid: gcloony", + "ou: drama", + "userPassword: secret", + "cn: Goerge Cloony", + "sn: Cloony", + + "dn: uid=jnewbie,ou=actors,ou=system", + "objectClass: top", + "objectClass: person", + "objectClass: organizationalPerson", + "objectClass: uidObject", + "uid: jnewbie", + "userPassword: secret", + "cn: Joe Newbie", + "sn: Newbie" +}) public class SearchLimitsIT extends AbstractLdapTestUnit { - /** - * An {@link Interceptor} that fakes a specified amount of delay to each - * search iteration so we can make sure search time limits are adhered to. - * - * @author Apache Directory Project - */ - class DelayInducingInterceptor extends BaseInterceptor +/** + * An {@link Interceptor} that fakes a specified amount of delay to each + * search iteration so we can make sure search time limits are adhered to. + * + * @author Apache Directory Project + */ +class DelayInducingInterceptor extends BaseInterceptor +{ + private Long delayMillis; + + + public DelayInducingInterceptor() { - private Long delayMillis; - - public DelayInducingInterceptor() - { - super( "DelayInterceptor" ); - } + super( "DelayInterceptor" ); + } - public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException + public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException + { + EntryFilteringCursor cursor = next( searchContext ); + cursor.addEntryFilter( new EntryFilter() { - EntryFilteringCursor cursor = next( searchContext ); - cursor.addEntryFilter( new EntryFilter() { - public boolean accept( SearchingOperationContext operation, Entry result ) throws Exception + public boolean accept( SearchingOperationContext operation, Entry result ) throws Exception + { + if ( delayMillis != null ) { - if ( delayMillis != null ) - { - Thread.sleep( delayMillis ); - } - - return true; + Thread.sleep( delayMillis ); } - }); - - return cursor; - } - - public void setDelayMillis( long delayMillis ) - { - if ( delayMillis <= 0 ) - { - this.delayMillis = null; + return true; } + } ); - this.delayMillis = delayMillis; - } + return cursor; } - private int oldMaxTimeLimit; - private long oldMaxSizeLimit; - private DelayInducingInterceptor delayInterceptor; - - - @Before - public void setUp() throws Exception + public void setDelayMillis( long delayMillis ) { - oldMaxTimeLimit = getLdapServer().getMaxTimeLimit(); - oldMaxSizeLimit = getLdapServer().getMaxSizeLimit(); - delayInterceptor = new DelayInducingInterceptor(); - getLdapServer().getDirectoryService().addFirst( delayInterceptor ); - } - + if ( delayMillis <= 0 ) + { + this.delayMillis = null; + } - @After - public void tearDown() throws Exception - { - getLdapServer().setMaxTimeLimit( oldMaxTimeLimit ); - getLdapServer().setMaxSizeLimit( oldMaxSizeLimit ); - getLdapServer().getDirectoryService().remove( "DelayInterceptor" ); + this.delayMillis = delayMillis; } +} +private int oldMaxTimeLimit; +private long oldMaxSizeLimit; +private DelayInducingInterceptor delayInterceptor; - // ----------------------------------------------------------------------- - // Time Limit Tests - // ----------------------------------------------------------------------- +@Before +public void setUp() throws Exception +{ + oldMaxTimeLimit = getLdapServer().getMaxTimeLimit(); + oldMaxSizeLimit = getLdapServer().getMaxSizeLimit(); + delayInterceptor = new DelayInducingInterceptor(); + getLdapServer().getDirectoryService().addFirst( delayInterceptor ); +} - /** - * Sets up the server with unlimited search time limit but constrains time - * by request time limit value to cause a time limit exceeded exception on - * the client. - */ - @Test ( expected = TimeLimitExceededException.class ) - public void testRequestConstrainedUnlimitByConfiguration() throws Exception - { - getLdapServer().setMaxTimeLimit( LdapServer.NO_TIME_LIMIT ); - delayInterceptor.setDelayMillis( 500 ); - getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT ); - } +@After +public void tearDown() throws Exception +{ + getLdapServer().setMaxTimeLimit( oldMaxTimeLimit ); + getLdapServer().setMaxSizeLimit( oldMaxSizeLimit ); + getLdapServer().getDirectoryService().remove( "DelayInterceptor" ); +} - /** - * Sets up the server with longer search time limit than the request's - * which constrains time by request time limit value to cause a time limit - * exceeded exception on the client. - */ - @Test ( expected = TimeLimitExceededException.class ) - public void testRequestConstrainedLessThanConfiguration() throws Exception - { - getLdapServer().setMaxTimeLimit( 10000 ); // this is in seconds - delayInterceptor.setDelayMillis( 500 ); +// ----------------------------------------------------------------------- +// Time Limit Tests +// ----------------------------------------------------------------------- + +/** + * Sets up the server with unlimited search time limit but constrains time + * by request time limit value to cause a time limit exceeded exception on + * the client. + */ +@Test(expected = TimeLimitExceededException.class) +public void testRequestConstrainedUnlimitByConfiguration() throws Exception +{ + getLdapServer().setMaxTimeLimit( LdapServer.NO_TIME_LIMIT ); + delayInterceptor.setDelayMillis( 500 ); - getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT ); - } + getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT ); +} - /** - * Sets up the server with shorter search time limit than the request's - * which constrains time by using server max limit value to cause a time - * limit exceeded exception on the client. - */ - @Test ( expected = TimeLimitExceededException.class ) - public void testRequestConstrainedGreaterThanConfiguration() throws Exception - { - getLdapServer().setMaxTimeLimit( 1 ); // this is in seconds - delayInterceptor.setDelayMillis( 1100 ); +/** + * Sets up the server with longer search time limit than the request's + * which constrains time by request time limit value to cause a time limit + * exceeded exception on the client. + */ +@Test(expected = TimeLimitExceededException.class) +public void testRequestConstrainedLessThanConfiguration() throws Exception +{ + getLdapServer().setMaxTimeLimit( 10000 ); // this is in seconds + delayInterceptor.setDelayMillis( 500 ); - getActorsWithLimit( "(objectClass=*)", 100000, LdapServer.NO_SIZE_LIMIT ); - } + getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT ); +} - /** - * Sets up the server with limited search time with unlimited request - * time limit. Should work just fine for the administrative user. - */ - @Test - public void testRequestUnlimitedConfigurationLimited() throws Exception - { - getLdapServer().setMaxTimeLimit( 1 ); // this is in seconds - delayInterceptor.setDelayMillis( 500 ); +/** + * Sets up the server with shorter search time limit than the request's + * which constrains time by using server max limit value to cause a time + * limit exceeded exception on the client. + */ +@Test(expected = TimeLimitExceededException.class) +public void testRequestConstrainedGreaterThanConfiguration() throws Exception +{ + getLdapServer().setMaxTimeLimit( 1 ); // this is in seconds + delayInterceptor.setDelayMillis( 1100 ); - getActorsWithLimit( "(objectClass=*)", - LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); - } + getActorsWithLimit( "(objectClass=*)", 100000, LdapServer.NO_SIZE_LIMIT ); +} - /** - * Sets up the server with limited search time with unlimited request - * time limit. Should not work for non administrative users. - */ - @Test ( expected = TimeLimitExceededException.class ) - public void testNonAdminRequestUnlimitedConfigurationLimited() throws Exception - { - getLdapServer().setMaxTimeLimit( 1 ); // this is in seconds - delayInterceptor.setDelayMillis( 500 ); +/** + * Sets up the server with limited search time with unlimited request + * time limit. Should work just fine for the administrative user. + */ +@Test +public void testRequestUnlimitedConfigurationLimited() throws Exception +{ + getLdapServer().setMaxTimeLimit( 1 ); // this is in seconds + delayInterceptor.setDelayMillis( 500 ); - getActorsWithLimitNonAdmin( "(objectClass=*)", - LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); - } + getActorsWithLimit( "(objectClass=*)", + LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); +} - // ----------------------------------------------------------------------- - // Size Limit Tests - // ----------------------------------------------------------------------- +/** + * Sets up the server with limited search time with unlimited request + * time limit. Should not work for non administrative users. + */ +@Test(expected = TimeLimitExceededException.class) +public void testNonAdminRequestUnlimitedConfigurationLimited() throws Exception +{ + getLdapServer().setMaxTimeLimit( 1 ); // this is in seconds + delayInterceptor.setDelayMillis( 500 ); + getActorsWithLimitNonAdmin( "(objectClass=*)", + LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); +} - /** - * Sets up the server with unlimited search size limit but constrains size - * by request size limit value to cause a size limit exceeded exception on - * the client. - */ - @Test (expected = SizeLimitExceededException.class) - public void testRequestConstrainedUnlimitByConfigurationSize() throws Exception - { - getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); - getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 1 ); - } +// ----------------------------------------------------------------------- +// Size Limit Tests +// ----------------------------------------------------------------------- + +/** + * Sets up the server with unlimited search size limit but constrains size + * by request size limit value to cause a size limit exceeded exception on + * the client. + */ +@Test(expected = SizeLimitExceededException.class) +public void testRequestConstrainedUnlimitByConfigurationSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); + getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 1 ); +} - /** - * Sets up the server with longer search size limit than the request's - * which constrains size by request size limit value to cause a size limit - * exceeded exception on the client. - */ - @Test ( expected = SizeLimitExceededException.class ) - public void testRequestConstrainedLessThanConfigurationSize() throws Exception - { - getLdapServer().setMaxSizeLimit( 10000 ); - getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 1 ); - } +/** + * Sets up the server with longer search size limit than the request's + * which constrains size by request size limit value to cause a size limit + * exceeded exception on the client. + */ +@Test(expected = SizeLimitExceededException.class) +public void testRequestConstrainedLessThanConfigurationSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( 10000 ); + getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 1 ); +} - /** - * Sets up the server with shorter search size limit than the request's - * which constrains size by using server max limit value. Should work - * just fine for the administrative user. - */ - @Test - public void testRequestConstrainedGreaterThanConfigurationSize() throws Exception - { - getLdapServer().setMaxSizeLimit( 1 ); - Set set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 100000 ); - assertEquals( 4, set.size() ); - } +/** + * Sets up the server with shorter search size limit than the request's + * which constrains size by using server max limit value. Should work + * just fine for the administrative user. + */ +@Test +public void testRequestConstrainedGreaterThanConfigurationSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( 1 ); + Set set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 100000 ); + assertEquals( 4, set.size() ); +} - /** - * Sets up the server with shorter search size limit than the request's - * which constrains size by using server max limit value to cause a size - * limit exceeded exception on the client. - */ - @Test (expected = SizeLimitExceededException.class ) - public void testNonAdminRequestConstrainedGreaterThanConfigurationSize() throws Exception - { - getLdapServer().setMaxSizeLimit( 1 ); - // We are not using the admin : it should fail - getActorsWithLimitNonAdmin( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 100000 ); - } +/** + * Sets up the server with shorter search size limit than the request's + * which constrains size by using server max limit value to cause a size + * limit exceeded exception on the client. + */ +@Test(expected = SizeLimitExceededException.class) +public void testNonAdminRequestConstrainedGreaterThanConfigurationSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( 1 ); + // We are not using the admin : it should fail + getActorsWithLimitNonAdmin( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 100000 ); +} - /** - * Sets up the server with limited search size with unlimited request - * size limit. Should work just fine for the administrative user. - */ - @Test - public void testRequestUnlimitedConfigurationLimitedSize() throws Exception - { - getLdapServer().setMaxSizeLimit( 1 ); - Set set = getActorsWithLimit( "(objectClass=*)", - LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); - assertEquals( 4, set.size() ); - } +/** + * Sets up the server with limited search size with unlimited request + * size limit. Should work just fine for the administrative user. + */ +@Test +public void testRequestUnlimitedConfigurationLimitedSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( 1 ); + Set set = getActorsWithLimit( "(objectClass=*)", + LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); + assertEquals( 4, set.size() ); +} - /** - * Sets up the server with limited search size with unlimited request - * size limit. Should not work for non administrative users. - */ - @Test ( expected = SizeLimitExceededException.class ) - public void testNonAdminRequestUnlimitedConfigurationLimitedSize() throws Exception - { - getLdapServer().setMaxSizeLimit( 1 ); - getActorsWithLimitNonAdmin( "(objectClass=*)", - LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); - } +/** + * Sets up the server with limited search size with unlimited request + * size limit. Should not work for non administrative users. + */ +@Test(expected = SizeLimitExceededException.class) +public void testNonAdminRequestUnlimitedConfigurationLimitedSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( 1 ); + getActorsWithLimitNonAdmin( "(objectClass=*)", + LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT ); +} - /** - * Test for DIRSERVER-1235. - * Sets up the server with unlimited search size limit but constrains size - * by request size limit value. The request size limit is less than the - * expected number of result entries, so exception expected. - * - * cf RFC 4511 : - * "sizeLimitExceeded (4) - * Indicates that the size limit specified by the client was - * exceeded before the operation could be completed." - */ - @Test ( expected = SizeLimitExceededException.class ) - public void testRequestConstraintedLessThanExpectedSize() throws Exception - { - getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); - getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 3 ); - } +/** + * Test for DIRSERVER-1235. + * Sets up the server with unlimited search size limit but constrains size + * by request size limit value. The request size limit is less than the + * expected number of result entries, so exception expected. + * + * cf RFC 4511 : + * "sizeLimitExceeded (4) + * Indicates that the size limit specified by the client was + * exceeded before the operation could be completed." + */ +@Test(expected = SizeLimitExceededException.class) +public void testRequestConstraintedLessThanExpectedSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); + getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 3 ); +} - /** - * Test for DIRSERVER-1235. - * Sets up the server with unlimited search size limit but constrains size - * by request size limit value. The request size limit is equal to the - * expected number of result entries so no exception expected. - */ - @Test - public void testRequestConstraintedEqualToExpectedSize() throws Exception - { - getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); - Set set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 4 ); - assertEquals( 4, set.size() ); - } +/** + * Test for DIRSERVER-1235. + * Sets up the server with unlimited search size limit but constrains size + * by request size limit value. The request size limit is equal to the + * expected number of result entries so no exception expected. + */ +@Test +public void testRequestConstraintedEqualToExpectedSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); + Set set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 4 ); + assertEquals( 4, set.size() ); +} - /** - * Test for DIRSERVER-1235. - * Sets up the server with unlimited search size limit but constrains size - * by request size limit value. The request size limit is greater than the - * expected number of result entries so no exception expected. - */ - @Test - public void testRequestConstraintedGreaterThanExpectedSize() throws Exception - { - getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); - Set set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 5 ); - assertEquals( 4, set.size() ); - } +/** + * Test for DIRSERVER-1235. + * Sets up the server with unlimited search size limit but constrains size + * by request size limit value. The request size limit is greater than the + * expected number of result entries so no exception expected. + */ +@Test +public void testRequestConstraintedGreaterThanExpectedSize() throws Exception +{ + getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); + Set set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 5 ); + assertEquals( 4, set.size() ); +} - /** - * Test for DIRSERVER-1235. - * Reads an entry using object scope and size limit 1, no exception - * expected. - */ - @Test - public void testRequestObjectScopeAndSizeLimit() throws Exception - { - getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); - DirContext ctx = getWiredContext( getLdapServer() ); - String filter = "(objectClass=*)"; - SearchControls controls = new SearchControls(); - controls.setTimeLimit( 0 ); - controls.setCountLimit( 1 ); - controls.setSearchScope( SearchControls.OBJECT_SCOPE ); - - NamingEnumeration namingEnumeration = - ctx.search( "ou=actors,ou=system", filter, controls ); - assertTrue( namingEnumeration.hasMore() ); - namingEnumeration.next(); - assertFalse( namingEnumeration.hasMore() ); - } +/** + * Test for DIRSERVER-1235. + * Reads an entry using object scope and size limit 1, no exception + * expected. + */ +@Test +public void testRequestObjectScopeAndSizeLimit() throws Exception +{ + getLdapServer().setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT ); + DirContext ctx = getWiredContext( getLdapServer() ); + String filter = "(objectClass=*)"; + SearchControls controls = new SearchControls(); + controls.setTimeLimit( 0 ); + controls.setCountLimit( 1 ); + controls.setSearchScope( SearchControls.OBJECT_SCOPE ); + + NamingEnumeration namingEnumeration = + ctx.search( "ou=actors,ou=system", filter, controls ); + assertTrue( namingEnumeration.hasMore() ); + namingEnumeration.next(); + assertFalse( namingEnumeration.hasMore() ); +} - // ----------------------------------------------------------------------- - // Utility Methods - // ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// Utility Methods +// ----------------------------------------------------------------------- + +/** + * Do a search request from the ou=actors,ou=system base, with a principal + * which is the administrator. + */ +private Set getActorsWithLimit( String filter, int timeLimitMillis, long sizeLimit ) throws Exception +{ + DirContext ctx = getWiredContext( getLdapServer() ); + Set results = new HashSet(); + SearchControls controls = new SearchControls(); + controls.setTimeLimit( timeLimitMillis ); + controls.setCountLimit( sizeLimit ); + controls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); - /** - * Do a search request from the ou=actors,ou=system base, with a principal - * which is the administrator. - */ - private Set getActorsWithLimit( String filter, int timeLimitMillis, long sizeLimit ) throws Exception - { - DirContext ctx = getWiredContext( getLdapServer() ); - Set results = new HashSet(); - SearchControls controls = new SearchControls(); - controls.setTimeLimit( timeLimitMillis ); - controls.setCountLimit( sizeLimit ); - controls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); + NamingEnumeration namingEnumeration = + ctx.search( "ou=actors,ou=system", filter, controls ); - NamingEnumeration namingEnumeration = - ctx.search( "ou=actors,ou=system", filter, controls ); + while ( namingEnumeration.hasMore() ) + { + results.add( namingEnumeration.next().getNameInNamespace() ); + } - while( namingEnumeration.hasMore() ) - { - results.add( namingEnumeration.next().getNameInNamespace() ); - } + return results; +} - return results; - } - /** - * Do a search request from the ou=actors,ou=system base, with a principal - * which is not the administrator. - */ - private Set getActorsWithLimitNonAdmin( String filter, int timeLimitMillis, long sizeLimit ) - throws Exception - { - DirContext ctx = getWiredContext( getLdapServer(), "uid=jblack,ou=actors,ou=system", "secret" ); - Set results = new HashSet(); - SearchControls controls = new SearchControls(); - controls.setTimeLimit( timeLimitMillis ); - controls.setCountLimit( sizeLimit ); - controls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); +/** + * Do a search request from the ou=actors,ou=system base, with a principal + * which is not the administrator. + */ +private Set getActorsWithLimitNonAdmin( String filter, int timeLimitMillis, long sizeLimit ) + throws Exception +{ + DirContext ctx = getWiredContext( getLdapServer(), "uid=jblack,ou=actors,ou=system", "secret" ); + Set results = new HashSet(); + SearchControls controls = new SearchControls(); + controls.setTimeLimit( timeLimitMillis ); + controls.setCountLimit( sizeLimit ); + controls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); - NamingEnumeration namingEnumeration = - ctx.search( "ou=actors,ou=system", filter, controls ); + NamingEnumeration namingEnumeration = + ctx.search( "ou=actors,ou=system", filter, controls ); - while( namingEnumeration.hasMore() ) - { - results.add( namingEnumeration.next().getNameInNamespace() ); - } + while ( namingEnumeration.hasMore() ) + { + results.add( namingEnumeration.next().getNameInNamespace() ); + } - return results; - } + return results; +} } Propchange: directory/apacheds/branches/apacheds-txns/server-tools/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Mar 3 00:20:10 2012 @@ -4,5 +4,5 @@ /directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-tools:1040956-1043765 /directory/apacheds/branches/milestones/server-tools:1072812-1075328 /directory/apacheds/trunk/interceptors/server-tools:1183435-1186974 -/directory/apacheds/trunk/server-tools:1066126-1067785,1068026-1072718,1072800-1075329,1209070-1214194 +/directory/apacheds/trunk/server-tools:1066126-1067785,1068026-1072718,1072800-1075329,1177663-1183434,1209070-1214194 /directory/studio/trunk/server-tools:1067786-1067997 Modified: directory/apacheds/branches/apacheds-txns/server-tools/src/main/resources/config/config/ou=config/ou=servers/ads-serverid=ldapserver/ou=extendedoperatiohandlers/ads-id=launchdiagnosticuihandler.ldif URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/server-tools/src/main/resources/config/config/ou%3Dconfig/ou%3Dservers/ads-serverid%3Dldapserver/ou%3Dextendedoperatiohandlers/ads-id%3Dlaunchdiagnosticuihandler.ldif?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/server-tools/src/main/resources/config/config/ou=config/ou=servers/ads-serverid=ldapserver/ou=extendedoperatiohandlers/ads-id=launchdiagnosticuihandler.ldif (original) +++ directory/apacheds/branches/apacheds-txns/server-tools/src/main/resources/config/config/ou=config/ou=servers/ads-serverid=ldapserver/ou=extendedoperatiohandlers/ads-id=launchdiagnosticuihandler.ldif Sat Mar 3 00:20:10 2012 @@ -1,3 +1,26 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + version: 1 dn: ads-Id=launchdiagnosticuihandler,ou=extendedoperationhandlers,ads-serverId=ld apServer,ou=servers,ou=config Propchange: directory/apacheds/branches/apacheds-txns/service-osgi/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Mar 3 00:20:10 2012 @@ -6,5 +6,5 @@ /directory/apacheds/branches/apacheds-subtree/service-osgi:965203-965686 /directory/apacheds/branches/milestones/service-osgi:1072812-1075328 /directory/apacheds/branches/xdbm-refactoring/service-osgi:945827-946347 -/directory/apacheds/trunk/service-osgi:1066126-1067785,1068026-1072718,1072800-1075329,1185396-1201298,1209070-1214194 +/directory/apacheds/trunk/service-osgi:1066126-1067785,1068026-1072718,1072800-1075329,1177663-1183434,1185396-1201298,1209070-1214194 /directory/studio/trunk/service-osgi:1067786-1067997 Modified: directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1296527&r1=1296526&r2=1296527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java (original) +++ directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java Sat Mar 3 00:20:10 2012 @@ -142,6 +142,7 @@ public class ApacheDsService private TxnManagerFactory txnManagerFactory; private OperationExecutionManagerFactory executionManagerFactory; + /** * starts various services configured according to the * configuration present in the given instance's layout @@ -156,19 +157,19 @@ public class ApacheDsService if ( !partitionsDir.exists() ) { LOG.info( "partition directory doesn't exist, creating {}", partitionsDir.getAbsolutePath() ); - + if ( !partitionsDir.mkdirs() ) { - throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionsDir ) ); + throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionsDir ) ); } } LOG.info( "using partition dir {}", partitionsDir.getAbsolutePath() ); - txnManagerFactory = new TxnManagerFactory( instanceLayout.getTxnLogDirectory().getPath(), + txnManagerFactory = new TxnManagerFactory( instanceLayout.getTxnLogDirectory().getPath(), DirectoryService.TXN_LOG_BUFFER_SIZE, DirectoryService.TXN_LOG_FILE_SIZE ); executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory ); - + initSchemaManager( instanceLayout ); initSchemaLdifPartition( instanceLayout ); initConfigPartition( instanceLayout ); @@ -299,7 +300,7 @@ public class ApacheDsService LOG.info( "Initializing the DirectoryService..." ); long startTime = System.currentTimeMillis(); - + DirectoryService directoryService = ServiceBuilder.createDirectoryService( directoryServiceBean, instanceLayout, schemaManager, txnManagerFactory, executionManagerFactory );