[rhq] modules/core
by Jay Shaughnessy
modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java | 62 +++++-----
1 file changed, 37 insertions(+), 25 deletions(-)
New commits:
commit d7b95c57a3dca634a417dde8cd005f524d83c9d3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 19 17:26:31 2013 -0400
Bug 1007530 - Installer prints hundreds of database errors when performing install leading user to believe install is unstable/failed
An attempt at a sort of hack-fix. I don't think there is a clean way to do this, really.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java
index b426361..c3bd236 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -37,9 +38,10 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+
import mazz.i18n.Logger;
import mazz.i18n.Msg;
-import org.rhq.core.db.ExtendedSQLException;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -47,11 +49,13 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
+
import org.rhq.core.db.DatabaseType;
import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.db.DbUtil;
import org.rhq.core.db.DbUtilsI18NFactory;
import org.rhq.core.db.DbUtilsI18NResourceKeys;
+import org.rhq.core.db.ExtendedSQLException;
import org.rhq.core.db.TypeMap;
/**
@@ -113,14 +117,14 @@ public class DBSetup {
m_connection = connection;
m_databaseType = DatabaseTypeFactory.getDatabaseType(connection);
m_consoleMode = false;
-
+
// MySQL complains if autocomit is true and you try to commit.
// DDL operations are not transactional anyhow.
m_connection.setAutoCommit(false);
-
+
m_doDisconnect = false;
}
-
+
/**
* A console application that can be used to run the DBSetup from a command line. The arguments are as follows:
*
@@ -419,8 +423,8 @@ public class DBSetup {
// Make sure we have a DBSetup XML file.
if (node_root.getNodeName().equalsIgnoreCase(DBSETUP_ROOT_ELEMENT_NAME) == false) {
if (source instanceof String) {
- throw new IOException(LOG.getMsgString(DbUtilsI18NResourceKeys.DBSETUP_SOURCE_NOT_VALID, source
- .toString()));
+ throw new IOException(LOG.getMsgString(DbUtilsI18NResourceKeys.DBSETUP_SOURCE_NOT_VALID,
+ source.toString()));
}
throw new IOException(LOG.getMsgString(DbUtilsI18NResourceKeys.DBSETUP_SOURCE_NOT_VALID, "<stream>"));
@@ -443,8 +447,8 @@ public class DBSetup {
if (fileInclude.isAbsolute() == false) {
if (!(source instanceof String)) {
- throw new IOException(LOG
- .getMsgString(DbUtilsI18NResourceKeys.DBSETUP_PATHS_NOT_RELATIVE_TO_STREAM));
+ throw new IOException(
+ LOG.getMsgString(DbUtilsI18NResourceKeys.DBSETUP_PATHS_NOT_RELATIVE_TO_STREAM));
}
fileInclude = new File(source_file.getParentFile(), nodeMap.getNodeValue());
@@ -553,8 +557,8 @@ public class DBSetup {
index.getTable().getName());
created_indexes++;
} catch (SQLException e) {
- handleFatalSQLException(e, DbUtilsI18NResourceKeys.DBSETUP_CREATED_INDEX_ERROR, index
- .getName(), index.getTable().getName());
+ handleFatalSQLException(e, DbUtilsI18NResourceKeys.DBSETUP_CREATED_INDEX_ERROR,
+ index.getName(), index.getTable().getName());
}
}
}
@@ -692,8 +696,8 @@ public class DBSetup {
} catch (SQLException e) {
failed_tables_count++;
failed_tables.add(table); // add it to the list so we try to clear it again in our second pass
- log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_CLEARED_TABLE_ERROR_FIRST_PASS, table
- .getName(), DbUtil.getSQLExceptionString(e));
+ log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_CLEARED_TABLE_ERROR_FIRST_PASS,
+ table.getName(), DbUtil.getSQLExceptionString(e));
}
}
@@ -715,8 +719,8 @@ public class DBSetup {
log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_CLEARED_TABLE, table.getName());
} catch (SQLException e) {
// crap - there is still a problem causing us to be unable to clear the data
- log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_CLEARED_TABLE_ERROR_SECOND_PASS, table
- .getName(), DbUtil.getSQLExceptionString(e));
+ log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_CLEARED_TABLE_ERROR_SECOND_PASS,
+ table.getName(), DbUtil.getSQLExceptionString(e));
}
}
}
@@ -770,8 +774,7 @@ public class DBSetup {
log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_DROPPED_VIEW, view.getName());
} catch (SQLException e) {
failed_views++;
- log(LogPriority.ERROR, DbUtilsI18NResourceKeys.DBSETUP_DROPPED_VIEW_ERROR, view.getName(), DbUtil
- .getSQLExceptionString(e));
+ logDropFailureIfNecessary(DbUtilsI18NResourceKeys.DBSETUP_DROPPED_VIEW_ERROR, view.getName(), e);
}
}
@@ -789,8 +792,7 @@ public class DBSetup {
log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_DROPPED_TABLE, table.getName());
} catch (SQLException e) {
failed_tables++;
- log(LogPriority.ERROR, DbUtilsI18NResourceKeys.DBSETUP_DROPPED_TABLE_ERROR, table.getName(), DbUtil
- .getSQLExceptionString(e));
+ logDropFailureIfNecessary(DbUtilsI18NResourceKeys.DBSETUP_DROPPED_TABLE_ERROR, table.getName(), e);
}
}
@@ -811,6 +813,16 @@ public class DBSetup {
return ret_ok;
}
+ // skip logging an error if the drop failure is due to the object not existing
+ private void logDropFailureIfNecessary(String I18NKey, String objectName, SQLException e) {
+ String sqlExceptionString = DbUtil.getSQLExceptionString(e);
+ if (null != sqlExceptionString && sqlExceptionString.toLowerCase().contains("does not exist")) {
+ return;
+ }
+
+ log(LogPriority.ERROR, I18NKey, objectName, sqlExceptionString);
+ }
+
/**
* Exports an existing schema to a DBSetup XML file.
*
@@ -858,8 +870,8 @@ public class DBSetup {
while (iterCols.hasNext() == true) {
Column col = (Column) iterCols.next();
- log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_EXPORT_FOUND_COLUMN, table.getName(), col
- .getName());
+ log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_EXPORT_FOUND_COLUMN, table.getName(),
+ col.getName());
Element elemChild = doc.createElement("column");
elemChild.setAttribute("name", col.getName());
@@ -969,8 +981,8 @@ public class DBSetup {
* @see ErrorHandler#warning(SAXParseException)
*/
public void warning(SAXParseException e) throws SAXException {
- log(LogPriority.WARN, e, DbUtilsI18NResourceKeys.DBSETUP_SAX_WARNING, e.getLineNumber(), e
- .getColumnNumber(), e.getMessage());
+ log(LogPriority.WARN, e, DbUtilsI18NResourceKeys.DBSETUP_SAX_WARNING, e.getLineNumber(),
+ e.getColumnNumber(), e.getMessage());
}
}
@@ -1039,7 +1051,7 @@ public class DBSetup {
}
long duration = System.currentTimeMillis() - start;
-// log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_DURATION, duration);
+ // log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_DURATION, duration);
// Reset the commit option
this.getConnection().setAutoCommit(committing);
@@ -1087,7 +1099,7 @@ public class DBSetup {
if (m_connection != null) {
return m_connection;
}
-
+
m_connection = DbUtil.getConnection(m_jdbcUrl, m_username, m_password);
try {
@@ -1119,7 +1131,7 @@ public class DBSetup {
if (!m_doDisconnect) {
return;
}
-
+
try {
m_connection.close();
} catch (Exception e) {
10 years, 9 months
[rhq] modules/enterprise
by mazz
modules/enterprise/server/appserver/pom.xml | 2
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat | 159 ++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.sh | 241 +++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server-console.bat | 2
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat | 218 +++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.security-policy | 10
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh | 622 +++++++++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat | 202 +++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.sh | 243 +++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat | 238 +++
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat | 160 --
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh | 242 ---
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server-console.bat | 5
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat | 219 ---
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 | 623 ----------
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.bat | 203 ---
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.sh | 244 ---
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage.bat | 239 ---
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 1
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java | 8
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java | 2
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java | 20
23 files changed, 1975 insertions(+), 1938 deletions(-)
New commits:
commit 3ef678248e1205dd7f64a6088756ebce0f91eca6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 19 17:07:00 2013 -0400
BZ 1006347 move the "real" start scripts into bin/internal.
The scripts in bin/ are obsoleted versions that spit out errors
and exit codes so people know not to use them.
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index 4063181..421ae6c 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -288,7 +288,7 @@
<!-- Make sure shell scripts are readable and executable. -->
<chmod perm="ug+x" verbose="true">
- <fileset dir="${deployment.dir}/bin" includes="*.sh,rhqctl" />
+ <fileset dir="${deployment.dir}/bin" includes="**/*.sh,rhqctl" />
<fileset dir="${deployment.dir}/jbossas/bin" includes="*.sh" />
</chmod>
</target>
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat
new file mode 100644
index 0000000..6f19e3c
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat
@@ -0,0 +1,159 @@
+@echo off
+
+rem ===========================================================================
+rem RHQ Server Windows Install Script
+rem
+rem This file is used to complete the installation of the RHQ Server on a
+rem Windows platform.
+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
+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_INSTALLER_JAVA_OPTS - Java VM command line options to be
+rem passed into the Java VM. If this is not defined
+rem this script will pass in a default set of options.
+rem If you only want to add options to the defaults,
+rem then you will want to use
+rem RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS instead.
+rem
+rem RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
+rem line options to be passed into the VM.
+rem This is added to
+rem RHQ_SERVER_INSTALLER_JAVA_OPTS; it
+rem is mainly used to augment the
+rem default set of options. This can be
+rem left unset if it is not needed.
+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 ===========================================================================
+
+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
+)
+
+if not exist "%RHQ_SERVER_HOME%\jbossas\jboss-modules.jar" (
+ echo ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ instance
+ echo Missing %RHQ_SERVER_HOME%\jboss-modules.jar
+ exit /B 1
+)
+
+rem ----------------------------------------------------------------------
+rem Determine the logs directory
+rem ----------------------------------------------------------------------
+
+set _LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
+
+rem ----------------------------------------------------------------------
+rem Prepare the VM command line options to be passed in
+rem ----------------------------------------------------------------------
+
+if not defined RHQ_SERVER_INSTALLER_JAVA_OPTS set RHQ_SERVER_INSTALLER_JAVA_OPTS=-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true
+
+rem Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_INSTALLER_JAVA_OPTS.
+if defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=DEBUG
+if not defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=INFO
+set RHQ_SERVER_INSTALLER_JAVA_OPTS=%RHQ_SERVER_INSTALLER_JAVA_OPTS% -Djava.awt.headless=true -Di18nlog.logger-type=commons -Drhq.server.properties-file=%RHQ_SERVER_HOME%\bin\rhq-server.properties -Drhq.server.installer.logdir=%RHQ_SERVER_HOME%\logs -Drhq.server.installer.loglevel=%_RHQ_LOGLEVEL%
+
+rem Sample JPDA settings for remote socket debugging
+rem set RHQ_SERVER_INSTALLER_JAVA_OPTS=%RHQ_SERVER_INSTALLER_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
+
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTALLER_JAVA_OPTS: %RHQ_SERVER_INSTALLER_JAVA_OPTS%
+if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS: %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS%
+
+rem ----------------------------------------------------------------------
+rem We need to add our own modules to the core set of JBossAS modules.
+rem ----------------------------------------------------------------------
+set _RHQ_MODULES_PATH=%RHQ_SERVER_HOME%\modules
+set _INTERNAL_MODULES_PATH=%RHQ_SERVER_HOME%\jbossas\modules
+set _JBOSS_MODULEPATH=%_RHQ_MODULES_PATH%;%_INTERNAL_MODULES_PATH%
+if defined RHQ_SERVER_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH%
+
+rem start the AS instance with our main installer module
+"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" %RHQ_SERVER_INSTALLER_JAVA_OPTS% %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar "%RHQ_SERVER_HOME%\jbossas\jboss-modules.jar" -mp "%_JBOSS_MODULEPATH%" org.rhq.rhq-installer-util %*
+
+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/internal/rhq-installer.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.sh
new file mode 100755
index 0000000..3aa29df
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.sh
@@ -0,0 +1,241 @@
+#!/bin/sh
+
+# =============================================================================
+# RHQ Server UNIX Install Script
+#
+# This file is used to complete the installation of the RHQ Server on a
+# UNIX platform.
+#
+# This script is customizable by setting the following environment variables:
+#
+# 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_JBOSS_HOME - The location of the AS instance that will
+# host RHQ. If this is set, it overrides any
+# JBOSS_HOME that might be set. If this not
+# set, JBOSS_HOME is used as a fallback. If
+# neither is set, it is assumed the AS bundled
+# under RHQ_SERVER_HOME/jbossas is to be used.
+#
+# 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_INSTALLER_JAVA_OPTS - Java VM command line options to be
+# passed into the Java VM. If this is not defined
+# this script will pass in a default set of options.
+# If you only want to add options to the defaults,
+# then you will want to use
+# RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS instead.
+#
+# RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
+# line options to be passed into the VM.
+# This is added to
+# RHQ_SERVER_INSTALLER_JAVA_OPTS; it
+# is mainly used to augment the
+# default set of options. This can be
+# left unset if it is not needed.
+#
+# 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.
+# =============================================================================
+
+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
+}
+
+# ----------------------------------------------------------------------
+# 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
+
+# only certain platforms support the -e argument for readlink
+if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
+ _READLINK_ARG="-e"
+fi
+
+# ----------------------------------------------------------------------
+# 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/internal directory.
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_HOME" ]; then
+ _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"
+
+# ----------------------------------------------------------------------
+# Determine what JBossAS instance to use.
+# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
+# assume we are to run the embedded AS instance from the RHQ
+# installation directory - RHQ_SERVER_HOME/jbossas
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then
+ if [ -z "$JBOSS_HOME" ]; then
+ RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas"
+ else
+ if [ ! -d "$JBOSS_HOME" ]; then
+ echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory"
+ echo "JBOSS_HOME: $JBOSS_HOME"
+ exit 1
+ fi
+ RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}"
+ fi
+else
+ if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then
+ echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory"
+ echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
+ exit 1
+ fi
+fi
+
+cd "$RHQ_SERVER_JBOSS_HOME"
+RHQ_SERVER_JBOSS_HOME=`pwd`
+
+debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
+
+if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then
+ echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance"
+ echo "Missing ${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar"
+ exit 1
+fi
+
+# we want the rest of this script to be able to assume cwd is the RHQ install dir
+cd "$RHQ_SERVER_HOME"
+
+# ----------------------------------------------------------------------
+# 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
+
+# ----------------------------------------------------------------------
+# Prepare the VM command line options to be passed in
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_INSTALLER_JAVA_OPTS" ]; then
+ RHQ_SERVER_INSTALLER_JAVA_OPTS="-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true"
+fi
+
+# Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_INSTALLER_JAVA_OPTS.
+if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then
+ _RHQ_LOGLEVEL="DEBUG"
+else
+ _RHQ_LOGLEVEL="INFO"
+fi
+
+RHQ_SERVER_INSTALLER_JAVA_OPTS="${RHQ_SERVER_INSTALLER_JAVA_OPTS} -Djava.awt.headless=true -Di18nlog.logger-type=commons -Drhq.server.properties-file=${RHQ_SERVER_HOME}/bin/rhq-server.properties -Drhq.server.installer.logdir=${RHQ_SERVER_HOME}/logs -Drhq.server.installer.loglevel=${_RHQ_LOGLEVEL} -Drhq.server.basedir=${RHQ_SERVER_HOME}"
+
+# Sample JPDA settings for remote socket debugging
+#RHQ_SERVER_INSTALLER_JAVA_OPTS="${RHQ_SERVER_INSTALLER_JAVA_OPTS} -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
+
+debug_msg "RHQ_SERVER_INSTALLER_JAVA_OPTS: $RHQ_SERVER_INSTALLER_JAVA_OPTS"
+debug_msg "RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS: $RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS"
+
+# ----------------------------------------------------------------------
+# We need to add our own modules to the core set of JBossAS modules.
+# ----------------------------------------------------------------------
+_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules"
+_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules"
+if [ -n "$_CYGWIN" ]; then
+ _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"`
+ _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"`
+fi
+_JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}"
+debug_msg "_JBOSS_MODULEPATH: $_JBOSS_MODULEPATH"
+
+# start the AS instance with our main installer module
+"$RHQ_SERVER_JAVA_EXE_FILE_PATH" ${RHQ_SERVER_INSTALLER_JAVA_OPTS} ${RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS} -jar "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" -mp "$_JBOSS_MODULEPATH" org.rhq.rhq-installer-util "$@"
+
+_EXIT_STATUS=$?
+exit $_EXIT_STATUS
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server-console.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server-console.bat
new file mode 100644
index 0000000..7f56679
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/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/internal/rhq-server.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
new file mode 100644
index 0000000..aa7de4b
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
@@ -0,0 +1,218 @@
+@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, JAVA_HOME 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.
+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. It is
+rem important to also set RHQ_SERVER_PASSWORD for the
+rem current user account.
+rem
+rem RHQ_SERVER_RUN_AS_ME - if defined, then when the Windows Service is
+rem installed, the domain\username of the user that the Windows
+rem Service will run as will be the current user (.\%USERNAME%).
+rem This takes precedence over RHQ_SERVER_RUN_AS. It is
+rem important to also set RHQ_SERVER_PASSWORD for the
+rem current user account.
+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 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 (
+ if defined RHQ_STORAGE_DEBUG echo No JRE found - will try to use JAVA_HOME: %JAVA_HOME%
+ set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
+ )
+)
+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_STORAGE_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
+if defined RHQ_STORAGE_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 not defined 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 not defined RHQ_SERVER_WRAPPER_LOG_DIR_PATH (
+ set RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
+)
+if not exist "%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" (
+ mkdir "%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%"
+)
+
+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%"
+rem This service is typically installed by rhqctl, so assume we don't want to prompt
+if not defined RHQ_SERVER_PASSWORD_PROMPT set RHQ_SERVER_PASSWORD_PROMPT=false
+
+if /i "%1"=="console" (
+ rem START SERVER
+ "%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" (
+ rem START SERVER
+ "%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 exits this script normally
+rem ----------------------------------------------------------------------
+
+:done
+endlocal
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.security-policy b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.security-policy
new file mode 100644
index 0000000..8860b47
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/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/internal/rhq-server.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
new file mode 100755
index 0000000..2b37aac
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
@@ -0,0 +1,622 @@
+#!/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_JBOSS_HOME - The location of the AS instance that will
+# host RHQ. If this is set, it overrides any
+# JBOSS_HOME that might be set. If this not
+# set, JBOSS_HOME is used as a fallback. If
+# neither is set, it is assumed the AS bundled
+# under RHQ_SERVER_HOME/jbossas is to be used.
+#
+# 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, JAVA_HOME 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.
+#
+# 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.
+#
+# RHQ_SERVER_STOP_DELAY - the number of minutes to wait for the server to go
+# down after sending the TERM signal. Defaults to
+# 5 minutes.
+#
+# RHQ_SERVER_KILL_AFTER_STOP_DELAY - If this is defined, the server will be
+# killed if it is still running after the
+# RHQ_SERVER_STOP_DELAY. If this is not
+# defined or set to "false" the script
+# will exit with error code 127.
+#
+#
+#
+# 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
+# RHQ_SERVER_STOP_DELAY=5
+# RHQ_SERVER_KILL_AFTER_STOP_DELAY=false
+
+# ----------------------------------------------------------------------
+# 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"
+
+# ----------------------------------------------------------------------
+# 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=`printf "%-30s (pid %-7s) IS %s" "RHQ Server" $_SERVER_PID $1`
+ _SERVER_RUNNING=1
+ else
+ _SERVER_STATUS=`printf "%-30s (pid %-7s) IS NOT running" "RHQ Server" $_SERVER_PID`
+ _SERVER_RUNNING=0
+ fi
+ else
+ _SERVER_STATUS=`printf "%-30s (no pid file) IS NOT running" "RHQ Server"`
+ _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=`printf "%-30s (pid %-7s) IS %s" "JBossAS Java VM child process" $_SERVER_PID $1`
+ _JVM_RUNNING=1
+ else
+ _JVM_STATUS=`printf "%-30s (pid %-7s) IS NOT running" "JBossAS Java VM child process" $_SERVER_PID`
+ _JVM_RUNNING=0
+ fi
+ else
+ _JVM_STATUS=`printf "%-30s (no pid file) IS NOT running" "JBossAS Java VM child process"`
+ _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
+}
+
+# ----------------------------------------------------------------------
+# Unset any lingering JBossAS environment variables that were set in
+# the user's environment. This might happen if the user has an external
+# JBossAS installed and configured but doesn't want RHQ to use it.
+# ----------------------------------------------------------------------
+unset_jboss_as_env ()
+{
+ unset JBOSS_HOME
+ unset RUN_CONF
+ unset JAVAC_JAR
+ unset JBOSS_CLASSPATH
+ unset JBOSS_BASE_DIR
+ unset JBOSS_LOG_DIR
+ unset JBOSS_CONFIG_DIR
+}
+
+# ----------------------------------------------------------------------
+# Kill RHQ Server
+# ----------------------------------------------------------------------
+
+kill_rhq_server ()
+{
+ 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."
+}
+
+# ----------------------------------------------------------------------
+# 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
+
+# only certain platforms support the -e argument for readlink
+if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
+ _READLINK_ARG="-e"
+fi
+
+# ----------------------------------------------------------------------
+# 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/internal directory.
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_HOME" ]; then
+ _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"
+
+# ----------------------------------------------------------------------
+# Determine what JBossAS instance to use.
+# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
+# assume we are to run the embedded AS instance from the RHQ
+# installation directory - RHQ_SERVER_HOME/jbossas
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then
+ if [ -z "$JBOSS_HOME" ]; then
+ RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas"
+ # Unset any lingering JBossAS environment variables that we don't want.
+ # These could be in the user's environment for an external AS install.
+ unset_jboss_as_env
+ else
+ if [ ! -d "$JBOSS_HOME" ]; then
+ echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory"
+ echo "JBOSS_HOME: $JBOSS_HOME"
+ exit 1
+ fi
+ RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}"
+ fi
+else
+ if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then
+ echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory"
+ echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
+ exit 1
+ fi
+ unset_jboss_as_env
+fi
+
+cd "$RHQ_SERVER_JBOSS_HOME"
+RHQ_SERVER_JBOSS_HOME=`pwd`
+
+debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
+
+
+if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then
+ echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid RHQ Server"
+ echo "Missing ${RHQ_SERVER_JBOSS_HOME}/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
+ debug_msg "No JRE found - will try to use JAVA_HOME: $JAVA_HOME"
+ RHQ_SERVER_JAVA_HOME="$JAVA_HOME"
+ 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
+
+if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then
+ _JBOSS_DEBUG_LOGGING="-Djboss.boot.server.log.level=DEBUG -Djboss.boot.server.log.console.level=DEBUG"
+else
+ _JBOSS_DEBUG_LOGGING=
+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
+_HTTP_COMPRESSION="-Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES=text/javascript,text/css,text/html"
+RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS} -Drhq.server.home=${RHQ_SERVER_HOME} -Djboss.server.log.dir=${_LOG_DIR_PATH} -Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true -Djboss.server.default.config=standalone-full.xml -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager -Djava.security.policy==${RHQ_SERVER_HOME}/bin/internal/rhq-server.security-policy ${_HTTP_COMPRESSION} ${_JBOSS_DEBUG_LOGGING}"
+
+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"
+
+# ----------------------------------------------------------------------
+# We need to add our own modules to the core set of JBossAS modules.
+# JBOSS_MODULEPATH tells standalone.sh what to use.
+# ----------------------------------------------------------------------
+_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules"
+_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules"
+if [ -n "$_CYGWIN" ]; then
+ _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"`
+ _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"`
+fi
+JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}"
+export JBOSS_MODULEPATH
+debug_msg "JBOSS_MODULEPATH: $JBOSS_MODULEPATH"
+
+# ----------------------------------------------------------------------
+# Now find the JBossAS standalone.sh script
+# ----------------------------------------------------------------------
+
+_JBOSS_RUN_SCRIPT="${RHQ_SERVER_JBOSS_HOME}/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/internal"
+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 SERVER
+ # first, make sure its working directory is the JBossAS bin directory
+ cd "${RHQ_SERVER_JBOSS_HOME}/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 SERVER
+ # first, make sure its working directory is the JBossAS bin directory
+ cd "${RHQ_SERVER_JBOSS_HOME}/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..."
+
+ kill -TERM $_SERVER_PID
+
+ if [ -z "$RHQ_SERVER_STOP_DELAY" ]; then
+ # RHQ_SERVER_STOP_DELAY is not set
+ RHQ_SERVER_STOP_DELAY=5
+ fi
+ case $RHQ_SERVER_STOP_DELAY in
+ ''|*[!0-9]*)
+ echo "RHQ_SERVER_STOP_DELAY is not a number (value=${RHQ_SERVER_STOP_DELAY})"
+ echo "Applying default value (5 minutes)"
+ RHQ_SERVER_STOP_DELAY=5
+ ;;
+ *) ;;
+ esac
+ if [ $RHQ_SERVER_STOP_DELAY -le 0 ]; then
+ echo "RHQ_SERVER_STOP_DELAY is less than or equal to zero (value=${RHQ_SERVER_STOP_DELAY})"
+ echo "Applying default value (5 minutes)"
+ RHQ_SERVER_STOP_DELAY=5
+ fi
+ waited_seconds=0
+ max_wait_seconds=$(expr $RHQ_SERVER_STOP_DELAY \* 60)
+ while [ "$_SERVER_RUNNING" -eq "1" ] && [ $waited_seconds -lt $max_wait_seconds ]; do
+ sleep 2s
+ waited_seconds=$(expr $waited_seconds + 2)
+ check_status "stopping..."
+ done
+
+ if [ "$_SERVER_RUNNING" = "0" ]; then
+ remove_pid_files
+ echo "RHQ Server has stopped."
+ exit 0
+ fi
+
+ debug_msg "RHQ Server did not stop within $RHQ_SERVER_STOP_DELAY minutes."
+ echo "Timed out waiting for RHQ Server to stop."
+ kill -QUIT $_SERVER_PID # Generate thread dump for later investigation
+
+ if [ -n "$RHQ_SERVER_KILL_AFTER_STOP_DELAY" ] && [ "$RHQ_SERVER_KILL_AFTER_STOP_DELAY" != "false" ]; then
+ kill_rhq_server
+ exit 0
+ else
+ echo "Failed to stop RHQ Server"
+ exit 127
+ fi
+ ;;
+
+'kill')
+ if [ "$_SERVER_RUNNING" = "0" ]; then
+ echo "$_SERVER_STATUS"
+ fi
+ if [ "$_JVM_RUNNING" = "0" ]; then
+ echo "$_JVM_STATUS"
+ remove_pid_files
+ exit 0
+ fi
+
+ kill_rhq_server
+ exit 0
+ ;;
+
+'clean')
+ if [ "$_SERVER_RUNNING" = "1" ]; then
+ echo "$_SERVER_STATUS"
+ echo "Please shutdown the server before cleaning."
+ exit 0
+ fi
+
+ echo "Cleaning data, tmp and log directories..."
+ rm -rf "${RHQ_SERVER_JBOSS_HOME}/standalone/data"
+ rm -rf "${RHQ_SERVER_JBOSS_HOME}/standalone/tmp"
+ rm -rf "${RHQ_SERVER_HOME}/logs"
+ ;;
+
+'status')
+ echo "$_SERVER_STATUS"
+ echo "$_JVM_STATUS"
+ exit 0
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop | kill | status | console | clean }"
+ exit 1
+ ;;
+esac
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
new file mode 100644
index 0000000..6c6534a
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
@@ -0,0 +1,202 @@
+@echo off
+
+rem =============================================================================
+rem RHQ Storage Installer Script
+rem
+rem This file is used to complete the installation of the RHQ storage Server on a
+rem Windows platform.
+rem
+rem This script is customizable by setting the following environment variables:
+rem
+rem RHQ_STORAGE_DEBUG - If this is defined, the script will emit debug
+rem messages. If this is not defined or set to "false"
+rem debug messages are not emitted.
+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_JBOSS_HOME - The location of the AS instance that will
+rem host RHQ. If this is set, it overrides any
+rem JBOSS_HOME that might be set. If this not
+rem set, JBOSS_HOME is used as a fallback. If
+rem neither is set, it is assumed the AS bundled
+rem under RHQ_SERVER_HOME\jbossas is to be used.
+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, JAVA_HOME 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
+rem is used.
+rem
+rem RHQ_STORAGE_INSTALLER_JAVA_OPTS - Java VM command line options to be
+rem passed into the Java VM. If this is not defined
+rem this script will pass in a default set of options.
+rem If you only want to add options to the defaults,
+rem then you will want to use
+rem RHQ_STORAGE_ADDITIONAL_JAVA_OPTS instead.
+rem
+rem RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
+rem line options to be passed into the VM.
+rem This is added to RHQ_STORAGE_JAVA_OPTS; it
+rem is mainly used to augment the
+rem default set of options. This can be
+rem left unset if it is not needed.
+rem
+rem =============================================================================
+
+setlocal
+
+rem if debug variable is set, it is assumed to be on, unless its value is false
+if "%RHQ_STORAGE_DEBUG%" == "false" (
+ set RHQ_STORAGE_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_STORAGE_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME%
+
+rem ----------------------------------------------------------------------
+rem Determine what JBossAS instance to use.
+rem If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
+rem assume we are to run the embedded AS instance from the RHQ
+rem installation directory - RHQ_SERVER_HOME\jbossas
+rem ----------------------------------------------------------------------
+
+if not defined RHQ_SERVER_JBOSS_HOME (
+ if not defined JBOSS_HOME (
+ set RHQ_SERVER_JBOSS_HOME=%RHQ_SERVER_HOME%\jbossas
+ ) else (
+ if not exist "%JBOSS_HOME%" (
+ echo ERROR! JBOSS_HOME is not pointing to a valid AS directory
+ echo JBOSS_HOME: "%JBOSS_HOME%"
+ exit /B 1
+ )
+ set RHQ_SERVER_JBOSS_HOME=%JBOSS_HOME%
+ )
+) else (
+ cd %RHQ_SERVER_JBOSS_HOME% || (
+ echo ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory
+ echo RHQ_SERVER_JBOSS_HOME: "%RHQ_SERVER_JBOSS_HOME%"
+ exit /B 1
+ )
+)
+
+cd %RHQ_SERVER_JBOSS_HOME%
+set RHQ_SERVER_JBOSS_HOME=%CD%
+
+if defined RHQ_STORAGE_DEBUG echo RHQ_SERVER_JBOSS_HOME: %RHQ_SERVER_JBOSS_HOME%
+
+
+if not exist "%RHQ_SERVER_JBOSS_HOME%\jboss-modules.jar" (
+ echo ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance
+ echo Missing "%RHQ_SERVER_JBOSS_HOME%\jboss-modules.jar"
+ exit /B 1
+)
+
+rem we want the rest of this script to be able to assume cwd is the RHQ install dir
+cd "%RHQ_SERVER_HOME%"
+
+
+rem ----------------------------------------------------------------------
+rem Create the logs directory
+rem ----------------------------------------------------------------------
+
+set _LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
+if not exist "%_LOG_DIR_PATH%" (
+ mkdir "%_LOG_DIR_PATH%"
+)
+
+
+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 (
+ if defined RHQ_STORAGE_DEBUG echo No JRE found - will try to use JAVA_HOME: %JAVA_HOME%
+ set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
+ )
+)
+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_STORAGE_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
+if defined RHQ_STORAGE_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 Prepare the VM command line options to be passed in
+rem ----------------------------------------------------------------------
+
+if not defined RHQ_STORAGE_INSTALLER_JAVA_OPTS (
+ set RHQ_STORAGE_INSTALLER_JAVA_OPTS=-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true
+)
+
+rem Add the JVM opts that we always want to specify, whether or not the user set RHQ_CCM_JAVA_OPTS.
+if defined RHQ_STORAGE_DEBUG (
+ set _RHQ_LOGLEVEL=DEBUG
+) else (
+ set _RHQ_LOGLEVEL=INFO
+)
+
+
+rem debugging the logging level now for development/testing
+set RHQ_STORAGE_INSTALLER_JAVA_OPTS=%RHQ_STORAGE_INSTALLER_JAVA_OPTS% -Djava.awt.headless=true -Drhq.server.properties-file=%RHQ_SERVER_HOME%\bin\rhq-server.properties -Drhq.storage.installer.logdir=%RHQ_SERVER_HOME%\logs -Drhq.storage.installer.loglevel=%_RHQ_LOGLEVEL% -Drhq.server.basedir=%RHQ_SERVER_HOME%
+
+rem Sample JPDA settings for remote socket debugging
+rem set RHQ_STORAGE_INSTALLER_JAVA_OPTS=%RHQ_STORAGE_INSTALLER_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
+
+if defined RHQ_STORAGE_DEBUG echo "RHQ_STORAGE_INSTALLER_JAVA_OPTS: %RHQ_STORAGE_INSTALLER_JAVA_OPTS%"
+if defined RHQ_STORAGE_DEBUG echo "RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS: %RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS%"
+
+
+rem ----------------------------------------------------------------------
+rem We need to add our own modules to the core set of JBossAS modules.
+rem ----------------------------------------------------------------------
+set _RHQ_MODULES_PATH=%RHQ_SERVER_HOME%\modules
+set _INTERNAL_MODULES_PATH=%RHQ_SERVER_JBOSS_HOME%\modules
+set _JBOSS_MODULEPATH=%_RHQ_MODULES_PATH%;%_INTERNAL_MODULES_PATH%
+
+if defined RHQ_STORAGE_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH%
+
+
+echo "Starting RHQ Storage Installer ..."
+
+rem start the AS instance with our main installer module
+
+"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" %RHQ_STORAGE_INSTALLER_JAVA_OPTS% %RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar "%RHQ_SERVER_JBOSS_HOME%\jboss-modules.jar" -mp "%_JBOSS_MODULEPATH%" org.rhq.rhq-cassandra-installer %*
+if not errorlevel 1 goto done
+exit /B %ERRORLEVEL%
+
+:done
+endlocal
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.sh
new file mode 100755
index 0000000..8bbc9bb
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.sh
@@ -0,0 +1,243 @@
+#!/bin/sh
+
+# =============================================================================
+# RHQ Storage Installer Script
+#
+# This file is used to complete the installation of the RHQ storage Server on a
+# UNIX platform.
+#
+# This script is customizable by setting the following environment variables:
+#
+# RHQ_STORAGE_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_JBOSS_HOME - The location of the AS instance that will
+# host RHQ. If this is set, it overrides any
+# JBOSS_HOME that might be set. If this not
+# set, JBOSS_HOME is used as a fallback. If
+# neither is set, it is assumed the AS bundled
+# under RHQ_SERVER_HOME/jbossas is to be used.
+#
+# 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_STORAGE_INSTALLER_JAVA_OPTS - Java VM command line options to be
+# passed into the Java VM. If this is not defined
+# this script will pass in a default set of options.
+# If you only want to add options to the defaults,
+# then you will want to use
+# RHQ_STORAGE_ADDITIONAL_JAVA_OPTS instead.
+#
+# RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
+# line options to be passed into the VM.
+# This is added to RHQ_STORAGE_JAVA_OPTS; it
+# is mainly used to augment the
+# default set of options. This can be
+# left unset if it is not needed.
+#
+# 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.
+# =============================================================================
+
+debug_msg ()
+{
+ # if debug variable is set, it is assumed to be on, unless its value is false
+ if [ -n "$RHQ_STORAGE_DEBUG" ] && [ "$RHQ_STORAGE_DEBUG" != "false" ]; then
+ echo $1
+ 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
+
+# only certain platforms support the -e argument for readlink
+if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
+ _READLINK_ARG="-e"
+fi
+
+# ----------------------------------------------------------------------
+# 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 $_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"
+
+# ----------------------------------------------------------------------
+# Determine what JBossAS instance to use.
+# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
+# assume we are to run the embedded AS instance from the RHQ
+# installation directory - RHQ_SERVER_HOME/jbossas
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then
+ if [ -z "$JBOSS_HOME" ]; then
+ RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas"
+ else
+ if [ ! -d "$JBOSS_HOME" ]; then
+ echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory"
+ echo "JBOSS_HOME: $JBOSS_HOME"
+ exit 1
+ fi
+ RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}"
+ fi
+else
+ if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then
+ echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory"
+ echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
+ exit 1
+ fi
+fi
+
+cd "$RHQ_SERVER_JBOSS_HOME"
+RHQ_SERVER_JBOSS_HOME=`pwd`
+
+debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
+
+if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then
+ echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance"
+ echo "Missing ${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar"
+ exit 1
+fi
+
+# we want the rest of this script to be able to assume cwd is the RHQ install dir
+cd "$RHQ_SERVER_HOME"
+
+# ----------------------------------------------------------------------
+# 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
+
+# ----------------------------------------------------------------------
+# Prepare the VM command line options to be passed in
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_STORAGE_INSTALLER_JAVA_OPTS" ]; then
+ RHQ_STORAGE_INSTALLER_JAVA_OPTS="-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true"
+fi
+
+# Add the JVM opts that we always want to specify, whether or not the user set RHQ_CCM_JAVA_OPTS.
+if [ -n "$RHQ_STORAGE_DEBUG" ] && [ "$RHQ_STORAGE_DEBUG" != "false" ]; then
+ _RHQ_LOGLEVEL="DEBUG"
+else
+ _RHQ_LOGLEVEL="INFO"
+fi
+
+# debugging the logging level now for development/testing
+RHQ_STORAGE_INSTALLER_JAVA_OPTS="${RHQ_STORAGE_INSTALLER_JAVA_OPTS} -Djava.awt.headless=true -Drhq.server.properties-file=${RHQ_SERVER_HOME}/bin/rhq-server.properties -Drhq.storage.installer.logdir=${RHQ_SERVER_HOME}/logs -Drhq.storage.installer.loglevel=${_RHQ_LOGLEVEL} -Drhq.server.basedir=${RHQ_SERVER_HOME}"
+
+# Sample JPDA settings for remote socket debugging
+#RHQ_STORAGE_INSTALLER_JAVA_OPTS="${RHQ_STORAGE_INSTALLER_JAVA_OPTS} -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
+
+debug_msg "RHQ_STORAGE_INSTALLER_JAVA_OPTS: $RHQ_STORAGE_INSTALLER_JAVA_OPTS"
+debug_msg "RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS: $RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS"
+
+# ----------------------------------------------------------------------
+# We need to add our own modules to the core set of JBossAS modules.
+# ----------------------------------------------------------------------
+_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules"
+_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules"
+if [ -n "$_CYGWIN" ]; then
+ _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"`
+ _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"`
+fi
+_JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}"
+debug_msg "_JBOSS_MODULEPATH: $_JBOSS_MODULEPATH"
+
+echo "Starting RHQ Storage Installer ..."
+
+# start the AS instance with our main installer module
+"$RHQ_SERVER_JAVA_EXE_FILE_PATH" ${RHQ_STORAGE_INSTALLER_JAVA_OPTS} ${RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS} -jar "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" -mp "$_JBOSS_MODULEPATH" org.rhq.rhq-cassandra-installer "$@"
+
+_EXIT_STATUS=$?
+exit $_EXIT_STATUS
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
new file mode 100644
index 0000000..70cca6c
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
@@ -0,0 +1,238 @@
+@echo off
+
+rem ===========================================================================
+rem RHQ Storage Node (Cassandra) Windows Startup Script
+rem
+rem This file is used to install, start, stop and remove the RHQ Storage Node
+rem (cassandra) Windows Service for the Windows platform. The RHQ Storage node
+rem is actually wrapped by the Java Service Wrapper (JSW) and it is the JSW that
+rem is the actual executable that is registered as the Windows Service.
+rem
+rem This script is customizable by setting the following environment variables:
+rem
+
+rem RHQ_STORAGE_DEBUG - If this is defined, the script will emit debug
+rem messages. If unset or "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_STORAGE_HOME - Defines where the Storage Node's home install directory
+rem is. If not defined, it will be assumed to be
+rem %RHQ_SERVER_HOME%\rhq-storage.
+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. If this and
+rem RHQ_SERVER_JAVA_EXE_FILE_PATH are not set, JAVA_HOME
+rem 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, RHQ_SERVER_JAVA_HOME
+rem is ignored. If this is not set, then
+rem %RHQ_SERVER_JAVA_HOME%\bin\java.exe is used.
+rem
+rem RHQ_STORAGE_INSTANCE_NAME - The name of the Windows Service; it must
+rem conform to the Windows Service naming conventions. By
+rem default, this is the name "rhqstorage-%COMPUTERNAME%"
+rem
+rem RHQ_STORAGE_WRAPPER_LOG_DIR_PATH - The full path to the location where
+rem the wrapper log file will go.
+rem
+rem RHQ_STORAGE_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. It is
+rem important to also set RHQ_STORAGE_PASSWORD for the
+rem current user account.
+rem
+rem RHQ_STORAGE_RUN_AS_ME - if defined, then when the Windows Service is
+rem installed, the domain\username of the user that the Windows
+rem Service will run as will be the current user (.\%USERNAME%).
+rem This takes precedence over RHQ_STORAGE_RUN_AS. It is
+rem important to also set RHQ_STORAGE_PASSWORD for the
+rem current user account.
+rem
+rem Note that you cannot define custom Java VM parameters or command line
+rem arguments to pass to Cassandra. If you wish to pass in specific arguments,
+rem modify the rhq-storage-wrapper.conf file.
+rem
+rem This script does not use the built-in cassandra.bat.
+rem ===========================================================================
+
+setlocal
+
+rem if debug variable is set, it is assumed to be on, unless its value is false
+if "%RHQ_STORAGE_DEBUG%" == "false" (
+ set RHQ_STORAGE_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_STORAGE_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME%
+
+rem ----------------------------------------------------------------------
+rem Change directory so the current directory is the Server home.
+rem ----------------------------------------------------------------------
+
+set RHQ_STORAGE_BIN_DIR_PATH=%~dp0
+
+if not defined RHQ_STORAGE_HOME (
+ set RHQ_STORAGE_HOME=%RHQ_SERVER_HOME%\rhq-storage
+)
+set RHQ_STORAGE_BIN_DIR_PATH=%RHQ_STORAGE_HOME%\bin
+
+if not exist %RHQ_STORAGE_BIN_DIR_PATH% (
+ echo Cannot find the RHQ_STORAGE bin directory: %RHQ_STORAGE_BIN_DIR_PATH%
+ exit /B 1
+)
+
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_HOME: %RHQ_STORAGE_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 (
+ if defined RHQ_STORAGE_DEBUG echo No JRE found - will try to use JAVA_HOME: %JAVA_HOME%
+ set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
+ )
+)
+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_STORAGE_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
+if defined RHQ_STORAGE_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 not defined RHQ_STORAGE_INSTANCE_NAME (
+ set RHQ_STORAGE_INSTANCE_NAME=rhqstorage-%COMPUTERNAME%
+)
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_INSTANCE_NAME: %RHQ_STORAGE_INSTANCE_NAME%
+
+rem ----------------------------------------------------------------------
+rem Determine the wrapper directory.
+rem ----------------------------------------------------------------------
+
+set RHQ_STORAGE_WRAPPER_DIR_PATH=%RHQ_SERVER_BIN_DIR_PATH%\..\wrapper
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_DIR_PATH: %RHQ_STORAGE_WRAPPER_DIR_PATH%
+
+rem ----------------------------------------------------------------------
+rem The Windows OS platform name is also the wrapper subdirectory name.
+rem ----------------------------------------------------------------------
+
+set RHQ_STORAGE_OS_PLATFORM=windows-x86_32
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_OS_PLATFORM: %RHQ_STORAGE_OS_PLATFORM%
+
+rem ----------------------------------------------------------------------
+rem Determine the wrapper executable that this script will run.
+rem ----------------------------------------------------------------------
+
+set RHQ_STORAGE_WRAPPER_EXE_FILE_PATH=%RHQ_STORAGE_WRAPPER_DIR_PATH%\%RHQ_STORAGE_OS_PLATFORM%\wrapper.exe
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_EXE_FILE_PATH: %RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%
+
+rem ----------------------------------------------------------------------
+rem Determine the Storage wrapper configuration file.
+rem ----------------------------------------------------------------------
+
+set RHQ_STORAGE_WRAPPER_CONF_FILE_PATH=%RHQ_STORAGE_WRAPPER_DIR_PATH%\rhq-storage-wrapper.conf
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_CONF_FILE_PATH: %RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%
+
+rem ----------------------------------------------------------------------
+rem Create and configure the wrapper log directory.
+rem ----------------------------------------------------------------------
+
+if not defined RHQ_STORAGE_WRAPPER_LOG_DIR_PATH (
+ set RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
+)
+if not exist "%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" (
+ mkdir "%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%"
+)
+
+if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_LOG_DIR_PATH: %RHQ_STORAGE_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_STORAGE_DEBUG set _DEBUG_OPTS=wrapper.debug=true
+
+rem Determine what user the Windows Service will run as.
+if defined RHQ_STORAGE_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_STORAGE_RUN_AS%"
+if defined RHQ_STORAGE_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+rem This service is typically installed by rhqctl, so assume we don't want to prompt
+if not defined RHQ_STORAGE_PASSWORD_PROMPT set RHQ_STORAGE_PASSWORD_PROMPT=false
+
+if /i "%1"=="console" (
+ rem START STORAGE NODE
+ start "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ goto done
+)
+
+if /i "%1"=="install" (
+ "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ goto done
+)
+
+if /i "%1"=="start" (
+ rem START STORAGE NODE
+ "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -t "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
+ goto done
+)
+
+if /i "%1"=="stop" (
+ "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -p "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
+ goto done
+)
+
+if /i "%1"=="remove" (
+ "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -r "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
+ goto done
+)
+
+if /i "%1"=="status" (
+ "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -q "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
+ goto done
+)
+
+echo Usage: %0 { install ^| start ^| stop ^| remove ^| status ^| console }
+goto :done
+
+
+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-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat
index 7f43cf9..8ccc2d3 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat
@@ -1,159 +1,3 @@
@echo off
-
-rem ===========================================================================
-rem RHQ Server Windows Install Script
-rem
-rem This file is used to complete the installation of the RHQ Server on a
-rem Windows platform.
-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
-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_INSTALLER_JAVA_OPTS - Java VM command line options to be
-rem passed into the Java VM. If this is not defined
-rem this script will pass in a default set of options.
-rem If you only want to add options to the defaults,
-rem then you will want to use
-rem RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS instead.
-rem
-rem RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
-rem line options to be passed into the VM.
-rem This is added to
-rem RHQ_SERVER_INSTALLER_JAVA_OPTS; it
-rem is mainly used to augment the
-rem default set of options. This can be
-rem left unset if it is not needed.
-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 ===========================================================================
-
-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
-)
-
-if not exist "%RHQ_SERVER_HOME%\jbossas\jboss-modules.jar" (
- echo ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ instance
- echo Missing %RHQ_SERVER_HOME%\jboss-modules.jar
- exit /B 1
-)
-
-rem ----------------------------------------------------------------------
-rem Determine the logs directory
-rem ----------------------------------------------------------------------
-
-set _LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
-
-rem ----------------------------------------------------------------------
-rem Prepare the VM command line options to be passed in
-rem ----------------------------------------------------------------------
-
-if not defined RHQ_SERVER_INSTALLER_JAVA_OPTS set RHQ_SERVER_INSTALLER_JAVA_OPTS=-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true
-
-rem Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_INSTALLER_JAVA_OPTS.
-if defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=DEBUG
-if not defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=INFO
-set RHQ_SERVER_INSTALLER_JAVA_OPTS=%RHQ_SERVER_INSTALLER_JAVA_OPTS% -Djava.awt.headless=true -Di18nlog.logger-type=commons -Drhq.server.properties-file=%RHQ_SERVER_HOME%\bin\rhq-server.properties -Drhq.server.installer.logdir=%RHQ_SERVER_HOME%\logs -Drhq.server.installer.loglevel=%_RHQ_LOGLEVEL%
-
-rem Sample JPDA settings for remote socket debugging
-rem set RHQ_SERVER_INSTALLER_JAVA_OPTS=%RHQ_SERVER_INSTALLER_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
-
-if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTALLER_JAVA_OPTS: %RHQ_SERVER_INSTALLER_JAVA_OPTS%
-if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS: %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS%
-
-rem ----------------------------------------------------------------------
-rem We need to add our own modules to the core set of JBossAS modules.
-rem ----------------------------------------------------------------------
-set _RHQ_MODULES_PATH=%RHQ_SERVER_HOME%\modules
-set _INTERNAL_MODULES_PATH=%RHQ_SERVER_HOME%\jbossas\modules
-set _JBOSS_MODULEPATH=%_RHQ_MODULES_PATH%;%_INTERNAL_MODULES_PATH%
-if defined RHQ_SERVER_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH%
-
-rem start the AS instance with our main installer module
-"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" %RHQ_SERVER_INSTALLER_JAVA_OPTS% %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar "%RHQ_SERVER_HOME%\jbossas\jboss-modules.jar" -mp "%_JBOSS_MODULEPATH%" org.rhq.rhq-installer-util %*
-
-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
+echo This script is obsolete and no longer used. Use rhqctl instead.
+exit /B 1
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh
index fb73810..548e1b6 100755
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh
@@ -1,241 +1,3 @@
#!/bin/sh
-
-# =============================================================================
-# RHQ Server UNIX Install Script
-#
-# This file is used to complete the installation of the RHQ Server on a
-# UNIX platform.
-#
-# This script is customizable by setting the following environment variables:
-#
-# 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_JBOSS_HOME - The location of the AS instance that will
-# host RHQ. If this is set, it overrides any
-# JBOSS_HOME that might be set. If this not
-# set, JBOSS_HOME is used as a fallback. If
-# neither is set, it is assumed the AS bundled
-# under RHQ_SERVER_HOME/jbossas is to be used.
-#
-# 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_INSTALLER_JAVA_OPTS - Java VM command line options to be
-# passed into the Java VM. If this is not defined
-# this script will pass in a default set of options.
-# If you only want to add options to the defaults,
-# then you will want to use
-# RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS instead.
-#
-# RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
-# line options to be passed into the VM.
-# This is added to
-# RHQ_SERVER_INSTALLER_JAVA_OPTS; it
-# is mainly used to augment the
-# default set of options. This can be
-# left unset if it is not needed.
-#
-# 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.
-# =============================================================================
-
-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
-}
-
-# ----------------------------------------------------------------------
-# 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
-
-# only certain platforms support the -e argument for readlink
-if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
- _READLINK_ARG="-e"
-fi
-
-# ----------------------------------------------------------------------
-# 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 $_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"
-
-# ----------------------------------------------------------------------
-# Determine what JBossAS instance to use.
-# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
-# assume we are to run the embedded AS instance from the RHQ
-# installation directory - RHQ_SERVER_HOME/jbossas
-# ----------------------------------------------------------------------
-
-if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then
- if [ -z "$JBOSS_HOME" ]; then
- RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas"
- else
- if [ ! -d "$JBOSS_HOME" ]; then
- echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory"
- echo "JBOSS_HOME: $JBOSS_HOME"
- exit 1
- fi
- RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}"
- fi
-else
- if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then
- echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory"
- echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
- exit 1
- fi
-fi
-
-cd "$RHQ_SERVER_JBOSS_HOME"
-RHQ_SERVER_JBOSS_HOME=`pwd`
-
-debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
-
-if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then
- echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance"
- echo "Missing ${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar"
- exit 1
-fi
-
-# we want the rest of this script to be able to assume cwd is the RHQ install dir
-cd "$RHQ_SERVER_HOME"
-
-# ----------------------------------------------------------------------
-# 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
-
-# ----------------------------------------------------------------------
-# Prepare the VM command line options to be passed in
-# ----------------------------------------------------------------------
-
-if [ -z "$RHQ_SERVER_INSTALLER_JAVA_OPTS" ]; then
- RHQ_SERVER_INSTALLER_JAVA_OPTS="-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true"
-fi
-
-# Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_INSTALLER_JAVA_OPTS.
-if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then
- _RHQ_LOGLEVEL="DEBUG"
-else
- _RHQ_LOGLEVEL="INFO"
-fi
-
-RHQ_SERVER_INSTALLER_JAVA_OPTS="${RHQ_SERVER_INSTALLER_JAVA_OPTS} -Djava.awt.headless=true -Di18nlog.logger-type=commons -Drhq.server.properties-file=${RHQ_SERVER_HOME}/bin/rhq-server.properties -Drhq.server.installer.logdir=${RHQ_SERVER_HOME}/logs -Drhq.server.installer.loglevel=${_RHQ_LOGLEVEL} -Drhq.server.basedir=${RHQ_SERVER_HOME}"
-
-# Sample JPDA settings for remote socket debugging
-#RHQ_SERVER_INSTALLER_JAVA_OPTS="${RHQ_SERVER_INSTALLER_JAVA_OPTS} -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
-
-debug_msg "RHQ_SERVER_INSTALLER_JAVA_OPTS: $RHQ_SERVER_INSTALLER_JAVA_OPTS"
-debug_msg "RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS: $RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS"
-
-# ----------------------------------------------------------------------
-# We need to add our own modules to the core set of JBossAS modules.
-# ----------------------------------------------------------------------
-_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules"
-_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules"
-if [ -n "$_CYGWIN" ]; then
- _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"`
- _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"`
-fi
-_JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}"
-debug_msg "_JBOSS_MODULEPATH: $_JBOSS_MODULEPATH"
-
-# start the AS instance with our main installer module
-"$RHQ_SERVER_JAVA_EXE_FILE_PATH" ${RHQ_SERVER_INSTALLER_JAVA_OPTS} ${RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS} -jar "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" -mp "$_JBOSS_MODULEPATH" org.rhq.rhq-installer-util "$@"
-
-_EXIT_STATUS=$?
-exit $_EXIT_STATUS
+echo "This script is obsolete and no longer used. Use rhqctl instead."
+exit 1
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
index 7f56679..8ccc2d3 100644
--- 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
@@ -1,2 +1,3 @@
-cd %~dp0
-rhq-server.bat console
+@echo off
+echo This script is obsolete and no longer used. Use rhqctl instead.
+exit /B 1
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
index cfdc8ea..8ccc2d3 100644
--- 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
@@ -1,218 +1,3 @@
@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, JAVA_HOME 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.
-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. It is
-rem important to also set RHQ_SERVER_PASSWORD for the
-rem current user account.
-rem
-rem RHQ_SERVER_RUN_AS_ME - if defined, then when the Windows Service is
-rem installed, the domain\username of the user that the Windows
-rem Service will run as will be the current user (.\%USERNAME%).
-rem This takes precedence over RHQ_SERVER_RUN_AS. It is
-rem important to also set RHQ_SERVER_PASSWORD for the
-rem current user account.
-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 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 (
- if defined RHQ_STORAGE_DEBUG echo No JRE found - will try to use JAVA_HOME: %JAVA_HOME%
- set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
- )
-)
-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_STORAGE_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
-if defined RHQ_STORAGE_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 not defined 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 not defined RHQ_SERVER_WRAPPER_LOG_DIR_PATH (
- set RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
-)
-if not exist "%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" (
- mkdir "%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%"
-)
-
-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%"
-rem This service is typically installed by rhqctl, so assume we don't want to prompt
-if not defined RHQ_SERVER_PASSWORD_PROMPT set RHQ_SERVER_PASSWORD_PROMPT=false
-
-if /i "%1"=="console" (
- rem START SERVER
- "%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" (
- rem START SERVER
- "%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 exits this script normally
-rem ----------------------------------------------------------------------
-
-:done
-endlocal
+echo This script is obsolete and no longer used. Use rhqctl instead.
+exit /B 1
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
deleted file mode 100644
index 8860b47..0000000
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.security-policy
+++ /dev/null
@@ -1,10 +0,0 @@
-// 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
index 385997f..548e1b6 100755
--- 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
@@ -1,622 +1,3 @@
#!/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_JBOSS_HOME - The location of the AS instance that will
-# host RHQ. If this is set, it overrides any
-# JBOSS_HOME that might be set. If this not
-# set, JBOSS_HOME is used as a fallback. If
-# neither is set, it is assumed the AS bundled
-# under RHQ_SERVER_HOME/jbossas is to be used.
-#
-# 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, JAVA_HOME 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.
-#
-# 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.
-#
-# RHQ_SERVER_STOP_DELAY - the number of minutes to wait for the server to go
-# down after sending the TERM signal. Defaults to
-# 5 minutes.
-#
-# RHQ_SERVER_KILL_AFTER_STOP_DELAY - If this is defined, the server will be
-# killed if it is still running after the
-# RHQ_SERVER_STOP_DELAY. If this is not
-# defined or set to "false" the script
-# will exit with error code 127.
-#
-#
-#
-# 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
-# RHQ_SERVER_STOP_DELAY=5
-# RHQ_SERVER_KILL_AFTER_STOP_DELAY=false
-
-# ----------------------------------------------------------------------
-# 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"
-
-# ----------------------------------------------------------------------
-# 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=`printf "%-30s (pid %-7s) IS %s" "RHQ Server" $_SERVER_PID $1`
- _SERVER_RUNNING=1
- else
- _SERVER_STATUS=`printf "%-30s (pid %-7s) IS NOT running" "RHQ Server" $_SERVER_PID`
- _SERVER_RUNNING=0
- fi
- else
- _SERVER_STATUS=`printf "%-30s (no pid file) IS NOT running" "RHQ Server"`
- _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=`printf "%-30s (pid %-7s) IS %s" "JBossAS Java VM child process" $_SERVER_PID $1`
- _JVM_RUNNING=1
- else
- _JVM_STATUS=`printf "%-30s (pid %-7s) IS NOT running" "JBossAS Java VM child process" $_SERVER_PID`
- _JVM_RUNNING=0
- fi
- else
- _JVM_STATUS=`printf "%-30s (no pid file) IS NOT running" "JBossAS Java VM child process"`
- _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
-}
-
-# ----------------------------------------------------------------------
-# Unset any lingering JBossAS environment variables that were set in
-# the user's environment. This might happen if the user has an external
-# JBossAS installed and configured but doesn't want RHQ to use it.
-# ----------------------------------------------------------------------
-unset_jboss_as_env ()
-{
- unset JBOSS_HOME
- unset RUN_CONF
- unset JAVAC_JAR
- unset JBOSS_CLASSPATH
- unset JBOSS_BASE_DIR
- unset JBOSS_LOG_DIR
- unset JBOSS_CONFIG_DIR
-}
-
-# ----------------------------------------------------------------------
-# Kill RHQ Server
-# ----------------------------------------------------------------------
-
-kill_rhq_server ()
-{
- 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."
-}
-
-# ----------------------------------------------------------------------
-# 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
-
-# only certain platforms support the -e argument for readlink
-if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
- _READLINK_ARG="-e"
-fi
-
-# ----------------------------------------------------------------------
-# 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 $_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"
-
-# ----------------------------------------------------------------------
-# Determine what JBossAS instance to use.
-# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
-# assume we are to run the embedded AS instance from the RHQ
-# installation directory - RHQ_SERVER_HOME/jbossas
-# ----------------------------------------------------------------------
-
-if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then
- if [ -z "$JBOSS_HOME" ]; then
- RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas"
- # Unset any lingering JBossAS environment variables that we don't want.
- # These could be in the user's environment for an external AS install.
- unset_jboss_as_env
- else
- if [ ! -d "$JBOSS_HOME" ]; then
- echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory"
- echo "JBOSS_HOME: $JBOSS_HOME"
- exit 1
- fi
- RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}"
- fi
-else
- if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then
- echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory"
- echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
- exit 1
- fi
- unset_jboss_as_env
-fi
-
-cd "$RHQ_SERVER_JBOSS_HOME"
-RHQ_SERVER_JBOSS_HOME=`pwd`
-
-debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
-
-
-if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then
- echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid RHQ Server"
- echo "Missing ${RHQ_SERVER_JBOSS_HOME}/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
- debug_msg "No JRE found - will try to use JAVA_HOME: $JAVA_HOME"
- RHQ_SERVER_JAVA_HOME="$JAVA_HOME"
- 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
-
-if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then
- _JBOSS_DEBUG_LOGGING="-Djboss.boot.server.log.level=DEBUG -Djboss.boot.server.log.console.level=DEBUG"
-else
- _JBOSS_DEBUG_LOGGING=
-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
-_HTTP_COMPRESSION="-Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES=text/javascript,text/css,text/html"
-RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS} -Drhq.server.home=${RHQ_SERVER_HOME} -Djboss.server.log.dir=${_LOG_DIR_PATH} -Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true -Djboss.server.default.config=standalone-full.xml -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager -Djava.security.policy==${RHQ_SERVER_HOME}/bin/rhq-server.security-policy ${_HTTP_COMPRESSION} ${_JBOSS_DEBUG_LOGGING}"
-
-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"
-
-# ----------------------------------------------------------------------
-# We need to add our own modules to the core set of JBossAS modules.
-# JBOSS_MODULEPATH tells standalone.sh what to use.
-# ----------------------------------------------------------------------
-_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules"
-_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules"
-if [ -n "$_CYGWIN" ]; then
- _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"`
- _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"`
-fi
-JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}"
-export JBOSS_MODULEPATH
-debug_msg "JBOSS_MODULEPATH: $JBOSS_MODULEPATH"
-
-# ----------------------------------------------------------------------
-# Now find the JBossAS standalone.sh script
-# ----------------------------------------------------------------------
-
-_JBOSS_RUN_SCRIPT="${RHQ_SERVER_JBOSS_HOME}/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 SERVER
- # first, make sure its working directory is the JBossAS bin directory
- cd "${RHQ_SERVER_JBOSS_HOME}/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 SERVER
- # first, make sure its working directory is the JBossAS bin directory
- cd "${RHQ_SERVER_JBOSS_HOME}/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..."
-
- kill -TERM $_SERVER_PID
-
- if [ -z "$RHQ_SERVER_STOP_DELAY" ]; then
- # RHQ_SERVER_STOP_DELAY is not set
- RHQ_SERVER_STOP_DELAY=5
- fi
- case $RHQ_SERVER_STOP_DELAY in
- ''|*[!0-9]*)
- echo "RHQ_SERVER_STOP_DELAY is not a number (value=${RHQ_SERVER_STOP_DELAY})"
- echo "Applying default value (5 minutes)"
- RHQ_SERVER_STOP_DELAY=5
- ;;
- *) ;;
- esac
- if [ $RHQ_SERVER_STOP_DELAY -le 0 ]; then
- echo "RHQ_SERVER_STOP_DELAY is less than or equal to zero (value=${RHQ_SERVER_STOP_DELAY})"
- echo "Applying default value (5 minutes)"
- RHQ_SERVER_STOP_DELAY=5
- fi
- waited_seconds=0
- max_wait_seconds=$(expr $RHQ_SERVER_STOP_DELAY \* 60)
- while [ "$_SERVER_RUNNING" -eq "1" ] && [ $waited_seconds -lt $max_wait_seconds ]; do
- sleep 2s
- waited_seconds=$(expr $waited_seconds + 2)
- check_status "stopping..."
- done
-
- if [ "$_SERVER_RUNNING" = "0" ]; then
- remove_pid_files
- echo "RHQ Server has stopped."
- exit 0
- fi
-
- debug_msg "RHQ Server did not stop within $RHQ_SERVER_STOP_DELAY minutes."
- echo "Timed out waiting for RHQ Server to stop."
- kill -QUIT $_SERVER_PID # Generate thread dump for later investigation
-
- if [ -n "$RHQ_SERVER_KILL_AFTER_STOP_DELAY" ] && [ "$RHQ_SERVER_KILL_AFTER_STOP_DELAY" != "false" ]; then
- kill_rhq_server
- exit 0
- else
- echo "Failed to stop RHQ Server"
- exit 127
- fi
- ;;
-
-'kill')
- if [ "$_SERVER_RUNNING" = "0" ]; then
- echo "$_SERVER_STATUS"
- fi
- if [ "$_JVM_RUNNING" = "0" ]; then
- echo "$_JVM_STATUS"
- remove_pid_files
- exit 0
- fi
-
- kill_rhq_server
- exit 0
- ;;
-
-'clean')
- if [ "$_SERVER_RUNNING" = "1" ]; then
- echo "$_SERVER_STATUS"
- echo "Please shutdown the server before cleaning."
- exit 0
- fi
-
- echo "Cleaning data, tmp and log directories..."
- rm -rf "${RHQ_SERVER_JBOSS_HOME}/standalone/data"
- rm -rf "${RHQ_SERVER_JBOSS_HOME}/standalone/tmp"
- rm -rf "${RHQ_SERVER_HOME}/logs"
- ;;
-
-'status')
- echo "$_SERVER_STATUS"
- echo "$_JVM_STATUS"
- exit 0
- ;;
-
-*)
- echo "Usage: $0 { start | stop | kill | status | console | clean }"
- exit 1
- ;;
-esac
+echo "This script is obsolete and no longer used. Use rhqctl instead."
+exit 1
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.bat
index 43ccd3b..8ccc2d3 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.bat
@@ -1,202 +1,3 @@
@echo off
-
-rem =============================================================================
-rem RHQ Storage Installer Script
-rem
-rem This file is used to complete the installation of the RHQ storage Server on a
-rem Windows platform.
-rem
-rem This script is customizable by setting the following environment variables:
-rem
-rem RHQ_STORAGE_DEBUG - If this is defined, the script will emit debug
-rem messages. If this is not defined or set to "false"
-rem debug messages are not emitted.
-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_JBOSS_HOME - The location of the AS instance that will
-rem host RHQ. If this is set, it overrides any
-rem JBOSS_HOME that might be set. If this not
-rem set, JBOSS_HOME is used as a fallback. If
-rem neither is set, it is assumed the AS bundled
-rem under RHQ_SERVER_HOME\jbossas is to be used.
-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, JAVA_HOME 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
-rem is used.
-rem
-rem RHQ_STORAGE_INSTALLER_JAVA_OPTS - Java VM command line options to be
-rem passed into the Java VM. If this is not defined
-rem this script will pass in a default set of options.
-rem If you only want to add options to the defaults,
-rem then you will want to use
-rem RHQ_STORAGE_ADDITIONAL_JAVA_OPTS instead.
-rem
-rem RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
-rem line options to be passed into the VM.
-rem This is added to RHQ_STORAGE_JAVA_OPTS; it
-rem is mainly used to augment the
-rem default set of options. This can be
-rem left unset if it is not needed.
-rem
-rem =============================================================================
-
-setlocal
-
-rem if debug variable is set, it is assumed to be on, unless its value is false
-if "%RHQ_STORAGE_DEBUG%" == "false" (
- set RHQ_STORAGE_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_STORAGE_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME%
-
-rem ----------------------------------------------------------------------
-rem Determine what JBossAS instance to use.
-rem If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
-rem assume we are to run the embedded AS instance from the RHQ
-rem installation directory - RHQ_SERVER_HOME\jbossas
-rem ----------------------------------------------------------------------
-
-if not defined RHQ_SERVER_JBOSS_HOME (
- if not defined JBOSS_HOME (
- set RHQ_SERVER_JBOSS_HOME=%RHQ_SERVER_HOME%\jbossas
- ) else (
- if not exist "%JBOSS_HOME%" (
- echo ERROR! JBOSS_HOME is not pointing to a valid AS directory
- echo JBOSS_HOME: "%JBOSS_HOME%"
- exit /B 1
- )
- set RHQ_SERVER_JBOSS_HOME=%JBOSS_HOME%
- )
-) else (
- cd %RHQ_SERVER_JBOSS_HOME% || (
- echo ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory
- echo RHQ_SERVER_JBOSS_HOME: "%RHQ_SERVER_JBOSS_HOME%"
- exit /B 1
- )
-)
-
-cd %RHQ_SERVER_JBOSS_HOME%
-set RHQ_SERVER_JBOSS_HOME=%CD%
-
-if defined RHQ_STORAGE_DEBUG echo RHQ_SERVER_JBOSS_HOME: %RHQ_SERVER_JBOSS_HOME%
-
-
-if not exist "%RHQ_SERVER_JBOSS_HOME%\jboss-modules.jar" (
- echo ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance
- echo Missing "%RHQ_SERVER_JBOSS_HOME%\jboss-modules.jar"
- exit /B 1
-)
-
-rem we want the rest of this script to be able to assume cwd is the RHQ install dir
-cd "%RHQ_SERVER_HOME%"
-
-
-rem ----------------------------------------------------------------------
-rem Create the logs directory
-rem ----------------------------------------------------------------------
-
-set _LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
-if not exist "%_LOG_DIR_PATH%" (
- mkdir "%_LOG_DIR_PATH%"
-)
-
-
-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 (
- if defined RHQ_STORAGE_DEBUG echo No JRE found - will try to use JAVA_HOME: %JAVA_HOME%
- set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
- )
-)
-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_STORAGE_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
-if defined RHQ_STORAGE_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 Prepare the VM command line options to be passed in
-rem ----------------------------------------------------------------------
-
-if not defined RHQ_STORAGE_INSTALLER_JAVA_OPTS (
- set RHQ_STORAGE_INSTALLER_JAVA_OPTS=-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true
-)
-
-rem Add the JVM opts that we always want to specify, whether or not the user set RHQ_CCM_JAVA_OPTS.
-if defined RHQ_STORAGE_DEBUG (
- set _RHQ_LOGLEVEL=DEBUG
-) else (
- set _RHQ_LOGLEVEL=INFO
-)
-
-
-rem debugging the logging level now for development/testing
-set RHQ_STORAGE_INSTALLER_JAVA_OPTS=%RHQ_STORAGE_INSTALLER_JAVA_OPTS% -Djava.awt.headless=true -Drhq.server.properties-file=%RHQ_SERVER_HOME%\bin\rhq-server.properties -Drhq.storage.installer.logdir=%RHQ_SERVER_HOME%\logs -Drhq.storage.installer.loglevel=%_RHQ_LOGLEVEL% -Drhq.server.basedir=%RHQ_SERVER_HOME%
-
-rem Sample JPDA settings for remote socket debugging
-rem set RHQ_STORAGE_INSTALLER_JAVA_OPTS=%RHQ_STORAGE_INSTALLER_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
-
-if defined RHQ_STORAGE_DEBUG echo "RHQ_STORAGE_INSTALLER_JAVA_OPTS: %RHQ_STORAGE_INSTALLER_JAVA_OPTS%"
-if defined RHQ_STORAGE_DEBUG echo "RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS: %RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS%"
-
-
-rem ----------------------------------------------------------------------
-rem We need to add our own modules to the core set of JBossAS modules.
-rem ----------------------------------------------------------------------
-set _RHQ_MODULES_PATH=%RHQ_SERVER_HOME%\modules
-set _INTERNAL_MODULES_PATH=%RHQ_SERVER_JBOSS_HOME%\modules
-set _JBOSS_MODULEPATH=%_RHQ_MODULES_PATH%;%_INTERNAL_MODULES_PATH%
-
-if defined RHQ_STORAGE_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH%
-
-
-echo "Starting RHQ Storage Installer ..."
-
-rem start the AS instance with our main installer module
-
-"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" %RHQ_STORAGE_INSTALLER_JAVA_OPTS% %RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar "%RHQ_SERVER_JBOSS_HOME%\jboss-modules.jar" -mp "%_JBOSS_MODULEPATH%" org.rhq.rhq-cassandra-installer %*
-if not errorlevel 1 goto done
-exit /B %ERRORLEVEL%
-
-:done
-endlocal
+echo This script is obsolete and no longer used. Use rhqctl instead.
+exit /B 1
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.sh
index d7ddbdf..548e1b6 100755
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.sh
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage-installer.sh
@@ -1,243 +1,3 @@
#!/bin/sh
-
-# =============================================================================
-# RHQ Storage Installer Script
-#
-# This file is used to complete the installation of the RHQ storage Server on a
-# UNIX platform.
-#
-# This script is customizable by setting the following environment variables:
-#
-# RHQ_STORAGE_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_JBOSS_HOME - The location of the AS instance that will
-# host RHQ. If this is set, it overrides any
-# JBOSS_HOME that might be set. If this not
-# set, JBOSS_HOME is used as a fallback. If
-# neither is set, it is assumed the AS bundled
-# under RHQ_SERVER_HOME/jbossas is to be used.
-#
-# 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_STORAGE_INSTALLER_JAVA_OPTS - Java VM command line options to be
-# passed into the Java VM. If this is not defined
-# this script will pass in a default set of options.
-# If you only want to add options to the defaults,
-# then you will want to use
-# RHQ_STORAGE_ADDITIONAL_JAVA_OPTS instead.
-#
-# RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command
-# line options to be passed into the VM.
-# This is added to RHQ_STORAGE_JAVA_OPTS; it
-# is mainly used to augment the
-# default set of options. This can be
-# left unset if it is not needed.
-#
-# 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.
-# =============================================================================
-
-debug_msg ()
-{
- # if debug variable is set, it is assumed to be on, unless its value is false
- if [ -n "$RHQ_STORAGE_DEBUG" ] && [ "$RHQ_STORAGE_DEBUG" != "false" ]; then
- echo $1
- 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
-
-# only certain platforms support the -e argument for readlink
-if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
- _READLINK_ARG="-e"
-fi
-
-# ----------------------------------------------------------------------
-# 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 $_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"
-
-# ----------------------------------------------------------------------
-# Determine what JBossAS instance to use.
-# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will
-# assume we are to run the embedded AS instance from the RHQ
-# installation directory - RHQ_SERVER_HOME/jbossas
-# ----------------------------------------------------------------------
-
-if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then
- if [ -z "$JBOSS_HOME" ]; then
- RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas"
- else
- if [ ! -d "$JBOSS_HOME" ]; then
- echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory"
- echo "JBOSS_HOME: $JBOSS_HOME"
- exit 1
- fi
- RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}"
- fi
-else
- if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then
- echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory"
- echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
- exit 1
- fi
-fi
-
-cd "$RHQ_SERVER_JBOSS_HOME"
-RHQ_SERVER_JBOSS_HOME=`pwd`
-
-debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME"
-
-if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then
- echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance"
- echo "Missing ${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar"
- exit 1
-fi
-
-# we want the rest of this script to be able to assume cwd is the RHQ install dir
-cd "$RHQ_SERVER_HOME"
-
-# ----------------------------------------------------------------------
-# 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
-
-# ----------------------------------------------------------------------
-# Prepare the VM command line options to be passed in
-# ----------------------------------------------------------------------
-
-if [ -z "$RHQ_STORAGE_INSTALLER_JAVA_OPTS" ]; then
- RHQ_STORAGE_INSTALLER_JAVA_OPTS="-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true"
-fi
-
-# Add the JVM opts that we always want to specify, whether or not the user set RHQ_CCM_JAVA_OPTS.
-if [ -n "$RHQ_STORAGE_DEBUG" ] && [ "$RHQ_STORAGE_DEBUG" != "false" ]; then
- _RHQ_LOGLEVEL="DEBUG"
-else
- _RHQ_LOGLEVEL="INFO"
-fi
-
-# debugging the logging level now for development/testing
-RHQ_STORAGE_INSTALLER_JAVA_OPTS="${RHQ_STORAGE_INSTALLER_JAVA_OPTS} -Djava.awt.headless=true -Drhq.server.properties-file=${RHQ_SERVER_HOME}/bin/rhq-server.properties -Drhq.storage.installer.logdir=${RHQ_SERVER_HOME}/logs -Drhq.storage.installer.loglevel=${_RHQ_LOGLEVEL} -Drhq.server.basedir=${RHQ_SERVER_HOME}"
-
-# Sample JPDA settings for remote socket debugging
-#RHQ_STORAGE_INSTALLER_JAVA_OPTS="${RHQ_STORAGE_INSTALLER_JAVA_OPTS} -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
-
-debug_msg "RHQ_STORAGE_INSTALLER_JAVA_OPTS: $RHQ_STORAGE_INSTALLER_JAVA_OPTS"
-debug_msg "RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS: $RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS"
-
-# ----------------------------------------------------------------------
-# We need to add our own modules to the core set of JBossAS modules.
-# ----------------------------------------------------------------------
-_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules"
-_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules"
-if [ -n "$_CYGWIN" ]; then
- _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"`
- _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"`
-fi
-_JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}"
-debug_msg "_JBOSS_MODULEPATH: $_JBOSS_MODULEPATH"
-
-echo "Starting RHQ Storage Installer ..."
-
-# start the AS instance with our main installer module
-"$RHQ_SERVER_JAVA_EXE_FILE_PATH" ${RHQ_STORAGE_INSTALLER_JAVA_OPTS} ${RHQ_STORAGE_INSTALLER_ADDITIONAL_JAVA_OPTS} -jar "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" -mp "$_JBOSS_MODULEPATH" org.rhq.rhq-cassandra-installer "$@"
-
-_EXIT_STATUS=$?
-exit $_EXIT_STATUS
+echo "This script is obsolete and no longer used. Use rhqctl instead."
+exit 1
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage.bat
index 3201ae5..8ccc2d3 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-storage.bat
@@ -1,238 +1,3 @@
@echo off
-
-rem ===========================================================================
-rem RHQ Storage Node (Cassandra) Windows Startup Script
-rem
-rem This file is used to install, start, stop and remove the RHQ Storage Node
-rem (cassandra) Windows Service for the Windows platform. The RHQ Storage node
-rem is actually wrapped by the Java Service Wrapper (JSW) and it is the JSW that
-rem is the actual executable that is registered as the Windows Service.
-rem
-rem This script is customizable by setting the following environment variables:
-rem
-
-rem RHQ_STORAGE_DEBUG - If this is defined, the script will emit debug
-rem messages. If unset or "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_STORAGE_HOME - Defines where the Storage Node's home install directory
-rem is. If not defined, it will be assumed to be
-rem %RHQ_SERVER_HOME%\rhq-storage.
-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. If this and
-rem RHQ_SERVER_JAVA_EXE_FILE_PATH are not set, JAVA_HOME
-rem 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, RHQ_SERVER_JAVA_HOME
-rem is ignored. If this is not set, then
-rem %RHQ_SERVER_JAVA_HOME%\bin\java.exe is used.
-rem
-rem RHQ_STORAGE_INSTANCE_NAME - The name of the Windows Service; it must
-rem conform to the Windows Service naming conventions. By
-rem default, this is the name "rhqstorage-%COMPUTERNAME%"
-rem
-rem RHQ_STORAGE_WRAPPER_LOG_DIR_PATH - The full path to the location where
-rem the wrapper log file will go.
-rem
-rem RHQ_STORAGE_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. It is
-rem important to also set RHQ_STORAGE_PASSWORD for the
-rem current user account.
-rem
-rem RHQ_STORAGE_RUN_AS_ME - if defined, then when the Windows Service is
-rem installed, the domain\username of the user that the Windows
-rem Service will run as will be the current user (.\%USERNAME%).
-rem This takes precedence over RHQ_STORAGE_RUN_AS. It is
-rem important to also set RHQ_STORAGE_PASSWORD for the
-rem current user account.
-rem
-rem Note that you cannot define custom Java VM parameters or command line
-rem arguments to pass to Cassandra. If you wish to pass in specific arguments,
-rem modify the rhq-storage-wrapper.conf file.
-rem
-rem This script does not use the built-in cassandra.bat.
-rem ===========================================================================
-
-setlocal
-
-rem if debug variable is set, it is assumed to be on, unless its value is false
-if "%RHQ_STORAGE_DEBUG%" == "false" (
- set RHQ_STORAGE_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_STORAGE_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME%
-
-rem ----------------------------------------------------------------------
-rem Change directory so the current directory is the Server home.
-rem ----------------------------------------------------------------------
-
-set RHQ_STORAGE_BIN_DIR_PATH=%~dp0
-
-if not defined RHQ_STORAGE_HOME (
- set RHQ_STORAGE_HOME=%RHQ_SERVER_HOME%\rhq-storage
-)
-set RHQ_STORAGE_BIN_DIR_PATH=%RHQ_STORAGE_HOME%\bin
-
-if not exist %RHQ_STORAGE_BIN_DIR_PATH% (
- echo Cannot find the RHQ_STORAGE bin directory: %RHQ_STORAGE_BIN_DIR_PATH%
- exit /B 1
-)
-
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_HOME: %RHQ_STORAGE_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 (
- if defined RHQ_STORAGE_DEBUG echo No JRE found - will try to use JAVA_HOME: %JAVA_HOME%
- set RHQ_SERVER_JAVA_HOME=%JAVA_HOME%
- )
-)
-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_STORAGE_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME%
-if defined RHQ_STORAGE_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 not defined RHQ_STORAGE_INSTANCE_NAME (
- set RHQ_STORAGE_INSTANCE_NAME=rhqstorage-%COMPUTERNAME%
-)
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_INSTANCE_NAME: %RHQ_STORAGE_INSTANCE_NAME%
-
-rem ----------------------------------------------------------------------
-rem Determine the wrapper directory.
-rem ----------------------------------------------------------------------
-
-set RHQ_STORAGE_WRAPPER_DIR_PATH=%RHQ_SERVER_BIN_DIR_PATH%\wrapper
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_DIR_PATH: %RHQ_STORAGE_WRAPPER_DIR_PATH%
-
-rem ----------------------------------------------------------------------
-rem The Windows OS platform name is also the wrapper subdirectory name.
-rem ----------------------------------------------------------------------
-
-set RHQ_STORAGE_OS_PLATFORM=windows-x86_32
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_OS_PLATFORM: %RHQ_STORAGE_OS_PLATFORM%
-
-rem ----------------------------------------------------------------------
-rem Determine the wrapper executable that this script will run.
-rem ----------------------------------------------------------------------
-
-set RHQ_STORAGE_WRAPPER_EXE_FILE_PATH=%RHQ_STORAGE_WRAPPER_DIR_PATH%\%RHQ_STORAGE_OS_PLATFORM%\wrapper.exe
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_EXE_FILE_PATH: %RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%
-
-rem ----------------------------------------------------------------------
-rem Determine the Storage wrapper configuration file.
-rem ----------------------------------------------------------------------
-
-set RHQ_STORAGE_WRAPPER_CONF_FILE_PATH=%RHQ_STORAGE_WRAPPER_DIR_PATH%\rhq-storage-wrapper.conf
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_CONF_FILE_PATH: %RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%
-
-rem ----------------------------------------------------------------------
-rem Create and configure the wrapper log directory.
-rem ----------------------------------------------------------------------
-
-if not defined RHQ_STORAGE_WRAPPER_LOG_DIR_PATH (
- set RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs
-)
-if not exist "%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" (
- mkdir "%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%"
-)
-
-if defined RHQ_STORAGE_DEBUG echo RHQ_STORAGE_WRAPPER_LOG_DIR_PATH: %RHQ_STORAGE_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_STORAGE_DEBUG set _DEBUG_OPTS=wrapper.debug=true
-
-rem Determine what user the Windows Service will run as.
-if defined RHQ_STORAGE_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_STORAGE_RUN_AS%"
-if defined RHQ_STORAGE_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
-rem This service is typically installed by rhqctl, so assume we don't want to prompt
-if not defined RHQ_STORAGE_PASSWORD_PROMPT set RHQ_STORAGE_PASSWORD_PROMPT=false
-
-if /i "%1"=="console" (
- rem START STORAGE NODE
- start "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
- goto done
-)
-
-if /i "%1"=="install" (
- "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
- goto done
-)
-
-if /i "%1"=="start" (
- rem START STORAGE NODE
- "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -t "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
- goto done
-)
-
-if /i "%1"=="stop" (
- "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -p "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
- goto done
-)
-
-if /i "%1"=="remove" (
- "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -r "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
- goto done
-)
-
-if /i "%1"=="status" (
- "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -q "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%"
- goto done
-)
-
-echo Usage: %0 { install ^| start ^| stop ^| remove ^| status ^| console }
-goto :done
-
-
-rem ----------------------------------------------------------------------
-rem CALL subroutine that exits this script normally
-rem ----------------------------------------------------------------------
-
-:done
-endlocal
+echo This script is obsolete and no longer used. Use rhqctl instead.
+exit /B 1
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl
old mode 100644
new mode 100755
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 6c2f6f9..8fdcc80 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
@@ -826,6 +826,7 @@ rhq.server.agent-update.nonstrict-version-check=true
<target name="fix-perms">
<echo>Make sure shell scripts are readable and executable.</echo>
<chmod dir="${project.build.outputDirectory}/bin" includes="*.sh,rhqctl" perm="ug+x" verbose="true" />
+ <chmod dir="${project.build.outputDirectory}/bin/internal" includes="*.sh" perm="ug+x" verbose="true" />
<chmod dir="${jboss.home}/bin" includes="*.sh" perm="ug+x" verbose="true" />
</target>
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java
index 5528619..b3e09a2 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java
@@ -70,13 +70,13 @@ public abstract class ControlCommand {
protected final Log log = LogFactory.getLog(getClass().getName());
private File basedir;
- private File binDir;
+ private File binDir; // where the internal startup scripts are
private PropertiesConfiguration rhqctlConfig;
public ControlCommand() {
basedir = new File(System.getProperty("rhq.server.basedir"));
- binDir = new File(basedir, "bin");
+ binDir = new File(basedir, "bin/internal");
File rhqctlPropertiesFile = getRhqCtlProperties();
try {
@@ -249,7 +249,7 @@ public abstract class ControlCommand {
if (isWindows()) {
result = new org.apache.commons.exec.CommandLine("cmd.exe");
result.addArgument("/C");
- result.addArgument(scriptName + ".bat");
+ result.addArgument(scriptName.replace('/', '\\') + ".bat");
} else {
result = new org.apache.commons.exec.CommandLine("./" + (addShExt ? scriptName + ".sh" : scriptName));
@@ -264,7 +264,7 @@ public abstract class ControlCommand {
protected String getScript(String scriptName) {
if (isWindows()) {
- return scriptName + ".bat";
+ return scriptName.replace('/', '\\') + ".bat";
}
return "./" + scriptName + ".sh";
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
index 5579af8..301c24f 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
@@ -340,7 +340,7 @@ public abstract class AbstractInstall extends ControlCommand {
protected void stopServer(File serverBasedir) throws Exception {
- File serverBinDir = new File(serverBasedir, "bin");
+ File serverBinDir = new File(serverBasedir, "bin/internal");
if (!serverBinDir.exists()) {
throw new IllegalArgumentException("No Server found for base directory [" + serverBasedir.getPath() + "]");
}
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
index 3363291..f31636d 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
@@ -227,7 +227,7 @@ public class Upgrade extends AbstractInstall {
}
Executor executor = new DefaultExecutor();
- executor.setWorkingDirectory(getBinDir());
+ executor.setWorkingDirectory(new File(getBaseDir(), "bin")); // data migrator script is not in bin/internal
executor.setStreamHandler(new PumpStreamHandler());
int exitValue = executor.execute(commandLine);
@@ -251,7 +251,8 @@ public class Upgrade extends AbstractInstall {
// to not get a port conflict
waitForProcessToStop(getStoragePid());
- org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-storage-installer", "--upgrade",
+ org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-storage-installer",
+ "--upgrade",
getFromServerDir(rhqctlCommandLine).getAbsolutePath());
Executor executor = new DefaultExecutor();
executor.setWorkingDirectory(getBinDir());
@@ -481,7 +482,7 @@ public class Upgrade extends AbstractInstall {
copyReferredFile(commandLine, oldServerProps, "rhq.server.client.security.truststore.file");
// now merge the old settings in with the default properties from the new server install
- String newServerPropsFilePath = new File(getBinDir(), "rhq-server.properties").getAbsolutePath();
+ String newServerPropsFilePath = new File(getBaseDir(), "bin/rhq-server.properties").getAbsolutePath();
PropertiesFileUpdate newServerPropsFile = new PropertiesFileUpdate(newServerPropsFilePath);
newServerPropsFile.update(oldServerProps);
@@ -567,7 +568,14 @@ public class Upgrade extends AbstractInstall {
throw new FileNotFoundException("Missing agent to upgrade: " + oldAgentDir.getAbsolutePath());
}
} else {
- oldAgentDir = getAgentBasedir();
+ oldAgentDir = null;
+ File fromServerDir = getFromServerDir(rhqctlCommandLine);
+ if (fromServerDir != null && fromServerDir.isDirectory()) {
+ File fromServerDirParent = fromServerDir.getParentFile();
+ if (fromServerDirParent != null && fromServerDirParent.isDirectory()) {
+ oldAgentDir = new File(fromServerDirParent, "rhq-agent");
+ }
+ }
if (!oldAgentDir.isDirectory()) {
log.info("No agent found in the old server location... skipping agent upgrade");
return;
@@ -691,6 +699,10 @@ public class Upgrade extends AbstractInstall {
return new File(getFromServerDir(commandLine), "bin/rhqctl").exists();
}
+ protected boolean isRhq410OrLater(CommandLine commandLine) {
+ return new File(getFromServerDir(commandLine), "bin/internal").isDirectory();
+ }
+
private void printDataMigrationNotice() {
log.info("\n================\n"
+ "If this was an upgrade from older systems that did not have storage nodes,\n "
10 years, 9 months
[rhq] modules/core
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 68bca808787fa95c8cca0c100ae6b113a07315b1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 19 16:35:07 2013 -0400
forgot to register the new storage system config props, adding...
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
index 70ad0e8..ef9360c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
@@ -113,11 +113,13 @@ public enum SystemSetting {
/**
* The STORAGE settings are all read-only and deal with shared, cluster-wide settings
* among storage nodes. They are read-only because they should only be updated through
- * the storage subsystem.
+ * the storage subsystem. The username and password should not be updated at all.
*/
STORAGE_CQL_PORT("STORAGE_CQL_PORT", PropertySimpleType.INTEGER, true, true),
STORAGE_GOSSIP_PORT("STORAGE_GOSSIP_PORT", PropertySimpleType.INTEGER, true, true),
STORAGE_AUTOMATIC_DEPLOYMENT("STORAGE_AUTOMATIC_DEPLOYMENT", PropertySimpleType.BOOLEAN, true, true),
+ STORAGE_USERNAME("STORAGE_USERNAME", PropertySimpleType.STRING, true, true),
+ STORAGE_PASSWORD("STORAGE_PASSWORD", PropertySimpleType.STRING, true, true),
//these seem to be unused yet still present in the database...
@Deprecated
10 years, 9 months
[rhq] modules/common modules/core modules/enterprise
by Jay Shaughnessy
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties | 4
modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/AbstractManager.java | 26 ++-
modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/VersionManager.java | 3
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml | 6
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 31 ++++
modules/core/util/src/main/java/org/rhq/core/util/obfuscation/Obfuscator.java | 13 +
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 17 +-
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java | 11 -
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 39 ++++-
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 76 +++++++++-
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java | 8 +
12 files changed, 201 insertions(+), 35 deletions(-)
New commits:
commit 553db312306ca9f49d27b5c9041d4a52d3bc59a2
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 19 11:53:14 2013 -0400
Bug 1006419 - Improve handling of obfuscated passwords for installation
Use generated username/password for storage nodes.
This removes the need for the user to generate a password and manually
paste it into rhq-server.properties prior to an install. It also generates
a username so that the username will not conflict with any rhq username, in
anticipation of a chained authentication mechanism that can use rhq auth as
a secondary login mechanism. This will be useful for support, for example,
since the generated username/password will be internally used only.
The generated username and encoded version of the password are now also stored
as system config values in the database. This allows the installer to use
the previously generated values for additional HA nodes.
The username/password logic used in install is:
IF set, use the values in the db system config
ELSE
IF pre-set, use the values in rhq-server.properties (primarily for dev builds)
ELSE generate username/password and set in rhq-server.properties
store values in db system config
also:
- removed username/password defaults from cassandra.properties (which should
likely go away, or minimally not be used in rhq-container.build.xml.
- added the new system config props to dbsetup and dbupgrade (2.141)
- limit generated usernames to alpha chars to avoid invalid c* identifiers
- remove logging of plain text storage password when creating superuser
- remove use of plain text storage password in temporary task file when
creating superuser (now decodes just prior to cql statement execution)
- added ServerInstallUtil.fetchStorageClusterSettings() to fetch current
storage settings in the db and updated persistStorageClusterSettingsIfNecessary()
to include the new props.
- added storage property constants to ServerProperties and started using the
constants in place of string literals in various places.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
index f9bdc30..e44b3ac 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
@@ -7,10 +7,10 @@
rhq.cassandra.basedir=${rhq.rootDir}
# The username with which to authenticate requests to Cassandra.
-rhq.storage.username=rhqadmin
+# rhq.storage.username=
# The password with which to authenticate requests to Cassandra.
-rhq.storage.password=1eeb2f255e832171df8592078de921bc
+# rhq.storage.password=
# Defines the number of tokens randomly assigned to a node on the ring. The more tokens,
# relative to other nodes, the larger the proportion of data that this node will store. You
diff --git a/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/AbstractManager.java b/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/AbstractManager.java
index fb9f127..778b8d5 100644
--- a/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/AbstractManager.java
+++ b/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/AbstractManager.java
@@ -40,6 +40,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.cassandra.util.ClusterBuilder;
+import org.rhq.core.util.obfuscation.PicketBoxObfuscator;
/**
* @author Stefan Negrea
@@ -53,12 +54,7 @@ abstract class AbstractManager {
private final Log log = LogFactory.getLog(AbstractManager.class);
enum Query {
- USER_EXISTS,
- SCHEMA_EXISTS,
- VERSION_COLUMNFAMILY_EXISTS,
- VERSION,
- REPLICATION_FACTOR,
- INSERT_SCHEMA_VERSION;
+ USER_EXISTS, SCHEMA_EXISTS, VERSION_COLUMNFAMILY_EXISTS, VERSION, REPLICATION_FACTOR, INSERT_SCHEMA_VERSION;
@Override
public String toString() {
@@ -295,7 +291,6 @@ abstract class AbstractManager {
return execute(queryString);
}
-
/**
* Execute all the queries in an update file as returned by @link {@link UpdateFile#getOrderedSteps()}.
*
@@ -334,7 +329,13 @@ abstract class AbstractManager {
log.info("Applying update file: " + updateFile);
for (String step : updateFile.getOrderedSteps(properties)) {
- log.info("Statement: \n" + step);
+ if (step.toUpperCase().contains("CREATE USER")) {
+ // the task file must not contain plain text passwords, so assume it needs to be decoded
+ step = replaceEncodedPassword(step);
+ log.debug("Statement: \n" + step);
+ } else {
+ log.info("Statement: \n" + step);
+ }
results.add(execute(step));
}
log.info("Applied update file: " + updateFile);
@@ -342,6 +343,15 @@ abstract class AbstractManager {
return results;
}
+ private String replaceEncodedPassword(String step) {
+ int firstQuoteIndex = step.indexOf("'");
+ int lastQuoteIndex = step.lastIndexOf("'");
+ String encodedPassword = step.substring(++firstQuoteIndex, lastQuoteIndex);
+ String decodedPassword = PicketBoxObfuscator.decode(encodedPassword);
+ String decodedStep = step.replace(encodedPassword, decodedPassword);
+ return decodedStep;
+ }
+
/**
* Execute a CQL query.
*
diff --git a/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/VersionManager.java b/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/VersionManager.java
index 9184af3..e71d12f 100644
--- a/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/VersionManager.java
+++ b/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/VersionManager.java
@@ -36,7 +36,6 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.cassandra.schema.exception.InstalledSchemaTooAdvancedException;
import org.rhq.cassandra.schema.exception.InstalledSchemaTooOldException;
import org.rhq.cassandra.schema.exception.SchemaNotInstalledException;
-import org.rhq.core.util.obfuscation.PicketBoxObfuscator;
/**
* @author Stefan Negrea
@@ -107,7 +106,7 @@ class VersionManager extends AbstractManager {
properties.put("replication_factor", calculateNewReplicationFactor() + "");
properties.put("cassandra_user_password", UUID.randomUUID() + "");
properties.put("rhq_admin_username", getUsername());
- properties.put("rhq_admin_password", PicketBoxObfuscator.decode(getPassword()));
+ properties.put("rhq_admin_password", getPassword());
/**
* NOTE: Before applying any schema, we need to create the rhqadmin user. If we have more
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 086f15e..5c8da9b 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
<description>Database schema setup, upgrade and other utilities</description>
<properties>
- <db.schema.version>2.140</db.schema.version>
+ <db.schema.version>2.141</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
index c6da7d2..671853f 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
@@ -143,11 +143,15 @@
PROPERTY_VALUE="true" DEFAULT_PROPERTY_VALUE="true"
FREAD_ONLY="TRUE"/>
- <!-- STORAGE_CQL_PORT and STORAGE_GOSSIP_PORT will get updated by the installer -->
+ <!-- STORAGE_USERNAME, STORAGE_PASSWORD, STORAGE_CQL_PORT and STORAGE_GOSSIP_PORT will get updated by the installer -->
<data ID="61" PROPERTY_KEY="STORAGE_CQL_PORT" FREAD_ONLY="TRUE"/>
<data ID="62" PROPERTY_KEY="STORAGE_GOSSIP_PORT" FREAD_ONLY="TRUE"/>
+ <data ID="63" PROPERTY_KEY="STORAGE_USERNAME" FREAD_ONLY="TRUE"/>
+
+ <data ID="64" PROPERTY_KEY="STORAGE_PASSWORD" FREAD_ONLY="TRUE"/>
+
</table>
</dbsetup>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index e98c95e..94688f6 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2036,6 +2036,8 @@
</schema-directSQL>
</schemaSpec>
+<!-- RHQ 4.7.0 uses DB Schema 2.132 -->
+
<schemaSpec version="2.133">
<!-- RHQ_STORAGE_NODE -->
<schema-createSequence name="RHQ_STORAGE_NODE_ID_SEQ" initial="10001" />
@@ -2073,6 +2075,8 @@
</schema-directSQL>
</schemaSpec>
+<!-- RHQ 4.7.0 uses DB Schema 2.133 -->
+
<schemaSpec version="2.134">
<!-- Make sure existing storage nodes are storing IP addresses and not hostnames -->
<schema-javaTask className="StorageNodeAddressUpgradeTask" />
@@ -2252,6 +2256,33 @@
</statement>
</schema-directSQL>
</schemaSpec>
+
+<!-- RHQ 4.9.0 uses DB Schema 2.140 -->
+
+ <schemaSpec version="2.141">
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Adding storage username">
+ INSERT INTO rhq_system_config (id, property_key, property_value, default_property_value, fread_only)
+ VALUES (63, 'STORAGE_USERNAME', null, null, true)
+ </statement>
+ <statement targetDBVendor="oracle" desc="Adding storage username">
+ INSERT INTO rhq_system_config (id, property_key, property_value, default_property_value, fread_only)
+ VALUES (63, 'STORAGE_USERNAME', null, null, 1)
+ </statement>
+ </schema-directSQL>
+
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Adding storage password">
+ INSERT INTO rhq_system_config (id, property_key, property_value, default_property_value, fread_only)
+ VALUES (64, 'STORAGE_PASSWORD', null, null, true)
+ </statement>
+ <statement targetDBVendor="oracle" desc="Adding default storage password">
+ INSERT INTO rhq_system_config (id, property_key, property_value, default_property_value, fread_only)
+ VALUES (64, 'STORAGE_PASSWORD', null, null, 1)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/obfuscation/Obfuscator.java b/modules/core/util/src/main/java/org/rhq/core/util/obfuscation/Obfuscator.java
index 4743548..2198f9e 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/obfuscation/Obfuscator.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/obfuscation/Obfuscator.java
@@ -119,9 +119,18 @@ public final class Obfuscator {
return new String(decode);
}
- // adapted from http://stackoverflow.com/questions/2863852/how-to-generate-a-random-strin...
+ /**
+ * Adapted from http://stackoverflow.com/questions/2863852/how-to-generate-a-random-strin....
+ * <p/>
+ * The default set of validCharacters: 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+ *
+ * @param random
+ * @param validCharacters
+ * @param length
+ * @return
+ */
public static String generateString(Random random, String validCharacters, int length) {
- validCharacters = (null == validCharacters || validCharacters.isEmpty()) ? "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#$"
+ validCharacters = (null == validCharacters || validCharacters.isEmpty()) ? "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
: validCharacters;
length = (length < 1) ? 10 : length;
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 c76ba7b..6c2f6f9 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
@@ -21,9 +21,12 @@
<property name="default.rhq.server.drift.binary.content" value="false"/>
+ <property name="default.rhq.storage.username" value=""/>
+ <property name="default.rhq.storage.password" value=""/>
+
<property name="default.jboss.bind.address" value=""/>
- <target name="set-predeploy-prop">
+ <target name="set-predeploy-prop">
<condition property="predeploy" value="true">
<or>
<equals arg1="${dev.profile.active}" arg2="true" />
@@ -46,6 +49,9 @@
<property name="rhq.server.quartz.selectWithLockSQL" value="${rhq.dev.quartz.selectWithLockSQL}" />
<property name="rhq.server.quartz.lockHandlerClass" value="${rhq.dev.quartz.lockHandlerClass}" />
<property name="rhq.server.drift.store-binary-content" value="${default.rhq.server.drift.binary.content}"/>
+ <!-- these are only set explicitly in dev envs, prod envs generate these at install time -->
+ <property name="rhq.storage.username" value="rhqadmin"/>
+ <property name="rhq.storage.password" value="1eeb2f255e832171df8592078de921bc"/>
<!-- this is only set explicitly in dev envs, prod envs must set these manually for security -->
<property name="jboss.bind.address" value="0.0.0.0"/>
</target>
@@ -64,6 +70,9 @@
<property name="rhq.server.quartz.selectWithLockSQL" value="${default.rhq.server.quartz.selectWithLockSQL}" />
<property name="rhq.server.quartz.lockHandlerClass" value="${default.rhq.server.quartz.lockHandlerClass}" />
<property name="rhq.server.drift.store-binary-content" value="${default.rhq.server.drift.binary.content}"/>
+ <!-- these are only set explicitly in dev envs, prod envs generate these at install time -->
+ <property name="rhq.storage.username" value="${default.rhq.storage.username}"/>
+ <property name="rhq.storage.password" value="${default.rhq.storage.password}"/>
<!-- this is only set by default in dev envs, prod envs must set these manually for security -->
<property name="jboss.bind.address" value="${default.jboss.bind.address}"/>
</target>
@@ -419,10 +428,10 @@
<target name="prepare-bin-dir">
<echo>*** Preparing bin dir ***</echo>
- <loadproperties>
- <zipentry zipfile="${settings.localRepository}/org/rhq/rhq-cassandra-ccm-core/${project.version}/rhq-cassandra-ccm-core-${project.version}.jar"
+ <loadproperties>
+ <zipentry zipfile="${settings.localRepository}/org/rhq/rhq-cassandra-ccm-core/${project.version}/rhq-cassandra-ccm-core-${project.version}.jar"
name="cassandra.properties"/>
- </loadproperties>
+ </loadproperties>
<echo>Connection URL is ${rhq.server.database.connection-url}</echo>
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
index 7d3d4e0..04f5cff 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
@@ -228,7 +228,7 @@ public class Installer {
}
case 'e': {
- // prompt for the password. we don't use a command line option because then the plain test password
+ // prompt for the password. we don't use a command line option because then the plain text password
// could get captured in command history.
Console console = System.console();
if (null != console) {
@@ -262,13 +262,12 @@ public class Installer {
}
}
- // if a password was asked to be obfuscated, that's all we do on the execution
+ // if a password was asked to be encoded, that's all we do on the execution
if (passwordToEncode != null) {
- String obfuscatedPassword = new InstallerServiceImpl(installerConfig).obfuscatePassword(String
+ String encodedPassword = new InstallerServiceImpl(installerConfig).obfuscatePassword(String
.valueOf(passwordToEncode));
- LOG.info("*** Encoded password properties for rhq-server.properties:");
- LOG.info("*** rhq.server.database.password=" + obfuscatedPassword);
- LOG.info("*** rhq.storage.password=" + obfuscatedPassword);
+ LOG.info("*** Encoded password for rhq-server.properties:");
+ LOG.info("*** rhq.server.database.password=" + encodedPassword);
return new WhatToDo[] { WhatToDo.DO_NOTHING };
}
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 906e4ea..4b42c53 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -265,7 +265,8 @@ public class InstallerServiceImpl implements InstallerService {
// create an rhqadmin management user so when discovered, the AS7 plugin can immediately
// connect to the RHQ Server. The password is generated as we try to make the RHQ server manageable by
// the plugin without the user having to get involved.
- String managementPassword = Obfuscator.generateString(new Random(), null, 8);
+ Random random = new Random();
+ String managementPassword = Obfuscator.generateString(random, null, 8);
ServerInstallUtil.createDefaultManagementUser(managementPassword, serverDetails, appServerConfigDir);
// Doing this prior to prepareDatabase sets the property before they are validated and saved.
@@ -275,6 +276,21 @@ public class InstallerServiceImpl implements InstallerService {
String encodedManagementPassword = Obfuscator.encode(managementPassword);
serverProperties.put(ServerProperties.PROP_MGMT_USER_PASSWORD, encodedManagementPassword);
+ // Similarly generate a storage username and password, and encode the password. If already set, don't
+ // override. This allows for canned values in a dev env, or user override in a prod env.
+ String storageUsername = serverProperties.get(ServerProperties.PROP_STORAGE_USERNAME);
+ String storagePassword = serverProperties.get(ServerProperties.PROP_STORAGE_PASSWORD);
+ if (ServerInstallUtil.isEmpty(storageUsername)) {
+ // note, limit to alpha usernames to ensure we don't violate cassandra identifier rules
+ storageUsername = Obfuscator.generateString(random, "abcdefghijklmnopqrstuvwxyz", 8);
+ serverProperties.put(ServerProperties.PROP_STORAGE_USERNAME, storageUsername);
+ }
+ if (ServerInstallUtil.isEmpty(storagePassword)) {
+ storagePassword = Obfuscator.generateString(random, null, 8);
+ String encodedStoragePassword = PicketBoxObfuscator.encode(storagePassword);
+ serverProperties.put(ServerProperties.PROP_STORAGE_PASSWORD, encodedStoragePassword);
+ }
+
prepareDatabase(serverProperties, serverDetails, existingSchemaOption);
// perform stuff that has to get done via the JBossAS management client
@@ -490,6 +506,19 @@ public class InstallerServiceImpl implements InstallerService {
throw new Exception("Could not complete the database schema installation", e);
}
+ // if the storage cluster credentials are already set (typically an HA install), override
+ // what's currently in the server properties file, and then continue with storage schema setup
+ Map<String, String> storageProperties = ServerInstallUtil.fetchStorageClusterSettings(serverProperties,
+ clearTextDbPassword);
+ String storageUsernameSetting = storageProperties.get(ServerProperties.PROP_STORAGE_USERNAME);
+ String storagePasswordSetting = storageProperties.get(ServerProperties.PROP_STORAGE_PASSWORD);
+ if (null != storageUsernameSetting) {
+ serverProperties.put(ServerProperties.PROP_STORAGE_USERNAME, storageUsernameSetting);
+ }
+ if (null != storagePasswordSetting) {
+ serverProperties.put(ServerProperties.PROP_STORAGE_PASSWORD, storagePasswordSetting);
+ }
+
SchemaManager storageNodeSchemaManager = null;
try {
storageNodeSchemaManager = createStorageNodeSchemaManager(serverProperties);
@@ -1174,8 +1203,8 @@ public class InstallerServiceImpl implements InstallerService {
}
private List<StorageNode> parseNodeInformation(HashMap<String, String> serverProps) {
- String[] nodes = serverProps.get("rhq.storage.nodes").split(",");
- String cqlPort = serverProps.get("rhq.storage.cql-port");
+ String[] nodes = serverProps.get(ServerProperties.PROP_STORAGE_NODES).split(",");
+ String cqlPort = serverProps.get(ServerProperties.PROP_STORAGE_CQL_PORT);
List<StorageNode> parsedNodes = new ArrayList<StorageNode>();
for (String node : nodes) {
@@ -1189,8 +1218,8 @@ public class InstallerServiceImpl implements InstallerService {
}
private SchemaManager createStorageNodeSchemaManager(HashMap<String, String> serverProps) {
- String username = serverProps.get("rhq.storage.username");
- String password = serverProps.get("rhq.storage.password");
+ String username = serverProps.get(ServerProperties.PROP_STORAGE_USERNAME);
+ String password = serverProps.get(ServerProperties.PROP_STORAGE_PASSWORD);
List<StorageNode> storageNodes = this.parseNodeInformation(serverProps);
String[] nodes = new String[storageNodes.size()];
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index 8b9ce6f..c01ef5c 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -977,6 +977,64 @@ public class ServerInstallUtil {
}
}
+ public static Map<String, String> fetchStorageClusterSettings(HashMap<String, String> serverProperties,
+ String password) throws Exception {
+
+ Map<String, String> result = new HashMap<String, String>(4);
+ DatabaseType db = null;
+ Connection connection = null;
+ PreparedStatement statement = null;
+
+ try {
+ String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
+ String userName = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME);
+ connection = getDatabaseConnection(dbUrl, userName, password);
+ db = DatabaseTypeFactory.getDatabaseType(connection);
+
+ if (!(db instanceof PostgresqlDatabaseType || db instanceof OracleDatabaseType)) {
+ throw new IllegalArgumentException("Unknown database type, can't continue: " + db);
+ }
+
+ connection = getDatabaseConnection(dbUrl, userName, password);
+ connection.setAutoCommit(false);
+
+ statement = connection.prepareStatement("" //
+ + "SELECT property_key, property_value FROM rhq_system_config " //
+ + " WHERE property_key LIKE 'STORAGE%' " //
+ + " AND NOT property_value IS NULL ");
+ ResultSet rs = statement.executeQuery();
+
+ while (rs.next()) {
+ String key = rs.getString(1);
+ String value = rs.getString(2);
+
+ if (key.equals("STORAGE_USERNAME")) {
+ result.put(ServerProperties.PROP_STORAGE_USERNAME, value);
+ } else if (key.equals("STORAGE_PASSWORD")) {
+ result.put(ServerProperties.PROP_STORAGE_PASSWORD, value);
+ } else if (key.equals("STORAGE_GOSSIP_PORT")) {
+ result.put(ServerProperties.PROP_STORAGE_GOSSIP_PORT, value);
+ } else if (key.equals("STORAGE_CQL_PORT")) {
+ result.put(ServerProperties.PROP_STORAGE_CQL_PORT, value);
+ }
+ }
+
+ connection.commit();
+
+ } catch (SQLException e) {
+ LOG.error("Failed to fetch storage cluster settings. Transaction will be rolled back.", e);
+ connection.rollback();
+ throw e;
+ } finally {
+ if (db != null) {
+ db.closeStatement(statement);
+ db.closeConnection(connection);
+ }
+ }
+
+ return result;
+ }
+
public static void persistStorageClusterSettingsIfNecessary(HashMap<String, String> serverProperties,
String password) throws Exception {
DatabaseType db = null;
@@ -1000,13 +1058,23 @@ public class ServerInstallUtil {
+ "SET property_value = ?, default_property_value = ? "
+ "WHERE property_key = ? AND property_value IS NULL AND default_property_value IS NULL");
- updateClusterSetting.setString(1, serverProperties.get("rhq.storage.cql-port"));
- updateClusterSetting.setString(2, serverProperties.get("rhq.storage.cql-port"));
+ updateClusterSetting.setString(1, serverProperties.get(ServerProperties.PROP_STORAGE_USERNAME));
+ updateClusterSetting.setString(2, serverProperties.get(ServerProperties.PROP_STORAGE_USERNAME));
+ updateClusterSetting.setString(3, "STORAGE_USERNAME");
+ updateClusterSetting.executeUpdate();
+
+ updateClusterSetting.setString(1, serverProperties.get(ServerProperties.PROP_STORAGE_PASSWORD));
+ updateClusterSetting.setString(2, serverProperties.get(ServerProperties.PROP_STORAGE_PASSWORD));
+ updateClusterSetting.setString(3, "STORAGE_PASSWORD");
+ updateClusterSetting.executeUpdate();
+
+ updateClusterSetting.setString(1, serverProperties.get(ServerProperties.PROP_STORAGE_CQL_PORT));
+ updateClusterSetting.setString(2, serverProperties.get(ServerProperties.PROP_STORAGE_CQL_PORT));
updateClusterSetting.setString(3, "STORAGE_CQL_PORT");
updateClusterSetting.executeUpdate();
- updateClusterSetting.setString(1, serverProperties.get("rhq.storage.gossip-port"));
- updateClusterSetting.setString(2, serverProperties.get("rhq.storage.gossip-port"));
+ updateClusterSetting.setString(1, serverProperties.get(ServerProperties.PROP_STORAGE_GOSSIP_PORT));
+ updateClusterSetting.setString(2, serverProperties.get(ServerProperties.PROP_STORAGE_GOSSIP_PORT));
updateClusterSetting.setString(3, "STORAGE_GOSSIP_PORT");
updateClusterSetting.executeUpdate();
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
index 6177830..6ac264d 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
@@ -118,6 +118,12 @@ public class ServerProperties {
public static final String PROP_MGMT_USER_PASSWORD = "rhq.server.management.password";
+ public static final String PROP_STORAGE_USERNAME = "rhq.storage.username";
+ public static final String PROP_STORAGE_PASSWORD = "rhq.storage.password";
+ public static final String PROP_STORAGE_NODES = "rhq.storage.nodes";
+ public static final String PROP_STORAGE_CQL_PORT = "rhq.storage.cql-port";
+ public static final String PROP_STORAGE_GOSSIP_PORT = "rhq.storage.gossip-port";
+
// this list contains all the properties that are to have boolean values (true | false)
public static final Set<String> BOOLEAN_PROPERTIES;
static {
@@ -147,6 +153,8 @@ public class ServerProperties {
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ);
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_WEBCONNS);
INTEGER_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_PORT);
+ INTEGER_PROPERTIES.add(PROP_STORAGE_CQL_PORT);
+ INTEGER_PROPERTIES.add(PROP_STORAGE_GOSSIP_PORT);
}
// this list contains all the properties that are to have non-empty string values
10 years, 9 months
[rhq] etc/scripts
by Thomas Segismont
etc/scripts/rhq-api-check | 4 ++++
etc/scripts/rhq-probe | 4 ++++
etc/scripts/rhq-trigger | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
New commits:
commit 6ddd1d6dc0c21e20c69a4d516a0d85c030b73abb
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Sep 19 17:33:10 2013 +0200
Added new scripts to trigger RHQ On Demand jobs
diff --git a/etc/scripts/rhq-api-check b/etc/scripts/rhq-api-check
new file mode 100755
index 0000000..0005ad6
--- /dev/null
+++ b/etc/scripts/rhq-api-check
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+rhq-trigger "rhq-api-check" "$@"
+
diff --git a/etc/scripts/rhq-probe b/etc/scripts/rhq-probe
new file mode 100755
index 0000000..284fa44
--- /dev/null
+++ b/etc/scripts/rhq-probe
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+rhq-trigger "rhq-probe" "$@"
+
diff --git a/etc/scripts/rhq-trigger b/etc/scripts/rhq-trigger
new file mode 100755
index 0000000..d362b86
--- /dev/null
+++ b/etc/scripts/rhq-trigger
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+JOB=$1
+if [ $# -eq 2 ]; then
+ BRANCH=$2
+else
+ BRANCH=`git rev-parse --abbrev-ref HEAD`
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo "Not in a Git repository. You must provide a branch name"
+ exit 1
+ fi
+fi
+
+echo "Will trigger job '$JOB' for branch '$BRANCH'"
+
+URL="https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/RHQ/view/RHQ%20On%2..."
+
+case "`uname`" in
+ CYGWIN*)
+ cygstart $URL
+ ;;
+
+ Darwin*)
+ open $URL
+ ;;
+
+ Linux)
+ xdg-open $URL > /dev/null 2>&1
+ ;;
+
+ *)
+ start '"browse"' "$URL"
+ ;;
+esac
+
10 years, 9 months
[rhq] 2 commits - modules/core
by John Sanda
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 20 ++++------
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java | 13 +++---
2 files changed, 15 insertions(+), 18 deletions(-)
New commits:
commit e3aa1e003b6d61bb42c4e6d48222c3d5d11ab5b6
Merge: a87c72d 3843704
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Sep 19 09:56:47 2013 -0400
Merge branch 'bug/1009666'
commit 3843704e61a48c6162dca42861fb0c44a70b3f47
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 18 20:37:47 2013 -0400
[BZ 1009666] Store plugin container init listeners in a list
The PC initialization listeners were introduced to work around a deadlock
issue with registering event pollers. The listeners are stored in a map in
which entries are keyed off of the class name. The only class that adds
listeners is EventContextImpl. This results in only every having one event
poller registered after PC initialization regardless of the number of event
pollers. Storing the listeners in a list resolves the issue.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 4f6a9a1..d88ce53 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -24,10 +24,10 @@ package org.rhq.core.pc;
import java.beans.Introspector;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.LinkedHashSet;
-import java.util.Map;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
@@ -146,8 +146,8 @@ public class PluginContainer {
// this is to prevent race conditions on startup between components from all the different managers
private ReadWriteLock rwLock = new ReentrantReadWriteLock();
- private Map<String, InitializationListener> initListeners = new HashMap<String, InitializationListener>();
- private Map<String, ShutdownListener> shutdownListeners = new HashMap<String, ShutdownListener>();
+ private List<InitializationListener> initListeners = new ArrayList<InitializationListener>();
+ private List<ShutdownListener> shutdownListeners = new ArrayList<ShutdownListener>();
private Object initListenersLock = new Object();
private Object shutdownListenersLock = new Object();
private boolean shuttingDown;
@@ -344,7 +344,7 @@ public class PluginContainer {
synchronized (initListenersLock) {
if (started) {
- for (InitializationListener listener : initListeners.values()) {
+ for (InitializationListener listener : initListeners) {
listener.initialized();
}
}
@@ -454,7 +454,7 @@ public class PluginContainer {
synchronized (shutdownListenersLock) {
if (!started) {
- for (ShutdownListener listener : shutdownListeners.values()) {
+ for (ShutdownListener listener : shutdownListeners) {
listener.shutdown();
}
}
@@ -741,13 +741,12 @@ public class PluginContainer {
* Add the callback listener to notify when the plugin container is initialized. If this method is invoked and
* the PC is already initialized, then <code>listener</code> will be invoked immediately.
*
- * @param name associated with the listener
* @param listener The callback object to notify. If a listener with the supplied name is registered, it
* will be replaced with the newly supplied listner.
*/
- public void addInitializationListener(String name, InitializationListener listener) {
+ public void addInitializationListener(InitializationListener listener) {
synchronized (initListenersLock) {
- initListeners.put(name, listener);
+ initListeners.add(listener);
if (started) {
listener.initialized();
@@ -760,13 +759,12 @@ public class PluginContainer {
* {@link #addInitializationListener(String, InitializationListener)} the <code>listener</code> will
* not be invoked immediately if the PC is already shutdown. It will only be invoked on future shutdowns.
*
- * @param name associated with the listener
* @param listener The callback object to notify. If a listener with the supplied name is registered, it
* will be replaced with the newly supplied listener.
*/
public void addShutdownListener(String name, ShutdownListener listener) {
synchronized (shutdownListenersLock) {
- shutdownListeners.put(name, listener);
+ shutdownListeners.add(listener);
}
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
index fd360cf..52f270b 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
@@ -124,13 +124,12 @@ public class EventContextImpl implements EventContext {
final int adjustedPollingInterval = Math.max(EventContext.MINIMUM_POLLING_INTERVAL, pollingInterval);
// Registering the event poller has to be done in a callback listener to avoid a potential deadlock.
// See https://bugzilla.redhat.com/show_bug.cgi?id=677349 for a detailed explaination.
- PluginContainer.getInstance().addInitializationListener(this.getClass().getName(),
- new PluginContainer.InitializationListener() {
- @Override
- public void initialized() {
- getEventManager().registerEventPoller(poller, adjustedPollingInterval, resource, sourceLocation);
- }
- });
+ PluginContainer.getInstance().addInitializationListener(new PluginContainer.InitializationListener() {
+ @Override
+ public void initialized() {
+ getEventManager().registerEventPoller(poller, adjustedPollingInterval, resource, sourceLocation);
+ }
+ });
}
private void unregisterEventPollerInternal(String eventType, String sourceLocation) {
10 years, 9 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 15 +-
modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java | 70 ++++++++++
2 files changed, 80 insertions(+), 5 deletions(-)
New commits:
commit a87c72d760acdf9f77849d2a094f3a81e9bbb257
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 18 22:19:43 2013 -0400
fix storage installer upgrade bugs (only impact upgrading from RHQ 4.9)
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index 30db17c..a2c04be 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -468,6 +468,15 @@ public class StorageInstaller {
installerInfo.basedir = storageBasedir;
installerInfo.logFile = new File(logDir, "rhq-storage.log");
+ boolean isRHQ48Install;
+ if (cassandraEnvFile.exists()) {
+ isRHQ48Install = true;
+ installerInfo.jmxPort = parseJmxPortFromCassandrEnv(cassandraEnvFile);
+ } else {
+ isRHQ48Install = false;
+ installerInfo.jmxPort = parseJmxPort(new File(oldConfDir, "cassandra-jvm.properties"));
+ }
+
deploymentOptions.setBasedir(storageBasedir.getAbsolutePath());
deploymentOptions.setLogFileName(installerInfo.logFile.getPath());
deploymentOptions.setLoggingLevel("INFO");
@@ -484,9 +493,7 @@ public class StorageInstaller {
deployer.applyConfigChanges();
deployer.updateFilePerms();
- if (cassandraEnvFile.exists()) {
- // Then this is an RHQ 4.8 install
- installerInfo.jmxPort = parseJmxPortFromCassandrEnv(cassandraEnvFile);
+ if (isRHQ48Install) {
Properties jvmProps = new Properties();
jvmProps.load(new FileInputStream(cassandraJvmPropsFile));
PropertiesFileUpdate propertiesUpdater = new PropertiesFileUpdate(
@@ -494,8 +501,6 @@ public class StorageInstaller {
jvmProps.setProperty("jmx_port", Integer.toString(installerInfo.jmxPort));
propertiesUpdater.update(jvmProps);
- } else {
- installerInfo.jmxPort = parseJmxPort(cassandraJvmPropsFile);
}
ConfigEditor oldYamlEditor = new ConfigEditor(oldYamlFile);
diff --git a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
index 6b5d9d7..22cc4c4 100644
--- a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
+++ b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
@@ -141,6 +141,76 @@ public class StorageInstallerTest {
assertEquals(properties.getProperty("thread_stack_size"), "-Xss256k", "The thread_stack_size property is wrong");
}
+ @Test(dependsOnMethods = "performDefaultInstall")
+ public void upgradeFromDefaultInstall() throws Exception {
+ CommandLineParser parser = new PosixParser();
+ File defaultInstallDir = new File(basedir.getParentFile(), "performDefaultInstall");
+ File upgradeFromServerDir = new File(defaultInstallDir, "rhq-server");
+ String[] args = {"--upgrade", upgradeFromServerDir.getAbsolutePath()};
+ CommandLine cmdLine = parser.parse(installer.getOptions(), args);
+
+ int status = installer.run(cmdLine);
+ assertEquals(status, 0, "Expected to get back a status code of 0 for a successful default upgrade");
+
+ String address = InetAddress.getLocalHost().getHostAddress();
+ assertNodeIsRunning();
+ assertRhqServerPropsUpdated(address);
+
+ File binDir = new File(storageDir, "bin");
+ assertTrue(binDir.exists(), "Expected to find bin directory at " + binDir);
+
+ File confDir = new File(storageDir, "conf");
+ assertTrue(confDir.exists(), "Expected to find conf directory at " + confDir);
+
+ File libDir = new File(storageDir, "lib");
+ assertTrue(libDir.exists(), "Expected to find lib directory at " + libDir);
+
+ File baseDataDir = new File(defaultInstallDir, "rhq-data");
+
+ File commitLogDir = new File(baseDataDir, "commit_log");
+ assertTrue(commitLogDir.exists(), "Expected to find commit_log directory at " + commitLogDir);
+
+ File dataDir = new File(baseDataDir, "data");
+ assertTrue(dataDir.exists(), "Expected to find data directory at " + dataDir);
+
+ File savedCachesDir = new File(baseDataDir, "saved_caches");
+ assertTrue(savedCachesDir.exists(), "Expected to find saved_caches directory at " + savedCachesDir);
+
+ File log4jFile = new File(confDir, "log4j-server.properties");
+ assertTrue(log4jFile.exists(), log4jFile + " does not exist");
+
+ File logsDir = new File(serverDir, "logs");
+ File logFile = new File(logsDir, "rhq-storage.log");
+
+ Properties log4jProps = new Properties();
+ log4jProps.load(new FileInputStream(log4jFile));
+ assertEquals(log4jProps.getProperty("log4j.appender.R.File"), logFile.getAbsolutePath(),
+ "The log file is wrong");
+
+ File yamlFile = new File(confDir, "cassandra.yaml");
+ ConfigEditor yamlEditor = new ConfigEditor(yamlFile);
+ yamlEditor.load();
+
+ assertEquals(yamlEditor.getInternodeAuthenticator(), "org.rhq.cassandra.auth.RhqInternodeAuthenticator",
+ "Failed to set the internode_authenticator property in " + yamlFile);
+ assertEquals(yamlEditor.getAuthenticator(), "org.apache.cassandra.auth.PasswordAuthenticator",
+ "The authenticator property is wrong");
+ assertEquals(yamlEditor.getListenAddress(), address, "The listen_address property is wrong");
+ assertEquals(yamlEditor.getNativeTransportPort(), (Integer) 9142, "The native_transport_port property is wrong");
+ assertEquals(yamlEditor.getRpcAddress(), address, "The rpc_address property is wrong");
+ assertEquals(yamlEditor.getStoragePort(), (Integer) 7100, "The storage_port property is wrong");
+
+ File cassandraJvmPropsFile = new File(confDir, "cassandra-jvm.properties");
+ Properties properties = new Properties();
+ properties.load(new FileInputStream(cassandraJvmPropsFile));
+
+ assertEquals(properties.getProperty("jmx_port"), "7299", "The jmx_port property is wrong");
+ assertEquals(properties.getProperty("heap_min"), "-Xms512M", "The heap_min property is wrong");
+ assertEquals(properties.getProperty("heap_max"), "-Xmx512M", "The heap_max property is wrong");
+ assertEquals(properties.getProperty("heap_new"), "-Xmn128M", "The heap_new property is wrong");
+ assertEquals(properties.getProperty("thread_stack_size"), "-Xss256k", "The thread_stack_size property is wrong");
+ }
+
@Test
public void performValidInstall() throws Exception {
CommandLineParser parser = new PosixParser();
10 years, 9 months
[rhq] Branch 'bug/1009666' - modules/core
by John Sanda
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 20 ++++------
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java | 13 +++---
2 files changed, 15 insertions(+), 18 deletions(-)
New commits:
commit 3843704e61a48c6162dca42861fb0c44a70b3f47
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 18 20:37:47 2013 -0400
[BZ 1009666] Store plugin container init listeners in a list
The PC initialization listeners were introduced to work around a deadlock
issue with registering event pollers. The listeners are stored in a map in
which entries are keyed off of the class name. The only class that adds
listeners is EventContextImpl. This results in only every having one event
poller registered after PC initialization regardless of the number of event
pollers. Storing the listeners in a list resolves the issue.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 4f6a9a1..d88ce53 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -24,10 +24,10 @@ package org.rhq.core.pc;
import java.beans.Introspector;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.LinkedHashSet;
-import java.util.Map;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
@@ -146,8 +146,8 @@ public class PluginContainer {
// this is to prevent race conditions on startup between components from all the different managers
private ReadWriteLock rwLock = new ReentrantReadWriteLock();
- private Map<String, InitializationListener> initListeners = new HashMap<String, InitializationListener>();
- private Map<String, ShutdownListener> shutdownListeners = new HashMap<String, ShutdownListener>();
+ private List<InitializationListener> initListeners = new ArrayList<InitializationListener>();
+ private List<ShutdownListener> shutdownListeners = new ArrayList<ShutdownListener>();
private Object initListenersLock = new Object();
private Object shutdownListenersLock = new Object();
private boolean shuttingDown;
@@ -344,7 +344,7 @@ public class PluginContainer {
synchronized (initListenersLock) {
if (started) {
- for (InitializationListener listener : initListeners.values()) {
+ for (InitializationListener listener : initListeners) {
listener.initialized();
}
}
@@ -454,7 +454,7 @@ public class PluginContainer {
synchronized (shutdownListenersLock) {
if (!started) {
- for (ShutdownListener listener : shutdownListeners.values()) {
+ for (ShutdownListener listener : shutdownListeners) {
listener.shutdown();
}
}
@@ -741,13 +741,12 @@ public class PluginContainer {
* Add the callback listener to notify when the plugin container is initialized. If this method is invoked and
* the PC is already initialized, then <code>listener</code> will be invoked immediately.
*
- * @param name associated with the listener
* @param listener The callback object to notify. If a listener with the supplied name is registered, it
* will be replaced with the newly supplied listner.
*/
- public void addInitializationListener(String name, InitializationListener listener) {
+ public void addInitializationListener(InitializationListener listener) {
synchronized (initListenersLock) {
- initListeners.put(name, listener);
+ initListeners.add(listener);
if (started) {
listener.initialized();
@@ -760,13 +759,12 @@ public class PluginContainer {
* {@link #addInitializationListener(String, InitializationListener)} the <code>listener</code> will
* not be invoked immediately if the PC is already shutdown. It will only be invoked on future shutdowns.
*
- * @param name associated with the listener
* @param listener The callback object to notify. If a listener with the supplied name is registered, it
* will be replaced with the newly supplied listener.
*/
public void addShutdownListener(String name, ShutdownListener listener) {
synchronized (shutdownListenersLock) {
- shutdownListeners.put(name, listener);
+ shutdownListeners.add(listener);
}
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
index fd360cf..52f270b 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
@@ -124,13 +124,12 @@ public class EventContextImpl implements EventContext {
final int adjustedPollingInterval = Math.max(EventContext.MINIMUM_POLLING_INTERVAL, pollingInterval);
// Registering the event poller has to be done in a callback listener to avoid a potential deadlock.
// See https://bugzilla.redhat.com/show_bug.cgi?id=677349 for a detailed explaination.
- PluginContainer.getInstance().addInitializationListener(this.getClass().getName(),
- new PluginContainer.InitializationListener() {
- @Override
- public void initialized() {
- getEventManager().registerEventPoller(poller, adjustedPollingInterval, resource, sourceLocation);
- }
- });
+ PluginContainer.getInstance().addInitializationListener(new PluginContainer.InitializationListener() {
+ @Override
+ public void initialized() {
+ getEventManager().registerEventPoller(poller, adjustedPollingInterval, resource, sourceLocation);
+ }
+ });
}
private void unregisterEventPollerInternal(String eventType, String sourceLocation) {
10 years, 9 months
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java | 3 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
New commits:
commit 13344592ed5c88b300903390481fbacd531f6461
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed Sep 18 14:57:57 2013 -0700
[BZ 1000175] - Cleanup from auto-refresh refactoring. Adjust initial date range back to proper value instead of last stored value.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java
index 891fb9d..5a81ab3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java
@@ -172,7 +172,6 @@ public class ButtonBarDateTimeRangeEditor extends EnhancedVLayout {
}
}
- Log.debug("DateTimeSelection: " + dateTimeSelection + " = " + dateTimeOffset);
return new Date(endDate.getTime() - dateTimeOffset);
}
@@ -236,7 +235,6 @@ public class ButtonBarDateTimeRangeEditor extends EnhancedVLayout {
@Override
public void onClick(ClickEvent clickEvent) {
IButton button = (IButton) clickEvent.getSource();
- Log.debug("Button pressed for: " + button.getTitle());
}
};
@@ -298,7 +296,6 @@ public class ButtonBarDateTimeRangeEditor extends EnhancedVLayout {
saveButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
- Log.debug("Saving Custom Date Range Window.");
Date startTimeDate = (Date) startTimeItem.getValue();
Date endTimeDate = (Date) endTimeItem.getValue();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java
index b51592d..8870e58 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java
@@ -73,6 +73,8 @@ public class MetricsResourceView extends AbstractD3GraphListView implements
public void onInit() {
super.onInit();
+ updateTimeRangeToNow();
+
final ResourceMetricAvailabilityView availabilityDetails = new ResourceMetricAvailabilityView(resource);
availabilityDetails.hide();
10 years, 9 months