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 ++++++++-
opends/build.xml | 96 ++++++++++++++++++++++++++++++++
opends/src/messages/messages/tools.properties | 32 +++++-----
opends/build.properties | 4
4 files changed, 140 insertions(+), 23 deletions(-)
diff --git a/opends/build.properties b/opends/build.properties
index 6069e05..e9156f3 100644
--- a/opends/build.properties
+++ b/opends/build.properties
@@ -1,5 +1,5 @@
-opendmk.lib.dir=
+#opendmk.lib.dir=/Users/jvergara/beach/OpenDMK-bin/lib
pkg.toolkit.dir=
-
+opendmk.lib.dir=
diff --git a/opends/build.xml b/opends/build.xml
index 88846b9..4c056d0 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -1179,8 +1179,104 @@
<chmod file="${pdir}/lib/_mixed-script.sh" perm="755" />
<chmod file="${pdir}/lib/_script-util.sh" perm="755" />
</target>
+
+ <!-- Populate the Directory Server package, but don't zip it up. -->
+ <target name="dsreplication" depends="generatemessages"
+ description="Compile only dsreplication.">
+
+ <taskdef name="getversionnumber"
+ classname="org.opends.build.tools.CreateVersionString">
+ <classpath>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+ <getversionnumber property="VERSION_NUMBER_STRING" />
+ <property name="pdir"
+ location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" />
+ <property name="dsreplication.rel.dir"
+ value="org/opends/server/tools/dsreplication"/>
+ <echo level="warning"
+ message="src dir ${src.dir}."/>
+ <echo level="warning"
+ message="classes dir ${classes.dir}."/>
+ <echo level="warning"
+ message="dsreplication classes dir ${classes.dir}/${dsreplication.rel.dir}."/>
+ <delete dir="${classes.dir}/${dsreplication.rel.dir}" />
+
+ <javac srcdir="${msg.javagen.dir}" destdir="${classes.dir}"
+ debug="on" debuglevel="${build.debuglevel}" source="1.5" target="1.5"
+ deprecation="true" fork="true" memoryInitialSize="${MEM}"
+ memoryMaximumSize="${MEM}">
+ <compilerarg value="-Xlint:all" />
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="build-tools.jar" />
+ </fileset>
+ <fileset dir="${build.lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </javac>
+ <javac srcdir="${guitools.src.dir}"
+ destdir="${classes.dir}"
+ debug="on" debuglevel="${build.debuglevel}" source="1.5" target="1.5"
+ deprecation="true" fork="true" memoryInitialSize="${MEM}"
+ memoryMaximumSize="${MEM}">
+ <compilerarg value="-Xlint:all" />
+
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="build-tools.jar" />
+ </fileset>
+ <fileset dir="${build.lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </javac>
+
+ <javac srcdir="${src.dir}"
+ destdir="${classes.dir}" includes="${dsreplication.rel.dir}/**,org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java,org/opends/server/util/args/ArgumentParser.java"
+ debug="on" debuglevel="${build.debuglevel}" source="1.5" target="1.5"
+ deprecation="true" fork="true" memoryInitialSize="${MEM}"
+ memoryMaximumSize="${MEM}">
+ <compilerarg value="-Xlint:all" />
+
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="build-tools.jar" />
+ </fileset>
+ <fileset dir="${build.lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </javac>
+
+ <delete file="${pdir}/lib/${SHORT_NAME}.jar" />
+ <jar jarfile="${pdir}/lib/${SHORT_NAME}.jar"
+ basedir="${classes.dir}"
+ excludes="${ads.classes.dir}, ${quicksetup.globalcompile.classes.dir}, org/opends/server/snmp/**,**/*_fr.properties,**/*_ja.properties,**/*_de.properties,**/*_es.properties,**/*_zh_TW.properties,**/*_zh_CN.properties,**/*_ko.properties"
+ compress="true" index="true" />
+
+ <copy todir="${pdir}/lib">
+ <fileset file="${lib.dir}/*.jar" />
+ </copy>
+
+ <echo level="warning"
+ message="jar file ${pdir}/lib/${SHORT_NAME}.jar."/>
+ </target>
<!-- Package the Directory Server for distribution. -->
diff --git a/opends/src/messages/messages/tools.properties b/opends/src/messages/messages/tools.properties
index 4d9ef86..6265ef7 100644
--- a/opends/src/messages/messages/tools.properties
+++ b/opends/src/messages/messages/tools.properties
@@ -1454,31 +1454,31 @@
INFO_WINDOWS_SERVICE_NAME_825=OpenDS
INFO_WINDOWS_SERVICE_DESCRIPTION_826=Open source Next Generation Directory \
Server. Installation path: %s
-INFO_WINDOWS_SERVICE_SUCCESSULLY_ENABLED_827=OpenDS was successfully enabled \
+INFO_WINDOWS_SERVICE_SUCCESSULLY_ENABLED_827=The server was successfully \
+ enabled to run as a Windows service
+INFO_WINDOWS_SERVICE_ALREADY_ENABLED_828=The server was already enabled to run \
as a Windows service
-INFO_WINDOWS_SERVICE_ALREADY_ENABLED_828=OpenDS was already enabled as a \
- Windows service
-SEVERE_ERR_WINDOWS_SERVICE_NAME_ALREADY_IN_USE_829=OpenDS could not be \
- enabled as a Windows service. The service name is already in use
+SEVERE_ERR_WINDOWS_SERVICE_NAME_ALREADY_IN_USE_829=The server could not be \
+ enabled to run as a Windows service. The service name is already in use
SEVERE_ERR_WINDOWS_SERVICE_ENABLE_ERROR_830=An unexpected error occurred \
- trying to enable OpenDS as a Windows service.%nCheck that you have \
- administrator rights (only Administrators can enable OpenDS as a Windows \
- Service)
-INFO_WINDOWS_SERVICE_SUCCESSULLY_DISABLED_831=OpenDS was successfully \
+ trying to enable the server as a Windows service.%nCheck that you have \
+ administrator rights (only Administrators can enable the server to run as a \
+ Windows Service)
+INFO_WINDOWS_SERVICE_SUCCESSULLY_DISABLED_831=The server was successfully \
disabled as a Windows service
-INFO_WINDOWS_SERVICE_ALREADY_DISABLED_832=OpenDS was already disabled as a \
+INFO_WINDOWS_SERVICE_ALREADY_DISABLED_832=The server was already disabled as a \
Windows service
-SEVERE_WARN_WINDOWS_SERVICE_MARKED_FOR_DELETION_833=OpenDS has been marked \
+SEVERE_WARN_WINDOWS_SERVICE_MARKED_FOR_DELETION_833=The server has been marked \
for deletion as a Windows Service
SEVERE_ERR_WINDOWS_SERVICE_DISABLE_ERROR_834=An unexpected error occurred \
- trying to disable OpenDS as a Windows service%nCheck that you have \
+ trying to disable the server as a Windows service%nCheck that you have \
administrator rights (only Administrators can disable OpenDS as a Windows \
Service)
-INFO_WINDOWS_SERVICE_ENABLED_835=OpenDS is enabled as a Windows service. The \
- service name for OpenDS is: %s
-INFO_WINDOWS_SERVICE_DISABLED_836=OpenDS is disabled as a Windows service
+INFO_WINDOWS_SERVICE_ENABLED_835=The server is enabled as a Windows service. \
+ The service name for the server is: %s
+INFO_WINDOWS_SERVICE_DISABLED_836=The server is disabled as a Windows service
SEVERE_ERR_WINDOWS_SERVICE_STATE_ERROR_837=An unexpected error occurred \
- trying to retrieve the state of OpenDS as a Windows service
+ trying to retrieve the state of the server as a Windows service
INFO_STOPDS_DESCRIPTION_WINDOWS_NET_STOP_838=Used by the window service code \
to inform that stop-ds is being called from the window services after a call \
to net stop
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