[rhq] 3 commits - modules/plugins
by ips
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineOption.java | 30 ++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java | 139 +++++-----
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java | 138 +++++++--
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java | 30 +-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java | 31 +-
modules/plugins/jboss-as-7/src/test/resources/log4j.xml | 3
7 files changed, 262 insertions(+), 111 deletions(-)
New commits:
commit ec16506e36e34f960bab19e263ce8781cdd6f944
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 28 14:45:52 2012 -0400
turn down PC logging by default to make test output more readable
diff --git a/modules/plugins/jboss-as-7/src/test/resources/log4j.xml b/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
index 2687703..6e73f53 100644
--- a/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
+++ b/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
@@ -43,7 +43,6 @@
</layout>
</appender>
-<!--
<category name="org.rhq.core.pc">
<priority value="ERROR"/>
</category>
@@ -51,7 +50,7 @@
<category name="org.rhq.core.pc.PluginContainer">
<priority value="INFO"/>
</category>
--->
+
<category name="org.rhq.core.clientapi">
<priority value="FATAL"/>
</category>
commit 94460b066cd9cbd956b4c2ec1aca454454071c4f
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 28 14:45:22 2012 -0400
well-formed XML cannot have "--" within a comment
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
index a8fe908..ba2e445 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
@@ -370,7 +370,7 @@ public class Domain2Descriptor {
builder.append(generateProperty(4, entryValue, type, entryKey, null));
builder.append('\n');
} else {
- builder.append("<!--").append(entry.getKey()).append("--").append(entry.getValue().toString())
+ builder.append("<!--").append(entry.getKey()).append("..").append(entry.getValue().toString())
.append("-->");
}
}
commit 1c3f8bcaf12995abf50565994f3fcabc5e2634f9
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 28 14:44:44 2012 -0400
add support for resolving jboss.*.dir sysprops that are relative paths (this completes the work on https://bugzilla.redhat.com/show_bug.cgi?id=807008); add some utility code for reading AS7 server command line options; improve code for determining log file location
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineOption.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineOption.java
new file mode 100644
index 0000000..e0cf57e
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineOption.java
@@ -0,0 +1,30 @@
+package org.rhq.modules.plugins.jbossas7;
+
+/**
+ * The name(s) associated with an AS7 server command line option.
+ *
+ * @author Ian Springer
+ */
+public class AS7CommandLineOption {
+
+ private Character shortName;
+ private String longName;
+
+ public AS7CommandLineOption(Character shortName, String longName) {
+ if ((shortName == null) && (longName == null)) {
+ throw new IllegalArgumentException("ShortName and longName cannot both be null.");
+ }
+
+ this.shortName = shortName;
+ this.longName = longName;
+ }
+
+ public Character getShortName() {
+ return shortName;
+ }
+
+ public String getLongName() {
+ return longName;
+ }
+
+}
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 a7acad9..6139dc1 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
@@ -32,6 +32,7 @@ import javax.xml.xpath.XPathFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jetbrains.annotations.Nullable;
import org.w3c.dom.Document;
import org.rhq.core.pluginapi.util.FileUtils;
@@ -44,9 +45,11 @@ import org.rhq.core.system.ProcessInfo;
*/
public class AbstractBaseDiscovery {
- static final String BOOT_LOG_FILE_SYSPROP = "org.jboss.boot.log.file";
private static final String HOME_DIR_SYSPROP = "jboss.home.dir";
+ private static final String BIND_ADDRESS_MANAGEMENT_SYSPROP = "jboss.bind.address.management";
+ private AS7CommandLineOption BIND_ADDRESS_MANAGEMENT_OPTION = new AS7CommandLineOption(null, "bmanagement");
+
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.";
@@ -82,17 +85,6 @@ public class AbstractBaseDiscovery {
}
/**
- * 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
- */
- //-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
- String getLogFileFromCommandLine(String[] commandLine) {
- return getSystemPropertyFromCommandLine(commandLine, BOOT_LOG_FILE_SYSPROP, "");
- }
-
- /**
* Try to obtain the management IP and port from the already parsed host.xml or standalone.xml
* @return an Object containing host and port
* @see #readStandaloneOrHostXmlFromFile(String) for how to obtain the parsed xml
@@ -194,47 +186,24 @@ public class AbstractBaseDiscovery {
if (value.contains(":")) {
int i = value.indexOf(":");
expression = value.substring(0, i);
- fallback = value.substring(i + 1);
+ fallback = ((i + 1) < value.length()) ? value.substring(i + 1) : "";
} else {
expression = value;
}
- /*
- * Now try to find the expression in the arguments.
- * AS 7 unfortunately is "too clever" and we need to look for
- * -D jboss.bind.address.management
- * or
- * -b management
- * to find the management addresss
- */
-
- String ret = null;
- for (int i = 0, commandLineLength = commandLine.length; i < commandLineLength; i++) {
- String line = commandLine[i];
- if (expression.contains("address")) {
- if (line.contains("-bmanagement") || line.contains("jboss.bind.address.management")) {
- if (line.contains("="))
- ret = line.substring(line.indexOf("=") + 1); // -bmanagement=1.2.3.4
- else
- ret = commandLine[i + 1]; // -bmanagement 1.2.3.4
- break;
- }
- } else if (expression.equals("jboss.management.http.port")) {
- if (line.contains(expression)) {
- ret = line.substring(line.indexOf("=") + 1);
- break;
- }
- } else if (expression.equals(SOCKET_BINDING_PORT_OFFSET_SYSPROP)) {
- if (line.contains(expression)) {
- ret = line.substring(line.indexOf('=')+1);
- break;
- }
- }
- }
- if (ret == null)
- ret = fallback;
- return ret;
+ String resolvedValue = null;
+ if (expression.equals(BIND_ADDRESS_MANAGEMENT_SYSPROP)) {
+ // special case: mgmt address can be specified via either -bmanagement= or -Djboss.bind.address.management=
+ resolvedValue = getOptionFromCommandLine(commandLine, BIND_ADDRESS_MANAGEMENT_OPTION);
+ }
+ if (resolvedValue == null) {
+ resolvedValue = getSystemPropertyFromCommandLine(commandLine, expression);
+ }
+ if (resolvedValue == null) {
+ resolvedValue = fallback;
+ }
+ return resolvedValue;
}
/**
@@ -314,7 +283,17 @@ public class AbstractBaseDiscovery {
protected File getHomeDir(ProcessInfo processInfo) {
String home = getSystemPropertyFromCommandLine(processInfo.getCommandLine(), HOME_DIR_SYSPROP,
processInfo.getEnvironmentVariable("JBOSS_HOME"));
- return new File(FileUtils.getCanonicalPath(home));
+ File homeDir = new File(home);
+ if (!homeDir.isAbsolute()) {
+ if (processInfo.getExecutable() == null) {
+ throw new RuntimeException(HOME_DIR_SYSPROP + " for AS7 process " + processInfo
+ + " is a relative path, and the RHQ Agent process does not have permission to resolve it.");
+ }
+ String cwd = processInfo.getExecutable().getCwd();
+ homeDir = new File(cwd, home);
+ }
+
+ return new File(FileUtils.getCanonicalPath(homeDir.getPath()));
}
protected String determineServerVersionFromHomeDir(String homeDir) {
@@ -356,17 +335,20 @@ public class AbstractBaseDiscovery {
}
}
+ @Nullable
protected static String getSystemPropertyFromCommandLine(String[] commandLine, String systemPropertyName) {
return getSystemPropertyFromCommandLine(commandLine, systemPropertyName, null);
}
+ @Nullable
protected static String getSystemPropertyFromCommandLine(String[] commandLine, String systemPropertyName,
- String defaultValue) {
- for (String arg : commandLine) {
- String prefix = "-D" + systemPropertyName;
- String prefixWithEqualsSign = prefix + "=";
+ String defaultValue) {
+ String prefix = "-D" + systemPropertyName;
+ String prefixWithEqualsSign = prefix + "=";
+ for (String arg : commandLine) {
if (arg.startsWith(prefixWithEqualsSign)) {
- return arg.substring(prefixWithEqualsSign.length());
+ return (prefixWithEqualsSign.length() < arg.length()) ?
+ arg.substring(prefixWithEqualsSign.length()) : "";
} else if (arg.equals(prefix)) {
return "";
}
@@ -374,15 +356,49 @@ public class AbstractBaseDiscovery {
return defaultValue;
}
- protected HostPort checkForSocketBindingOffset(HostPort managementPort, String[] commandLine) {
- for (String line : commandLine) {
- if (line.contains(SOCKET_BINDING_PORT_OFFSET_SYSPROP)) {
- String tmp = line.substring(line.indexOf('=')+1);
- Integer offset = Integer.valueOf(tmp);
- managementPort.port+=offset;
- break;
+ @Nullable
+ protected static String getOptionFromCommandLine(String[] commandLine, AS7CommandLineOption option) {
+ String shortOptionPrefix;
+ String shortOption;
+ if (option.getShortName() != null) {
+ shortOption = "-" + option.getShortName();
+ shortOptionPrefix = shortOption + "=";
+ } else {
+ shortOption = null;
+ shortOptionPrefix = null;
+ }
+ String longOptionPrefix;
+ if (option.getLongName() != null) {
+ longOptionPrefix = "--" + option.getLongName() + "=";
+ } else {
+ longOptionPrefix = null;
+ }
+ for (int i = 0, commandLineLength = commandLine.length; i < commandLineLength; i++) {
+ String arg = commandLine[i];
+ if (option.getShortName() != null) {
+ if (arg.startsWith(shortOptionPrefix)) {
+ return (shortOptionPrefix.length() < arg.length()) ? arg.substring(shortOptionPrefix.length()) : "";
+ } else if (arg.equals(shortOption)) {
+ return (i != (commandLineLength - 1)) ? commandLine[i + 1] : "";
+ }
+ }
+ if (option.getLongName() != null) {
+ if (arg.startsWith(longOptionPrefix)) {
+ return (longOptionPrefix.length() < arg.length()) ? arg.substring(longOptionPrefix.length()) : "";
+ }
}
}
+ // If we reached here, the option wasn't on the command line.
+
+ return null;
+ }
+
+ protected HostPort checkForSocketBindingOffset(HostPort managementPort, String[] commandLine) {
+ String value = getSystemPropertyFromCommandLine(commandLine, SOCKET_BINDING_PORT_OFFSET_SYSPROP);
+ if (value != null) {
+ int offset = Integer.valueOf(value);
+ managementPort.port += offset;
+ }
return managementPort;
}
@@ -412,4 +428,5 @@ public class AbstractBaseDiscovery {
return "HostPort{" + "host='" + host + '\'' + ", port=" + port + ", isLocal=" + isLocal + '}';
}
}
+
}
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 553075a..06371c6 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
@@ -56,7 +56,8 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* Abstract base discovery component for the two server types - "JBossAS7 Host Controller" and
* "JBossAS7 Standalone Server".
*/
-public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery implements ResourceDiscoveryComponent, ManualAddFacet {
+public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery
+ implements ResourceDiscoveryComponent, ManualAddFacet {
private final Log log = LogFactory.getLog(this.getClass());
@@ -64,16 +65,16 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext discoveryContext) throws Exception {
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
- List<ProcessScanResult> scans = discoveryContext.getAutoDiscoveredProcesses();
- for (ProcessScanResult psr : scans) {
+ List<ProcessScanResult> processScanResults = discoveryContext.getAutoDiscoveredProcesses();
+ for (ProcessScanResult processScanResult : processScanResults) {
try {
- DiscoveredResourceDetails details = buildResourceDetails(discoveryContext, psr);
+ DiscoveredResourceDetails details = buildResourceDetails(discoveryContext, processScanResult);
discoveredResources.add(details);
log.info("Discovered new " + discoveryContext.getResourceType().getName() + " Resource with key ["
+ details.getResourceKey() + "].");
} catch (Exception e) {
- log.error("Discovery for a " + discoveryContext.getResourceType().getName()
- + " Resource failed for process " + psr + ": " + e);
+ log.error("Discovery of a " + discoveryContext.getResourceType().getName()
+ + " Resource failed for " + processScanResult.getProcessInfo() + ".", e);
}
}
@@ -86,16 +87,17 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
// for management port
ProcessInfo process = psr.getProcessInfo();
String[] commandLine = process.getCommandLine();
- String homeDir = getHomeDir(process).getPath();
- JBossProductType productType = JBossProductType.determineJBossProductType(new File(homeDir));
- String version = determineServerVersionFromHomeDir(homeDir);
+ File homeDir = getHomeDir(process);
+ JBossProductType productType = JBossProductType.determineJBossProductType(homeDir);
+ String version = determineServerVersionFromHomeDir(homeDir.getPath());
if (productType != JBossProductType.AS) {
version = productType.SHORT_NAME + " " + version;
}
- File baseDir = getBaseDir(process);
+ File baseDir = getBaseDir(process, homeDir);
String configName = baseDir.getName();
String key = baseDir.getPath();
- readStandaloneOrHostXmlFromFile(getHostXmlFile(process).getPath()); // this sets this.hostXml
+ File configDir = getConfigDir(process, baseDir);
+ readStandaloneOrHostXmlFromFile(getHostXmlFile(process, configDir).getPath()); // this sets this.hostXml
HostPort hostPort = getHostPortFromHostXml();
String name = buildDefaultResourceName(hostPort, configName, productType);
@@ -103,12 +105,12 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
pluginConfig.put(new PropertySimple("homeDir", homeDir));
pluginConfig.put(new PropertySimple("baseDir", baseDir));
- pluginConfig.put(new PropertySimple("configDir", getConfigDir(process)));
+ pluginConfig.put(new PropertySimple("configDir", configDir));
pluginConfig.put(new PropertySimple("startScript", getMode().getStartScript()));
- pluginConfig.put(new PropertySimple("domainHost", findHost(getHostXmlFile(process))));
- fillUserPassFromFile(pluginConfig, getMode(), homeDir);
- String logFile = getLogFile(process).getAbsolutePath();
- initLogEventSourcesConfigProp(logFile, pluginConfig);
+ pluginConfig.put(new PropertySimple("domainHost", findHost(getHostXmlFile(process, configDir))));
+ fillUserPassFromFile(pluginConfig, getMode(), homeDir.getPath());
+ File logFile = getLogFile(getLogDir(process, baseDir));
+ initLogEventSourcesConfigProp(logFile.getPath(), pluginConfig);
HostPort managementHostPort = getManagementPortFromHostXml(commandLine);
pluginConfig.put(new PropertySimple("hostname", managementHostPort.host));
pluginConfig.put(new PropertySimple("port", managementHostPort.port));
@@ -141,41 +143,117 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
pluginConfig, process);
}
- protected File getBaseDir(ProcessInfo process) {
+ protected File getBaseDir(ProcessInfo process, File homeDir) {
String baseDirString = getSystemPropertyFromCommandLine(process.getCommandLine(),
getBaseDirSystemPropertyName());
- File baseDir = (baseDirString != null) ? new File(FileUtils.getCanonicalPath(baseDirString)) :
- new File(getHomeDir(process), getDefaultBaseDirName());
+ File baseDir;
+ if (baseDirString != null) {
+ baseDir = new File(baseDirString);
+ if (!baseDir.isAbsolute()) {
+ if (process.getExecutable() == null) {
+ baseDir = new File(homeDir, baseDirString);
+ if (!baseDir.exists()) {
+ throw new RuntimeException(getBaseDirSystemPropertyName() + " for AS7 process " + process
+ + " is a relative path, and the RHQ Agent process does not have permission to resolve it.");
+ }
+ } else {
+ String cwd = process.getExecutable().getCwd();
+ baseDir = new File(cwd, baseDirString);
+ if (!baseDir.exists()) {
+ baseDir = new File(homeDir, baseDirString);
+ }
+ }
+ }
+ baseDir = new File(FileUtils.getCanonicalPath(baseDir.getPath()));
+ } else {
+ baseDir = new File(homeDir, getDefaultBaseDirName());
+ }
return baseDir;
}
- protected File getConfigDir(ProcessInfo process) {
+ protected File getConfigDir(ProcessInfo process, File baseDir) {
String configDirString = getSystemPropertyFromCommandLine(process.getCommandLine(),
getConfigDirSystemPropertyName());
- File configDir = (configDirString != null) ? new File(FileUtils.getCanonicalPath(configDirString)) :
- new File(getBaseDir(process), getDefaultConfigDirName());
+ File configDir;
+ if (configDirString != null) {
+ configDir = new File(configDirString);
+ if (!configDir.isAbsolute()) {
+ if (process.getExecutable() == null) {
+ throw new RuntimeException(getConfigDirSystemPropertyName() + " for AS7 process " + process
+ + " is a relative path, and the RHQ Agent process does not have permission to resolve it.");
+ }
+ String cwd = process.getExecutable().getCwd();
+ configDir = new File(cwd, configDirString);
+ }
+ configDir = new File(FileUtils.getCanonicalPath(configDir.getPath()));
+ } else {
+ configDir = new File(baseDir, getDefaultConfigDirName());
+ }
return configDir;
}
- protected File getHostXmlFile(ProcessInfo process) {
- return new File(getConfigDir(process), getHostXmlFileName());
+ protected File getLogDir(ProcessInfo process, File baseDir) {
+ String logDirString = getSystemPropertyFromCommandLine(process.getCommandLine(),
+ getLogDirSystemPropertyName());
+ File logDir;
+ if (logDirString != null) {
+ logDir = new File(logDirString);
+ if (!logDir.isAbsolute()) {
+ if (process.getExecutable() == null) {
+ throw new RuntimeException(getLogDirSystemPropertyName() + " for AS7 process " + process
+ + " is a relative path, and the RHQ Agent process does not have permission to resolve it.");
+ }
+ String cwd = process.getExecutable().getCwd();
+ logDir = new File(cwd, logDirString);
+ }
+ logDir = new File(FileUtils.getCanonicalPath(logDir.getPath()));
+ } else {
+ logDir = new File(baseDir, getDefaultLogDirName());
+ }
+ return logDir;
+ }
+
+ // Returns the name of the host config xml file (domain controller) or server config xml file (standalone server),
+ // e.g. "standalone.xml" or "host.xml".
+ protected String getHostXmlFileName(ProcessInfo process) {
+ AS7CommandLineOption hostXmlFileNameOption = getHostXmlFileNameOption();
+ String optionValue = getOptionFromCommandLine(process.getCommandLine(), hostXmlFileNameOption);
+ return (optionValue != null) ? optionValue : getDefaultHostXmlFileName();
+ }
+
+
+ // Returns the host config xml file (domain controller) or server config xml file (standalone server).
+ protected File getHostXmlFile(ProcessInfo process, File configDir) {
+ return new File(configDir, getHostXmlFileName(process));
}
protected String getDefaultConfigDirName() {
return "configuration";
}
+ protected String getDefaultLogDirName() {
+ return "log";
+ }
+
protected abstract AS7Mode getMode();
- protected abstract File getLogFile(ProcessInfo process);
+ protected File getLogFile(File logDir) {
+ return new File(logDir, getLogFileName());
+ }
protected abstract String getBaseDirSystemPropertyName();
protected abstract String getConfigDirSystemPropertyName();
+ protected abstract String getLogDirSystemPropertyName();
+
protected abstract String getDefaultBaseDirName();
- protected abstract String getHostXmlFileName();
+ protected abstract AS7CommandLineOption getHostXmlFileNameOption();
+
+ protected abstract String getDefaultHostXmlFileName();
+
+ protected abstract String getLogFileName();
protected abstract String buildDefaultResourceName(HostPort hostPort, String configName, JBossProductType productType);
@@ -187,20 +265,20 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
ResourceDiscoveryContext context) throws InvalidPluginConfigurationException {
String hostname = pluginConfiguration.getSimpleValue("hostname", null);
- String portS = pluginConfiguration.getSimpleValue("port", null);
+ String portString = pluginConfiguration.getSimpleValue("port", null);
String user = pluginConfiguration.getSimpleValue("user", null);
String pass = pluginConfiguration.getSimpleValue("password", null);
- if (hostname == null || portS == null) {
+ if (hostname == null || portString == null) {
throw new InvalidPluginConfigurationException("Host and port must not be null");
}
- int port = Integer.valueOf(portS);
+ int port = Integer.valueOf(portString);
ProductInfo productInfo = new ProductInfo(hostname, user, pass, port).getFromRemote();
String productName = productInfo.getProductName();
String productVersion = productInfo.getProductVersion();
- String resourceKey = hostname + ":" + portS + ":" + productName;
+ String resourceKey = hostname + ":" + port + ":" + productName;
String description;
if (productName.contains("EAP")) {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
index 7adbbf3..a4a46df 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
@@ -36,6 +36,9 @@ public class HostControllerDiscovery extends BaseProcessDiscovery {
private static final String DOMAIN_BASE_DIR_SYSPROP = "jboss.domain.base.dir";
private static final String DOMAIN_CONFIG_DIR_SYSPROP = "jboss.domain.config.dir";
+ private static final String DOMAIN_LOG_DIR_SYSPROP = "jboss.domain.log.dir";
+
+ private AS7CommandLineOption HOST_CONFIG_OPTION = new AS7CommandLineOption(null, "host-config");
@Override
protected AS7Mode getMode() {
@@ -53,16 +56,31 @@ public class HostControllerDiscovery extends BaseProcessDiscovery {
}
@Override
+ protected String getLogDirSystemPropertyName() {
+ return DOMAIN_LOG_DIR_SYSPROP;
+ }
+
+ @Override
protected String getDefaultBaseDirName() {
return "domain";
}
@Override
- protected String getHostXmlFileName() {
+ protected AS7CommandLineOption getHostXmlFileNameOption() {
+ return HOST_CONFIG_OPTION;
+ }
+
+ @Override
+ protected String getDefaultHostXmlFileName() {
return "host.xml";
}
@Override
+ protected String getLogFileName() {
+ return "host-controller.log";
+ }
+
+ @Override
protected String buildDefaultResourceName(HostPort hostPort, String configName, JBossProductType productType) {
String suffix = (hostPort.isLocal) ? "Domain Controller" : "Host Controller";
return configName + " " + productType.NAME + " " + suffix;
@@ -76,19 +94,15 @@ public class HostControllerDiscovery extends BaseProcessDiscovery {
}
@Override
- protected File getLogFile(ProcessInfo process) {
- String bootLogFile = getLogFileFromCommandLine(process.getCommandLine());
- return new File(bootLogFile);
- }
-
- @Override
protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContext discoveryContext,
ProcessScanResult psr) {
DiscoveredResourceDetails details = super.buildResourceDetails(discoveryContext, psr);
+ ProcessInfo process = psr.getProcessInfo();
Configuration pluginConfig = details.getPluginConfiguration();
String domainConfig = getServerConfigFromCommandLine(psr.getProcessInfo().getCommandLine(), getMode());
pluginConfig.put(new PropertySimple("domainConfig", domainConfig));
- pluginConfig.put(new PropertySimple("hostConfig", getHostXmlFile(psr.getProcessInfo())));
+ String configDirString = pluginConfig.getSimpleValue("configDir", null);
+ pluginConfig.put(new PropertySimple("hostConfig", getHostXmlFile(process, new File(configDirString))));
return details;
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
index 9854cec..9102b21 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
@@ -36,6 +36,9 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
private static final String SERVER_BASE_DIR_SYSPROP = "jboss.server.base.dir";
private static final String SERVER_CONFIG_DIR_SYSPROP = "jboss.server.config.dir";
+ private static final String SERVER_LOG_DIR_SYSPROP = "jboss.server.log.dir";
+
+ private AS7CommandLineOption SERVER_CONFIG_OPTION = new AS7CommandLineOption('c', "server-config");
@Override
protected AS7Mode getMode() {
@@ -53,16 +56,31 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
}
@Override
+ protected String getLogDirSystemPropertyName() {
+ return SERVER_LOG_DIR_SYSPROP;
+ }
+
+ @Override
protected String getDefaultBaseDirName() {
return "standalone";
}
@Override
- protected String getHostXmlFileName() {
+ protected AS7CommandLineOption getHostXmlFileNameOption() {
+ return SERVER_CONFIG_OPTION;
+ }
+
+ @Override
+ protected String getDefaultHostXmlFileName() {
return "standalone.xml";
}
@Override
+ protected String getLogFileName() {
+ return "server.log";
+ }
+
+ @Override
protected String buildDefaultResourceName(HostPort hostPort, String configName, JBossProductType productType) {
String hostName = findHostName();
StringBuilder name = new StringBuilder();
@@ -79,13 +97,6 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
}
@Override
- protected File getLogFile(ProcessInfo process) {
- String bootLogFile = getLogFileFromCommandLine(process.getCommandLine());
- File logDir = new File(bootLogFile).getParentFile();
- return new File(logDir, "server.log");
- }
-
- @Override
protected HostPort getManagementPortFromHostXml(String[] commandLine) {
HostPort managementPort = super.getManagementPortFromHostXml(commandLine);
if (!managementPort.withOffset) {
@@ -98,8 +109,10 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContext discoveryContext,
ProcessScanResult psr) {
DiscoveredResourceDetails details = super.buildResourceDetails(discoveryContext, psr);
+ ProcessInfo process = psr.getProcessInfo();
Configuration pluginConfig = details.getPluginConfiguration();
- pluginConfig.put(new PropertySimple("config", getHostXmlFile(psr.getProcessInfo())));
+ String configDirString = pluginConfig.getSimpleValue("configDir", null);
+ pluginConfig.put(new PropertySimple("config", getHostXmlFile(process, new File(configDirString))));
return details;
}
12 years, 1 month
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java | 37 +++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
New commits:
commit 6be170143654c233137dc8841adb84d1f01ebf0d
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 28 12:56:19 2012 -0400
[BZ 802544] Adding export details column to drift compliance report
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
index 23edd16..05dc91a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
@@ -30,6 +30,12 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceBooleanField;
+import com.smartgwt.client.data.fields.DataSourceImageField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceLinkField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
@@ -150,6 +156,13 @@ public class DriftComplianceReport extends LocatableVLayout implements Bookmarka
ListGridField fieldCategory = new ListGridField(DataSource.Field.CATEGORY, MSG.common_title_category());
ListGridField fieldVersion = new ListGridField(DataSource.Field.VERSION, MSG.common_title_version());
ListGridField fieldCount = new ListGridField(DataSource.Field.COUNT, MSG.common_title_count());
+ ListGridField fieldExport = new ListGridField("exportDetails", "Export Details");
+
+ ExportChangeHandler exportChangeHandler = new ExportChangeHandler(getListGrid(), DataSource.Field.TYPEID,
+ DataSource.Field.EXPORT);
+ fieldExport.setCanToggle(true);
+ fieldExport.setCanEdit(true);
+ fieldExport.addChangedHandler(exportChangeHandler);
ListGridField fieldInCompliance = new ListGridField(DataSource.Field.IN_COMPLIANCE, MSG
.common_title_in_compliance());
@@ -223,7 +236,10 @@ public class DriftComplianceReport extends LocatableVLayout implements Bookmarka
}
});
- setListGridFields(fieldTypeName, fieldPlugin, fieldCategory, fieldVersion, fieldCount, fieldInCompliance);
+ setListGridFields(fieldTypeName, fieldPlugin, fieldCategory, fieldVersion, fieldCount, fieldInCompliance,
+ fieldExport);
+ getListGrid().setEditEvent(ListGridEditEvent.CLICK);
+ getListGrid().setEditByCell(true);
addExportAction();
}
@@ -269,6 +285,19 @@ public class DriftComplianceReport extends LocatableVLayout implements Bookmarka
public static final String VERSION = "version"; // String
public static final String OBJECT = "object";
public static final String IN_COMPLIANCE = "inCompliance";
+ public static final String EXPORT = "exportDetails";
+ }
+
+ public DataSource() {
+ DataSourceLinkField name = new DataSourceLinkField(Field.TYPENAME);
+ DataSourceTextField plugin = new DataSourceTextField(Field.TYPEPLUGIN);
+ DataSourceImageField category = new DataSourceImageField(Field.CATEGORY);
+ DataSourceTextField version = new DataSourceTextField(Field.VERSION);
+ DataSourceIntegerField count = new DataSourceIntegerField(Field.COUNT);
+ DataSourceBooleanField inCompliance = new DataSourceBooleanField(Field.IN_COMPLIANCE);
+ DataSourceBooleanField export = new DataSourceBooleanField(Field.EXPORT);
+
+ setFields(name, plugin, category, version, count, inCompliance, export);
}
@Override
@@ -287,6 +316,7 @@ public class DriftComplianceReport extends LocatableVLayout implements Bookmarka
record.setAttribute(Field.TYPEID, from.getTypeId());
record.setAttribute(Field.VERSION, from.getVersion());
record.setAttribute(Field.OBJECT, from);
+ record.setAttribute(Field.EXPORT, false);
if (from.getNumDriftTemplates() > 0) {
record.setAttribute(Field.IN_COMPLIANCE, Boolean.toString(from.isInCompliance()));
@@ -323,6 +353,11 @@ public class DriftComplianceReport extends LocatableVLayout implements Bookmarka
}
});
}
+
+ @Override
+ protected void executeUpdate(Record editedRecord, Record oldRecord, DSRequest request,
+ DSResponse response) {
+ }
}
}
}
12 years, 1 month
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 12ebf6300a7afd04e645e1bdeffebe8a3c243e49
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 28 12:08:32 2012 -0400
[BZ 802544] Generate status column for recent alerts report
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
index f00e734..a68cb82 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
@@ -85,7 +85,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
cleanForCSV(alert.getAlertDefinition().getName()) + "," +
getConditionText(alert) + ", " +
alert.getAlertDefinition().getPriority() + "," +
- "Status" + "," +
+ getStatus(alert) + "," +
cleanForCSV(alert.getAlertDefinition().getResource().getName()) + "," +
cleanForCSV(ReportHelper.parseAncestry(alert.getAlertDefinition().getResource().getAncestry()))
+ "," + getDetailsURL(alert);
@@ -95,6 +95,13 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
return "Creation Time,Name,Condition Text,Priority,Status,Resource,Ancestry,Details URL";
}
+ private String getStatus(Alert alert) {
+ if (alert.getAcknowledgeTime() == null || alert.getAcknowledgeTime() < 0) {
+ return "No Ack";
+ }
+ return "Ack (" + alert.getAcknowledgingSubject() + ")";
+ }
+
private String getDetailsURL(Alert alert) {
String protocol;
if (request.isSecure()) {
12 years, 1 month
[rhq] modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java | 11 ++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
New commits:
commit f12571b2e6e4d5d17e8fb12a08f2cb781570a271
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 28 11:36:50 2012 -0400
Add some more protection against a null AvailabilityType getting included
in an AvailabilityReport.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
index 037fed6..24fdcf5 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
@@ -151,7 +151,7 @@ public class AvailabilityExecutor implements Runnable, Callable<AvailabilityRepo
if (Thread.interrupted()) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred during availability check, but this thread has been interrupted, "
- + "so most likely the plugin container is shutting down: " + e);
+ + "so most likely the plugin container is shutting down: " + e);
}
return availabilityReport;
}
@@ -308,15 +308,18 @@ public class AvailabilityExecutor implements Runnable, Callable<AvailabilityRepo
}
}
}
- if (current == null) {
- current = AvailabilityType.DOWN;
+ }
+ if (null == current) {
+ if (log.isDebugEnabled()) {
+ log.debug("Protecting against null getAvailability(). Setting DOWN to " + resource);
}
+ current = AvailabilityType.DOWN;
}
}
// Add the availability to the report if it changed from its previous state or if this is a full report.
// Update the resource container only if the avail has changed.
- boolean availChanged = (previous == null) || (previous.getAvailabilityType() != current);
+ boolean availChanged = (null != current && (null == previous) || (current != previous.getAvailabilityType()));
if (availChanged || scan.isFull) {
Availability availability;
12 years, 1 month
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit a9f4f0dcf8357cc73760e62c4ac86ade3ae3af39
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 28 11:17:50 2012 -0400
[BZ 802544]] Don't pass empty string for query params
The multi-valued query params in ExportModalWindow are stored as arrays.
The views build up the filter values in a list and call List.toArray.
When the list is empty though an array of length zero is passed to
ExportModalWindow. This was resulting in query params with the empty
string as values when we really want the defaults.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
index 3372829..f572495 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
@@ -215,7 +215,7 @@ public class ExportModalWindow {
if (showAllDetail) {
queryString.append("details=").append(form.getValueAsString(DETAILS_FIELD));
}
- if(operationRequestStatuses != null){
+ if(!isEmpty(operationRequestStatuses)){
StringBuilder operationRequestStatusBuffer = new StringBuilder();
for (String operationRequestStatus : operationRequestStatuses) {
operationRequestStatusBuffer.append(operationRequestStatus);
@@ -224,7 +224,7 @@ public class ExportModalWindow {
queryString.append("operationRequestStatus=").append(operationRequestStatusBuffer.toString());
}
- if(alertPriorityFilters != null){
+ if(!isEmpty(alertPriorityFilters)){
StringBuilder alertsPriorityBuffer = new StringBuilder();
for (String alertPriority : alertPriorityFilters) {
alertsPriorityBuffer.append(alertPriority);
@@ -234,7 +234,7 @@ public class ExportModalWindow {
}
// Drift Related
- if(driftCategories != null){
+ if(!isEmpty(driftCategories)){
StringBuilder driftCategoriesBuffer = new StringBuilder();
for (String category : driftCategories) {
driftCategoriesBuffer.append(category).append(",");
@@ -255,6 +255,10 @@ public class ExportModalWindow {
return URL.encode(BASE_URL + reportUrl + "." + format + "?"+queryString);
}
+ private boolean isEmpty(String[] array) {
+ return array == null || array.length == 0;
+ }
+
public boolean isShowAllDetail(){
return showAllDetail;
}
12 years, 1 month
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionHandler.java | 21 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionLocal.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java | 34 +++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java | 14 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java | 58 ++++++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java | 8 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsHandler.java | 56 +++++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java | 14 +-
8 files changed, 140 insertions(+), 68 deletions(-)
New commits:
commit 0c0026f945091e9d2da2d23160ff9372616323af
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 28 10:59:54 2012 -0400
[BZ 802544] Adding details url column in more reports
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionHandler.java
index 8c9a8ef..c84c446 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionHandler.java
@@ -8,6 +8,7 @@ import java.util.TreeMap;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.StreamingOutput;
@@ -38,7 +39,7 @@ public class AlertDefinitionHandler extends AbstractRestBean implements AlertDef
ResourceManagerLocal resourceManager;
@Override
- public StreamingOutput alertDefinitions(UriInfo uriInfo, javax.ws.rs.core.Request request, HttpHeaders headers ) {
+ public StreamingOutput alertDefinitions(UriInfo uriInfo, final HttpServletRequest request, HttpHeaders headers ) {
return new StreamingOutput() {
@@ -80,7 +81,8 @@ public class AlertDefinitionHandler extends AbstractRestBean implements AlertDef
+ alertDefinition.getEnabled() + ","
+ alertDefinition.getPriority() + ","
+ cleanForCSV(getParentName(resource)) + ","
- + cleanForCSV(ReportHelper.parseAncestry(resource.getAncestry()));
+ + cleanForCSV(ReportHelper.parseAncestry(resource.getAncestry())) + ","
+ + getDetailsURL(alertDefinition);
}
private String getParentName(Resource resource){
@@ -89,7 +91,20 @@ public class AlertDefinitionHandler extends AbstractRestBean implements AlertDef
private String getHeader(){
- return "Name,Description,Enabled,Priority,Parent,Ancestry";
+ return "Name,Description,Enabled,Priority,Parent,Ancestry,Details URL";
+ }
+
+ private String getDetailsURL(AlertDefinition alertDef) {
+ String protocol;
+ if (request.isSecure()) {
+ protocol = "https";
+ } else {
+ protocol = "http";
+ }
+
+ return protocol + "://" + request.getServerName() + ":" + request.getServerPort() +
+ "/coregui/#Resource/" + alertDef.getResource().getId() + "/Alerts/Definitions/" +
+ alertDef.getId();
}
private Resource loadResource(int resourceId) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionLocal.java
index 618cc8a..5e3b9c7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/AlertDefinitionLocal.java
@@ -1,6 +1,7 @@
package org.rhq.enterprise.server.rest.reporting;
import javax.ejb.Local;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
@@ -13,7 +14,7 @@ public interface AlertDefinitionLocal {
@Produces({"text/csv", "application/xml"})
StreamingOutput alertDefinitions(
@Context UriInfo uriInfo,
- @Context Request request,
+ @Context HttpServletRequest request,
@Context HttpHeaders headers );
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
index 01c9054..f00e734 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
@@ -9,9 +9,9 @@ import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo;
@@ -28,7 +28,6 @@ import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.rest.AbstractRestBean;
import org.rhq.enterprise.server.rest.SetCallerInterceptor;
import org.rhq.enterprise.server.util.CriteriaQuery;
@@ -46,14 +45,9 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
@EJB
private AlertManagerLocal alertManager;
- @EJB
- private SubjectManagerLocal subjectMgr;
-
@Override
- public StreamingOutput recentAlerts(
- final String alertPriority,
- UriInfo uriInfo,
- Request request, HttpHeaders headers) {
+ public StreamingOutput recentAlerts(final String alertPriority, UriInfo uriInfo, final HttpServletRequest request,
+ HttpHeaders headers) {
return new StreamingOutput() {
@Override
public void write(OutputStream stream) throws IOException, WebApplicationException {
@@ -91,13 +85,27 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
cleanForCSV(alert.getAlertDefinition().getName()) + "," +
getConditionText(alert) + ", " +
alert.getAlertDefinition().getPriority() + "," +
- "Status"+ "," +
- cleanForCSV(alert.getAlertDefinition().getResource().getName())+","+
- cleanForCSV(ReportHelper.parseAncestry(alert.getAlertDefinition().getResource().getAncestry()));
+ "Status" + "," +
+ cleanForCSV(alert.getAlertDefinition().getResource().getName()) + "," +
+ cleanForCSV(ReportHelper.parseAncestry(alert.getAlertDefinition().getResource().getAncestry()))
+ + "," + getDetailsURL(alert);
}
private String getHeader(){
- return "Creation Time,Name,Condition Text,Priority,Status,Resource,Ancestry";
+ return "Creation Time,Name,Condition Text,Priority,Status,Resource,Ancestry,Details URL";
+ }
+
+ private String getDetailsURL(Alert alert) {
+ String protocol;
+ if (request.isSecure()) {
+ protocol = "https";
+ } else {
+ protocol = "http";
+ }
+
+ return protocol + "://" + request.getServerName() + ":" + request.getServerPort() +
+ "/coregui/#Resource/" + alert.getAlertDefinition().getResource().getId() + "/Alerts/History/" +
+ alert.getId();
}
private String getConditionText(Alert alert) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java
index c968d0c..035f316 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java
@@ -1,8 +1,16 @@
package org.rhq.enterprise.server.rest.reporting;
import javax.ejb.Local;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
@Path("/reports/recentAlerts")
@Local
@@ -14,7 +22,7 @@ public interface RecentAlertLocal {
StreamingOutput recentAlerts(
@QueryParam("alertPriority") @DefaultValue("high,medium,low") String alertPriority,
@Context UriInfo uriInfo,
- @Context Request request,
+ @Context HttpServletRequest request,
@Context HttpHeaders headers);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java
index abc1db4..2e65214 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java
@@ -1,32 +1,33 @@
package org.rhq.enterprise.server.rest.reporting;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.criteria.DriftCriteria;
import org.rhq.core.domain.criteria.GenericDriftCriteria;
import org.rhq.core.domain.drift.DriftCategory;
import org.rhq.core.domain.drift.DriftComposite;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.drift.DriftManagerLocal;
import org.rhq.enterprise.server.rest.AbstractRestBean;
import org.rhq.enterprise.server.rest.SetCallerInterceptor;
import org.rhq.enterprise.server.util.CriteriaQuery;
import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.interceptor.Interceptors;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.StreamingOutput;
-import javax.ws.rs.core.UriInfo;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
import static org.rhq.enterprise.server.rest.reporting.ReportHelper.cleanForCSV;
import static org.rhq.enterprise.server.rest.reporting.ReportHelper.formatDateTime;
@@ -39,16 +40,18 @@ public class RecentDriftHandler extends AbstractRestBean implements RecentDriftL
@EJB
private DriftManagerLocal driftManager;
- @EJB
- private SubjectManagerLocal subjectMgr;
-
@Override
- public StreamingOutput recentDrift(final String categories, final Integer snapshot, final String path, final String definition, final Long startTime, final Long endTime, final UriInfo uriInfo, Request request, final HttpHeaders headers) {
+ public StreamingOutput recentDrift(final String categories, final Integer snapshot, final String path,
+ final String definition, final Long startTime, final Long endTime, final UriInfo uriInfo,
+ final HttpServletRequest request, final HttpHeaders headers) {
return new StreamingOutput() {
@Override
public void write(OutputStream stream) throws IOException, WebApplicationException {
GenericDriftCriteria criteria = new GenericDriftCriteria();
+ // Need to fetch the change set so that we can the definition id which is
+ // needed to build the details url.
+ criteria.fetchChangeSet(true);
criteria.addFilterChangeSetStartVersion(1);// always start at 1 for this report
if(snapshot != null){
@@ -100,11 +103,26 @@ public class RecentDriftHandler extends AbstractRestBean implements RecentDriftL
drift.getDrift().getCategory() + "," +
drift.getDrift().getPath() + "," +
cleanForCSV(drift.getResource().getName()) +","+
- cleanForCSV(ReportHelper.parseAncestry(drift.getResource().getAncestry()));
+ cleanForCSV(ReportHelper.parseAncestry(drift.getResource().getAncestry())) + "," +
+ getDetailsURL(drift);
}
private String getHeader(){
- return "Creation Time,Definition,Snapshot,Category,Path,Resource,Ancestry";
+ return "Creation Time,Definition,Snapshot,Category,Path,Resource,Ancestry,Details URL";
+ }
+
+ private String getDetailsURL(DriftComposite driftDetails) {
+ String protocol;
+ if (request.isSecure()) {
+ protocol = "https";
+ } else {
+ protocol = "http";
+ }
+
+ return protocol + "://" + request.getServerName() + ":" + request.getServerPort() +
+ "/coregui/#Resource/" + driftDetails.getResource().getId() + "/Drift/Definitions/" +
+ driftDetails.getDrift().getChangeSet().getDriftDefinitionId() + "/Drift/0id_" +
+ driftDetails.getDrift().getId();
}
};
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java
index 7f5cad8..fb4747d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java
@@ -1,11 +1,15 @@
package org.rhq.enterprise.server.rest.reporting;
import javax.ejb.Local;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
@Path("/reports/recentDrift")
@Local
@@ -22,7 +26,7 @@ public interface RecentDriftLocal {
@QueryParam("startTime") Long startTime,
@QueryParam("endTime") Long endTime,
@Context UriInfo uriInfo,
- @Context Request request,
+ @Context HttpServletRequest request,
@Context HttpHeaders headers);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsHandler.java
index 6786e30..0431735 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsHandler.java
@@ -1,31 +1,32 @@
package org.rhq.enterprise.server.rest.reporting;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.OperationRequestStatus;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.rest.AbstractRestBean;
import org.rhq.enterprise.server.rest.SetCallerInterceptor;
import org.rhq.enterprise.server.util.CriteriaQuery;
import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.interceptor.Interceptors;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.StreamingOutput;
-import javax.ws.rs.core.UriInfo;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
import static org.rhq.enterprise.server.rest.reporting.ReportHelper.cleanForCSV;
import static org.rhq.enterprise.server.rest.reporting.ReportHelper.formatDateTime;
@@ -37,14 +38,9 @@ public class RecentOperationsHandler extends AbstractRestBean implements RecentO
@EJB
private OperationManagerLocal operationManager;
- @EJB
- private SubjectManagerLocal subjectMgr;
-
-
@Override
- public StreamingOutput recentOperations(
- final String operationRequestStatus,
- UriInfo uriInfo, Request request, HttpHeaders headers) {
+ public StreamingOutput recentOperations(final String operationRequestStatus, UriInfo uriInfo,
+ final HttpServletRequest request, HttpHeaders headers) {
return new StreamingOutput() {
@Override
public void write(OutputStream stream) throws IOException, WebApplicationException {
@@ -83,11 +79,25 @@ public class RecentOperationsHandler extends AbstractRestBean implements RecentO
operation.getSubjectName() + "," +
operation.getStatus() + "," +
cleanForCSV(operation.getResource().getName()) +","+
- cleanForCSV(ReportHelper.parseAncestry(operation.getResource().getAncestry()));
+ cleanForCSV(ReportHelper.parseAncestry(operation.getResource().getAncestry())) + "," +
+ getDetailsURL(operation);
}
private String getHeader(){
- return "Date Submitted,Operation,Requester,Status,Resource,Ancestry";
+ return "Date Submitted,Operation,Requester,Status,Resource,Ancestry,Details URL";
+ }
+
+ private String getDetailsURL(ResourceOperationHistory history) {
+ String protocol;
+ if (request.isSecure()) {
+ protocol = "https";
+ } else {
+ protocol = "http";
+ }
+
+ return protocol + "://" + request.getServerName() + ":" + request.getServerPort() +
+ "/coregui/#Resource/" + history.getResource().getId() + "/Operations/History/" +
+ history.getId();
}
};
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java
index d654773..d27d236 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java
@@ -1,8 +1,16 @@
package org.rhq.enterprise.server.rest.reporting;
import javax.ejb.Local;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
@Path("/reports/recentOperations")
@Local
@@ -14,7 +22,7 @@ public interface RecentOperationsLocal {
StreamingOutput recentOperations(
@QueryParam("operationRequestStatus") @DefaultValue("inprogress,success,failure,cancelled") String operationRequestStatus,
@Context UriInfo uriInfo,
- @Context Request request,
+ @Context HttpServletRequest request,
@Context HttpHeaders headers);
}
12 years, 1 month
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/alert/SubsystemRecentAlertsView.java | 10 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryHandler.java | 27 ++++++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryLocal.java | 8 ++
4 files changed, 31 insertions(+), 16 deletions(-)
New commits:
commit 7cde889a84325eda5164b0c7f72fa024be072e7a
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 28 10:28:02 2012 -0400
[BZ 802544] Adding details url column in config history report
Also fixing a couple compilation errors in coregui.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
index c3cb655..23edd16 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
@@ -237,7 +237,7 @@ public class DriftComplianceReport extends LocatableVLayout implements Bookmarka
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
ExportModalWindow exportModalWindow =
- ExportModalWindow.createExportWindowForInventorySummary("driftCompliance", null);
+ ExportModalWindow.createExportWindowForInventorySummary("driftCompliance", false, null);
exportModalWindow.show();
refreshTableInfo();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/alert/SubsystemRecentAlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/alert/SubsystemRecentAlertsView.java
index 3dc5eab..6ee27d9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/alert/SubsystemRecentAlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/alert/SubsystemRecentAlertsView.java
@@ -1,14 +1,15 @@
package org.rhq.enterprise.gui.coregui.client.report.alert;
+import java.util.ArrayList;
+import java.util.List;
+
import com.smartgwt.client.widgets.grid.ListGridRecord;
+
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.enterprise.gui.coregui.client.alert.SubsystemResourceAlertView;
import org.rhq.enterprise.gui.coregui.client.components.ExportModalWindow;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import java.util.ArrayList;
-import java.util.List;
-
public class SubsystemRecentAlertsView extends SubsystemResourceAlertView {
public SubsystemRecentAlertsView(String locatorId, boolean hasWriteAccess) {
@@ -42,7 +43,8 @@ public class SubsystemRecentAlertsView extends SubsystemResourceAlertView {
alertPriorityList.add(AlertPriority.LOW);
}
}
- ExportModalWindow exportModalWindow = ExportModalWindow.createExportWindowForRecentAlerts("recentAlerts",alertPriorityList);
+ ExportModalWindow exportModalWindow = ExportModalWindow.createExportWindowForRecentAlerts(
+ "recentAlerts", alertPriorityList.toArray(new String[alertPriorityList.size()]));
exportModalWindow.show();
refreshTableInfo();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryHandler.java
index 60547fa..39a25d9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryHandler.java
@@ -7,16 +7,15 @@ import java.io.OutputStream;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.rest.AbstractRestBean;
import org.rhq.enterprise.server.rest.SetCallerInterceptor;
@@ -34,11 +33,9 @@ public class ConfigurationHistoryHandler extends AbstractRestBean implements Con
@EJB
private ConfigurationManagerLocal configurationManager;
- @EJB
- private SubjectManagerLocal subjectMgr;
-
@Override
- public StreamingOutput configurationHistory(UriInfo uriInfo, Request request, HttpHeaders headers ) {
+ public StreamingOutput configurationHistory(UriInfo uriInfo, final HttpServletRequest request,
+ HttpHeaders headers ) {
return new StreamingOutput() {
@Override
@@ -71,16 +68,28 @@ public class ConfigurationHistoryHandler extends AbstractRestBean implements Con
+ formatDateTime(configurationUpdate.getCreatedTime())+","
+ formatDateTime(configurationUpdate.getModifiedTime())+","
+ configurationUpdate.getStatus()+","
- + cleanForCSV(ReportHelper.parseAncestry(configurationUpdate.getResource().getAncestry()));
+ + cleanForCSV(ReportHelper.parseAncestry(configurationUpdate.getResource().getAncestry())) + ","
+ + getDetailsURL(configurationUpdate);
//@todo: check dates, user, update-type
}
private String getHeader(){
- return "Name,Version,Date Submitted,Date Completed,Status,Ancestry";
+ return "Name,Version,Date Submitted,Date Completed,Status,Ancestry,Details URL";
}
- };
+ private String getDetailsURL(ResourceConfigurationUpdate configUpdate) {
+ String protocol;
+ if (request.isSecure()) {
+ protocol = "https";
+ } else {
+ protocol = "http";
+ }
+ return protocol + "://" + request.getServerName() + ":" + request.getServerPort() +
+ "/coregui/#Resource/" + configUpdate.getResource().getId() + "/Configuration/History/" +
+ configUpdate.getId();
+ }
+ };
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryLocal.java
index 8446563..879d760 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/ConfigurationHistoryLocal.java
@@ -1,10 +1,14 @@
package org.rhq.enterprise.server.rest.reporting;
import javax.ejb.Local;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
-import javax.ws.rs.core.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
@Path("/reports/configurationHistory")
@Local
@@ -15,7 +19,7 @@ public interface ConfigurationHistoryLocal {
@Produces({"text/csv", "application/xml"})
StreamingOutput configurationHistory(
@Context UriInfo uriInfo,
- @Context Request request,
+ @Context HttpServletRequest request,
@Context HttpHeaders headers);
}
12 years, 1 month
[rhq] modules/core
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit c5451b437c438dd0254524316b845ea2acc98ed2
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 28 09:52:57 2012 -0400
put bz# in warning message
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index bfbf346..9245d3c 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1222,8 +1222,9 @@ public class InventoryManager extends AgentService implements ContainerService,
// TODO REMOVE THIS IF STATEMENT - IT IS JUST FOR TESTING
if (!resource.getChildResources().getClass().getName().contains("Collections$SetFromMap")) {
- new Exception("BAD CHILD SET:" + resource.getChildResources().getClass().getName() + ":"
- + resource.getId() + ":" + resource.getName()).printStackTrace();
+ new Exception("BAD CHILD SET - IF YOU SEE THIS, LOG IT IN BZ 801432:"
+ + resource.getChildResources().getClass().getName() + ":" + resource.getId() + ":"
+ + resource.getName()).printStackTrace();
}
for (Resource child : resource.getChildResources()) {
12 years, 1 month
[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java | 43 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java | 19
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java | 9
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java | 31
modules/plugins/jboss-as-7/src/test/resources/standalone711.xml | 325 ++++++++++
6 files changed, 403 insertions(+), 26 deletions(-)
New commits:
commit 249e20180843f3d0c6f4ca85edb153e5d91587a6
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 28 15:29:32 2012 +0200
BZ 805028 - honor the new port-offset attribtute for <socket-binding-group> elements in the AS7 descriptor.
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 8206c61..a7acad9 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
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -50,6 +50,7 @@ public class AbstractBaseDiscovery {
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.";
+ private static final String SOCKET_BINDING_PORT_OFFSET_SYSPROP = "jboss.socket.binding.port-offset";
protected Document hostXml;
protected final Log log = LogFactory.getLog(this.getClass());
private static final String JBOSS_EAP_PREFIX = "jboss-eap-";
@@ -108,6 +109,7 @@ public class AbstractBaseDiscovery {
socketBindingName = obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/socket-binding/@http");
String socketInterface = obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/socket/@interface");
+ String portOffset = null;
if (!socketInterface.isEmpty()) {
interfaceExpession = obtainXmlPropertyViaXPath("//interfaces/interface[@name='" + socketInterface
@@ -133,6 +135,11 @@ public class AbstractBaseDiscovery {
+ socketBindingName + "']/@port");
String interfaceName = obtainXmlPropertyViaXPath("/server/socket-binding-group/socket-binding[@name='"
+ socketBindingName + "']/@interface");
+ String socketBindingGroupName = "standard-sockets";
+ // /server/socket-binding-group[@name='standard-sockets']/@port-offset
+ String xpathExpression =
+ "/server/socket-binding-group[@name='" + socketBindingGroupName + "']/@port-offset";
+ portOffset = obtainXmlPropertyViaXPath(xpathExpression);
// TODO the next may also be expressed differently
interfaceExpession = obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" + interfaceName
@@ -149,11 +156,19 @@ public class AbstractBaseDiscovery {
else
hp.host = "localhost"; // Fallback
+ hp.port = 0;
+
if (portString != null && !portString.isEmpty()) {
String tmp = replaceDollarExpression(portString, commandLine, String.valueOf(DEFAULT_MGMT_PORT));
hp.port = Integer.valueOf(tmp);
- } else
- hp.port = DEFAULT_MGMT_PORT; // Fallback to default
+ }
+
+ if (portOffset!=null && !portOffset.isEmpty()) {
+ String tmp = replaceDollarExpression(portOffset, commandLine, "0");
+ Integer offset = Integer.valueOf(tmp);
+ hp.port += offset;
+ hp.withOffset=true;
+ }
return hp;
}
@@ -203,13 +218,17 @@ public class AbstractBaseDiscovery {
ret = commandLine[i + 1]; // -bmanagement 1.2.3.4
break;
}
- } else if (expression.contains("port")) {
+ } else if (expression.equals("jboss.management.http.port")) {
if (line.contains(expression)) {
ret = line.substring(line.indexOf("=") + 1);
break;
}
+ } else if (expression.equals(SOCKET_BINDING_PORT_OFFSET_SYSPROP)) {
+ if (line.contains(expression)) {
+ ret = line.substring(line.indexOf('=')+1);
+ break;
+ }
}
-
}
if (ret == null)
ret = fallback;
@@ -355,6 +374,19 @@ public class AbstractBaseDiscovery {
return defaultValue;
}
+ protected HostPort checkForSocketBindingOffset(HostPort managementPort, String[] commandLine) {
+ for (String line : commandLine) {
+ if (line.contains(SOCKET_BINDING_PORT_OFFSET_SYSPROP)) {
+ String tmp = line.substring(line.indexOf('=')+1);
+ Integer offset = Integer.valueOf(tmp);
+ managementPort.port+=offset;
+ break;
+ }
+ }
+
+ return managementPort;
+ }
+
/**
* Helper class that holds information about the host,port tuple
*/
@@ -362,6 +394,7 @@ public class AbstractBaseDiscovery {
String host;
int port;
boolean isLocal = true;
+ boolean withOffset = false;
public HostPort() {
host = "localhost";
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 c5515f3..553075a 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
@@ -58,8 +58,6 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
*/
public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery implements ResourceDiscoveryComponent, ManualAddFacet {
- private static final String SOCKET_BINDING_PORT_OFFSET_SYSPROP = "jboss.socket.binding.port-offset";
-
private final Log log = LogFactory.getLog(this.getClass());
// Auto-discover running AS7 instances.
@@ -180,21 +178,8 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
protected abstract String getHostXmlFileName();
protected abstract String buildDefaultResourceName(HostPort hostPort, String configName, JBossProductType productType);
-
- protected abstract String buildDefaultResourceDescription(HostPort hostPort, JBossProductType productType);
-
- protected HostPort checkForSocketBindingOffset(HostPort managementPort, String[] commandLine) {
- for (String line : commandLine) {
- if (line.contains(SOCKET_BINDING_PORT_OFFSET_SYSPROP)) {
- String tmp = line.substring(line.indexOf('=')+1);
- Integer offset = Integer.valueOf(tmp);
- managementPort.port+=offset;
- break;
- }
- }
- return managementPort;
- }
+ protected abstract String buildDefaultResourceDescription(HostPort hostPort, JBossProductType productType);
// Manually add a (remote) AS7 instance.
@Override
@@ -288,7 +273,7 @@ public abstract class BaseProcessDiscovery extends AbstractBaseDiscovery impleme
}
}
- private String findHost(File hostXmlFile) {
+ private String findHost(File hostXmlFile) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
String hostName = null;
try {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
index 32d206b..7adbbf3 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
index c5ffaac..9854cec 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -88,14 +88,17 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
@Override
protected HostPort getManagementPortFromHostXml(String[] commandLine) {
HostPort managementPort = super.getManagementPortFromHostXml(commandLine);
- return checkForSocketBindingOffset(managementPort, commandLine);
+ if (!managementPort.withOffset) {
+ managementPort = checkForSocketBindingOffset(managementPort, commandLine);
+ }
+ return managementPort;
}
@Override
protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContext discoveryContext,
ProcessScanResult psr) {
DiscoveredResourceDetails details = super.buildResourceDetails(discoveryContext, psr);
- Configuration pluginConfig = details.getPluginConfiguration();
+ Configuration pluginConfig = details.getPluginConfiguration();
pluginConfig.put(new PropertySimple("config", getHostXmlFile(psr.getProcessInfo())));
return details;
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
index 85ae619..7c7c70f 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
@@ -112,6 +112,37 @@ public class XmlFileReadingTest {
}
+ public void testXpath711() throws Exception {
+
+ BaseProcessDiscovery bd = new StandaloneASDiscovery();
+ URL url = getClass().getClassLoader().getResource("standalone711.xml");
+ bd.readStandaloneOrHostXmlFromFile(url.getFile());
+
+ String realm = bd.obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/@security-realm");
+ assert "ManagementRealm".equals(realm) : "Realm was " + realm;
+ String sbindingRef = bd.obtainXmlPropertyViaXPath(
+ ("//management/management-interfaces/http-interface/socket-binding/@http"));
+ assert "management-http".equals(sbindingRef): "Socketbinding was " + sbindingRef;
+
+ String pathExpr = "/server/socket-binding-group/socket-binding[@name='" + sbindingRef + "']/@port";
+ String port = bd.obtainXmlPropertyViaXPath(pathExpr);
+ assert "${jboss.management.http.port:9990}".equals(port) : "Port was [" + port + "]";
+
+ pathExpr = "/server/socket-binding-group/socket-binding[@name='" + sbindingRef + "']/@interface";
+ String interfName = bd.obtainXmlPropertyViaXPath(pathExpr);
+ assert "management".equals(interfName) : "Interface was " + interfName;
+
+ pathExpr = "/server/interfaces/interface[@name='" + interfName + "']/inet-address/@value";
+ String interfElem = bd.obtainXmlPropertyViaXPath(pathExpr);
+ assert "${jboss.bind.address.management:127.0.0.71}".equals(interfElem) : "InterfElem was " + interfElem;
+
+ String socketBindingGroupName = "standard-sockets";
+ pathExpr = "/server/socket-binding-group[@name='" + socketBindingGroupName + "']/@port-offset";
+ String offsetAttr = bd.obtainXmlPropertyViaXPath(pathExpr);
+ assert "${jboss.socket.binding.port-offset:123}".equals(offsetAttr) : "Port-Offset was " + offsetAttr;
+
+ }
+
public void testGetRealm() throws Exception {
BaseProcessDiscovery bd = new StandaloneASDiscovery();
diff --git a/modules/plugins/jboss-as-7/src/test/resources/standalone711.xml b/modules/plugins/jboss-as-7/src/test/resources/standalone711.xml
new file mode 100644
index 0000000..c3400d1
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/resources/standalone711.xml
@@ -0,0 +1,325 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-2012 Red Hat, Inc.
+ ~ All rights reserved.
+ ~
+ ~ This program is free software; you can redistribute it and/or modify
+ ~ it under the terms of the GNU General Public License as published by
+ ~ the Free Software Foundation version 2 of the License.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program; if not, write to the Free Software
+ ~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ -->
+
+<server xmlns="urn:jboss:domain:1.2">
+
+ <extensions>
+ <extension module="org.jboss.as.clustering.infinispan"/>
+ <extension module="org.jboss.as.configadmin"/>
+ <extension module="org.jboss.as.connector"/>
+ <extension module="org.jboss.as.deployment-scanner"/>
+ <extension module="org.jboss.as.ee"/>
+ <extension module="org.jboss.as.ejb3"/>
+ <extension module="org.jboss.as.jaxrs"/>
+ <extension module="org.jboss.as.jdr"/>
+ <extension module="org.jboss.as.jmx"/>
+ <extension module="org.jboss.as.jpa"/>
+ <extension module="org.jboss.as.logging"/>
+ <extension module="org.jboss.as.mail"/>
+ <extension module="org.jboss.as.naming"/>
+ <extension module="org.jboss.as.osgi"/>
+ <extension module="org.jboss.as.pojo"/>
+ <extension module="org.jboss.as.remoting"/>
+ <extension module="org.jboss.as.sar"/>
+ <extension module="org.jboss.as.security"/>
+ <extension module="org.jboss.as.threads"/>
+ <extension module="org.jboss.as.transactions"/>
+ <extension module="org.jboss.as.web"/>
+ <extension module="org.jboss.as.webservices"/>
+ <extension module="org.jboss.as.weld"/>
+ </extensions>
+
+ <management>
+ <security-realms>
+ <security-realm name="ManagementRealm">
+ <authentication>
+ <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
+ </authentication>
+ </security-realm>
+ <security-realm name="ApplicationRealm">
+ <authentication>
+ <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
+ </authentication>
+ </security-realm>
+ </security-realms>
+ <management-interfaces>
+ <native-interface security-realm="ManagementRealm">
+ <socket-binding native="management-native"/>
+ </native-interface>
+ <http-interface security-realm="ManagementRealm">
+ <socket-binding http="management-http"/>
+ </http-interface>
+ </management-interfaces>
+ </management>
+
+ <profile>
+ <subsystem xmlns="urn:jboss:domain:logging:1.1">
+ <console-handler name="CONSOLE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ </console-handler>
+ <periodic-rotating-file-handler name="FILE">
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ <file relative-to="jboss.server.log.dir" path="server.log"/>
+ <suffix value=".yyyy-MM-dd"/>
+ <append value="true"/>
+ </periodic-rotating-file-handler>
+ <logger category="com.arjuna">
+ <level name="WARN"/>
+ </logger>
+ <logger category="org.apache.tomcat.util.modeler">
+ <level name="WARN"/>
+ </logger>
+ <logger category="sun.rmi">
+ <level name="WARN"/>
+ </logger>
+ <logger category="jacorb">
+ <level name="WARN"/>
+ </logger>
+ <logger category="jacorb.config">
+ <level name="ERROR"/>
+ </logger>
+ <root-logger>
+ <level name="INFO"/>
+ <handlers>
+ <handler name="CONSOLE"/>
+ <handler name="FILE"/>
+ </handlers>
+ </root-logger>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:configadmin:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:datasources:1.0">
+ <datasources>
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
+ <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ </datasource>
+ <drivers>
+ <driver name="h2" module="com.h2database.h2">
+ <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
+ </driver>
+ </drivers>
+ </datasources>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
+ <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:ee:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:ejb3:1.2">
+ <session-bean>
+ <stateless>
+ <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
+ </stateless>
+ <stateful default-access-timeout="5000" cache-ref="simple"/>
+ <singleton default-access-timeout="5000"/>
+ </session-bean>
+ <pools>
+ <bean-instance-pools>
+ <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
+ <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
+ </bean-instance-pools>
+ </pools>
+ <caches>
+ <cache name="simple" aliases="NoPassivationCache"/>
+ <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
+ </caches>
+ <passivation-stores>
+ <file-passivation-store name="file"/>
+ </passivation-stores>
+ <async thread-pool-name="default"/>
+ <timer-service thread-pool-name="default">
+ <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
+ </timer-service>
+ <remote connector-ref="remoting-connector" thread-pool-name="default"/>
+ <thread-pools>
+ <thread-pool name="default">
+ <max-threads count="10"/>
+ <keepalive-time time="100" unit="milliseconds"/>
+ </thread-pool>
+ </thread-pools>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">
+ <cache-container name="hibernate" default-cache="local-query">
+ <local-cache name="entity">
+ <transaction mode="NON_XA"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="local-query">
+ <transaction mode="NONE"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="timestamps">
+ <transaction mode="NONE"/>
+ <eviction strategy="NONE"/>
+ </local-cache>
+ </cache-container>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jca:1.1">
+ <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
+ <bean-validation enabled="true"/>
+ <default-workmanager>
+ <short-running-threads>
+ <core-threads count="50"/>
+ <queue-length count="50"/>
+ <max-threads count="50"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </short-running-threads>
+ <long-running-threads>
+ <core-threads count="50"/>
+ <queue-length count="50"/>
+ <max-threads count="50"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </long-running-threads>
+ </default-workmanager>
+ <cached-connection-manager/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.1">
+ <show-model value="true"/>
+ <remoting-connector/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jpa:1.0">
+ <jpa default-datasource=""/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:mail:1.0">
+ <mail-session jndi-name="java:jboss/mail/Default">
+ <smtp-server outbound-socket-binding-ref="mail-smtp"/>
+ </mail-session>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:naming:1.1"/>
+ <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy">
+ <properties>
+ <property name="org.osgi.framework.startlevel.beginning">
+ 1
+ </property>
+ </properties>
+ <capabilities>
+ <capability name="javax.servlet.api:v25"/>
+ <capability name="javax.transaction.api"/>
+ <capability name="org.apache.felix.log" startlevel="1"/>
+ <capability name="org.jboss.osgi.logging" startlevel="1"/>
+ <capability name="org.apache.felix.configadmin" startlevel="1"/>
+ <capability name="org.jboss.as.osgi.configadmin" startlevel="1"/>
+ </capabilities>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:remoting:1.1">
+ <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:security:1.1">
+ <security-domains>
+ <security-domain name="other" cache-type="default">
+ <authentication>
+ <login-module code="Remoting" flag="optional">
+ <module-option name="password-stacking" value="useFirstPass"/>
+ </login-module>
+ <login-module code="RealmUsersRoles" flag="required">
+ <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
+ <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
+ <module-option name="realm" value="ApplicationRealm"/>
+ <module-option name="password-stacking" value="useFirstPass"/>
+ </login-module>
+ </authentication>
+ </security-domain>
+ <security-domain name="jboss-web-policy" cache-type="default">
+ <authorization>
+ <policy-module code="Delegating" flag="required"/>
+ </authorization>
+ </security-domain>
+ <security-domain name="jboss-ejb-policy" cache-type="default">
+ <authorization>
+ <policy-module code="Delegating" flag="required"/>
+ </authorization>
+ </security-domain>
+ </security-domains>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:threads:1.1"/>
+ <subsystem xmlns="urn:jboss:domain:transactions:1.1">
+ <core-environment>
+ <process-id>
+ <uuid/>
+ </process-id>
+ </core-environment>
+ <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
+ <coordinator-environment default-timeout="300"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
+ <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
+ <virtual-server name="default-host" enable-welcome-root="true">
+ <alias name="localhost"/>
+ <alias name="example.com"/>
+ </virtual-server>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:webservices:1.1">
+ <modify-wsdl-address>true</modify-wsdl-address>
+ <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
+ <endpoint-config name="Standard-Endpoint-Config"/>
+ <endpoint-config name="Recording-Endpoint-Config">
+ <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
+ <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
+ </pre-handler-chain>
+ </endpoint-config>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
+ </profile>
+
+ <interfaces>
+ <interface name="management">
+ <inet-address value="${jboss.bind.address.management:127.0.0.71}"/>
+ </interface>
+ <interface name="public">
+ <inet-address value="${jboss.bind.address:127.0.0.71}"/>
+ </interface>
+ <interface name="unsecure">
+ <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
+ </interface>
+ </interfaces>
+
+ <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:123}">
+ <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
+ <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
+ <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:19443}"/>
+ <socket-binding name="ajp" port="8009"/>
+ <socket-binding name="http" port="8080"/>
+ <socket-binding name="https" port="8443"/>
+ <socket-binding name="osgi-http" interface="management" port="8090"/>
+ <socket-binding name="remoting" port="4447"/>
+ <socket-binding name="txn-recovery-environment" port="4712"/>
+ <socket-binding name="txn-status-manager" port="4713"/>
+ <outbound-socket-binding name="mail-smtp">
+ <remote-destination host="localhost" port="25"/>
+ </outbound-socket-binding>
+ </socket-binding-group>
+
+</server>
12 years, 1 month
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java | 31 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ExportChangeHandler.java | 6 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java | 7 --
3 files changed, 24 insertions(+), 20 deletions(-)
New commits:
commit a04052c588ff0db24c565347e8de56a2c1055705
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 28 09:23:10 2012 -0400
[BZ 802544] Pass the exportAll flag to the export window
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
index 91f44e3..3372829 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
@@ -20,6 +20,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.components;
+import java.util.LinkedHashMap;
+import java.util.Set;
+
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Window;
@@ -38,14 +41,12 @@ import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.IconEnum;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.PopupWindow;
-import java.util.LinkedHashMap;
-import java.util.Set;
-
/**
* Build a custom Export window based for particular export screens.
*
@@ -65,7 +66,7 @@ public class ExportModalWindow {
private PopupWindow exportWindow;
- private boolean showDetail;
+ private boolean showAllDetail;
// optional Fields
@@ -78,7 +79,7 @@ public class ExportModalWindow {
*/
String[] operationRequestStatuses;
- Set<Integer> resourceTypeIdsForExport;
+ Set<Integer> resourceTypeIds;
// for Recent Drift Report
String driftDefinition;
@@ -93,8 +94,8 @@ public class ExportModalWindow {
}
private ExportModalWindow(String reportUrl, boolean showDetail, Set<Integer> resourceTypeIds) {
this.reportUrl = reportUrl;
- this.showDetail = showDetail;
- resourceTypeIdsForExport = resourceTypeIds;
+ this.showAllDetail = showDetail;
+ this.resourceTypeIds = resourceTypeIds;
createDialogWindow();
}
@@ -125,9 +126,9 @@ public class ExportModalWindow {
return newExportDialog;
}
- public static ExportModalWindow createExportWindowForInventorySummary(String reportUrl,
+ public static ExportModalWindow createExportWindowForInventorySummary(String reportUrl, boolean showAllDetails,
Set<Integer> resourceTypeIdsForExport) {
- ExportModalWindow newExportDialog = new ExportModalWindow(reportUrl, true, resourceTypeIdsForExport);
+ ExportModalWindow newExportDialog = new ExportModalWindow(reportUrl, showAllDetails, resourceTypeIdsForExport);
return newExportDialog;
}
@@ -157,7 +158,7 @@ public class ExportModalWindow {
formatsList.setDefaultValue("csv");
CheckboxItem detailCheckboxItem = new CheckboxItem(DETAILS_FIELD, "Show Detail");
- detailCheckboxItem.setVisible(showDetail);
+ detailCheckboxItem.setVisible(showAllDetail);
detailCheckboxItem.setValue(false);
DateRangeItem dateRangeItem = new DateRangeItem(DATE_RANGE_FIELD, "Date Range");
@@ -211,7 +212,7 @@ public class ExportModalWindow {
String format = form.getValueAsString(FORMAT_FIELD);
StringBuilder queryString = new StringBuilder();
- if (showDetail) {
+ if (showAllDetail) {
queryString.append("details=").append(form.getValueAsString(DETAILS_FIELD));
}
if(operationRequestStatuses != null){
@@ -254,12 +255,12 @@ public class ExportModalWindow {
return URL.encode(BASE_URL + reportUrl + "." + format + "?"+queryString);
}
- public boolean isShowDetail(){
- return showDetail;
+ public boolean isShowAllDetail(){
+ return showAllDetail;
}
- public void setShowDetail(boolean showDetail) {
- this.showDetail = showDetail;
+ public void setShowAllDetail(boolean showAllDetail) {
+ this.showAllDetail = showAllDetail;
}
public void setDriftDefinition(String driftDefinition) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ExportChangeHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ExportChangeHandler.java
index cb34c0c..6cc5fc2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ExportChangeHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ExportChangeHandler.java
@@ -48,7 +48,11 @@ public class ExportChangeHandler implements ChangedHandler {
this.exportAttribute = exportAttribute;
}
- public Set<Integer> getResourceTypeIdsForExport() {
+ /**
+ * @return The set of resource type ids that the user has selected for which details
+ * should be included in the export.
+ */
+ public Set<Integer> getResourceTypeIds() {
return resourceTypeIds;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
index 6a513fc..f6b84b9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
@@ -79,6 +79,8 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
private ResourceSearchView resourceList;
+ private boolean exportAll;
+
public ResourceInstallReport(String locatorId ) {
super(locatorId);
setHeight100();
@@ -245,7 +247,7 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
ExportModalWindow exportModalWindow = ExportModalWindow.createExportWindowForInventorySummary(
- "inventorySummary", exportChangeHandler.getResourceTypeIdsForExport());
+ "inventorySummary", exportAll, exportChangeHandler.getResourceTypeIds());
exportModalWindow.show();
refreshTableInfo();
}
@@ -261,9 +263,6 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
setFilterFormItems(exportAllDetails);
exportAllDetails.addChangedHandler(new ChangedHandler() {
-
- boolean exportAll;
-
@Override
public void onChanged(ChangedEvent event) {
exportAll = !exportAll;
12 years, 1 month