Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 571994 Details for
Bug 803625
AS7 plugin does not support jboss.server.base.dir
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Proposed patch 803625
0001-Fix-for-803625-AS7-plugin-does-not-support-jboss.ser.patch (text/plain), 11.97 KB, created by
Mattias Nilsson Grip
on 2012-03-22 13:33:32 UTC
(
hide
)
Description:
Proposed patch 803625
Filename:
MIME Type:
Creator:
Mattias Nilsson Grip
Created:
2012-03-22 13:33:32 UTC
Size:
11.97 KB
patch
obsolete
>From 2190dbe336ff1c04ad6125a755b5f48f7f8cf6ee Mon Sep 17 00:00:00 2001 >From: Mattias Nilsson Grip <mattias.nilsson.grip@redpill-linpro.com> >Date: Thu, 22 Mar 2012 14:13:00 +0100 >Subject: [PATCH] Fix for 803625 - AS7 plugin does not support > jboss.server.base.dir > >--- > .../plugins/jbossas7/AbstractBaseDiscovery.java | 95 ++++++++++++++++---- > .../plugins/jbossas7/BaseProcessDiscovery.java | 42 +++------ > 2 files changed, 94 insertions(+), 43 deletions(-) > >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java >index 0bf4961..1a4044e 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java >@@ -44,6 +44,8 @@ import org.rhq.core.system.ProcessInfo; > public class AbstractBaseDiscovery { > static final String DORG_JBOSS_BOOT_LOG_FILE = "-Dorg.jboss.boot.log.file="; > private static final String DJBOSS_SERVER_HOME_DIR = "-Djboss.home.dir"; >+ private static final String DJBOSS_SERVER_BASE_DIR = "-Djboss.server.base.dir"; >+ private static final String DJBOSS_SERVER_CONFIG_DIR = "-Djboss.server.config.dir"; > static final int DEFAULT_MGMT_PORT = 9990; > private static final String JBOSS_AS_PREFIX = "jboss-as-"; > static final String CALL_READ_STANDALONE_OR_HOST_XML_FIRST = "hostXml is null. You need to call 'readStandaloneOrHostXml' first."; >@@ -90,7 +92,7 @@ public class AbstractBaseDiscovery { > } > > /** >- * Determine the server home (=base) directory by parsing the passed command line >+ * Determine the server home directory by parsing the passed command line > * @param commandLine command line arguments of the process > * @return The home dir if found or empty string otherwise > */ >@@ -103,6 +105,56 @@ public class AbstractBaseDiscovery { > } > > /** >+ * Determine the base directory for server content by parsing the >+ * passed command line >+ * @param commandLine command line arguments of the process >+ * @return The base dir if found or empty string otherwise >+ */ >+ String getBaseDirFromCommandLine(String[] commandLine) { >+ for (String line : commandLine) { >+ if (line.startsWith(DJBOSS_SERVER_BASE_DIR)) >+ return line.substring(DJBOSS_SERVER_BASE_DIR.length() + 1); >+ } >+ return ""; >+ } >+ >+ /** >+ * Determine the base configuration directory by parsing the >+ * passed command line >+ * @param commandLine command line arguments of the process >+ * @return The config dir if found or empty string otherwise >+ */ >+ String getConfigDirFromCommandLine(String[] commandLine) { >+ for (String line : commandLine) { >+ if (line.startsWith(DJBOSS_SERVER_CONFIG_DIR)) >+ return line.substring(DJBOSS_SERVER_CONFIG_DIR.length() + 1); >+ } >+ return ""; >+ } >+ >+ /** >+ * Obtain the running configuration from the command line if it was passed via --(server,domain,host)-config >+ * @param commandLine Command line to look at >+ * @param mode mode and thus command line switch to look for >+ * @return the config or the default for the mode if no config was passed on the command line. >+ */ >+ String getServerConfigFromCommandLine(String[] commandLine, AS7Mode mode) { >+ String configArg = mode.getConfigArg(); >+ >+ for (int index = 0; index < commandLine.length; index++) { >+ if (commandLine[index].startsWith(configArg)) { >+ if (index + 1 < commandLine.length) { >+ return commandLine[index + 1]; >+ } else { >+ break; >+ } >+ } >+ } >+ >+ return mode.getDefaultXmlFile(); >+ } >+ >+ /** > * Determine the location of the boot log file of the server by parsing the command line > * @param commandLine command line arguments of the process > * @return The log file location or empty string otherwise >@@ -139,7 +191,7 @@ public class AbstractBaseDiscovery { > + "']/inet-address/@value"); > if (interfaceExpession.isEmpty()) { > interfaceExpession = obtainXmlPropertyViaXPath("//interfaces/interface[@name='" + socketInterface >- + "']/loopback-address/@value"); >+ + "']/loopback-address/@value"); > } > portString = obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/socket/@port"); > } else if (socketBindingName.isEmpty()) { >@@ -150,7 +202,7 @@ public class AbstractBaseDiscovery { > + "']/inet-address/@value"); > if (interfaceExpession.isEmpty()) { > interfaceExpession = obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" + interfaceName >- + "']/loopback-address/@value"); >+ + "']/loopback-address/@value"); > } > } else { > // later AS7.1 and EAP6 standalone.xml >@@ -164,7 +216,7 @@ public class AbstractBaseDiscovery { > + "']/inet-address/@value"); > if (interfaceExpession.isEmpty()) { > interfaceExpession = obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" + interfaceName >- + "']/loopback-address/@value"); >+ + "']/loopback-address/@value"); > } > } > HostPort hp = new HostPort(); >@@ -325,20 +377,31 @@ public class AbstractBaseDiscovery { > * @return The path to the definition file. > */ > protected String getHostXmlFileLocation(ProcessInfo processInfo, boolean isDomain) { >- >- String home = processInfo.getEnvironmentVariable("jboss.home.dir"); >- if (home == null) >- home = getHomeDirFromCommandLine(processInfo.getCommandLine()); >- StringBuilder builder = new StringBuilder(home); >- if (isDomain) >- builder.append(File.separator).append(AS7Mode.DOMAIN.getBaseDir()); >- else >- builder.append(File.separator).append(AS7Mode.STANDALONE.getBaseDir()); >- builder.append(File.separator).append("configuration"); >+ final String[] commandLine = processInfo.getCommandLine(); >+ String configDir = getConfigDirFromCommandLine(commandLine); >+ StringBuilder builder; >+ if (!configDir.isEmpty()) { >+ builder = new StringBuilder(configDir); >+ } else { >+ String baseDir = getBaseDirFromCommandLine(commandLine); >+ if (!baseDir.isEmpty()) { >+ builder = new StringBuilder(baseDir); >+ } else { >+ String home = processInfo.getEnvironmentVariable("jboss.home.dir"); >+ if (home == null) >+ home = getHomeDirFromCommandLine(commandLine); >+ builder = new StringBuilder(home); >+ if (isDomain) >+ builder.append(File.separator).append(AS7Mode.DOMAIN.getBaseDir()); >+ else >+ builder.append(File.separator).append(AS7Mode.STANDALONE.getBaseDir()); >+ } >+ builder.append(File.separator).append("configuration"); >+ } > if (isDomain) >- builder.append(File.separator).append(AS7Mode.HOST.getDefaultXmlFile()); >+ builder.append(File.separator).append(getServerConfigFromCommandLine(commandLine, AS7Mode.HOST)); > else >- builder.append(File.separator).append(AS7Mode.STANDALONE.getDefaultXmlFile()); >+ builder.append(File.separator).append(getServerConfigFromCommandLine(commandLine, AS7Mode.STANDALONE)); > return builder.toString(); > > } >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java >index 0dfc54c..9b93fb2 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java >@@ -135,8 +135,6 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > config.put(new PropertySimple("hostConfig", hostConfig)); > > } else { // Standalone server >- serverNameFull = homeDir; >- > if (isEAP) > description = "Standalone " + JBOSS_EAP_6 + " server"; > else if (isJDG) >@@ -145,7 +143,8 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > description = "Standalone " + AS7 + " server"; > > readStandaloneOrHostXml(psr.getProcessInfo(), false); >- if (serverNameFull.isEmpty()) { >+ if (homeDir.isEmpty()) { >+ // Will this code ever run? /Mattias > // Try to obtain the server name > // -Dorg.jboss.boot.log.file=domain/servers/server-one/log/boot.log > // This is a hack until I know a better way to do so. >@@ -155,12 +154,23 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > tmp = tmp.substring(i + 8); > tmp = tmp.substring(0, tmp.indexOf(File.separator)); > serverNameFull = tmp; >- >+ } else { >+ // determine serverNameFull from jboss.server.base.dir system property on command line >+ String baseDir = getBaseDirFromCommandLine(commandLine); >+ if (!baseDir.isEmpty()) { >+ serverNameFull = baseDir; >+ } else { >+ // determine serverNameFull from standalone.xml location >+ String standaloneXmlFileLocation = getHostXmlFileLocation(psr.getProcessInfo(), false); >+ serverNameFull = standaloneXmlFileLocation.substring(0, >+ standaloneXmlFileLocation.lastIndexOf(File.separator + "configuration")); >+ } > } >+ > String host = findHost(psr.getProcessInfo(), false); > config.put(new PropertySimple("domainHost", host)); > >- config.put(new PropertySimple("baseDir", serverNameFull)); >+ config.put(new PropertySimple("baseDir", homeDir)); > > serverName = findHostName(); > if (serverName.isEmpty()) >@@ -368,28 +378,6 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > return hostName; > } > >- /** >- * Obtain the running configuration from the command line if it was passed via --(server,domain,host)-config >- * @param commandLine Command line to look at >- * @param mode mode and thus command line switch to look for >- * @return the config or the default for the mode if no config was passed on the command line. >- */ >- private String getServerConfigFromCommandLine(String[] commandLine, AS7Mode mode) { >- String configArg = mode.getConfigArg(); >- >- for (int index = 0; index < commandLine.length; index++) { >- if (commandLine[index].startsWith(configArg)) { >- if (index + 1 < commandLine.length) { >- return commandLine[index + 1]; >- } else { >- break; >- } >- } >- } >- >- return mode.getDefaultXmlFile(); >- } >- > //-Dorg.jboss.boot.log.file=/devel/jbas7/jboss-as/build/target/jboss-7.0.0.Alpha2/domain/log/server-manager/boot.log > //-Dlogging.configuration=file:/devel/jbas7/jboss-as/build/target/jboss-7.0.0.Alpha2/domain/configuration/logging.properties > >-- >1.7.5.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 803625
: 571994 |
573608