From 4c484ff6ea57ce79c5072a830e6536ac41c820c3 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 15 Mar 2007 15:52:50 +0000
Subject: [PATCH] Fix for issue 528 (Windows Service Definition for Automatic Startup).

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index a81f378..94da554 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -84,6 +84,33 @@
         MSGID_DIRECTORY_SERVER_STARTED);
   }
 
+  /**
+   * This methods enables this server as a Windows service.
+   * @throws InstallException if something goes wrong.
+   */
+  protected void enableWindowsService() throws InstallException
+  {
+    int code = org.opends.server.tools.ConfigureWindowsService.enableService(
+    System.out, System.err);
+
+    String errorMessage = ResourceProvider.getInstance().getMsg(
+    "error-enabling-windows-service");
+
+    switch (code)
+    {
+      case
+      org.opends.server.tools.ConfigureWindowsService.SERVICE_ENABLE_SUCCESS:
+      break;
+      case
+      org.opends.server.tools.ConfigureWindowsService.SERVICE_ALREADY_ENABLED:
+      break;
+      default:
+      throw new InstallException(InstallException.Type.WINDOWS_SERVICE_ERROR,
+      errorMessage, null);
+    }
+  }
+
+
   private String getThrowableMsg(String key, Throwable t)
   {
     return getThrowableMsg(key, null, t);

--
Gitblit v1.10.0