Fix for Issues #1025 and #1248 ('stop-ds.bat should be able to stop server even if LDAP port' and 'cannot stop server through status panel').
The goal of these changes is to be able to have exactly the same user interface in Windows and Unix to stop the server. In windows we force the user to provide LDAP credentials even if the command is going to be run locally. The goal is to allow to stop the server using only system credentials (as we do in UNIX) when the user does not provide arguments when calling stop-ds.bat.
In order to do this I have written some native code. This native code is called when we start the server to:
1. Launch the java process and get the associated PID.
2. Create a server.pid file as we do for UNIX systems to store the PID of the process.
The native code that stops the server reads the PID file contents and tries to stop the process associated with the PID.
In order to allow the users to be able to build the product with independence of the platform, the binaries will be included with the source code. The code used to generate these binaries will also be provided.
I have generated 1 executable called winlauncher.exe. The binaries will be committed in the source tree under lib (with activation.jar and mail.jar). They will also be installed under <server root>\lib.
The native code is in the files winlauncher.c and winlauncher.h. These files are placed under the new directory build-tools/src/windows.
I have tried to keep the native code simple and leave as much logic as I could into the batch files (for instance everything related to the discovery of the java binaries) so that the administrators can play with them.
A README file has been also been included to explain how to generate the binaries.
Extras:
When we call start-ds from the command line, the server will not stop when the command prompt window is closed (unless start-ds was called to run in not-detached mode). The next step is to register DS as a service to avoid the server to be stopped when the user logs out.
When we call setup (with no arguments) or the statuspanel the generated process (and windows) will no longer get killed when the command prompt window is killed.
When the user double-clicks on the setup.bat or the statuspanel.bat files, the command prompt window only appears briefly. Today when we do this a command prompt window stays open until we close setup or the status panel window.