| | |
| | | { |
| | | private static final class ModifyPerformanceRunner extends PerformanceRunner |
| | | { |
| | | private final class ModifyWorkerThread extends WorkerThread |
| | | private final class ModifyWorkerThread extends ConnectionWorker |
| | | { |
| | | private ModifyRequest mr; |
| | | private Object[] data; |
| | |
| | | @Override |
| | | public FutureResult<?> performOperation( |
| | | final AsynchronousConnection connection, |
| | | final DataSource[] dataSources, long startTime) |
| | | final DataSource[] dataSources, final long startTime) |
| | | { |
| | | if (dataSources != null) |
| | | { |
| | | data = DataSource.generateData(dataSources, data); |
| | | } |
| | | mr = newModifyRequest(data); |
| | | return connection.modify(mr, |
| | | new UpdateStatsResultHandler<Result>(startTime)); |
| | | return connection.modify(mr, new UpdateStatsResultHandler<Result>( |
| | | startTime, connection, this)); |
| | | } |
| | | |
| | | |
| | |
| | | colonPos = formattedString.indexOf(':'); |
| | | if (colonPos > 0) |
| | | { |
| | | mr.addModification(ModificationType.REPLACE, formattedString |
| | | .substring(0, colonPos), formattedString |
| | | .substring(colonPos + 1)); |
| | | mr.addModification(ModificationType.REPLACE, |
| | | formattedString.substring(0, colonPos), |
| | | formattedString.substring(colonPos + 1)); |
| | | } |
| | | } |
| | | return mr; |
| | |
| | | |
| | | |
| | | @Override |
| | | StatsThread newStatsThread() |
| | | ConnectionWorker newConnectionWorker( |
| | | final AsynchronousConnection connection, |
| | | final ConnectionFactory connectionFactory) |
| | | { |
| | | return new StatsThread(new String[0]); |
| | | return new ModifyWorkerThread(connection, connectionFactory); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | WorkerThread newWorkerThread(final AsynchronousConnection connection, |
| | | final ConnectionFactory connectionFactory) |
| | | StatsThread newStatsThread() |
| | | { |
| | | return new ModifyWorkerThread(connection, connectionFactory); |
| | | return new StatsThread(new String[0]); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | // Create the command-line argument parser for use with this |
| | | // program. |
| | | final LocalizableMessage toolDescription = |
| | | INFO_MODRATE_TOOL_DESCRIPTION.get(); |
| | | final LocalizableMessage toolDescription = INFO_MODRATE_TOOL_DESCRIPTION |
| | | .get(); |
| | | final ArgumentParser argParser = new ArgumentParser( |
| | | ModRate.class.getName(), toolDescription, false, true, 1, 0, |
| | | "[(attribute:value format string) ...]"); |
| | |
| | | try |
| | | { |
| | | TransportFactory.setInstance(new PerfToolTCPNIOTransportFactory()); |
| | | connectionFactoryProvider = |
| | | new ConnectionFactoryProvider(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, |
| | |
| | | argParser.setNoPropertiesFileArgument(noPropertiesFileArgument); |
| | | |
| | | baseDN = new StringArgument("targetDN", OPTION_SHORT_BASEDN, |
| | | OPTION_LONG_TARGETDN, true, false, true, INFO_TARGETDN_PLACEHOLDER.get(), |
| | | null, null, INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get()); |
| | | OPTION_LONG_TARGETDN, true, false, true, |
| | | INFO_TARGETDN_PLACEHOLDER.get(), null, null, |
| | | INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get()); |
| | | baseDN.setPropertyName(OPTION_LONG_BASEDN); |
| | | argParser.addArgument(baseDN); |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | connectionFactory = |
| | | connectionFactoryProvider.getAuthenticatedConnectionFactory(); |
| | | connectionFactory = connectionFactoryProvider |
| | | .getAuthenticatedConnectionFactory(); |
| | | runner.validate(); |
| | | } |
| | | catch (final ArgumentException ae) |