| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package com.sun.opends.sdk.tools; |
| | |
| | | { |
| | | private static final class ModifyPerformanceRunner extends PerformanceRunner |
| | | { |
| | | private final class ModifyWorkerThread extends |
| | | WorkerThread<ResultHandler<Result>> |
| | | private final class ModifyWorkerThread extends WorkerThread |
| | | { |
| | | private ModifyRequest mr; |
| | | private Object[] data; |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultHandler<Result> getHandler(final long startTime) |
| | | { |
| | | return new UpdateStatsResultHandler<Result>(startTime); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public FutureResult<?> performOperation( |
| | | final AsynchronousConnection connection, |
| | | final ResultHandler<Result> handler, final DataSource[] dataSources) |
| | | final DataSource[] dataSources, long startTime) |
| | | { |
| | | if (dataSources != null) |
| | | { |
| | | data = DataSource.generateData(dataSources, data); |
| | | } |
| | | mr = newModifyRequest(data); |
| | | return connection.modify(mr, handler); |
| | | return connection.modify(mr, |
| | | new UpdateStatsResultHandler<Result>(startTime)); |
| | | } |
| | | |
| | | |
| | |
| | | private ModifyPerformanceRunner(final ArgumentParser argParser, |
| | | final ConsoleApplication app) throws ArgumentException |
| | | { |
| | | super(argParser, app); |
| | | super(argParser, app, false, false, false); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @Override |
| | | WorkerThread<?> newWorkerThread(final AsynchronousConnection connection, |
| | | WorkerThread newWorkerThread(final AsynchronousConnection connection, |
| | | final ConnectionFactory connectionFactory) |
| | | { |
| | | return new ModifyWorkerThread(connection, connectionFactory); |
| | |
| | | final ArgumentParser argParser = new ArgumentParser( |
| | | ModRate.class.getName(), toolDescription, false, true, 1, 0, |
| | | "[(attribute:value format string) ...]"); |
| | | ArgumentParserConnectionFactory connectionFactory; |
| | | ConnectionFactoryProvider connectionFactoryProvider; |
| | | ConnectionFactory connectionFactory; |
| | | ModifyPerformanceRunner runner; |
| | | |
| | | BooleanArgument showUsage; |
| | |
| | | { |
| | | System.setProperty("org.opends.sdk.ldap.transport.linger", "0"); |
| | | } |
| | | connectionFactory = new ArgumentParserConnectionFactory(argParser, this); |
| | | connectionFactoryProvider = |
| | | new ConnectionFactoryProvider(argParser, this); |
| | | runner = new ModifyPerformanceRunner(argParser, this); |
| | | propertiesFileArgument = new StringArgument("propertiesFilePath", null, |
| | | OPTION_LONG_PROP_FILE_PATH, false, false, true, |
| | |
| | | try |
| | | { |
| | | argParser.parseArguments(args); |
| | | connectionFactory.validate(); |
| | | connectionFactory = |
| | | connectionFactoryProvider.getAuthenticatedConnectionFactory(); |
| | | runner.validate(); |
| | | } |
| | | catch (final ArgumentException ae) |