From 62be845bbaf00d0ff6fa8584695efdfe91e4872e Mon Sep 17 00:00:00 2001
From: jcambon <jcambon@localhost>
Date: Tue, 12 May 2009 13:18:37 +0000
Subject: [PATCH] Partial Fix for issue #3938 : dsconfig is really too slow in non-interactive mode, almost unusable on Niagara systems
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java | 21 ++++++++++++++++++++-
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java | 6 ++++--
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java | 9 ++++++++-
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java | 10 +++++++++-
4 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
index 7ae1d56..6774144 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
@@ -544,7 +544,8 @@
* @throws ArgumentException
* If a global argument could not be registered.
*/
- private void initializeGlobalArguments() throws ArgumentException {
+ private void initializeGlobalArguments(String[] args)
+ throws ArgumentException {
if (globalArgumentsInitialized == false) {
verboseArgument = new BooleanArgument("verbose", 'v', "verbose",
INFO_DESCRIPTION_VERBOSE.get());
@@ -619,6 +620,7 @@
// Register any global arguments required by the management
// context factory.
+ factory.setRawArguments(args);
factory.registerGlobalArguments(parser);
globalArgumentsInitialized = true;
@@ -706,7 +708,7 @@
private int run(String[] args) {
// Register global arguments and sub-commands.
try {
- initializeGlobalArguments();
+ initializeGlobalArguments(args);
initializeSubCommands();
} catch (ArgumentException e) {
Message message = ERR_CANNOT_INITIALIZE_ARGS.get(e.getMessage());
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java
index 0cfae9c..5a2ba67 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2007-2008 Sun Microsystems, Inc.
+ * Copyright 2007-2009 Sun Microsystems, Inc.
*/
package org.opends.server.tools.dsconfig;
@@ -105,4 +105,11 @@
return new CommandBuilder(null, null);
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setRawArguments(String[] args) {
+ // No implementation required.
+ }
+
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
index 64bed3d..228c780 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
@@ -59,6 +59,7 @@
import java.util.LinkedHashSet;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
+import org.opends.server.tools.ToolConstants;
/**
@@ -79,6 +80,9 @@
// This CLI is always using the administration connector with SSL
private boolean alwaysSSL = false;
+ // Raw arguments
+ private String[] rawArgs = null;
+
/**
* Creates a new LDAP management context factory.
*
@@ -323,7 +327,13 @@
return context;
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setRawArguments(String[] args) {
+ this.rawArgs = args;
+ }
/**
* {@inheritDoc}
@@ -343,7 +353,16 @@
try
{
- secureArgsList.initArgumentsWithConfiguration();
+ if (rawArgs != null) {
+ for (String rawArg : rawArgs) {
+ if (rawArg.contains(ToolConstants.OPTION_LONG_HELP) ||
+ (rawArg.charAt(1) == ToolConstants.OPTION_SHORT_HELP) || (rawArg.
+ charAt(1) == '?')) {
+ // used for usage default values only
+ secureArgsList.initArgumentsWithConfiguration();
+ }
+ }
+ }
}
catch (ConfigException ce)
{
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java
index 578417b..61f3742 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2007-2008 Sun Microsystems, Inc.
+ * Copyright 2007-2009 Sun Microsystems, Inc.
*/
package org.opends.server.tools.dsconfig;
@@ -88,6 +88,14 @@
/**
+ * Set the raw arguments (used for default value setting).
+ *
+ * @param args raw arguments.
+ */
+ public void setRawArguments(String[] args);
+
+
+ /**
* Validates any global arguments passed to the application.
* Implementations of this method should check that the values
* passed to their global arguments are valid and are not
--
Gitblit v1.10.0