From a3decf6f3114f51764c1bbe80a892c6e9d1fe2b7 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 02 Nov 2007 12:05:52 +0000
Subject: [PATCH] The following modifications are aimed to have the same interaction in the status and dsconfig command lines by sharing the same code. The formatting of the table in status command-line has also be modified to be consistent with the one provided by dsconfig.
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
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 19388c9..e30b15c 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
@@ -84,11 +84,40 @@
// Lazily create the LDAP management context.
if (context == null)
{
+ LDAPConnectionConsoleInteraction ci =
+ new LDAPConnectionConsoleInteraction(app, secureArgsList);
+ ci.run();
+ context = getManagementContext(app, ci);
+ }
+ return context;
+ }
+
+ /**
+ * Gets the management context which sub-commands should use in
+ * order to manage the directory server. Implementations can use the
+ * application instance for retrieving passwords interactively.
+ *
+ * @param app
+ * The application instance.
+ * @param ci the LDAPConsoleInteraction object to be used. The code assumes
+ * that the LDAPConsoleInteraction has already been run.
+ * @return Returns the management context which sub-commands should
+ * use in order to manage the directory server.
+ * @throws ArgumentException
+ * If a management context related argument could not be
+ * parsed successfully.
+ * @throws ClientException
+ * If the management context could not be created.
+ */
+ public ManagementContext getManagementContext(ConsoleApplication app,
+ LDAPConnectionConsoleInteraction ci)
+ throws ArgumentException, ClientException
+ {
+ // Lazily create the LDAP management context.
+ if (context == null)
+ {
// Interact with the user though the console to get
// LDAP connection information
- LDAPConnectionConsoleInteraction ci =
- new LDAPConnectionConsoleInteraction(app, secureArgsList);
- ci.run();
String hostName = ci.getHostName();
Integer portNumber = ci.getPortNumber();
String bindDN = ci.getBindDN();
--
Gitblit v1.10.0