From e9a9b7ff3d9cf81434aafa51d8d9f737abe9f139 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 15 Jul 2009 22:42:51 +0000
Subject: [PATCH] Allow productization in the name of the Window service by allowing to pass the name and description of the service name in ConfigureWindowsService.

---
 opends/src/server/org/opends/server/tools/ConfigureWindowsService.java |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/ConfigureWindowsService.java b/opends/src/server/org/opends/server/tools/ConfigureWindowsService.java
index 44a2293..061fd99 100644
--- a/opends/src/server/org/opends/server/tools/ConfigureWindowsService.java
+++ b/opends/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.server.tools;
@@ -399,6 +399,27 @@
    */
   public static int enableService(PrintStream out, PrintStream err)
   {
+    return enableService(out, err, INFO_WINDOWS_SERVICE_NAME.get().toString(),
+        INFO_WINDOWS_SERVICE_DESCRIPTION.get(getServerRoot()).toString());
+  }
+
+  /**
+   * Enables OpenDS to run as a windows service.
+   * @param out the stream used to write the standard output.
+   * @param err the stream used to write the error output.
+   * @param serviceName the name of the service as it will appear in the
+   * registry.
+   * @param serviceDescription the description of the service as it will appear
+   * in the registry.
+   * @return <CODE>SERVICE_ENABLE_SUCCESS</CODE>,
+   * <CODE>SERVICE_ENABLE_ERROR</CODE>,
+   * <CODE>SERVICE_NAME_ALREADY_IN_USE</CODE> or
+   * <CODE>SERVICE_ALREADY_ENABLED</CODE> depending on whether the service could
+   * be enabled or not.
+   */
+  public static int enableService(PrintStream out, PrintStream err,
+      String serviceName, String serviceDescription)
+  {
     int returnValue;
     Message msg;
     String serverRoot = getServerRoot();
@@ -415,8 +436,8 @@
           getBinaryFullPath(),
           "create",
           serverRoot,
-          INFO_WINDOWS_SERVICE_NAME.get().toString(),
-          INFO_WINDOWS_SERVICE_DESCRIPTION.get(serverRoot).toString(),
+          serviceName,
+          serviceDescription,
           DEBUG_OPTION
       };
     }
@@ -426,8 +447,8 @@
           getBinaryFullPath(),
           "create",
           serverRoot,
-          INFO_WINDOWS_SERVICE_NAME.get().toString(),
-          INFO_WINDOWS_SERVICE_DESCRIPTION.get(serverRoot).toString(),
+          serviceName,
+          serviceDescription,
           DEBUG_OPTION
       };
     }

--
Gitblit v1.10.0