mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
15.52.2007 24841fa78a4602463372f5f5a678bf2e1ba0b4b6
refs
author jvergara <jvergara@localhost>
Thursday, March 15, 2007 16:52 +0100
committer jvergara <jvergara@localhost>
Thursday, March 15, 2007 16:52 +0100
commit24841fa78a4602463372f5f5a678bf2e1ba0b4b6
tree 0901922680e8ffa91c3ec74cc69bd5c9cac57a82 tree | zip | gz
parent 5c118604bf96e4aff22e3d4e3e88e103fce6dd4d view | diff
Fix for issue 528 (Windows Service Definition for Automatic Startup).

The following changes are targeted to be able to run OpenDS as a windows
service.

The idea is to be able to run OpenDS to run as a service and to be able
also to disable this feature.

The setup has been updated to run OpenDS as a service in windows (which
is the standard behavior in this platform). The uninstall has also been
updated to remove all references to OpenDS in the Registry and in the
list of services once OpenDS has been uninstalled.

A new executable (opends_service.exe) has been added to be able to
perform all the tasks that require native code
(registering/unregistering the service, sending events to the event log,
etc.). Most of the code required by this executable is in the file
service.c. The README file has been updated and a Makefile file
provided to generate all the executables.

A new command line has been added: windowsservice.bat. The usage of
this command line is the following one:

This utility may be used to configure OpenDS as a Windows service.
Usage: windowsservice {options}
where {options} include:
-e or --enableService
Enables OpenDS as a Windows service.
-d or --disableService
Disables OpenDS as a Windows service and stops the server
-s or --serviceState
Provides information about the state of OpenDS as a Windows service.
-H or --help
Display this usage information.

The class associated with this command line (ConfigureWindowsService)
uses opends_service.exe. ConfigureWindowsService is basically a wrapper
that allows to have the messages displayed to the user in the Java code
(and so to minimize what is done by the native code).


Some changes have been made in the start-ds(.bat) and stop-ds(.bat)
scripts by extending what the --checkStartability (in DirectoryServer
class) and --checkStoppability (in StopDS class) do. I think that it is
a good idea to have all the parsing of the arguments into the java code
(specially considering the limitations of the .bat files). So I have
moved most of the parsing to the java code so that the is the java code
that provides a return code to the scripts to tell them what to do
(start the server in detach mode, stop the server using a system call,
stop the server using protocol, etc.).

In the particular case of how start-ds.bat and stop-ds.bat have been
updated to manage the case where the server must be started using the
system call 'net start <service_name>' and 'net stop <service_name>'.
--checkstoppability and --checkstartability tell whether the server must
be stopped/started directly with a system call (or stopped using LDAP
protocol) or using the Windows Service system. If it is the latter the
bat files use two new auxiliary classes (StopWindowsService and
StartWindowsService). These classes figure out the service name
associated with the OpenDS instance and call net stop (or net start)
using that service name.

When net start/net stop are called start-ds.bat (or stop-ds.bat) are
called. The Windows Services have been configured to call start-ds.bat
and stop-ds.bat with some particular options (--windowsNetStart and
--windowsNetStop) to identify the case where we must start/stop the
server directly (and so not having an infinite recursive loop of calls
to net start/net stop).

In order to have the same user experience when the server is configured
to run as a service and when is not the tool class WaitForDelete has
also been updated to write its output to a file. This has been done
because piping from the standard output to a file in the context of a
Windows Service call does not seem to work properly. So now
WaitForDelete has a new option --outputFile.

setup --cli on windows has a new option '-n' or '-noWindowsService' to allow not to enable the windows service. When run in interactive mode and this options is not specified the user will systematically be asked whether to enable the windows service or not.

27 files modified
11 files added
5994 ■■■■ changed files
opends/build-tools/src/windows/EventLogMsg.mc 103 ●●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/Makefile 86 ●●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/README 86 ●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/common.c 96 ●●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/common.h 35 ●●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/service.c 2167 ●●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/service.h 109 ●●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/winlauncher.c 661 ●●●● diff | view | raw | blame | history
opends/build-tools/src/windows/winlauncher.h 53 ●●●● diff | view | raw | blame | history
opends/build.xml 8 ●●●●● diff | view | raw | blame | history
opends/lib/opends_service.exe diff | view | raw | blame | history
opends/lib/winlauncher.exe diff | view | raw | blame | history
opends/resource/bin/start-ds 55 ●●●●● diff | view | raw | blame | history
opends/resource/bin/start-ds.bat 32 ●●●● diff | view | raw | blame | history
opends/resource/bin/stop-ds 158 ●●●●● diff | view | raw | blame | history
opends/resource/bin/stop-ds.bat 92 ●●●● diff | view | raw | blame | history
opends/resource/bin/windowsservice.bat 33 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallException.java 4 ●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java 11 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallProgressStep.java 4 ●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 15 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java 27 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 13 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java 4 ●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 13 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties 49 ●●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallException.java 4 ●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallProgressStep.java 4 ●●●● diff | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java 256 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java 223 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/messages/CoreMessages.java 31 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/messages/ToolMessages.java 338 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/tools/ConfigureWindowsService.java 612 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/tools/InstallDS.java 45 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/tools/StartWindowsService.java 142 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/tools/StopDS.java 219 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/tools/StopWindowsService.java 147 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/tools/WaitForFileDelete.java 59 ●●●●● diff | view | raw | blame | history