[rhq] Branch 'mazz/test-rhq-on-as7' - modules/enterprise

mazz mazz at fedoraproject.org
Wed Aug 1 16:58:36 UTC 2012


 modules/enterprise/server/appserver/pom.xml                                                       |   10 
 modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat           |  115 ++
 modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh            |  159 +++
 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server-console.bat             |    2 
 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat                     |  223 ++++
 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.security-policy         |   10 
 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh                      |  483 ++++++++++
 modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf    |  212 ++++
 modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.dll |binary
 modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.exe |binary
 modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.jar |binary
 modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc     |   16 
 modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml                      |    5 
 13 files changed, 1226 insertions(+), 9 deletions(-)

New commits:
commit 61d8a7e4dedec28a9394b54077da931ad3dd9140
Author: John Mazzitelli <mazz at redhat.com>
Date:   Wed Aug 1 12:58:30 2012 -0400

    getting the startup scripts to work with AS7.

diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index ee378b8..36a74a4 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -60,12 +60,6 @@
         </dependency>
 
         <dependency>
-            <groupId>jgroups</groupId>
-            <artifactId>jgroups-all</artifactId>
-            <version>2.2.9.1</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.opensymphony.quartz</groupId>
             <artifactId>quartz</artifactId>
             <!-- NOTE: version defined in root pom dependencyManagement section -->
@@ -159,8 +153,6 @@
 
                                     <!-- dev DB settings (used to init rhq-server.properties if dev profile is active or developer prop is set) -->
                                     <property name="rhq.dev.ds.connection-url"          value="${rhq.dev.ds.connection-url}" />
-                                    <property name="rhq.dev.ds.driver-class"            value="${rhq.dev.ds.driver-class}" />
-                                    <property name="rhq.dev.ds.xa-datasource-class"     value="${rhq.dev.ds.xa-datasource-class}" />
                                     <property name="rhq.dev.ds.user-name"               value="${rhq.dev.ds.user-name}" />
                                     <property name="rhq.dev.ds.password.encrypted"      value="${rhq.dev.ds.password.encrypted}" />
                                     <property name="rhq.dev.ds.type-mapping"            value="${rhq.dev.ds.type-mapping}" />
@@ -205,7 +197,7 @@
                                     <property name="developer"          value="${developer}" />
                                     <property name="rhq.earName"        value="${rhq.earName}" />
 
