From 1734229125e7bad5f85dfe11d076eeda206236a9 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 18 Oct 2010 19:41:47 +0000
Subject: [PATCH] Update from OpenDS sdk by Bo Li: Added unmodifiable and copyOf request factories. Added authrate performance utility.

---
 sdk/src/com/sun/opends/sdk/tools/SearchRate.java |   33 ++++++++++++---------------------
 1 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/sdk/src/com/sun/opends/sdk/tools/SearchRate.java b/sdk/src/com/sun/opends/sdk/tools/SearchRate.java
index be6a73a..ddc81ae 100644
--- a/sdk/src/com/sun/opends/sdk/tools/SearchRate.java
+++ b/sdk/src/com/sun/opends/sdk/tools/SearchRate.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
+ *      Copyright 2010 Sun Microsystems, Inc.
  */
 
 package com.sun.opends.sdk.tools;
@@ -85,8 +85,6 @@
 
     private final class SearchStatsThread extends StatsThread
     {
-      private long totalEntryCount;
-
       private final String[] extraColumn;
 
 
@@ -103,7 +101,6 @@
       String[] getAdditionalColumns()
       {
         final int entryCount = entryRecentCount.getAndSet(0);
-        totalEntryCount += entryCount;
         if (successCount > 0)
         {
           extraColumn[0] = String.format("%.1f", (double) entryCount
@@ -119,8 +116,7 @@
 
 
 
-    private final class SearchWorkerThread extends
-        WorkerThread<SearchStatsHandler>
+    private final class SearchWorkerThread extends WorkerThread
     {
       private SearchRequest sr;
 
@@ -137,17 +133,9 @@
 
 
       @Override
-      public SearchStatsHandler getHandler(final long startTime)
-      {
-        return new SearchStatsHandler(startTime);
-      }
-
-
-
-      @Override
       public FutureResult<?> performOperation(
           final AsynchronousConnection connection,
-          final SearchStatsHandler handler, final DataSource[] dataSources)
+          final DataSource[] dataSources, final long startTime)
       {
         if (sr == null)
         {
@@ -169,7 +157,7 @@
           sr.setFilter(String.format(filter, data));
           sr.setName(String.format(baseDN, data));
         }
-        return connection.search(sr, handler);
+        return connection.search(sr, new SearchStatsHandler(startTime));
       }
     }
 
@@ -190,7 +178,7 @@
     private SearchPerformanceRunner(final ArgumentParser argParser,
         final ConsoleApplication app) throws ArgumentException
     {
-      super(argParser, app);
+      super(argParser, app, false, false, false);
     }
 
 
@@ -204,7 +192,7 @@
 
 
     @Override
-    WorkerThread<?> newWorkerThread(final AsynchronousConnection connection,
+    WorkerThread newWorkerThread(final AsynchronousConnection connection,
         final ConnectionFactory connectionFactory)
     {
       return new SearchWorkerThread(connection, connectionFactory);
@@ -380,7 +368,8 @@
         .getName(), toolDescription, false, true, 1, 0,
         "[filter format string] [attributes ...]");
 
-    ArgumentParserConnectionFactory connectionFactory;
+    ConnectionFactoryProvider connectionFactoryProvider;
+    ConnectionFactory connectionFactory;
     SearchPerformanceRunner runner;
 
     StringArgument baseDN;
@@ -396,7 +385,8 @@
       {
         System.setProperty("org.opends.sdk.ldap.transport.linger", "0");
       }
-      connectionFactory = new ArgumentParserConnectionFactory(argParser, this);
+      connectionFactoryProvider =
+          new ConnectionFactoryProvider(argParser, this);
       runner = new SearchPerformanceRunner(argParser, this);
 
       propertiesFileArgument = new StringArgument("propertiesFilePath", null,
@@ -457,7 +447,8 @@
     try
     {
       argParser.parseArguments(args);
-      connectionFactory.validate();
+      connectionFactory =
+          connectionFactoryProvider.getAuthenticatedConnectionFactory();
       runner.validate();
     }
     catch (final ArgumentException ae)

--
Gitblit v1.10.0