From 184ed890c828220c114f60ee165ce2230ada3d7c Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Tue, 15 May 2007 08:10:13 +0000
Subject: [PATCH] issue 1430 fix (all utilities should provide as standard option -V/--version) to specify the LDAP protocol version number, we should use now -V/--ldapVersion to get the 'product' version --version
---
opends/src/server/org/opends/server/core/DirectoryServer.java | 53 ++++++++++++++++++++++++++++++++---------------------
1 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 7724359..a4bcc88 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -29,6 +29,8 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.util.Collections;
@@ -8327,6 +8329,33 @@
return buffer.toString();
}
+ /**
+ * Prints out the version string for the Directory Server.
+ *
+ *
+ * @param outputStream The output stream to which the version information
+ * should be written.
+ *
+ * @throws IOException If a problem occurs while attempting to write the
+ * version information to the provided output stream.
+ */
+ public static void printVersion(OutputStream outputStream)
+ throws IOException
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(getVersionString());
+ buffer.append(EOL);
+ buffer.append("Build " + BUILD_ID);
+ buffer.append(EOL);
+
+ if ((FIX_IDS != null) && (FIX_IDS.length() > 0))
+ {
+ buffer.append("Fix IDs: " + FIX_IDS);
+ buffer.append(EOL);
+ }
+ outputStream.write(getBytes(buffer.toString()));
+ return;
+ }
/**
@@ -8613,7 +8642,6 @@
BooleanArgument fullVersion = null;
BooleanArgument noDetach = null;
BooleanArgument systemInfo = null;
- BooleanArgument version = null;
StringArgument configClass = null;
StringArgument configFile = null;
@@ -8658,11 +8686,6 @@
argParser.addArgument(windowsNetStart);
- version = new BooleanArgument("version", 'V', "version",
- MSGID_DSCORE_DESCRIPTION_VERSION);
- argParser.addArgument(version);
-
-
fullVersion = new BooleanArgument("fullversion", 'F', "fullVersion",
MSGID_DSCORE_DESCRIPTION_FULLVERSION);
fullVersion.setHidden(true);
@@ -8738,13 +8761,13 @@
// that is something other than NOTHING_TO_DO, SERVER_ALREADY_STARTED,
// START_AS_DETACH, START_AS_NON_DETACH, START_AS_WINDOWS_SERVICE to
// indicate that a problem occurred.
- if (argParser.usageDisplayed())
+ if (argParser.usageOrVersionDisplayed())
{
// We're just trying to display usage, and that's already been done so
// exit with a code of zero.
System.exit(NOTHING_TO_DO);
}
- else if (fullVersion.isPresent() || version.isPresent() ||
+ else if (fullVersion.isPresent() ||
systemInfo.isPresent() || dumpMessages.isPresent())
{
// We're not really trying to start, so rebuild the argument list
@@ -8768,7 +8791,7 @@
System.exit(checkStartability(argParser));
}
}
- else if (argParser.usageDisplayed())
+ else if (argParser.usageOrVersionDisplayed())
{
System.exit(0);
}
@@ -8792,18 +8815,6 @@
return;
}
- else if (version.isPresent())
- {
- System.out.println(getVersionString());
- System.out.println("Build " + BUILD_ID);
-
- if ((FIX_IDS != null) && (FIX_IDS.length() > 0))
- {
- System.out.println("Fix IDs: " + FIX_IDS);
- }
-
- return;
- }
else if (systemInfo.isPresent())
{
System.out.println(getVersionString());
--
Gitblit v1.10.0