-                                    <!-- dev/test DB type (needed to init rhq-ds.xml) -->
+                                    <!-- dev/test DB type (TODO: do we still need this?) -->
                                     <property name="rhq.test.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
                                     <property name="rhq.dev.ds.type-mapping"  value="${rhq.dev.ds.type-mapping}" />
                                 </ant>
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat
new file mode 100644
index 0000000..a1f05b5
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat
@@ -0,0 +1,115 @@
+ at echo off
+
+rem ===========================================================================
+rem RHQ Server Windows Generate db password script
+rem
+rem This file is used to execute the generate a new encrypted db password.
+rem
+rem This script is customizable by setting the following environment variables:
+rem
+rem    RHQ_SERVER_DEBUG - If this is defined, the script will emit debug
+rem                       messages.
+rem                       If not set or set to "false", debug is turned off.
+rem
+rem    RHQ_SERVER_HOME - Defines where the Server's home install directory is.
+rem                      If not defined, it will be assumed to be the parent
+rem                      directory of the directory where this script lives.
+rem
+rem    RHQ_SERVER_JAVA_HOME - The location of the JRE that the Server will
+rem                           use. This will be ignored if
+rem                           RHQ_SERVER_JAVA_EXE_FILE_PATH is set.
+rem                           If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are
+rem                           not set, the Server's embedded JRE will be used.
+rem
+rem    RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java
+rem                                    executable to use. If this is set,
+rem                                    RHQ_SERVER_JAVA_HOME is ignored.
+rem                                    If this is not set, then
+rem                                    %RHQ_SERVER_JAVA_HOME%\bin\java.exe
+rem                                    is used. If this and
+rem                                    RHQ_SERVER_JAVA_HOME are not set, the
+rem                                    Server's embedded JRE will be used.
+rem
+rem If the embedded JRE is to be used but is not available, the fallback
+rem JRE to be used will be determined by the JAVA_HOME environment variable.
+rem
+rem ===========================================================================
+
+setlocal
+
+rem if debug variable is set, it is assumed to be on, unless its value is false
+if "%RHQ_SERVER_DEBUG%" == "false" (
+   set RHQ_SERVER_DEBUG=
+)
+
+rem ----------------------------------------------------------------------
+rem Ensure password parameter is present
+rem ----------------------------------------------------------------------
+
+if /i "%1"=="" (
+   echo Usage: %0 { plainTextPassword }
+   goto :done
+)
+
+rem ----------------------------------------------------------------------
+rem Change directory so the current directory is the Server home.
+rem ----------------------------------------------------------------------
+
+set RHQ_SERVER_BIN_DIR_PATH=%~dp0
+
+if not defined RHQ_SERVER_HOME (
+   cd "%RHQ_SERVER_BIN_DIR_PATH%\.."
+) else (
+   cd "%RHQ_SERVER_HOME%" || (
+      echo Cannot go to the RHQ_SERVER_HOME directory: %RHQ_SERVER_HOME%
+      exit /B 1
+      )
+)
+
+set RHQ_SERVER_HOME=%CD%
+
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME%
+
+rem ----------------------------------------------------------------------
+rem Find the Java executable and verify we have a VM available.
+rem ----------------------------------------------------------------------
+
+if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
+   if not defined RHQ_SERVER_JAVA_HOME call :prepare_embedded_jre
+)
+
+if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH set RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_HOME%\bin\java.exe
+
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_EXE_FILE_PATH: %RHQ_SERVER_JAVA_EXE_FILE_PATH%
+
+if not exist "%RHQ_SERVER_JAVA_EXE_FILE_PATH%" (
+   echo There is no JVM available.
+   echo Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately.
+   exit /B 1
+)
+
+set _JB_DIR=%RHQ_SERVER_HOME%\jbossas
+"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" -cp %_JB_DIR%\modules\org\picketbox\main\picketbox-4.0.7.Final.jar;%_JB_DIR%\modules\org\jboss\logging\main\jboss-logging-3.1.0.GA.jar org.picketbox.datasource.security.SecureIdentityLoginModule %1
+
+goto :done
+
+rem ----------------------------------------------------------------------
+rem CALL subroutine that prepares to use the embedded JRE
+rem ----------------------------------------------------------------------
+
+:prepare_embedded_jre
+set RHQ_SERVER_JAVA_HOME=%RHQ_SERVER_HOME%\jre
+if defined RHQ_SERVER_DEBUG echo Using the embedded JRE
+if not exist "%RHQ_SERVER_JAVA_HOME%" (
+   if defined RHQ_SERVER_DEBUG echo No embedded JRE found - will try to use JAVA_HOME: %JAVA_HOME%
+   set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
+)
+goto :eof
+
+rem ----------------------------------------------------------------------
+rem CALL subroutine that exits this script normally
+rem ----------------------------------------------------------------------
+
+:done
+endlocal
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh
new file mode 100755
index 0000000..0320c08
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh
@@ -0,0 +1,159 @@
+#!/bin/sh
+
+# =============================================================================
+# RHQ Server UNIX Generate db password script
+#
+# This file is used to execute the generate a new encrypted db password.
+#
+# This script is customizable by setting the following environment variables:
+#
+#    RHQ_SERVER_HOME - Defines where the server's home install directory is.
+#                      If not defined, it will be assumed to be the parent
+#                      directory of the directory where this script lives.
+#
+#    RHQ_SERVER_JAVA_HOME - The location of the JRE that the server will
+#                           use. This will be ignored if
+#                           RHQ_SERVER_JAVA_EXE_FILE_PATH is set.
+#                           If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are
+#                           not set, the Server's embedded JRE will be used.
+#
+#    RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java
+#                                    executable to use. If this is set,
+#                                    RHQ_SERVER_JAVA_HOME is ignored.
+#                                    If this is not set, then
+#                                    $RHQ_SERVER_JAVA_HOME/bin/java
+#                                    is used. If this and
+#                                    RHQ_SERVER_JAVA_HOME are not set, the
+#                                    Server's embedded JRE will be used.
+#
+# If the embedded JRE is to be used but is not available, the fallback
+# JRE to be used will be determined by the JAVA_HOME environment variable.
+#
+# =============================================================================
+
+# ----------------------------------------------------------------------
+# Environment variables you can set to customize the launch of the RHQ Server.
+# ----------------------------------------------------------------------
+
+# RHQ_SERVER_HOME=/path/to/server/home
+# RHQ_SERVER_DEBUG=true
+# JAVA_HOME=/path/to/java/installation
+# RHQ_SERVER_JAVA_EXE_FILE_PATH=/path/directly/to/java/executable
+# ----------------------------------------------------------------------
+# Make sure we unset any lingering JBossAS environment variables that
+# were set in the user's environment.  This might happen if the user
+# has an external JBossAS configured.
+# ----------------------------------------------------------------------
+
+unset JBOSS_HOME
+unset RUN_CONF
+unset JAVAC_JAR
+unset JBOSS_CLASSPATH
+
+# ----------------------------------------------------------------------
+# Dumps a message iff debug mode is enabled
+# ----------------------------------------------------------------------
+
+debug_msg ()
+{
+   # if debug variable is set, it is assumed to be on, unless its value is false
+   if [ "x$RHQ_SERVER_DEBUG" != "x" ]; then
+      if [ "$RHQ_SERVER_DEBUG" != "false" ]; then
+         echo $1
+      fi
+   fi
+}
+
+
+# ----------------------------------------------------------------------
+# Determine what specific platform we are running on.
+# Set some platform-specific variables.
+# ----------------------------------------------------------------------
+
+case "`uname`" in
+   CYGWIN*) _CYGWIN=true
+            ;;
+   Darwin*) _DARWIN=true
+            ;;
+   SunOS*) _SOLARIS=true
+            ;;
+   AIX*) _AIX=true
+            ;;
+esac
+
+# ----------------------------------------------------------------------
+# Determine the RHQ Server installation directory.
+# If RHQ_SERVER_HOME is not defined, we will assume we are running
+# directly from the server installation's bin directory.
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_HOME" ]; then
+   _DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"`
+   RHQ_SERVER_HOME=`dirname "$_DOLLARZERO"`/..
+else
+   if [ ! -d "$RHQ_SERVER_HOME" ]; then
+      echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid directory"
+      echo "RHQ_SERVER_HOME: $RHQ_SERVER_HOME"
+      exit 1
+   fi
+fi
+
+cd "$RHQ_SERVER_HOME"
+RHQ_SERVER_HOME=`pwd`
+
+debug_msg "RHQ_SERVER_HOME: $RHQ_SERVER_HOME"
+
+if [ ! -f "${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar" ]; then
+   echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ Server"
+   echo "Missing ${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar"
+   exit 1
+fi
+
+# ----------------------------------------------------------------------
+# if we are on a Mac and JAVA_HOME is not set, then set it to /usr
+# as this is the default location.
+# ----------------------------------------------------------------------
+if [ -z "$JAVA_HOME" ]; then
+   if [ -n "$_DARWIN" ]; then
+     debug_msg "Running on Mac OS X, setting JAVA_HOME to /usr"
+     JAVA_HOME=/usr
+   fi
+fi
+
+
+# ----------------------------------------------------------------------
+# Find the Java executable and verify we have a VM available
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then
+   if [ -z "$RHQ_SERVER_JAVA_HOME" ]; then
+      RHQ_SERVER_JAVA_HOME="${RHQ_SERVER_HOME}/jre"
+      debug_msg "Using the embedded JRE"
+      if [ ! -d "$RHQ_SERVER_JAVA_HOME" ]; then
+         debug_msg "No embedded JRE found - will try to use JAVA_HOME: $JAVA_HOME"
+         RHQ_SERVER_JAVA_HOME="$JAVA_HOME"
+      fi
+   fi
+   debug_msg "RHQ_SERVER_JAVA_HOME: $RHQ_SERVER_JAVA_HOME"
+   RHQ_SERVER_JAVA_EXE_FILE_PATH="${RHQ_SERVER_JAVA_HOME}/bin/java"
+fi
+debug_msg "RHQ_SERVER_JAVA_EXE_FILE_PATH: $RHQ_SERVER_JAVA_EXE_FILE_PATH"
+
+if [ ! -f "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then
+   echo "There is no JVM available."
+   echo "Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately."
+   exit 1
+fi
+
+# run.sh will use JAVA as the full java command
+JAVA="$RHQ_SERVER_JAVA_EXE_FILE_PATH"
+export JAVA
+
+if [ $# -eq 0 ]
+then
+    echo "Usage generate-db-password <password>"
+    exit 1
+fi
+
+_JB_DIR=${RHQ_SERVER_HOME}/jbossas
+$JAVA -cp ${_JB_DIR}/modules/org/picketbox/main/picketbox-4.0.7.Final.jar:${_JB_DIR}/modules/org/jboss/logging/main/jboss-logging-3.1.0.GA.jar org.picketbox.datasource.security.SecureIdentityLoginModule $*
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server-console.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server-console.bat
new file mode 100644
index 0000000..4f7b79d
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server-console.bat
@@ -0,0 +1,2 @@
+cd %~dp0
+rhq-server.bat console
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat
new file mode 100644
index 0000000..25db362
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat
@@ -0,0 +1,223 @@
+ at echo off
+
+rem ===========================================================================
+rem RHQ Server Windows Startup Script
+rem
+rem This file is used to install, start, stop and remove the RHQ Server Windows
+rem Service for the Windows platform.  It can also be used to start the
+rem RHQ Server in a console window. The RHQ Server is actually wrapped
+rem by the Java Service Wrapper (JSW) and it is the JSW that is the actual
+rem executable that is registered as the Windows Service.
+rem
+rem This script is customizable by setting the following environment variables:
+rem
+rem    RHQ_SERVER_DEBUG - If this is defined, the script will emit debug
+rem                       messages.
+rem                       If not set or set to "false", debug is turned off.
+rem
+rem    RHQ_SERVER_HOME - Defines where the Server's home install directory is.
+rem                      If not defined, it will be assumed to be the parent
+rem                      directory of the directory where this script lives.
+rem
+rem    RHQ_SERVER_JAVA_HOME - The location of the JRE that the Server will
+rem                           use. This will be ignored if
+rem                           RHQ_SERVER_JAVA_EXE_FILE_PATH is set.
+rem                           If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are
+rem                           not set, the Server's embedded JRE will be used.
+rem
+rem    RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java
+rem                                    executable to use. If this is set,
+rem                                    RHQ_SERVER_JAVA_HOME is ignored.
+rem                                    If this is not set, then
+rem                                    %RHQ_SERVER_JAVA_HOME%\bin\java.exe
+rem                                    is used. If this and
+rem                                    RHQ_SERVER_JAVA_HOME are not set, the
+rem                                    Server's embedded JRE will be used.
+rem
+rem    RHQ_SERVER_INSTANCE_NAME - The name of the Windows Service; it must
+rem                               conform to the Windows Service naming
+rem                               conventions. By default, this is the
+rem                               name "rhqserver-%COMPUTERNAME%"
+rem
+rem    RHQ_SERVER_WRAPPER_LOG_DIR_PATH - The full path to the location where
+rem                                      the wrapper log file will go.
+rem
+rem    RHQ_SERVER_RUN_AS - if defined, then when the Windows Service is
+rem                        installed, the value is the domain\username of the
+rem                        user that the Windows Service will run as 
+rem                       
+rem    RHQ_SERVER_RUN_AS_ME - if defined, then when the Windows Service is
+rem                           installed, the domain\username of the
+rem                           user that the Windows Service will run as will
+rem                           be the current user (.\%USERNAME%).  This takes
+rem                           precedence over RHQ_SERVER_RUN_AS.
+rem                       
+rem Note that you cannot define custom Java VM parameters or command line
+rem arguments to pass to the RHQ Server standalone.sh.  If you wish to pass in 
+rem specific arguments, modify the rhq-server-wrapper.conf file.
+rem
+rem If the embedded JRE is to be used but is not available, the fallback
+rem JRE to be used will be determined by the JAVA_HOME environment variable.
+rem
+rem This script does not use the built-in JBossAS run.bat. 
+rem ===========================================================================
+
+setlocal
+
+rem if debug variable is set, it is assumed to be on, unless its value is false
+if "%RHQ_SERVER_DEBUG%" == "false" (
+   set RHQ_SERVER_DEBUG=
+)
+
+rem ----------------------------------------------------------------------
+rem Change directory so the current directory is the Server home.
+rem ----------------------------------------------------------------------
+
+set RHQ_SERVER_BIN_DIR_PATH=%~dp0
+
+if not defined RHQ_SERVER_HOME (
+   cd "%RHQ_SERVER_BIN_DIR_PATH%\.."
+) else (
+   cd "%RHQ_SERVER_HOME%" || (
+      echo Cannot go to the RHQ_SERVER_HOME directory: %RHQ_SERVER_HOME%
+      exit /B 1
+      )
+)
+
+set RHQ_SERVER_HOME=%CD%
+
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME%
+
+rem ----------------------------------------------------------------------
+rem Find the Java executable and verify we have a VM available.
+rem ----------------------------------------------------------------------
+
+if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
+   if not defined RHQ_SERVER_JAVA_HOME call :prepare_embedded_jre
+)
+
+if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH set RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_HOME%\bin\java.exe
+
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_EXE_FILE_PATH: %RHQ_SERVER_JAVA_EXE_FILE_PATH%
+
+if not exist "%RHQ_SERVER_JAVA_EXE_FILE_PATH%" (
+   echo There is no JVM available.
+   echo Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately.
+   exit /B 1
+)
+
+rem ----------------------------------------------------------------------
+rem Define the name used for the name of the Windows Service.
+rem If this is not defined, the name of the computer is used.
+rem ----------------------------------------------------------------------
+
+if "%RHQ_SERVER_INSTANCE_NAME%"=="" (
+   set RHQ_SERVER_INSTANCE_NAME=rhqserver-%COMPUTERNAME%
+)
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTANCE_NAME: %RHQ_SERVER_INSTANCE_NAME%
+
+rem ----------------------------------------------------------------------
+rem Determine the wrapper directory.
+rem ----------------------------------------------------------------------
+
+set RHQ_SERVER_WRAPPER_DIR_PATH=%RHQ_SERVER_BIN_DIR_PATH%\wrapper
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_WRAPPER_DIR_PATH: %RHQ_SERVER_WRAPPER_DIR_PATH%
+
+rem ----------------------------------------------------------------------
+rem The Windows OS platform name is also the wrapper subdirectory name.
+rem ----------------------------------------------------------------------
+
+set RHQ_SERVER_OS_PLATFORM=windows-x86_32
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_OS_PLATFORM: %RHQ_SERVER_OS_PLATFORM%
+
+rem ----------------------------------------------------------------------
+rem Determine the wrapper executable that this script will run.
+rem ----------------------------------------------------------------------
+
+set RHQ_SERVER_WRAPPER_EXE_FILE_PATH=%RHQ_SERVER_WRAPPER_DIR_PATH%\%RHQ_SERVER_OS_PLATFORM%\wrapper.exe
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_WRAPPER_EXE_FILE_PATH: %RHQ_SERVER_WRAPPER_EXE_FILE_PATH%
+
+rem ----------------------------------------------------------------------
+rem Determine the Server wrapper configuration file.
+rem ----------------------------------------------------------------------
+
+set RHQ_SERVER_WRAPPER_CONF_FILE_PATH=%RHQ_SERVER_WRAPPER_DIR_PATH%\rhq-server-wrapper.conf
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_WRAPPER_CONF_FILE_PATH: %RHQ_SERVER_WRAPPER_CONF_FILE_PATH%
+
+rem ----------------------------------------------------------------------
+rem Create and configure the wrapper log directory.
+rem ----------------------------------------------------------------------
+
+if "%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" == "" (
+   if not exist "%RHQ_SERVER_HOME%\logs" (
+      mkdir "%RHQ_SERVER_HOME%\logs"
+   )
+   set RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
+)
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_WRAPPER_LOG_DIR_PATH: %RHQ_SERVER_WRAPPER_LOG_DIR_PATH%
+
+rem ----------------------------------------------------------------------
+rem Determine what to do and do it.
+rem ----------------------------------------------------------------------
+
+rem Determine if there should be debug VM options passed into it.
+rem For some reason, this can't go inside another if statement.
+if defined RHQ_SERVER_DEBUG set _DEBUG_OPTS=wrapper.debug=true
+
+rem Determine what user the Windows Service will run as.
+if defined RHQ_SERVER_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_SERVER_RUN_AS%"
+if defined RHQ_SERVER_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+
+if /i "%1"=="console" (
+   "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+   goto done
+)
+
+if /i "%1"=="install" (
+   "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+   goto done
+)
+
+if /i "%1"=="start" (
+   "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -t "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%"
+   goto done
+)
+
+if /i "%1"=="stop" (
+   "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -p "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%"
+   goto done
+)
+
+if /i "%1"=="remove" (
+   "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -r "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%"
+   goto done
+)
+
+if /i "%1"=="status" (
+   "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -q "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%"
+   goto done
+)
+
+echo Usage: %0 { install ^| start ^| stop ^| remove ^| status ^| console }
+goto :done
+
+rem ----------------------------------------------------------------------
+rem CALL subroutine that prepares to use the embedded JRE
+rem ----------------------------------------------------------------------
+
+:prepare_embedded_jre
+set RHQ_SERVER_JAVA_HOME=%RHQ_SERVER_HOME%\jre
+if defined RHQ_SERVER_DEBUG echo Using the embedded JRE
+if not exist "%RHQ_SERVER_JAVA_HOME%" (
+   if defined RHQ_SERVER_DEBUG echo No embedded JRE found - will try to use JAVA_HOME: %JAVA_HOME%
+   set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
+)
+goto :eof
+
+rem ----------------------------------------------------------------------
+rem CALL subroutine that exits this script normally
+rem ----------------------------------------------------------------------
+
+:done
+endlocal
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.security-policy b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.security-policy
new file mode 100644
index 0000000..8860b47
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.security-policy
@@ -0,0 +1,10 @@
+// We need the SecurityManager installed to enable sandboxing of CLI scripts
+// but we don't define any other security measures on the RHQ server itself.
+//
+// Granting all permissions allows us to run the RHQ server as if no security
+// manager was in place (which is assumed by default by JBoss AS) but be able
+// to use it when we need it for our own purposes.
+
+grant {
+    permission java.security.AllPermission;
+};
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh
new file mode 100644
index 0000000..f4fb511
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh
@@ -0,0 +1,483 @@
+#!/bin/sh
+
+# chkconfig: 2345 92 26
+# description: Starts and stops the RHQ Server
+#
+# processname: java
+
+# =============================================================================
+# RHQ Server UNIX Startup Script
+#
+# This file is used to execute the RHQ Server on a UNIX platform as part of
+# the platform's bootup sequence or as a foreground console process.
+# Run this script without any command line options for the syntax help.
+#
+# This script is customizable by setting the following environment variables:
+#
+# Note that if this script is to be used as an init.d script, you must set
+# RHQ_SERVER_HOME so this script knows where to find the Server installation.
+#
+#    RHQ_SERVER_DEBUG - If this is defined, the script will emit debug
+#                       messages. If this is not defined or set to "false"
+#                       debug messages are not emitted.
+#
+#    RHQ_SERVER_HOME - Defines where the server's home install directory is.
+#                      If not defined, it will be assumed to be the parent
+#                      directory of the directory where this script lives.
+#
+#    RHQ_SERVER_JAVA_HOME - The location of the JRE that the server will
+#                           use. This will be ignored if
+#                           RHQ_SERVER_JAVA_EXE_FILE_PATH is set.
+#                           If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are
+#                           not set, the Server's embedded JRE will be used.
+#
+#    RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java
+#                                    executable to use. If this is set,
+#                                    RHQ_SERVER_JAVA_HOME is ignored.
+#                                    If this is not set, then
+#                                    $RHQ_SERVER_JAVA_HOME/bin/java
+#                                    is used. If this and
+#                                    RHQ_SERVER_JAVA_HOME are not set, the
+#                                    Server's embedded JRE will be used.
+#
+#    RHQ_SERVER_JAVA_OPTS - Java VM command line options to be
+#                           passed into the Server's VM. If this is not defined
+#                           this script will pass in a default set of options.
+#                           If this is set, it completely overrides the
+#                           Server's defaults. If you only want to add options
+#                           to the Server's defaults, then you will want to
+#                           use RHQ_SERVER_ADDITIONAL_JAVA_OPTS instead.
+#
+#    RHQ_SERVER_ADDITIONAL_JAVA_OPTS - additional Java VM command line options
+#                                      to be passed into the Server's VM. This
+#                                      is added to RHQ_SERVER_JAVA_OPTS; it
+#                                      is mainly used to augment the Server's
+#                                      default set of options. This can be
+#                                      left unset if it is not needed.
+#
+#    RHQ_SERVER_CMDLINE_OPTS - If this is defined, these are the command line
+#                              arguments that will be passed to the RHQ Server
+#                              JBossAS standalone.sh. If you only want to add
+#                              options to the Server's defaults, then you will
+#                              want to use RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS
+#                              instead.
+#
+#    RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS - additional command line arguments to
+#                                         be passed to the RHQ Server JBossAS 
+#                                         standalone.sh. This is added to 
+#                                         RHQ_SERVER_CMDLINE_OPTS; it is mainly
+#                                         used to augment the Server's default
+#                                         set of options. This can be left unset
+#                                         if it is not needed.
+#
+#    RHQ_SERVER_PIDFILE_DIR - a full path to a writable directory where this
+#                             script can write its pidfile to.
+#                             If not defined, this defaults to the Server's
+#                             bin directory.
+#
+# If the embedded JRE is to be used but is not available, the fallback
+# JRE to be used will be determined by the JAVA_HOME environment variable.
+#
+# This script calls standalone.sh when starting the underlying JBossAS server.
+# =============================================================================
+
+# ----------------------------------------------------------------------
+# Environment variables that can customize the launch of the RHQ Server.
+# ----------------------------------------------------------------------
+
+# RHQ_SERVER_HOME=/path/to/server/home
+# RHQ_SERVER_DEBUG=true
+# JAVA_HOME=/path/to/java/installation
+# RHQ_SERVER_JAVA_EXE_FILE_PATH=/path/directly/to/java/executable
+# RHQ_SERVER_JAVA_OPTS=VM options
+# RHQ_SERVER_ADDITIONAL_JAVA_OPTS=additional VM options
+# RHQ_SERVER_CMDLINE_OPTS=standalone.sh options
+# RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS=additional standalone.sh options
+
+# ----------------------------------------------------------------------
+# Environment variables to set in order to enable remote debugging.
+# ----------------------------------------------------------------------
+
+#RHQ_SERVER_ADDITIONAL_JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
+
+# Enable JProfiler
+#JPROFILER_HOME="/opt/jprofiler6"
+#RHQ_SERVER_ADDITIONAL_JAVA_OPTS="$RHQ_SERVER_ADDITIONAL_JAVA_OPTS -agentlib:jprofilerti=port=8849 -Xbootclasspath/a:$JPROFILER_HOME/bin/agent.jar"
+#export PATH="$PATH:$JPROFILER_HOME/bin"
+#export LD_LIBRARY_PATH="$JPROFILER_HOME/bin/linux-x64"
+
+# ----------------------------------------------------------------------
+# Make sure we unset any lingering JBossAS environment variables that
+# were set in the user's environment.  This might happen if the user
+# has an external JBossAS configured.
+# ----------------------------------------------------------------------
+
+unset JBOSS_HOME
+unset RUN_CONF
+unset JAVAC_JAR
+unset JBOSS_CLASSPATH
+
+# ----------------------------------------------------------------------
+# Dumps a message iff debug mode is enabled
+# ----------------------------------------------------------------------
+
+debug_msg ()
+{
+   # if debug variable is set, it is assumed to be on, unless its value is false
+   if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then
+      echo $1
+   fi
+}
+
+# ----------------------------------------------------------------------
+# Sets _SERVER_STATUS, _SERVER_RUNNING and _SERVER_PID based on the
+# status of the RHQ Server VM start script (standalone.sh).
+# Also sets _JVM_STATUS, _JVM_RUNNING and _JVM_PID based on the
+# status of the JBossAS Java Virtual Machine.
+# ----------------------------------------------------------------------
+
+check_status ()
+{
+    if [ -f "$_SERVER_PIDFILE" ]; then
+        _SERVER_PID=`cat "$_SERVER_PIDFILE"`
+        if [ -n "$_SERVER_PID" ] && kill -0 $_SERVER_PID 2>/dev/null ; then
+            _SERVER_STATUS="RHQ Server (pid $_SERVER_PID) is $1"
+            _SERVER_RUNNING=1
+        else
+            _SERVER_STATUS="RHQ Server (pid $_SERVER_PID) is NOT running"
+            _SERVER_RUNNING=0
+        fi
+    else
+        _SERVER_STATUS="RHQ Server (no pid file) is NOT running"
+        _SERVER_RUNNING=0
+    fi
+
+    if [ -f "$_JVM_PIDFILE" ]; then
+        _JVM_PID=`cat "$_JVM_PIDFILE"`
+        if [ -n "$_JVM_PID" ] && kill -0 $_JVM_PID 2>/dev/null ; then
+            _JVM_STATUS="JBossAS Java VM child process (pid $_JVM_PID) is $1"
+            _JVM_RUNNING=1
+        else
+            _JVM_STATUS="JBossAS Java VM child process (pid $_JVM_PID) is NOT running"
+            _JVM_RUNNING=0
+        fi
+    else
+        _JVM_STATUS="JBossAS Java VM child process (no pid file) is NOT running"
+        _JVM_RUNNING=0
+    fi
+}
+
+# ----------------------------------------------------------------------
+# Ensures that the PID files no longer exist
+# ----------------------------------------------------------------------
+
+remove_pid_files ()
+{
+   if [ -f "$_SERVER_PIDFILE" ]; then
+      rm -f "$_SERVER_PIDFILE"
+   fi
+   if [ -f "$_JVM_PIDFILE" ]; then
+      rm -f "$_JVM_PIDFILE"
+   fi
+}
+
+# ----------------------------------------------------------------------
+# Determine what specific platform we are running on.
+# Set some platform-specific variables.
+# ----------------------------------------------------------------------
+
+case "`uname`" in
+   CYGWIN*) _CYGWIN=true
+            ;;
+   Linux*)  _LINUX=true
+            ;;
+   Darwin*) _DARWIN=true
+            ;;
+   SunOS*) _SOLARIS=true
+            ;;
+   AIX*)   _AIX=true
+            ;;
+esac
+
+# ----------------------------------------------------------------------
+# Determine the RHQ Server installation directory.
+# If RHQ_SERVER_HOME is not defined, we will assume we are running
+# directly from the server installation's bin directory.
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_HOME" ]; then
+   if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
+      # only certain platforms support the -e argument for readlink
+      _READLINK_ARG="-e"
+   fi
+   _DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null || echo "$0"`
+   RHQ_SERVER_HOME=`dirname "$_DOLLARZERO"`/..
+else
+   if [ ! -d "$RHQ_SERVER_HOME" ]; then
+      echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid directory"
+      echo "RHQ_SERVER_HOME: $RHQ_SERVER_HOME"
+      exit 1
+   fi
+fi
+
+cd "$RHQ_SERVER_HOME"
+RHQ_SERVER_HOME=`pwd`
+
+debug_msg "RHQ_SERVER_HOME: $RHQ_SERVER_HOME"
+
+if [ ! -f "${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar" ]; then
+   echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ Server"
+   echo "Missing ${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar"
+   exit 1
+fi
+
+# ----------------------------------------------------------------------
+# if we are on a Mac and JAVA_HOME is not set, then set it to /usr
+# as this is the default location.
+# ----------------------------------------------------------------------
+if [ -z "$JAVA_HOME" ]; then
+   if [ -n "$_DARWIN" ]; then
+     debug_msg "Running on Mac OS X, setting JAVA_HOME to /usr"
+     JAVA_HOME=/usr
+   fi
+fi
+
+# create the logs directory
+_LOG_DIR_PATH="${RHQ_SERVER_HOME}/logs"
+if [ -n "$_CYGWIN" ]; then
+   _LOG_DIR_PATH=`cygpath --windows --path "$_LOG_DIR_PATH"`
+fi
+if [ ! -d "${_LOG_DIR_PATH}" ]; then
+   mkdir "${_LOG_DIR_PATH}"
+fi
+
+# ----------------------------------------------------------------------
+# Find the Java executable and verify we have a VM available
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then
+   if [ -z "$RHQ_SERVER_JAVA_HOME" ]; then
+      RHQ_SERVER_JAVA_HOME="${RHQ_SERVER_HOME}/jre"     
+      if [ -d "$RHQ_SERVER_JAVA_HOME" ]; then
+         debug_msg "Using the embedded JRE"
+      else
+         debug_msg "No embedded JRE found - will try to use JAVA_HOME: $JAVA_HOME"
+         RHQ_SERVER_JAVA_HOME="$JAVA_HOME"
+      fi
+   fi
+   debug_msg "RHQ_SERVER_JAVA_HOME: $RHQ_SERVER_JAVA_HOME"
+   RHQ_SERVER_JAVA_EXE_FILE_PATH="${RHQ_SERVER_JAVA_HOME}/bin/java"
+fi
+debug_msg "RHQ_SERVER_JAVA_EXE_FILE_PATH: $RHQ_SERVER_JAVA_EXE_FILE_PATH"
+
+if [ ! -f "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then
+   echo "There is no JVM available."
+   echo "Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately."
+   exit 1
+fi
+
+# standalone.sh will use JAVA as the full java command
+JAVA="$RHQ_SERVER_JAVA_EXE_FILE_PATH"
+export JAVA
+
+# ----------------------------------------------------------------------
+# Prepare the VM command line options to be passed in
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_JAVA_OPTS" ]; then
+   RHQ_SERVER_JAVA_OPTS="-Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
+fi
+# Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_JAVA_OPTS.
+# Note that the double equals for the policy file specification IS INTENTIONAL
+RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS} -Djboss.server.log.dir=${_LOG_DIR_PATH} -Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true -Djboss.server.default.config=standalone.xml -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager -Djava.security.policy==${RHQ_SERVER_HOME}/bin/rhq-server.security-policy"
+
+debug_msg "RHQ_SERVER_JAVA_OPTS: $RHQ_SERVER_JAVA_OPTS"
+debug_msg "RHQ_SERVER_ADDITIONAL_JAVA_OPTS: $RHQ_SERVER_ADDITIONAL_JAVA_OPTS"
+
+# standalone.sh wants the options to be in the JAVA_OPTS variable
+JAVA_OPTS="$RHQ_SERVER_JAVA_OPTS $RHQ_SERVER_ADDITIONAL_JAVA_OPTS"
+export JAVA_OPTS
+
+# ----------------------------------------------------------------------
+# Prepare the command line arguments passed to the RHQ Server JBossAS
+# standalone.sh script
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_CMDLINE_OPTS" ]; then
+   _PROPS_FILE_PATH="${RHQ_SERVER_HOME}/bin/rhq-server.properties"
+
+   # convert paths if we are on Windows
+   if [ -n "$_CYGWIN" ]; then
+      _PROPS_FILE_PATH=`cygpath --windows --path "$_PROPS_FILE_PATH"`
+   fi
+
+   RHQ_SERVER_CMDLINE_OPTS="-P ${_PROPS_FILE_PATH}"   
+fi
+
+debug_msg "RHQ_SERVER_CMDLINE_OPTS: $RHQ_SERVER_CMDLINE_OPTS"
+debug_msg "RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS: $RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS"
+
+# JBoss may parse its command line args such that later options of a
+# certain type may override earlier options of that same type, so make sure the
+# additional opts are added after the base opts, since we want the additional
+# opts to take precedence
+_CMDLINE_OPTS="$RHQ_SERVER_CMDLINE_OPTS $RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS"
+
+# ----------------------------------------------------------------------
+# Now find the JBossAS standalone.sh script
+# ----------------------------------------------------------------------
+
+_JBOSS_RUN_SCRIPT="${RHQ_SERVER_HOME}/jbossas/bin/standalone.sh"
+
+if [ ! -f "$_JBOSS_RUN_SCRIPT" ]; then
+   echo "ERROR! Cannot find the JBossAS run script"
+   echo "Not found: $_JBOSS_RUN_SCRIPT"
+   exit 1
+fi
+debug_msg "_JBOSS_RUN_SCRIPT: $_JBOSS_RUN_SCRIPT"
+
+# ----------------------------------------------------------------------
+# Define where we want to write the pidfiles - let user override the dir
+# Note that we actually have two pidfiles - one is for the script
+# that starts the JBossAS Java virtual machine and the second is the
+# actual server's Java virtual machine process itself.
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_PIDFILE_DIR" ]; then
+   RHQ_SERVER_PIDFILE_DIR="${RHQ_SERVER_HOME}/bin"
+fi
+mkdir -p "$RHQ_SERVER_PIDFILE_DIR"
+
+_SERVER_PIDFILE="${RHQ_SERVER_PIDFILE_DIR}/rhq-server.pid"
+_JVM_PIDFILE="${RHQ_SERVER_PIDFILE_DIR}/rhq-jvm.pid"
+
+# ----------------------------------------------------------------------
+# Execute the command that the user wants us to do
+# ----------------------------------------------------------------------
+
+check_status "running"
+
+case "$1" in
+'console')
+        if [ "$_SERVER_RUNNING" = "1" ]; then
+           echo "$_SERVER_STATUS"
+           exit 0
+        fi
+
+        echo "Starting RHQ Server in console..."
+
+        # we are running in foreground, make both pids show the same process
+        echo "$$" > "$_SERVER_PIDFILE"
+        echo "$$" > "$_JVM_PIDFILE"
+
+        # start the server, making sure its working directory is the JBossAS bin directory
+        cd "${RHQ_SERVER_HOME}/jbossas/bin"
+        "$_JBOSS_RUN_SCRIPT" $_CMDLINE_OPTS
+
+        _JBOSS_STATUS=$?
+
+        remove_pid_files
+
+        exit $_JBOSS_STATUS
+        ;;
+
+'start')
+        if [ "$_SERVER_RUNNING" = "1" ]; then
+           echo "$_SERVER_STATUS"
+           exit 0
+        fi
+
+        echo "Trying to start the RHQ Server..."
+
+        LAUNCH_JBOSS_IN_BACKGROUND=true
+        JBOSS_PIDFILE="$_JVM_PIDFILE"
+        export LAUNCH_JBOSS_IN_BACKGROUND
+        export JBOSS_PIDFILE
+
+        # start the server, making sure its working directory is the JBossAS bin directory
+        cd "${RHQ_SERVER_HOME}/jbossas/bin"
+        if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then
+           "$_JBOSS_RUN_SCRIPT" $_CMDLINE_OPTS &
+        else
+           "$_JBOSS_RUN_SCRIPT" $_CMDLINE_OPTS > /dev/null 2>&1 &
+        fi
+
+        echo "$!" > "$_SERVER_PIDFILE"
+
+        sleep 5
+        check_status "starting"
+        echo "$_SERVER_STATUS"
+
+        if [ "$_SERVER_RUNNING" = "1" ]; then
+           exit 0
+        else
+           echo "Failed to start - make sure the RHQ Server is fully configured properly"
+           exit 1
+        fi
+        ;;
+
+'stop')
+        if [ "$_SERVER_RUNNING" = "0" ]; then
+           echo "$_SERVER_STATUS"
+           remove_pid_files
+           exit 0
+        fi
+
+        echo "Trying to stop the RHQ Server..."
+
+        echo "RHQ Server (pid=${_SERVER_PID}) is stopping..."
+
+        while [ "$_SERVER_RUNNING" = "1"  ]; do
+           kill -TERM $_SERVER_PID
+           sleep 2
+           check_status "stopping..."
+        done
+
+        remove_pid_files
+        echo "RHQ Server has stopped."
+        exit 0
+        ;;
+
+'kill')
+        if [ "$_SERVER_RUNNING" = "0" ]; then
+           echo "$_SERVER_STATUS"
+        fi
+        if [ "$_JVM_RUNNING" = "0" ]; then
+           echo "$_JVM_STATUS"
+           remove_pid_files
+           exit 0
+        fi
+
+        echo "Trying to kill the RHQ Server..."
+
+        echo "RHQ Server parent process (pid=${_SERVER_PID}) is being killed..."
+        while [ "$_SERVER_RUNNING" = "1"  ]; do
+           kill -9 $_SERVER_PID
+           sleep 2
+           check_status "killing..."
+        done
+
+        echo "Java Virtual Machine child process (pid=${_JVM_PID}) is being killed..."
+        while [ "$_JVM_RUNNING" = "1"  ]; do
+           kill -9 $_JVM_PID
+           sleep 2
+           check_status "killing..."
+        done
+
+        remove_pid_files
+        echo "RHQ Server has been killed."
+        exit 0
+        ;;
+
+'status')
+        echo "$_SERVER_STATUS"
+        echo "$_JVM_STATUS"
+        exit 0
+        ;;
+
+*)
+        echo "Usage: $0 { start | stop | kill | status | console }"
+        exit 1
+        ;;
+esac
+
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf
new file mode 100644
index 0000000..9fef419
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf
@@ -0,0 +1,212 @@
+#*****************************************************************************
+# RHQ Server Java Service Wrapper Configuration File
+#
+# If you wish to modify these settings or add additional ones, it is
+# recommended that you do not modify this file; instead, create your own
+# override include file named "rhq-server-wrapper.inc" and place it in the
+# same directory where this file is located.
+#
+# See http://wrapper.tanukisoftware.org/doc/english/properties.html
+# for full documentation on all available wrapper.* settings
+#*****************************************************************************
+
+#*****************************************************************************
+# Environment Variables Required
+#
+# All of the below environment variables may be either specified in the
+# process environment or in the wrapper environment configuration file or on
+# the command line. The wrapper environment configuration file must be
+# named "rhq-server-wrapper.env" and must be placed in the same directory
+# where this file is located.
+#
+# Note that all paths must be full, absolute paths unless noted otherwise.
+#
+# set.RHQ_SERVER_HOME                 - RHQ Server installation directory
+# set.RHQ_SERVER_INSTANCE_NAME        - A name to identify the RHQ Server
+# set.RHQ_SERVER_JAVA_EXE_FILE_PATH   - Java executable
+# set.RHQ_SERVER_OS_PLATFORM          - The operating system platform name
+# set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH - The Java Service Wrapper's log file (helpful if installing, uninstalling or starting fails)
+#*****************************************************************************
+
+# Load in the specific environment for the RHQ Server instance to start
+#include %RHQ_SERVER_HOME%/bin/wrapper/rhq-server-wrapper.env
+
+#*****************************************************************************
+# Start Properties
+#*****************************************************************************
+# Java JVM Executable (quotes not needed)
+wrapper.java.command=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+
+# Java Main class. This class must implement the WrapperListener interface. (quotes not needed)
+wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
+
+# Java Classpath (include wrapper.jar). Add classpath elements starting at 1 (quotes not needed)
+wrapper.java.classpath.1=%RHQ_SERVER_HOME%/bin/wrapper/%RHQ_SERVER_OS_PLATFORM%/wrapper.jar
+
+# Java Library Path (location of wrapper.dll/libwrapper.so and other JNI libs) (quotes not needed)
+wrapper.java.library.path.1=%RHQ_SERVER_HOME%/bin/wrapper/%RHQ_SERVER_OS_PLATFORM%
+
+# The RHQ Server starts the JBossAS container
+wrapper.app.parameter.1=-jar
+wrapper.app.parameter.2="%RHQ_SERVER_HOME%/jbossas/jboss-modules.jar"
+
+# Additional command line arguments to be passed to the RHQ Server/JBossAS container (quotes ARE needed)
+wrapper.app.parameter.3=-mp
+wrapper.app.parameter.4="%RHQ_SERVER_HOME%/jbossas/modules"
+wrapper.app.parameter.5=-jaxpmodule
+wrapper.app.parameter.6=javax.xml.jaxp-provider
+wrapper.app.parameter.7=org.jboss.as.standalone
+wrapper.app.parameter.8="-Djboss.home.dir=%RHQ_SERVER_HOME%/jbossas"
+wrapper.app.parameter.9=-P
+wrapper.app.parameter.10="%RHQ_SERVER_HOME%/bin/rhq-server.properties"
+
+# Additional JVM parameters (quotes ARE needed)
+wrapper.java.additional.1="-D[Standalone]"
+wrapper.java.additional.2=-Dapp.name=rhq-server
+wrapper.java.additional.3=-server
+wrapper.java.additional.4=-Xms1024M
+wrapper.java.additional.5=-Xmx1024M
+wrapper.java.additional.6=-XX:PermSize=256M
+wrapper.java.additional.7=-XX:MaxPermSize=256M
+wrapper.java.additional.8=-XX:+TieredCompilation
+wrapper.java.additional.9=-XX:+UseCompressedOops
+wrapper.java.additional.10=-Djava.net.preferIPv4Stack=true
+wrapper.java.additional.11=-Dorg.jboss.resolver.warning=true
+wrapper.java.additional.12=-Dsun.rmi.dgc.client.gcInterval=3600000
+wrapper.java.additional.13=-Dsun.rmi.dgc.server.gcInterval=3600000
+wrapper.java.additional.14=-Djboss.modules.system.pkgs=org.jboss.byteman
+wrapper.java.additional.15=-Djava.awt.headless=true
+wrapper.java.additional.16=-Djboss.server.default.config=standalone.xml
+wrapper.java.additional.17="-Dorg.jboss.boot.log.file=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%/jbossas-boot.log"
+wrapper.java.additional.18="-Dlogging.configuration=file:%RHQ_SERVER_HOME%/jbossas/standalone/configuration/logging.properties"
+wrapper.java.additional.19=-Dsun.lang.ClassLoader.allowArraySyntax=true
+wrapper.java.additional.20=-Djava.security.manager
+# the double equals for the policy file specification IS INTENTIONAL
+wrapper.java.additional.21="-Djava.security.policy==%RHQ_SERVER_HOME%/bin/rhq-server.security-policy"
+# Don't need these now, but this is commented out in case we need to add an endorsed dir in the future
+#wrapper.java.additional.22="-Djava.endorsed.dirs=%RHQ_SERVER_HOME%/jbossas/lib/endorsed"
+
+# We want to make sure the Server starts in the JBossAS bin directory
+wrapper.working.dir=%RHQ_SERVER_HOME%/jbossas/bin
+
+#*****************************************************************************
+# Wrapper Logging Properties
+#*****************************************************************************
+# if TRUE, this will turn logging level immediately to DEBUG
+wrapper.debug=FALSE
+
+# Format of output for the console.  (See docs for formats)
+wrapper.console.format=M
+
+# Log Level for console output. (NONE,DEBUG,STATUS,INFO,ERROR,FATAL)
+wrapper.console.loglevel=INFO
+
+# Log file to use for wrapper output logging. (quotes not needed)
+wrapper.logfile=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%/rhq-server-wrapper.log
+
+# Format of output for the log file.  (See docs for formats)
+wrapper.logfile.format=LPTM
+
+# Log Level for log file output. (NONE,DEBUG,STATUS,INFO,ERROR,FATAL)
+wrapper.logfile.loglevel=ERROR
+
+# 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=1
+
+# Log Level for sys/event log output.  (See docs for log levels)
+wrapper.syslog.loglevel=NONE
+
+# if JVM hangs, this tries to get a thread dump
+# (if TRUE, then ntservice.console is forced to TRUE as well)
+wrapper.request_thread_dump_on_failed_jvm_exit=FALSE
+
+#*****************************************************************************
+# Wrapper Windows Properties
+#*****************************************************************************
+# Title to use when running as a console
+wrapper.console.title=RHQ Server [%RHQ_SERVER_INSTANCE_NAME%]
+
+#*****************************************************************************
+# Wrapper Windows 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=%RHQ_SERVER_INSTANCE_NAME%
+
+# Display name of the service
+wrapper.ntservice.displayname=RHQ Server [%RHQ_SERVER_INSTANCE_NAME%]
+
+# Description of the service
+wrapper.ntservice.description=RHQ Server instance named %RHQ_SERVER_INSTANCE_NAME%
+
+# 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 service to interact with desktop (must be FALSE if account is specified)
+wrapper.ntservice.interactive=FALSE
+
+# Show a console - only takes effect if interactive is TRUE
+wrapper.ntservice.console=FALSE
+
+# The service runs as this user; Local System account is used if not specified
+# If prompt is true, the user will be prompted for the password.  If false,
+# the password configuration property will be used.
+#wrapper.ntservice.account=.\username
+wrapper.ntservice.password.prompt=TRUE
+#wrapper.ntservice.password=xyz
+
+#*****************************************************************************
+# Wrapper UNIX Service Properties
+#*****************************************************************************
+# For UNIX, make sure it is daemonized
+wrapper.daemonize=TRUE
+
+#*****************************************************************************
+# Wrapper Shutdown Monitoring Properties
+#*****************************************************************************
+# File to be monitored - when anchor file is deleted, the instance will shutdown
+#wrapper.anchorfile=%RHQ_SERVER_HOME%\bin\anchor
+#wrapper.anchor.poll_interval=5
+
+# auto-restart on weird exit status - if exiting normally, just shutdown
+wrapper.on_exit.default=RESTART
+wrapper.on_exit.0=SHUTDOWN
+
+# immediately restart the JVM when java.lang.OutOfMemoryError is detected in its output
+wrapper.filter.trigger.1=java.lang.OutOfMemoryError
+wrapper.filter.action.1=RESTART
+
+# Determine when to restart or if an invocation simply failed on startup
+wrapper.max_failed_invocations=2
+wrapper.successful_invocation_time=300
+wrapper.startup.timeout=30
+
+# How to poll the VM to make sure it is not hung
+wrapper.ping.interval=30
+wrapper.ping.timeout=45
+wrapper.cpu.timeout=10
+
+# Allow our server some extra time to shutdown, since it may take a while to clear the comm repo
+wrapper.shutdown.timeout=180
+wrapper.jvm_exit.timeout=180
+
+#*****************************************************************************
+# Wrapper Override Properties
+# wrapper.XXX properties defined in this included file override any
+# properties previously defined above.
+#*****************************************************************************
+#include %RHQ_SERVER_HOME%/bin/wrapper/rhq-server-wrapper.inc
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.dll b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.dll
new file mode 100644
index 0000000..37c4f33
Binary files /dev/null and b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.dll differ
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.exe b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.exe
new file mode 100644
index 0000000..a46a2ac
Binary files /dev/null and b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.exe differ
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.jar b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.jar
new file mode 100644
index 0000000..c766405
Binary files /dev/null and b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/windows-x86_32/wrapper.jar differ
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
new file mode 100644
index 0000000..060f39c
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
@@ -0,0 +1,16 @@
+#
+# Additional dev-only options for the RHQ Server Java Service Wrapper
+#
+
+# enable remote debugging
+wrapper.java.additional.22=-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
+
+# enable jprofiler
+#set.PATH=%PATH%;<jprofiler-install-dir>\bin\windows
+#wrapper.java.additional.23=-agentlib:jprofilerti=port=8849
+#wrapper.java.additional.24=-Xbootclasspath/a:<jprofiler-install-dir>\bin\agent.jar
+
+# disable JVM startup timeout
+wrapper.startup.timeout=0
+# disable JVM ping timeout
+wrapper.ping.timeout=0
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index e4888b4..eded774 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -199,6 +199,11 @@
         <delete dir="${jboss.home}/standalone/tmp" />
         <delete dir="${jboss.home}/standalone/work" /> <!-- TODO: does AS7 still have this? -->
 
+        <echo>Delete unused configurations</echo>
+        <delete file="${jboss.home}/standalone/configuration/standalone-ha.xml" />
+        <delete file="${jboss.home}/standalone/configuration/standalone-full.xml" />
+        <delete file="${jboss.home}/standalone/configuration/standalone-full-ha.xml" />
+
         <!-- TODO: we need to put Quartz in the ear and deploy a scheduler sar -->
         <!--
         <echo>Upgrading Quartz to v${quartz.version} ...</echo>




More information about the rhq-commits mailing list