directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccust...@apache.org
Subject svn commit: r564117 [1/2] - in /directory: apacheds/trunk/server-installers/src/main/installers/ apacheds/trunk/server-installers/src/main/resources/ daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/ daemon/trunk/plugin/src/main/jav...
Date Thu, 09 Aug 2007 06:45:39 GMT
Author: ccustine
Date: Wed Aug  8 23:45:35 2007
New Revision: 564117

URL: http://svn.apache.org/viewvc?view=rev&rev=564117
Log:
DIRSERVER-246, DIRSERVER-621, DIRSERVER-749, DIRSERVER-920, DIRSERVER-930, DIRSERVER-1015, DIRSERVER-1016

This changeset includes:
- Complete replacement of the Jsvc/Procrun daemon with Tanuki Wrapper
- Multi home data directories
- New native Windows installers based on NSIS
- New RPM installation

Added:
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds-default.conf
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds-fhs.conf
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds-rpm.spec
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds-server-win.nsi
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds-suite-win.nsi
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds-sysconfig.conf
    directory/apacheds/trunk/server-installers/src/main/installers/apacheds.conf
    directory/apacheds/trunk/server-installers/src/main/resources/adstree.ico   (with props)
    directory/apacheds/trunk/server-installers/src/main/resources/both_header.bmp   (with props)
    directory/apacheds/trunk/server-installers/src/main/resources/connections.xml
    directory/apacheds/trunk/server-installers/src/main/resources/header.bmp
    directory/apacheds/trunk/server-installers/src/main/resources/server_header.bmp   (with props)
    directory/apacheds/trunk/server-installers/src/main/resources/studio_header.bmp   (with props)
    directory/apacheds/trunk/server-installers/src/main/resources/welcome.bmp   (with props)
    directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/TanukiBootstrapper.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisTarget.java
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-ppc-64   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-x86-32   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-x86-64   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-macosx-ppc-32   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-macosx-universal-32   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-sparc-32   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-sparc-64   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-x86-32   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/bin/wrapper-windows-x86-32.exe   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/conf/
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/conf/apacheds.conf
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/conf/wrapper.conf
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-ppc-64.so   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-x86-32.so   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-x86-64.so   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-macosx-ppc-32.jnilib   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-macosx-universal-32.jnilib   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-sparc-32.so   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-sparc-64.so   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-x86-32.so   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/wrapper-windows-x86-32.dll   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/wrapper.jar   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/lib/wrappertest.jar   (with props)
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/App.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/AppCommand.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/AppNoWrapper.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/InstallApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/PauseApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/ResumeApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/SimpleApp.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/SimpleInstallApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/SimpleUninstallApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/StartApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/StopApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/UninstallApp-NT.bat.in
    directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper/src/sh.script.in

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds-default.conf
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds-default.conf?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds-default.conf (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds-default.conf Wed Aug  8 23:45:35 2007
@@ -0,0 +1,19 @@
+# In this file you can override parameters specified in the default
+# Apache Directory Server config file which is usually at
+# /opt/apacheds-x.x.x/conf/apacheds.conf
+#
+# See also http://wrapper.tanukisoftware.org/doc/english/properties.html
+# For a list of properties that can be set.
+#
+# Common overrides shown commented below
+
+
+# Override the JRE used
+# wrapper.java.command=%JAVA_HOME%/bin/java
+
+# Override the JVM memory settings
+# Initial Java Heap Size (in MB)
+# wrapper.java.initmemory=384
+
+# Maximum Java Heap Size (in MB)
+# wrapper.java.maxmemory=384

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds-fhs.conf
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds-fhs.conf?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds-fhs.conf (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds-fhs.conf Wed Aug  8 23:45:35 2007
@@ -0,0 +1,113 @@
+#********************************************************************
+# TestWrapper Properties
+#
+# NOTE - Please use src/conf/apacheds.conf.in as a template for your
+#        own application rather than the values used for the
+#        TestWrapper sample.
+#********************************************************************
+# Java Application
+#wrapper.java.command=%JAVA_HOME%/bin/java
+
+#include /etc/apacheds/%INSTANCE%.conf
+wrapper.java.command=@app.java.home@
+
+# Java Main class.  This class must implement the WrapperListener interface
+#  or guarantee that the WrapperManager class is initialized.  Helper
+#  classes are provided to do this for you.  See the Integration section
+#  of the documentation for details.
+wrapper.java.mainclass=org.apache.directory.daemon.TanukiBootstrapper
+#wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
+wrapper.max_failed_invocations=1
+
+wrapper.java.classpath.1=../lib/bootstrapper.jar
+wrapper.java.classpath.2=../lib/wrapper.jar
+wrapper.java.classpath.3=../lib/logger.jar
+
+# Java Library Path (location of Wrapper.DLL or libwrapper.so)
+wrapper.java.library.path.1=../lib
+
+# Java Additional Parameters
+wrapper.java.additional.1=-Dlog4j.configuration=file:///%INSTANCE_HOME%/%INSTANCE%/conf/log4j.properties
+wrapper.java.additional.2=-Dapacheds.var.dir=/var/lib/apacheds/%INSTANCE%
+wrapper.java.additional.3=-Dapacheds.log.dir=/var/log/apacheds/%INSTANCE%
+wrapper.java.additional.4=-Dapacheds.run.dir=/var/run/apacheds/%INSTANCE%
+wrapper.java.additional.5=-Dapacheds.instance=%INSTANCE%
+wrapper.java.additional.6=-Dbootstrap.start.class=org.apache.ldap.server.Service
+wrapper.java.additional.7=-Dbootstrap.stop.class=org.apache.ldap.server.Service
+
+# Initial Java Heap Size (in MB)
+wrapper.java.initmemory=384
+
+# Maximum Java Heap Size (in MB)
+wrapper.java.maxmemory=384
+
+# Application parameters.  Add parameters as needed starting from 1
+wrapper.app.parameter.1=%APACHEDS_HOME%
+wrapper.app.parameter.2=org.apache.directory.server.Service
+wrapper.app.parameter.3=%INSTANCE_HOME%/%INSTANCE%/conf/server.xml
+
+#********************************************************************
+# Wrapper Logging Properties
+#********************************************************************
+# Format of output for the console.  (See docs for formats)
+wrapper.console.format=PM
+
+# Log Level for console output.  (See docs for log levels)
+wrapper.console.loglevel=INFO
+
+# Log file to use for wrapper output logging.
+wrapper.logfile=/var/log/apacheds/%INSTANCE%/wrapper.log
+
+# Format of output for the log file.  (See docs for formats)
+wrapper.logfile.format=LPTM
+
+# Log Level for log file output.  (See docs for log levels)
+wrapper.logfile.loglevel=INFO
+
+# Maximum size that the log file will be allowed to grow to before
+#  the log is rolled. Size is specified in bytes.  The default value
+#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
+#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
+wrapper.logfile.maxsize=1m
+
+# Maximum number of rolled log files which will be allowed before old
+#  files are deleted.  The default value of 0 implies no limit.
+wrapper.logfile.maxfiles=5
+
+# Log Level for sys/event log output.  (See docs for log levels)
+wrapper.syslog.loglevel=NONE
+
+#********************************************************************
+# Wrapper Windows Properties
+#********************************************************************
+# Title to use when running as a console
+wrapper.console.title=apacheds-%INSTANCE%
+
+#********************************************************************
+# Wrapper Windows NT/2000/XP Service Properties
+#********************************************************************
+# WARNING - Do not modify any of these properties when an application
+#  using this configuration file has been installed as a service.
+#  Please uninstall the service before modifying this section.  The
+#  service can then be reinstalled.
+
+# Name of the service
+wrapper.ntservice.name=apacheds-%INSTANCE%
+
+# Display name of the service
+wrapper.ntservice.displayname=Apache Directory Server - %INSTANCE%
+
+# Description of the service
+wrapper.ntservice.description=Apache Directory Server - %INSTANCE%
+
+# Service dependencies.  Add dependencies as needed starting from 1
+#wrapper.ntservice.dependency.1=
+
+# Mode in which the service is installed.  AUTO_START or DEMAND_START
+wrapper.ntservice.starttype=AUTO_START
+
+# Allow the service to interact with the desktop.
+wrapper.ntservice.interactive=false
+
+# Anything after this line can't be overridden
+#include "%INSTANCE_HOME%/%INSTANCE%/conf/apacheds.conf"
\ No newline at end of file

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds-rpm.spec
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds-rpm.spec?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds-rpm.spec (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds-rpm.spec Wed Aug  8 23:45:35 2007
@@ -0,0 +1,110 @@
+Summary: ${app.display.name} Server 
+Name: ${app}
+Version: ${app.version}
+Release: ${app.release}
+License: ${app.license.type}
+Group: System Environment/Daemons
+URL: ${app.url}
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+${app.description}
+
+%define adsdata %{_localstatedir}/lib/%{name}
+%define adshome /opt/%{name}-%{version}
+
+%prep
+echo $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT
+cp -rf ${image.basedir} $RPM_BUILD_ROOT/%{name}-%{version}
+cd $RPM_BUILD_ROOT
+tar -zcvf %{_topdir}/SOURCES/%{name}-%{version}.tar.gz %{name}-%{version}
+
+%setup -q
+
+%build
+cd $RPM_BUILD_ROOT/%{name}-%{version}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT%{adshome}/bin
+mkdir -p $RPM_BUILD_ROOT%{adshome}/conf
+mkdir -p $RPM_BUILD_ROOT%{adshome}/lib/ext
+mkdir -p $RPM_BUILD_ROOT%{adsdata}/default/conf
+mkdir -p $RPM_BUILD_ROOT%{adsdata}/default/partitions
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}/default
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}/default
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+${mk.docs.dirs}
+${mk.sources.dirs}
+
+pwd
+install -m 755 ${image.basedir}/bin/%{name} $RPM_BUILD_ROOT%{adshome}/bin/%{name}
+install -m 644 ${image.basedir}/lib/wrapper.jar $RPM_BUILD_ROOT%{adshome}/lib/wrapper.jar
+install -m 644 ${image.basedir}/lib/bootstrapper.jar $RPM_BUILD_ROOT%{adshome}/lib/bootstrapper.jar
+install -m 644 ${image.basedir}/lib/libwrapper.so $RPM_BUILD_ROOT%{adshome}/lib/libwrapper.so
+install -m 644 ${image.basedir}/lib/logger.jar $RPM_BUILD_ROOT%{adshome}/lib/logger.jar
+install -m 644 ${image.basedir}/bin/apacheds-tools.jar $RPM_BUILD_ROOT%{adshome}/bin/apacheds-tools.jar
+install -m 755 ${image.basedir}/bin/apacheds-tools.sh $RPM_BUILD_ROOT%{adshome}/bin/apacheds-tools.sh
+install -m 600 ${image.basedir}/conf/server.xml $RPM_BUILD_ROOT%{adsdata}/default/conf/server.xml
+install -m 644 ${image.basedir}/conf/apacheds.conf $RPM_BUILD_ROOT%{adshome}/conf/apacheds.conf
+install -m 644 ${image.basedir}/conf/apacheds-default.conf $RPM_BUILD_ROOT%{adsdata}/default/conf/apacheds.conf
+install -m 644 ${image.basedir}/conf/log4j.properties $RPM_BUILD_ROOT%{adsdata}/default/conf/log4j.properties
+install -m 744 ${image.basedir}/bin/${server.init} $RPM_BUILD_ROOT/etc/init.d/%{name}
+install -m 644 ${image.basedir}/conf/apacheds-sysconfig.conf $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/apacheds
+install -m 644 ${image.basedir}/${app.license.name} $RPM_BUILD_ROOT%{adshome}
+install -m 644 ${image.basedir}/${app.readme.name} $RPM_BUILD_ROOT%{adshome}
+install -m 644 ${image.basedir}/${app.icon} $RPM_BUILD_ROOT%{adshome}
+${install.append.libs}
+${install.docs}
+${install.sources}
+${install.notice.file}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}
+%{_sbindir}/groupadd apacheds >/dev/null 2>&1 || :
+%{_sbindir}/useradd -g apacheds -d %{adsdata} apacheds >/dev/null 2>&1 || :
+
+%post
+/sbin/chkconfig --add %{name}
+
+%files
+%defattr(-,apacheds,apacheds,-)
+#%doc ${app.license.name} ${app.readme.name}
+%config %attr(0755, root, root) /etc/init.d/%{name}
+%{adshome}
+%{adshome}/bin
+%{adshome}/lib
+%{adshome}/lib/ext
+%{adsdata}
+%{adsdata}
+%{adsdata}/default
+%{adsdata}/default/conf
+%{adsdata}/default/partitions
+%{_localstatedir}/log/%{name}
+%{_localstatedir}/log/%{name}/default
+%{_localstatedir}/run/%{name}
+%{_localstatedir}/run/%{name}/default
+%{adshome}/bin/%{name}
+%{adshome}/lib/wrapper.jar
+%{adshome}/lib/bootstrapper.jar
+%{adshome}/bin/apacheds-tools.jar
+%{adshome}/bin/apacheds-tools.sh
+%{adshome}/lib/logger.jar
+%config %{adsdata}/default/conf/log4j.properties
+%config %{adsdata}/default/conf/apacheds.conf
+%config %{adsdata}/default/conf/server.xml
+%config %{_sysconfdir}/sysconfig/apacheds
+%{adshome}/${app.readme.name}
+%{adshome}/${app.license.name}
+%{adshome}/${app.icon}
+${verify.append.libs}
+${verify.docs}
+${verify.sources}
+${verify.notice.file}

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds-server-win.nsi
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds-server-win.nsi?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds-server-win.nsi (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds-server-win.nsi Wed Aug  8 23:45:35 2007
@@ -0,0 +1,642 @@
+!define AppName "${app.description}"
+!define AppVersion "${app.version}"
+!define OutFile "${app.final.name}"
+!define ShortName "${app}"
+!define JRE_VERSION "1.5.0"
+!define Vendor "Apache Software Foundation"
+!define Project "Apache Directory"
+!define Suite "Apache Directory Suite"
+
+!define JAVA_URL "http://java.sun.com/javase/downloads/index_jdk5.jsp"
+
+!macro CreateInternetShortcut FILENAME URL ;ICONFILE ICONINDEX
+WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
+!macroend
+
+!include "MUI.nsh"
+!include "Sections.nsh"
+
+Var InstallJRE
+Var JREPath
+
+
+
+;--------------------------------
+;Configuration
+
+  ;General
+  Name "${AppName}"
+  OutFile "..\${OutFile}.exe"
+
+  ;Folder selection page
+  InstallDir "$PROGRAMFILES\${AppName}"
+
+  ;Get install folder from registry if available
+  InstallDirRegKey HKLM "SOFTWARE\${Vendor}\${ShortName}" ""
+
+; Installation types
+InstType "Full"
+
+BrandingText "${AppName} - ${AppVersion}"
+XPStyle on
+
+!define MUI_COMPONENTSPAGE_SMALLDESC
+!define MUI_WELCOMEFINISHPAGE_BITMAP "../../../src/main/resources/welcome.bmp"
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP "../../../src/main/resources/both_header.bmp"
+!define iconfile "../../src/main/resources/adstree.ico"
+!define MUI_ICON ${iconfile}
+!define MUI_UNICON ${iconfile}
+
+;--------------------------------
+;Pages
+
+  ; License page
+  !insertmacro MUI_PAGE_WELCOME
+  !insertmacro MUI_PAGE_LICENSE "../../src/main/resources/META-INF/LICENSE.txt"
+
+  ; This page checks for JRE. It displays a dialog based on JRE.ini if it needs to install JRE
+  ; Otherwise you won't see it.
+  ;Page custom CheckInstalledJRE
+
+  ; Define headers for the 'Java installation successfully' page
+  #!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Java installation complete"
+  #!define MUI_PAGE_HEADER_TEXT "Installing Java runtime"
+  #!define MUI_PAGE_HEADER_SUBTEXT "Please wait while we install the Java runtime"
+  #!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "Java runtime installed successfully."
+  #!insertmacro MUI_PAGE_INSTFILES
+  !define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Installation complete"
+  !define MUI_PAGE_HEADER_TEXT "Installing"
+  !define MUI_PAGE_HEADER_SUBTEXT "Please wait while ${AppName} is being installed."
+
+  !insertmacro MUI_PAGE_COMPONENTS
+
+  # The main installation directory
+
+    Var SERVER_HOME_DIR
+    ;!define MUI_PAGE_CUSTOMFUNCTION_PRE PreServerDir
+    !define MUI_DIRECTORYPAGE_VARIABLE          $SERVER_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Server Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the directory where you would like to install ${AppName}"  ; GUI page title
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var INSTANCE_HOME_DIR
+    !define MUI_PAGE_CUSTOMFUNCTION_PRE PreInstanceDir
+    !define MUI_DIRECTORYPAGE_VARIABLE          $INSTANCE_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Server Instances Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the directory where you would like instance data to be stored.\n\nThis directory will be the home location for new instances."  ; GUI page title
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var JAVA_HOME_DIR
+    !define MUI_DIRECTORYPAGE_VARIABLE          $JAVA_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Java JDK Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the Java JDK home directory that you would like to use for running the installed applications."
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+
+  !insertmacro MUI_PAGE_INSTFILES
+  !insertmacro MUI_PAGE_FINISH
+
+; Uninstall  
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+!cd win32
+
+
+;--------------------------------
+;Modern UI Configuration
+
+  !define MUI_ABORTWARNING
+
+;--------------------------------
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"
+
+
+;--------------------------------
+;Language Strings
+
+  ;Description
+  LangString DESC_SecServerFiles ${LANG_ENGLISH} "Apache Directory Server Application Files"
+  LangString DESC_SecInstanceFiles ${LANG_ENGLISH} "Example server instance"
+
+  ;Header
+  LangString TEXT_JRE_TITLE ${LANG_ENGLISH} "Java Runtime Environment"
+  LangString TEXT_JRE_SUBTITLE ${LANG_ENGLISH} "Installation"
+  LangString TEXT_PRODVER_TITLE ${LANG_ENGLISH} "Installed version of ${AppName}"
+  LangString TEXT_PRODVER_SUBTITLE ${LANG_ENGLISH} "Installation cancelled"
+
+;--------------------------------
+;Installer Sections
+
+SectionGroup "Apache Directory Server"
+Section "Application Files" SecServerFiles
+  SectionIn 1 2
+  SetOutPath "$SERVER_HOME_DIR\bin"
+  File /r "bin\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR\lib"
+  File /r "lib\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR\conf"
+  File /r "conf\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR"
+  File "*"
+  
+    Push "$SERVER_HOME_DIR"
+    Push "*.txt"
+    Call ConvertFiles
+
+    Push "$SERVER_HOME_DIR\conf"
+    Push "*.*"
+    Call ConvertFiles
+
+    GetFunctionAddress $R0 ReplaceConfig ; handle to callback fn
+    Push $R0
+    Push "$SERVER_HOME_DIR\conf\apacheds.conf" ; file to replace in
+    Call ReplaceInFile
+
+  ;Store install folder
+  WriteRegStr HKLM "SOFTWARE\${Vendor}\${Project}\Server" "InstallDir" $SERVER_HOME_DIR
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "DisplayName" "${Suite} - (remove only)"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "DisplayIcon" "$SERVER_HOME_DIR\uninstall.exe"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "UninstallString" '"$SERVER_HOME_DIR\uninstall.exe"'
+  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "NoModify" "1"
+  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "NoRepair" "1"
+
+  # Probably need to filter the file here (put in instance home)
+
+
+  ;Create uninstaller
+  WriteUninstaller "$SERVER_HOME_DIR\Uninstall.exe"
+
+    CreateDirectory "$SMPROGRAMS\Apache Directory Suite\Server"
+
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\Apache Directory Suite\Server\Basic Users Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-basic-users-guide.html"
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\Apache Directory Suite\Server\Advanced Users Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-advanced-users-guide.html"
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\Apache Directory Suite\Server\Developers Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-developers-guide.html"
+
+    CreateShortCut "$SMPROGRAMS\Apache Directory Suite\Uninstall.lnk" "$SERVER_HOME_DIR\uninstall.exe" "" "$SERVER_HOME_DIR\uninstall.exe" 0
+
+SectionEnd
+
+; This section needs a custom screen to ask for a name for the instance (replace default)
+Section "Example Instance" SecInstanceFiles
+    SectionIn 1 2
+    Push "default"
+    Call CreateInstanceDirs
+
+    ;I am hand picking the files for now, but we could simplify this by creating a template for new instances
+    SetOutPath "$INSTANCE_HOME_DIR\default\conf"
+    File "conf/log4j.properties"
+    File /oname=apacheds.conf "conf/apacheds-default.conf"
+    File "conf/server.xml"
+
+    Push "$INSTANCE_HOME_DIR\default\conf"
+    Push "*.*"
+    Call ConvertFiles
+
+
+
+    Push "default"
+    Push "$INSTANCE_HOME_DIR"
+    Call RegisterInstance
+SectionEnd
+SectionGroupEnd
+
+
+;--------------------------------
+;Descriptions
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecServerFiles} $(DESC_SecServerFiles)
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstanceFiles} $(DESC_SecInstanceFiles)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;---------------------------------
+; Functions
+
+; Converts Unix to CR/LF for Windows
+Function ConvertFiles
+    Pop $R0
+    Pop $R1
+
+    FindFirst $R2 $R3 "$R1\$R0"
+    loop:
+      StrCmp $R3 "" done
+      Push "$R1\$R3"
+      Call ConvertUnixNewLines
+      FindNext $R2 $R3
+      Goto loop
+    done:
+      FindClose $R2
+
+    Pop $R3
+    Pop $R2
+    Pop $R1
+    Pop $R0
+FunctionEnd
+
+Function CreateInstanceDirs
+    Pop $0
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\log"
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\conf"
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\partitions"
+    ; the run dir seems to be irrelevant on Windows, but the InstallationLayout.verifyInstallation() method requires it
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\run"
+    Pop $0
+FunctionEnd
+
+Function RegisterInstance
+    Pop $0
+    Pop $1
+    nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" -i "$SERVER_HOME_DIR\conf\${ShortName}.conf" set.INSTANCE_HOME="$0" "set.INSTANCE=$1" set.APACHEDS_HOME="$SERVER_HOME_DIR" '
+    Pop $1
+    Pop $0
+FunctionEnd
+
+Function un.RegisterInstance
+    Pop $0
+    nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" -r "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE=$0"'
+    Pop $0
+FunctionEnd
+
+Function .onInstSuccess
+  Push "$INSTANCE_HOME_DIR\conf\apacheds-default.conf"
+  Call ConvertUnixNewLines
+
+  ; Start the server
+  MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to start the default directory instance?" IDYES startService IDNO End
+startService:  
+  nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" --start "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE_HOME=$INSTANCE_HOME_DIR" "set.INSTANCE=default" "set.APACHEDS_HOME=$SERVER_HOME_DIR"'
+  
+End:
+FunctionEnd
+
+;--------------------------------
+;Installer Functions
+
+Function .onInit
+    SetCurInstType 0
+    SetAutoClose false
+    StrCpy $SERVER_HOME_DIR "$PROGRAMFILES\Apache Directory Server"
+    Call CheckInstalledJRE
+    StrCpy $JAVA_HOME_DIR "$JREPath"
+FunctionEnd
+
+Function PreServerDir
+    ;StrCpy $SERVER_HOME_DIR $INSTDIR
+    ;SetAutoClose false
+FunctionEnd
+
+Function PreInstanceDir
+    StrCpy $INSTANCE_HOME_DIR $SERVER_HOME_DIR\instances
+FunctionEnd
+
+Function CheckInstalledJRE
+  Push "${JRE_VERSION}"
+  Call DetectJRE
+  Exch $0	; Get return value from stack
+
+  StrCmp $0 "0" NoFound
+  StrCmp $0 "-1" FoundOld
+  Goto JREAlreadyInstalled
+
+FoundOld:
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "Field 1" "Text" "${AppName} requires a more recent version of the Java Runtime Environment than the one found on your computer.  The installation of JRE ${JRE_VERSION} will start."
+  ;!insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
+  ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini"
+  Goto MustInstallJRE
+
+NoFound:
+  ;MessageBox MB_OK "JRE not found"
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "Field 1" "Text" "No Java Runtime Environment could be found on your computer. The installation of JRE v${JRE_VERSION} will start."
+  !insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
+  ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini"
+  Goto MustInstallJRE
+
+MustInstallJRE:
+  Exch $0	; $0 now has the installoptions page return value
+  ; Do something with return value here
+  Pop $0	; Restore $0
+  StrCpy $InstallJRE "yes"
+  Return
+
+JREAlreadyInstalled:
+;  MessageBox MB_OK "No download: ${TEMP2}"
+;  MessageBox MB_OK "JRE already installed"
+  StrCpy $InstallJRE "no"
+  StrCpy $JREPath "$0"
+
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "UserDefinedSection" "JREPath" $JREPATH
+  Pop $0		; Restore $0
+  Return
+
+FunctionEnd
+
+; Returns: 0 - JRE not found. -1 - JRE found but too old. Otherwise - Path to JAVA EXE
+
+; DetectJRE. Version requested is on the stack.
+; Returns (on stack)	"0" on failure (java too old or not installed), otherwise path to java interpreter
+; Stack value will be overwritten!
+
+Function DetectJRE
+  Exch $0	; Get version requested
+		; Now the previous value of $0 is on the stack, and the asked for version of JDK is in $0
+  Push $1	; $1 = Java version string (ie 1.5.0)
+  Push $2	; $2 = Javahome
+  Push $3	; $3 and $4 are used for checking the major/minor version of java
+  Push $4
+  ;MessageBox MB_OK "Detecting JRE"
+  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
+  ;MessageBox MB_OK "Read : $1"
+  StrCmp $1 "" DetectTry2
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
+  ;MessageBox MB_OK "Read 3: $2"
+  StrCmp $2 "" DetectTry2
+  Goto GetJRE
+
+DetectTry2:
+  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
+  ;MessageBox MB_OK "Detect Read : $1"
+  StrCmp $1 "" NoFound
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
+  ;MessageBox MB_OK "Detect Read 3: $2"
+  StrCmp $2 "" NoFound
+
+GetJRE:
+; $0 = version requested. $1 = version found. $2 = javaHome
+  ;MessageBox MB_OK "Getting JRE"
+  IfFileExists "$2\bin\java.exe" 0 NoFound
+  StrCpy $3 $0 1			; Get major version. Example: $1 = 1.5.0, now $3 = 1
+  StrCpy $4 $1 1			; $3 = major version requested, $4 = major version found
+  ;MessageBox MB_OK "Want $3 , found $4"
+  IntCmp $4 $3 0 FoundOld FoundNew
+  StrCpy $3 $0 1 2
+  StrCpy $4 $1 1 2			; Same as above. $3 is minor version requested, $4 is minor version installed
+  ;MessageBox MB_OK "Want $3 , found $4"
+  IntCmp $4 $3 FoundNew FoundOld FoundNew
+
+NoFound:
+  ;MessageBox MB_OK "JRE not found"
+  Push "0"
+  Goto DetectJREEnd
+
+FoundOld:
+  MessageBox MB_OK "JRE too old: $3 is older than $4"
+;  Push ${TEMP2}
+  Push "-1"
+  Goto DetectJREEnd
+FoundNew:
+  ;MessageBox MB_OK "JRE is new: $3 is newer than $4"
+
+  Push "$2"
+;  Push "OK"
+;  Return
+   Goto DetectJREEnd
+DetectJREEnd:
+	; Top of stack is return value, then r4,r3,r2,r1
+	Exch	; => r4,rv,r3,r2,r1,r0
+	Pop $4	; => rv,r3,r2,r1r,r0
+	Exch	; => r3,rv,r2,r1,r0
+	Pop $3	; => rv,r2,r1,r0
+	Exch 	; => r2,rv,r1,r0
+	Pop $2	; => rv,r1,r0
+	Exch	; => r1,rv,r0
+	Pop $1	; => rv,r0
+	Exch	; => r0,rv
+	Pop $0	; => rv
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+  ReadRegStr $SERVER_HOME_DIR HKLM "SOFTWARE\${Vendor}\${Project}\Server" "InstallDir"
+
+  ; Need to parse a list of instances or directories somehow
+  Push "default"
+  Call un.RegisterInstance
+
+  ; remove registry keys
+  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}"
+  DeleteRegKey HKLM  "SOFTWARE\${Vendor}\${Project}"
+
+  ; remove shortcuts, if any.
+  RMDir /r "$SMPROGRAMS\Apache Directory Suite"
+
+  ; remove files in root, then all dirs created by the installer.... leave user added or instance dirs.
+  Delete "$SERVER_HOME_DIR\*"
+  RMDir /r "$SERVER_HOME_DIR\bin"
+  RMDir /r "$SERVER_HOME_DIR\conf"
+  RMDir /r "$SERVER_HOME_DIR\var"
+  RMDir /r "$SERVER_HOME_DIR\lib"
+  RMDir /r "$SERVER_HOME_DIR\log"
+
+SectionEnd
+
+Function ConvertUnixNewLines
+    ; Usage:
+    ;Push "path\to\text_file.txt"
+    ;Call ConvertUnixNewLines
+
+    Exch $R0 ;file #1 path
+    Push $R1 ;file #1 handle
+    Push $R2 ;file #2 path
+    Push $R3 ;file #2 handle
+    Push $R4 ;data
+    Push $R5
+
+     FileOpen $R1 $R0 r
+     GetTempFileName $R2
+     FileOpen $R3 $R2 w
+
+     loopRead:
+      ClearErrors
+      FileRead $R1 $R4
+      IfErrors doneRead
+
+       StrCpy $R5 $R4 1 -1
+       StrCmp $R5 $\n 0 +4
+       StrCpy $R5 $R4 1 -2
+       StrCmp $R5 $\r +3
+       StrCpy $R4 $R4 -1
+       StrCpy $R4 "$R4$\r$\n"
+
+      FileWrite $R3 $R4
+
+     Goto loopRead
+     doneRead:
+
+     FileClose $R3
+     FileClose $R1
+
+     SetDetailsPrint none
+     Delete $R0
+     Rename $R2 $R0
+     SetDetailsPrint both
+
+    Pop $R5
+    Pop $R4
+    Pop $R3
+    Pop $R2
+    Pop $R1
+    Pop $R0
+FunctionEnd
+
+Function ReplaceInFile
+    ;
+	Exch $R0 ;file name to search in
+	Exch
+	Exch $R4 ;callback function handle
+	Push $R1 ;file handle
+	Push $R2 ;temp file name
+	Push $R3 ;temp file handle
+	Push $R5 ;line read
+
+	GetTempFileName $R2
+  	FileOpen $R1 $R0 r ;file to search in
+  	FileOpen $R3 $R2 w ;temp file
+
+loop_read:
+ 	ClearErrors
+ 	FileRead $R1 $R5 ;read line
+ 	Push $R5 ; put line on stack
+ 	Call $R4
+ 	Pop $R5 ; read line from stack
+ 	IfErrors exit
+ 	FileWrite $R3 $R5 ;write modified line
+	Goto loop_read
+exit:
+  	FileClose $R1
+  	FileClose $R3
+
+   	SetDetailsPrint none
+  	Delete $R0
+  	Rename $R2 $R0
+  	Delete $R2
+   	SetDetailsPrint both
+
+	; pop in reverse order
+	Pop $R5
+	Pop $R3
+	Pop $R2
+	Pop $R1
+	Pop $R4
+	Pop $R0
+FunctionEnd
+
+Function ReplaceConfig
+    ; Example usage of ReplaceInFile
+    ; Called Like this:
+    ;
+    ;GetFunctionAddress $R0 ReplaceInSQL ; handle to callback fn
+    ;Push $R0
+    ;Push "$INSTDIR\template.sql" ; file to replace in
+    ;Call ReplaceInFile
+	;
+	;
+	; save R1
+	Push $R1
+	Exch
+	;
+	;
+	; A sequence of replacements.
+        ; the string to replace in is at the top of the stack
+    Push "@app.java.home@" ; string to find
+	Push "$JAVA_HOME_DIR\bin\java.exe"
+	Call StrReplace
+
+	; restore stack
+	Exch
+	Pop $R1
+FunctionEnd
+
+# Uses $0
+Function openLinkNewWindow
+  Push $3
+  Push $2
+  Push $1
+  Push $0
+  ReadRegStr $0 HKCR "http\shell\open\command" ""
+# Get browser path
+    DetailPrint $0
+  StrCpy $2 '"'
+  StrCpy $1 $0 1
+  StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
+    StrCpy $2 ' '
+  StrCpy $3 1
+  loop:
+    StrCpy $1 $0 1 $3
+    DetailPrint $1
+    StrCmp $1 $2 found
+    StrCmp $1 "" found
+    IntOp $3 $3 + 1
+    Goto loop
+
+  found:
+    StrCpy $1 $0 $3
+    StrCmp $2 " " +2
+      StrCpy $1 '$1"'
+
+  Pop $0
+  Exec '$1 $0'
+  Pop $1
+  Pop $2
+  Pop $3
+FunctionEnd
+
+Var STR_REPLACE_VAR_0
+Var STR_REPLACE_VAR_1
+Var STR_REPLACE_VAR_2
+Var STR_REPLACE_VAR_3
+Var STR_REPLACE_VAR_4
+Var STR_REPLACE_VAR_5
+Var STR_REPLACE_VAR_6
+Var STR_REPLACE_VAR_7
+Var STR_REPLACE_VAR_8
+
+Function StrReplace
+  Exch $STR_REPLACE_VAR_2
+  Exch 1
+  Exch $STR_REPLACE_VAR_1
+  Exch 2
+  Exch $STR_REPLACE_VAR_0
+    StrCpy $STR_REPLACE_VAR_3 -1
+    StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
+    StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+    loop:
+      IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
+      StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
+      StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
+      Goto loop
+    found:
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
+      IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
+      StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
+      StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
+      StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+      Goto loop
+    done:
+  Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
+  Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
+  Exch $STR_REPLACE_VAR_0
+FunctionEnd
+
+!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
+  Push "${HAYSTACK}"
+  Push "${NEEDLE}"
+  Push "${NEEDLE2}"
+  Call StrReplace
+  Pop "${OUT}"
+!macroend
+
+!define StrReplace '!insertmacro "_strReplaceConstructor"'
+

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds-suite-win.nsi
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds-suite-win.nsi?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds-suite-win.nsi (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds-suite-win.nsi Wed Aug  8 23:45:35 2007
@@ -0,0 +1,686 @@
+!define AppName "${app.description}"
+!define AppVersion "${app.version}"
+!define OutFile "${app.final.name}"
+!define ShortName "${app}"
+!define JRE_VERSION "1.5.0"
+!define Vendor "Apache Software Foundation"
+!define Project "Apache Directory"
+!define Suite "Apache Directory Suite"
+
+!define JAVA_URL "http://java.sun.com/javase/downloads/index_jdk5.jsp"
+
+!macro CreateInternetShortcut FILENAME URL ;ICONFILE ICONINDEX
+WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
+!macroend
+
+!include "MUI.nsh"
+!include "Sections.nsh"
+
+Var InstallJRE
+Var JREPath
+
+
+
+;--------------------------------
+;Configuration
+
+  ;General
+  Name "${AppName}"
+  OutFile "..\${OutFile}.exe"
+
+  ;Folder selection page
+  InstallDir "$PROGRAMFILES\${AppName}"
+
+  ;Get install folder from registry if available
+  InstallDirRegKey HKLM "SOFTWARE\${Vendor}\${ShortName}" ""
+
+; Installation types
+InstType "Full"
+InstType "Server Only"
+InstType "Studio Only"
+
+BrandingText "${AppName} - ${AppVersion}"
+XPStyle on
+
+!define MUI_COMPONENTSPAGE_SMALLDESC
+!define MUI_WELCOMEFINISHPAGE_BITMAP "../../../src/main/resources/welcome.bmp"
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP "../../../src/main/resources/both_header.bmp"
+!define iconfile "../../src/main/resources/adstree.ico"
+!define MUI_ICON ${iconfile}
+!define MUI_UNICON ${iconfile}
+
+;--------------------------------
+;Pages
+
+  ; License page
+  !insertmacro MUI_PAGE_WELCOME
+  !insertmacro MUI_PAGE_LICENSE "../../src/main/resources/META-INF/LICENSE.txt"
+
+  ; This page checks for JRE. It displays a dialog based on JRE.ini if it needs to install JRE
+  ; Otherwise you won't see it.
+  ;Page custom CheckInstalledJRE
+
+  ; Define headers for the 'Java installation successfully' page
+  #!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Java installation complete"
+  #!define MUI_PAGE_HEADER_TEXT "Installing Java runtime"
+  #!define MUI_PAGE_HEADER_SUBTEXT "Please wait while we install the Java runtime"
+  #!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "Java runtime installed successfully."
+  #!insertmacro MUI_PAGE_INSTFILES
+  !define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Installation complete"
+  !define MUI_PAGE_HEADER_TEXT "Installing"
+  !define MUI_PAGE_HEADER_SUBTEXT "Please wait while ${AppName} is being installed."
+
+  !insertmacro MUI_PAGE_COMPONENTS
+
+  # The main installation directory
+
+    Var SERVER_HOME_DIR
+    ;!define MUI_PAGE_CUSTOMFUNCTION_PRE PreServerDir
+    !define MUI_DIRECTORYPAGE_VARIABLE          $SERVER_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Server Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the directory where you would like to install ${AppName}"  ; GUI page title
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var INSTANCE_HOME_DIR
+    !define MUI_PAGE_CUSTOMFUNCTION_PRE PreInstanceDir
+    !define MUI_DIRECTORYPAGE_VARIABLE          $INSTANCE_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Server Instances Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the directory where you would like instance data to be stored.\n\nThis directory will be the home location for new instances."  ; GUI page title
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var STUDIO_HOME_DIR
+    !define MUI_DIRECTORYPAGE_VARIABLE          $STUDIO_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Apache Directory Studio Install Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "This is the location where you would like to install Apache Directory Studio."
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var JAVA_HOME_DIR
+    !define MUI_DIRECTORYPAGE_VARIABLE          $JAVA_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Java JDK Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the Java JDK home directory that you would like to use for running the installed applications."
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+
+  !insertmacro MUI_PAGE_INSTFILES
+  !insertmacro MUI_PAGE_FINISH
+
+; Uninstall  
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+!cd win32
+
+
+;--------------------------------
+;Modern UI Configuration
+
+  !define MUI_ABORTWARNING
+
+;--------------------------------
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"
+
+
+;--------------------------------
+;Language Strings
+
+  ;Description
+  LangString DESC_SecServerFiles ${LANG_ENGLISH} "Apache Directory Server Application Files"
+  LangString DESC_SecStudioFiles ${LANG_ENGLISH} "Apache Directory Studio Application Files"
+  LangString DESC_SecStudioConnections ${LANG_ENGLISH} "Example connections to locally installed server"
+  LangString DESC_SecInstanceFiles ${LANG_ENGLISH} "Example server instance"
+
+  ;Header
+  LangString TEXT_JRE_TITLE ${LANG_ENGLISH} "Java Runtime Environment"
+  LangString TEXT_JRE_SUBTITLE ${LANG_ENGLISH} "Installation"
+  LangString TEXT_PRODVER_TITLE ${LANG_ENGLISH} "Installed version of ${AppName}"
+  LangString TEXT_PRODVER_SUBTITLE ${LANG_ENGLISH} "Installation cancelled"
+
+;--------------------------------
+;Installer Sections
+
+SectionGroup "Apache Directory Server"
+Section "Application Files" SecServerFiles
+  SectionIn 1 2
+  SetOutPath "$SERVER_HOME_DIR\bin"
+  File /r "bin\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR\lib"
+  File /r "lib\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR\conf"
+  File /r "conf\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR"
+  File "*"
+  
+    Push "$SERVER_HOME_DIR"
+    Push "*.txt"
+    Call ConvertFiles
+
+    Push "$SERVER_HOME_DIR\conf"
+    Push "*.*"
+    Call ConvertFiles
+
+    GetFunctionAddress $R0 ReplaceConfig ; handle to callback fn
+    Push $R0
+    Push "$SERVER_HOME_DIR\conf\apacheds.conf" ; file to replace in
+    Call ReplaceInFile
+
+  ;Store install folder
+  WriteRegStr HKLM "SOFTWARE\${Vendor}\${Project}\Server" "InstallDir" $SERVER_HOME_DIR
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "DisplayName" "${Suite} - (remove only)"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "DisplayIcon" "$SERVER_HOME_DIR\uninstall.exe"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "UninstallString" '"$SERVER_HOME_DIR\uninstall.exe"'
+  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "NoModify" "1"
+  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}" "NoRepair" "1"
+
+  # Probably need to filter the file here (put in instance home)
+
+
+  ;Create uninstaller
+  WriteUninstaller "$SERVER_HOME_DIR\Uninstall.exe"
+
+    CreateDirectory "$SMPROGRAMS\Apache Directory Suite\Server"
+
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\Apache Directory Suite\Server\Basic Users Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-basic-users-guide.html"
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\Apache Directory Suite\Server\Advanced Users Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-advanced-users-guide.html"
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\Apache Directory Suite\Server\Developers Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-developers-guide.html"
+
+    CreateShortCut "$SMPROGRAMS\Apache Directory Suite\Uninstall.lnk" "$SERVER_HOME_DIR\uninstall.exe" "" "$SERVER_HOME_DIR\uninstall.exe" 0
+
+SectionEnd
+
+; This section needs a custom screen to ask for a name for the instance (replace default)
+Section "Example Instance" SecInstanceFiles
+    SectionIn 1 2
+    Push "default"
+    Call CreateInstanceDirs
+
+    ;I am hand picking the files for now, but we could simplify this by creating a template for new instances
+    SetOutPath "$INSTANCE_HOME_DIR\default\conf"
+    File "conf/log4j.properties"
+    File /oname=apacheds.conf "conf/apacheds-default.conf"
+    File "conf/server.xml"
+
+    Push "$INSTANCE_HOME_DIR\default\conf"
+    Push "*.*"
+    Call ConvertFiles
+
+
+
+    Push "default"
+    Push "$INSTANCE_HOME_DIR"
+    Call RegisterInstance
+SectionEnd
+SectionGroupEnd
+
+SectionGroup "Apache Directory Studio"
+Section "Application Files" SecStudioFiles
+  SectionIn 1 3
+  SetOutPath "$STUDIO_HOME_DIR"
+  File /r "ApacheDirectoryStudio\*"
+
+  ;Store install folder
+  WriteRegStr HKLM "SOFTWARE\${Vendor}\${Project}\Studio" "InstallDir" "$STUDIO_HOME_DIR"
+
+  CreateDirectory "$SMPROGRAMS\Apache Directory Suite\Studio"
+  CreateShortCut "$SMPROGRAMS\Apache Directory Suite\Studio\Studio.lnk" "$STUDIO_HOME_DIR\Apache Directory Studio.exe" "" "$STUDIO_HOME_DIR\Apache Directory Studio.exe" 0
+
+  # Probably need to filter the file here (put in instance home)
+
+  ;Create uninstaller
+  ;WriteUninstaller "$STUDIO_HOME_DIR\Uninstall.exe"
+
+SectionEnd
+Section "Example Connections" SecStudioConnections
+  SectionIn 1 3
+  IfFileExists "$PROFILE\.ApacheDirectoryStudio\.metadata\.plugins\org.apache.directory.studio.ldapbrowser.core\connections.xml" End 0
+  SetOutPath "$PROFILE\.ApacheDirectoryStudio\.metadata\.plugins\org.apache.directory.studio.ldapbrowser.core"
+  File "..\..\..\src\main\resources\connections.xml"
+End:
+
+SectionEnd
+SectionGroupEnd
+
+;--------------------------------
+;Descriptions
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecServerFiles} $(DESC_SecServerFiles)
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecStudioFiles} $(DESC_SecStudioFiles)
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecStudioConnections} $(DESC_SecStudioConnections)
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstanceFiles} $(DESC_SecInstanceFiles)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;---------------------------------
+; Functions
+
+; Converts Unix to CR/LF for Windows
+Function ConvertFiles
+    Pop $R0
+    Pop $R1
+
+    FindFirst $R2 $R3 "$R1\$R0"
+    loop:
+      StrCmp $R3 "" done
+      Push "$R1\$R3"
+      Call ConvertUnixNewLines
+      FindNext $R2 $R3
+      Goto loop
+    done:
+      FindClose $R2
+
+    Pop $R3
+    Pop $R2
+    Pop $R1
+    Pop $R0
+FunctionEnd
+
+Function CreateInstanceDirs
+    Pop $0
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\log"
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\conf"
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\partitions"
+    ; the run dir seems to be irrelevant on Windows, but the InstallationLayout.verifyInstallation() method requires it
+    CreateDirectory "$INSTANCE_HOME_DIR\$0\run"
+    Pop $0
+FunctionEnd
+
+Function RegisterInstance
+    Pop $0
+    Pop $1
+    nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" -i "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE_HOME=$0" "set.INSTANCE=$1" "set.APACHEDS_HOME=$SERVER_HOME_DIR" '
+    Pop $1
+    Pop $0
+FunctionEnd
+
+Function un.RegisterInstance
+    Pop $0
+    nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" -r "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE=$0"'
+    Pop $0
+FunctionEnd
+
+Function .onInstSuccess
+  Push "$INSTANCE_HOME_DIR\conf\apacheds-default.conf"
+  Call ConvertUnixNewLines
+
+  ; Start the server
+  MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to start the default directory instance?" IDYES startService IDNO End
+startService:  
+  nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" --start "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE_HOME=$INSTANCE_HOME_DIR" "set.INSTANCE=default" "set.APACHEDS_HOME=$SERVER_HOME_DIR"'
+  
+End:
+FunctionEnd
+
+;--------------------------------
+;Installer Functions
+
+Function .onInit
+    SetCurInstType 0
+    SetAutoClose false
+    StrCpy $SERVER_HOME_DIR "$PROGRAMFILES\Apache Directory Server"
+    StrCpy $STUDIO_HOME_DIR "$PROGRAMFILES\Apache Directory Studio"
+    Call CheckInstalledJRE
+    StrCpy $JAVA_HOME_DIR "$JREPath"
+FunctionEnd
+
+Function PreServerDir
+    ;StrCpy $SERVER_HOME_DIR $INSTDIR
+    ;SetAutoClose false
+FunctionEnd
+
+Function PreInstanceDir
+    StrCpy $INSTANCE_HOME_DIR $SERVER_HOME_DIR\instances
+FunctionEnd
+
+Function CheckInstalledJRE
+  Push "${JRE_VERSION}"
+  Call DetectJRE
+  Exch $0	; Get return value from stack
+
+  StrCmp $0 "0" NoFound
+  StrCmp $0 "-1" FoundOld
+  Goto JREAlreadyInstalled
+
+FoundOld:
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "Field 1" "Text" "${AppName} requires a more recent version of the Java Runtime Environment than the one found on your computer.  The installation of JRE ${JRE_VERSION} will start."
+  ;!insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
+  ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini"
+  Goto MustInstallJRE
+
+NoFound:
+  ;MessageBox MB_OK "JRE not found"
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "Field 1" "Text" "No Java Runtime Environment could be found on your computer. The installation of JRE v${JRE_VERSION} will start."
+  !insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
+  ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini"
+  Goto MustInstallJRE
+
+MustInstallJRE:
+  Exch $0	; $0 now has the installoptions page return value
+  ; Do something with return value here
+  Pop $0	; Restore $0
+  StrCpy $InstallJRE "yes"
+  Return
+
+JREAlreadyInstalled:
+;  MessageBox MB_OK "No download: ${TEMP2}"
+;  MessageBox MB_OK "JRE already installed"
+  StrCpy $InstallJRE "no"
+  StrCpy $JREPath "$0"
+
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "UserDefinedSection" "JREPath" $JREPATH
+  Pop $0		; Restore $0
+  Return
+
+FunctionEnd
+
+; Returns: 0 - JRE not found. -1 - JRE found but too old. Otherwise - Path to JAVA EXE
+
+; DetectJRE. Version requested is on the stack.
+; Returns (on stack)	"0" on failure (java too old or not installed), otherwise path to java interpreter
+; Stack value will be overwritten!
+
+Function DetectJRE
+  Exch $0	; Get version requested
+		; Now the previous value of $0 is on the stack, and the asked for version of JDK is in $0
+  Push $1	; $1 = Java version string (ie 1.5.0)
+  Push $2	; $2 = Javahome
+  Push $3	; $3 and $4 are used for checking the major/minor version of java
+  Push $4
+  ;MessageBox MB_OK "Detecting JRE"
+  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
+  ;MessageBox MB_OK "Read : $1"
+  StrCmp $1 "" DetectTry2
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
+  ;MessageBox MB_OK "Read 3: $2"
+  StrCmp $2 "" DetectTry2
+  Goto GetJRE
+
+DetectTry2:
+  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
+  ;MessageBox MB_OK "Detect Read : $1"
+  StrCmp $1 "" NoFound
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
+  ;MessageBox MB_OK "Detect Read 3: $2"
+  StrCmp $2 "" NoFound
+
+GetJRE:
+; $0 = version requested. $1 = version found. $2 = javaHome
+  ;MessageBox MB_OK "Getting JRE"
+  IfFileExists "$2\bin\java.exe" 0 NoFound
+  StrCpy $3 $0 1			; Get major version. Example: $1 = 1.5.0, now $3 = 1
+  StrCpy $4 $1 1			; $3 = major version requested, $4 = major version found
+  ;MessageBox MB_OK "Want $3 , found $4"
+  IntCmp $4 $3 0 FoundOld FoundNew
+  StrCpy $3 $0 1 2
+  StrCpy $4 $1 1 2			; Same as above. $3 is minor version requested, $4 is minor version installed
+  ;MessageBox MB_OK "Want $3 , found $4"
+  IntCmp $4 $3 FoundNew FoundOld FoundNew
+
+NoFound:
+  ;MessageBox MB_OK "JRE not found"
+  Push "0"
+  Goto DetectJREEnd
+
+FoundOld:
+  MessageBox MB_OK "JRE too old: $3 is older than $4"
+;  Push ${TEMP2}
+  Push "-1"
+  Goto DetectJREEnd
+FoundNew:
+  ;MessageBox MB_OK "JRE is new: $3 is newer than $4"
+
+  Push "$2"
+;  Push "OK"
+;  Return
+   Goto DetectJREEnd
+DetectJREEnd:
+	; Top of stack is return value, then r4,r3,r2,r1
+	Exch	; => r4,rv,r3,r2,r1,r0
+	Pop $4	; => rv,r3,r2,r1r,r0
+	Exch	; => r3,rv,r2,r1,r0
+	Pop $3	; => rv,r2,r1,r0
+	Exch 	; => r2,rv,r1,r0
+	Pop $2	; => rv,r1,r0
+	Exch	; => r1,rv,r0
+	Pop $1	; => rv,r0
+	Exch	; => r0,rv
+	Pop $0	; => rv
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+  ReadRegStr $SERVER_HOME_DIR HKLM "SOFTWARE\${Vendor}\${Project}\Server" "InstallDir"
+  ReadRegStr $STUDIO_HOME_DIR HKLM "SOFTWARE\${Vendor}\${Project}\Studio" "InstallDir"
+  ;StrCpy $SERVER_HOME_DIR $0
+  ;StrCpy $STUDIO_HOME_DIR $1
+
+  ; Need to parse a list of instances or directories somehow
+  Push "default"
+  Call un.RegisterInstance
+
+  ; remove registry keys
+  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Project}"
+  DeleteRegKey HKLM  "SOFTWARE\${Vendor}\${Project}"
+
+  ; remove shortcuts, if any.
+  RMDir /r "$SMPROGRAMS\Apache Directory Suite"
+
+  ; remove files in root, then all dirs created by the installer.... leave user added or instance dirs.
+  Delete "$SERVER_HOME_DIR\*"
+  RMDir /r "$SERVER_HOME_DIR\bin"
+  RMDir /r "$SERVER_HOME_DIR\conf"
+  RMDir /r "$SERVER_HOME_DIR\var"
+  RMDir /r "$SERVER_HOME_DIR\lib"
+  RMDir /r "$SERVER_HOME_DIR\log"
+  RMDir /r "$STUDIO_HOME_DIR"  ;Studio install dir
+
+SectionEnd
+
+Function ConvertUnixNewLines
+    ; Usage:
+    ;Push "path\to\text_file.txt"
+    ;Call ConvertUnixNewLines
+
+    Exch $R0 ;file #1 path
+    Push $R1 ;file #1 handle
+    Push $R2 ;file #2 path
+    Push $R3 ;file #2 handle
+    Push $R4 ;data
+    Push $R5
+
+     FileOpen $R1 $R0 r
+     GetTempFileName $R2
+     FileOpen $R3 $R2 w
+
+     loopRead:
+      ClearErrors
+      FileRead $R1 $R4
+      IfErrors doneRead
+
+       StrCpy $R5 $R4 1 -1
+       StrCmp $R5 $\n 0 +4
+       StrCpy $R5 $R4 1 -2
+       StrCmp $R5 $\r +3
+       StrCpy $R4 $R4 -1
+       StrCpy $R4 "$R4$\r$\n"
+
+      FileWrite $R3 $R4
+
+     Goto loopRead
+     doneRead:
+
+     FileClose $R3
+     FileClose $R1
+
+     SetDetailsPrint none
+     Delete $R0
+     Rename $R2 $R0
+     SetDetailsPrint both
+
+    Pop $R5
+    Pop $R4
+    Pop $R3
+    Pop $R2
+    Pop $R1
+    Pop $R0
+FunctionEnd
+
+Function ReplaceInFile
+    ;
+	Exch $R0 ;file name to search in
+	Exch
+	Exch $R4 ;callback function handle
+	Push $R1 ;file handle
+	Push $R2 ;temp file name
+	Push $R3 ;temp file handle
+	Push $R5 ;line read
+
+	GetTempFileName $R2
+  	FileOpen $R1 $R0 r ;file to search in
+  	FileOpen $R3 $R2 w ;temp file
+
+loop_read:
+ 	ClearErrors
+ 	FileRead $R1 $R5 ;read line
+ 	Push $R5 ; put line on stack
+ 	Call $R4
+ 	Pop $R5 ; read line from stack
+ 	IfErrors exit
+ 	FileWrite $R3 $R5 ;write modified line
+	Goto loop_read
+exit:
+  	FileClose $R1
+  	FileClose $R3
+
+   	SetDetailsPrint none
+  	Delete $R0
+  	Rename $R2 $R0
+  	Delete $R2
+   	SetDetailsPrint both
+
+	; pop in reverse order
+	Pop $R5
+	Pop $R3
+	Pop $R2
+	Pop $R1
+	Pop $R4
+	Pop $R0
+FunctionEnd
+
+Function ReplaceConfig
+    ; Example usage of ReplaceInFile
+    ; Called Like this:
+    ;
+    ;GetFunctionAddress $R0 ReplaceInSQL ; handle to callback fn
+    ;Push $R0
+    ;Push "$INSTDIR\template.sql" ; file to replace in
+    ;Call ReplaceInFile
+	;
+	;
+	; save R1
+	Push $R1
+	Exch
+	;
+	;
+	; A sequence of replacements.
+        ; the string to replace in is at the top of the stack
+	Push "@app.java.home@" ; string to find
+	Push "$JAVA_HOME_DIR\bin\java.exe"
+	Call StrReplace
+
+	; restore stack
+	Exch
+	Pop $R1
+FunctionEnd
+
+# Uses $0
+Function openLinkNewWindow
+  Push $3
+  Push $2
+  Push $1
+  Push $0
+  ReadRegStr $0 HKCR "http\shell\open\command" ""
+# Get browser path
+    DetailPrint $0
+  StrCpy $2 '"'
+  StrCpy $1 $0 1
+  StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
+    StrCpy $2 ' '
+  StrCpy $3 1
+  loop:
+    StrCpy $1 $0 1 $3
+    DetailPrint $1
+    StrCmp $1 $2 found
+    StrCmp $1 "" found
+    IntOp $3 $3 + 1
+    Goto loop
+
+  found:
+    StrCpy $1 $0 $3
+    StrCmp $2 " " +2
+      StrCpy $1 '$1"'
+
+  Pop $0
+  Exec '$1 $0'
+  Pop $1
+  Pop $2
+  Pop $3
+FunctionEnd
+
+Var STR_REPLACE_VAR_0
+Var STR_REPLACE_VAR_1
+Var STR_REPLACE_VAR_2
+Var STR_REPLACE_VAR_3
+Var STR_REPLACE_VAR_4
+Var STR_REPLACE_VAR_5
+Var STR_REPLACE_VAR_6
+Var STR_REPLACE_VAR_7
+Var STR_REPLACE_VAR_8
+
+Function StrReplace
+  Exch $STR_REPLACE_VAR_2
+  Exch 1
+  Exch $STR_REPLACE_VAR_1
+  Exch 2
+  Exch $STR_REPLACE_VAR_0
+    StrCpy $STR_REPLACE_VAR_3 -1
+    StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
+    StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+    loop:
+      IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
+      StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
+      StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
+      Goto loop
+    found:
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
+      IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
+      StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
+      StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
+      StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+      Goto loop
+    done:
+  Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
+  Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
+  Exch $STR_REPLACE_VAR_0
+FunctionEnd
+
+!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
+  Push "${HAYSTACK}"
+  Push "${NEEDLE}"
+  Push "${NEEDLE2}"
+  Call StrReplace
+  Pop "${OUT}"
+!macroend
+
+!define StrReplace '!insertmacro "_strReplaceConstructor"'
+

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds-sysconfig.conf
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds-sysconfig.conf?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds-sysconfig.conf (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds-sysconfig.conf Wed Aug  8 23:45:35 2007
@@ -0,0 +1,2 @@
+INSTANCE_HOME="/var/lib/apacheds"
+APACHEDS_HOME="/opt/@app@-@app.version@"

Added: directory/apacheds/trunk/server-installers/src/main/installers/apacheds.conf
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/apacheds.conf?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/apacheds.conf (added)
+++ directory/apacheds/trunk/server-installers/src/main/installers/apacheds.conf Wed Aug  8 23:45:35 2007
@@ -0,0 +1,98 @@
+#include /etc/apacheds/%INSTANCE%.conf
+wrapper.java.command=@app.java.home@
+
+wrapper.java.mainclass=org.apache.directory.daemon.TanukiBootstrapper
+wrapper.max_failed_invocations=1
+
+wrapper.java.classpath.1=../lib/bootstrapper.jar
+wrapper.java.classpath.2=../lib/wrapper.jar
+wrapper.java.classpath.3=../lib/logger.jar
+
+# Java Library Path (location of Wrapper.DLL or libwrapper.so)
+wrapper.java.library.path.1=../lib
+
+# Java Additional Parameters
+wrapper.java.additional.1=-Dlog4j.configuration="file:///%INSTANCE_HOME%/%INSTANCE%/conf/log4j.properties"
+wrapper.java.additional.2=-Dapacheds.var.dir="%INSTANCE_HOME%/%INSTANCE%"
+wrapper.java.additional.3=-Dapacheds.log.dir="%INSTANCE_HOME%/%INSTANCE%/log"
+wrapper.java.additional.4=-Dapacheds.run.dir="%INSTANCE_HOME%/%INSTANCE%/run"
+wrapper.java.additional.5=-Dapacheds.instance=%INSTANCE%
+wrapper.java.additional.6=-Dbootstrap.start.class=org.apache.ldap.server.Service
+wrapper.java.additional.7=-Dbootstrap.stop.class=org.apache.ldap.server.Service
+
+# Initial Java Heap Size (in MB)
+wrapper.java.initmemory=384
+
+# Maximum Java Heap Size (in MB)
+wrapper.java.maxmemory=384
+
+# Application parameters.  Add parameters as needed starting from 1
+wrapper.app.parameter.1="%APACHEDS_HOME%"
+wrapper.app.parameter.2=org.apache.directory.server.Service
+wrapper.app.parameter.3="%INSTANCE_HOME%/%INSTANCE%/conf/server.xml"
+
+#********************************************************************
+# Wrapper Logging Properties
+#********************************************************************
+# Format of output for the console.  (See docs for formats)
+wrapper.console.format=PM
+
+# Log Level for console output.  (See docs for log levels)
+wrapper.console.loglevel=INFO
+
+# Log file to use for wrapper output logging.
+wrapper.logfile="%INSTANCE_HOME%/%INSTANCE%/log/wrapper.log"
+
+# Format of output for the log file.  (See docs for formats)
+wrapper.logfile.format=LPTM
+
+# Log Level for log file output.  (See docs for log levels)
+wrapper.logfile.loglevel=INFO
+
+# Maximum size that the log file will be allowed to grow to before
+#  the log is rolled. Size is specified in bytes.  The default value
+#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
+#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
+wrapper.logfile.maxsize=1m
+
+# Maximum number of rolled log files which will be allowed before old
+#  files are deleted.  The default value of 0 implies no limit.
+wrapper.logfile.maxfiles=5
+
+# Log Level for sys/event log output.  (See docs for log levels)
+wrapper.syslog.loglevel=NONE
+
+#********************************************************************
+# Wrapper Windows Properties
+#********************************************************************
+# Title to use when running as a console
+wrapper.console.title=apacheds-%INSTANCE%
+
+#********************************************************************
+# Wrapper Windows NT/2000/XP Service Properties
+#********************************************************************
+# WARNING - Do not modify any of these properties when an application
+#  using this configuration file has been installed as a service.
+#  Please uninstall the service before modifying this section.  The
+#  service can then be reinstalled.
+
+# Name of the service
+wrapper.ntservice.name=apacheds-%INSTANCE%
+
+# Display name of the service
+wrapper.ntservice.displayname=Apache Directory Server - %INSTANCE%
+
+# Description of the service
+wrapper.ntservice.description=Apache Directory Server - %INSTANCE%
+
+# Service dependencies.  Add dependencies as needed starting from 1
+#wrapper.ntservice.dependency.1=
+
+# Mode in which the service is installed.  AUTO_START or DEMAND_START
+wrapper.ntservice.starttype=AUTO_START
+
+# Allow the service to interact with the desktop.
+wrapper.ntservice.interactive=false
+
+# Anything after this line can't be overridden
+#include "%INSTANCE_HOME%/%INSTANCE%/conf/apacheds.conf"
\ No newline at end of file

Added: directory/apacheds/trunk/server-installers/src/main/resources/adstree.ico
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/adstree.ico?view=auto&rev=564117
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/trunk/server-installers/src/main/resources/adstree.ico
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/apacheds/trunk/server-installers/src/main/resources/both_header.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/both_header.bmp?view=auto&rev=564117
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/trunk/server-installers/src/main/resources/both_header.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/apacheds/trunk/server-installers/src/main/resources/connections.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/connections.xml?view=auto&rev=564117
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/resources/connections.xml (added)
+++ directory/apacheds/trunk/server-installers/src/main/resources/connections.xml Wed Aug  8 23:45:35 2007
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<java version="1.6.0_02" class="java.beans.XMLDecoder"> 
+ <array class="[Ljava.lang.Object;" length="1"> 
+  <void index="0"> 
+   <array class="java.lang.Object" length="3"> 
+    <void index="0"> 
+     <object class="org.apache.directory.studio.ldapbrowser.core.model.ConnectionParameter"> 
+      <void property="aliasesDereferencingMethod"> 
+       <int>1</int> 
+      </void> 
+      <void property="authMethod"> 
+       <int>1</int> 
+      </void> 
+      <void property="baseDN"> 
+       <object class="org.apache.directory.studio.ldapbrowser.core.model.DN"> 
+        <void property="rdns"> 
+         <array class="org.apache.directory.studio.ldapbrowser.core.model.RDN" length="2"> 
+          <void index="0"> 
+           <object class="org.apache.directory.studio.ldapbrowser.core.model.RDN"> 
+            <void property="parts"> 
+             <array class="org.apache.directory.studio.ldapbrowser.core.model.RDNPart" length="1"> 
+              <void index="0"> 
+               <object class="org.apache.directory.studio.ldapbrowser.core.model.RDNPart"> 
+                <void property="type"> 
+                 <string>dc</string> 
+                </void> 
+                <void property="unencodedValue"> 
+                 <string>example</string> 
+                </void> 
+               </object> 
+              </void> 
+             </array> 
+            </void> 
+           </object> 
+          </void> 
+          <void index="1"> 
+           <object class="org.apache.directory.studio.ldapbrowser.core.model.RDN"> 
+            <void property="parts"> 
+             <array class="org.apache.directory.studio.ldapbrowser.core.model.RDNPart" length="1"> 
+              <void index="0"> 
+               <object class="org.apache.directory.studio.ldapbrowser.core.model.RDNPart"> 
+                <void property="type"> 
+                 <string>dc</string> 
+                </void> 
+                <void property="unencodedValue"> 
+                 <string>com</string> 
+                </void> 
+               </object> 
+              </void> 
+             </array> 
+            </void> 
+           </object> 
+          </void> 
+         </array> 
+        </void> 
+       </object> 
+      </void> 
+      <void property="bindPassword"> 
+       <string>secret</string> 
+      </void> 
+      <void property="bindPrincipal"> 
+       <string>uid=admin,ou=system</string> 
+      </void> 
+      <void property="connectionProviderClassName"> 
+       <string>org.apache.directory.studio.ldapbrowser.core.internal.model.JNDIConnectionProvider</string> 
+      </void> 
+      <void property="countLimit"> 
+       <int>1000</int> 
+      </void> 
+      <void property="fetchBaseDNs"> 
+       <boolean>true</boolean> 
+      </void> 
+      <void property="host"> 
+       <string>localhost</string> 
+      </void> 
+      <void property="name"> 
+       <string>Example</string> 
+      </void> 
+      <void property="port"> 
+       <int>10389</int> 
+      </void> 
+      <void property="referralsHandlingMethod"> 
+       <int>1</int> 
+      </void> 
+     </object> 
+    </void> 
+    <void index="1"> 
+     <array class="org.apache.directory.studio.ldapbrowser.core.model.SearchParameter" length="0"/> 
+    </void> 
+    <void index="2"> 
+     <array class="org.apache.directory.studio.ldapbrowser.core.model.BookmarkParameter" length="0"/> 
+    </void> 
+   </array> 
+  </void> 
+ </array> 
+</java> 

Added: directory/apacheds/trunk/server-installers/src/main/resources/header.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/header.bmp?view=auto&rev=564117
==============================================================================
Binary files /tmp/tmpY70RbF and /tmp/tmpSi-KIF differ

Added: directory/apacheds/trunk/server-installers/src/main/resources/server_header.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/server_header.bmp?view=auto&rev=564117
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/trunk/server-installers/src/main/resources/server_header.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/apacheds/trunk/server-installers/src/main/resources/studio_header.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/studio_header.bmp?view=auto&rev=564117
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/trunk/server-installers/src/main/resources/studio_header.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/apacheds/trunk/server-installers/src/main/resources/welcome.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/resources/welcome.bmp?view=auto&rev=564117
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/trunk/server-installers/src/main/resources/welcome.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/TanukiBootstrapper.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/TanukiBootstrapper.java?view=auto&rev=564117
==============================================================================
--- directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/TanukiBootstrapper.java (added)
+++ directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/TanukiBootstrapper.java Wed Aug  8 23:45:35 2007
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+package org.apache.directory.daemon;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tanukisoftware.wrapper.WrapperListener;
+import org.tanukisoftware.wrapper.WrapperManager;
+
+import javax.naming.directory.InitialDirContext;
+import java.util.Hashtable;
+import java.util.Properties;
+
+/**
+ * The bootstrapper used by Tanuki Wrapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: $
+ */
+public class TanukiBootstrapper extends Bootstrapper implements WrapperListener
+{
+    private static final Logger log = LoggerFactory.getLogger( Bootstrapper.class );
+
+
+    private TanukiBootstrapper()
+    {
+    }
+
+    public static void main( String[] args )
+    {
+        WrapperManager.start( new TanukiBootstrapper(), args );
+    }
+
+    public Integer start(String[] args) {
+        setInstallationLayout( args[0] );
+        setParentLoader( Thread.currentThread().getContextClassLoader() );
+        callInit( shift( args, 1 ) );
+        callStart();
+        return null;
+    }
+
+    public int stop(int exitCode) {
+        log.info( "Attempting graceful shutdown of this server instance" );
+
+        callStop( EMPTY_STRARRAY );
+        callDestroy();
+
+        log.info( "Completed graceful shutdown..." );
+
+        return exitCode;
+    }
+
+    public void controlEvent(int event) {
+        log.error("Recvd Event: " + event);
+        if (WrapperManager.isControlledByNativeWrapper()) {
+            // The Wrapper will take care of this event
+        } else {
+            // We are not being controlled by the Wrapper, so
+            //  handle the event ourselves.
+            if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) ||
+                    (event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) ||
+                    (event == WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT)){
+                WrapperManager.stop(0);
+            }
+        }
+    }
+
+}



Mime
View raw message