modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java | 6 ++++++ modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 8 ++++++++ 2 files changed, 14 insertions(+)
New commits: commit a509359864fcdd3f19c37db99d62414181cc3bef Author: Heiko W. Rupp hwr@redhat.com Date: Fri Jan 13 17:18:53 2012 +0100
BZ 734495 - allow to provide JAVA_HOME
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java index 99c8cee..60f819f 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java @@ -113,6 +113,10 @@ public class BaseServerComponent extends BaseComponent { processExecution.setWaitForCompletion(15000L); // 15 seconds // TODO: Should we wait longer than 15 seconds? processExecution.setKillOnTimeout(false);
+ String javaHomeDir = pluginConfiguration.getSimpleValue("javaHomePath",null); + if (javaHomeDir!=null) { + processExecution.getEnvironmentVariables().put("JAVA_HOME", javaHomeDir); + }
if (log.isDebugEnabled()) { log.debug("About to execute the following process: [" + processExecution + "]"); @@ -121,6 +125,8 @@ public class BaseServerComponent extends BaseComponent { logExecutionResults(results); if (results.getError()!=null) { operationResult.setErrorMessage(results.getError().getMessage()); + } else if (results.getExitCode()!=null) { + operationResult.setErrorMessage("Start failed with error code " + results.getExitCode() + ":\n" + results.getCapturedOutput()); } else { operationResult.setSimpleResult("Success"); } diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index 7e88906..bdcf227 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -70,6 +70,10 @@ <c:simple-property name="hostConfig" type="string" default="host.xml" description="Running configuration (host part)" displayName="Host Configuration"/> <c:simple-property name="baseDir" type="file" description="Base directory of the server installation" displayName="Base directory" readOnly="true" required="false"/> <c:simple-property name="startScript" type="file" default="bin/domain.sh" description="Script used to start the server. If the path is not absolute, it is relative to the base directory"/> + <c:simple-property name="javaHomePath" type="file" displayName="JAVA_HOME Path" required="false" + description="The absolute path to a JRE or JDK installation directory containing + the JVM that should be used to start and shutdown the HostController instance; + defaults to the home directory of the RHQ agent JRE."/> <c:simple-property name="domainHost" type="string" readOnly="true" required="false" description="Host name within the AS7 domain"/>
&logSources; @@ -330,6 +334,10 @@ <c:simple-property name="config" type="string" default="standalone.xml" description="Running configuration" displayName="Configuration"/> <c:simple-property name="baseDir" type="file" description="Base directory of the server installation" displayName="Base directory" readOnly="true" required="false"/> <c:simple-property name="startScript" type="file" default="bin/standalone.sh" description="Script used to start the server. If the path is not absolute, it is relative to the base directory"/> + <c:simple-property name="javaHomePath" type="file" displayName="JAVA_HOME Path" required="false" + description="The absolute path to a JRE or JDK installation directory containing + the JVM that should be used to start and shutdown the JBossAS instance; + defaults to the home directory of the RHQ agent JRE."/> <c:list-property name="system-properties"> <c:map-property name="system-property"> <c:simple-property name="key" readOnly="true"/>
rhq-commits@lists.fedorahosted.org