modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AutoDiscoveryExecutor.java
| 18 +++------
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineOption.java
| 19 ++++++++--
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
| 2 -
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
| 6 +--
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
| 15 ++++---
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
| 2 -
7 files changed, 36 insertions(+), 28 deletions(-)
New commits:
commit 35aadf4db3bd68be52fffed4006e10a0fae09cfd
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 28 21:44:24 2012 -0400
fix a couple compile errors and a regression in the code that determines the
management bind address from the command line
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
index e0cf57e..4ca0a84 100644
---
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
@@ -7,10 +7,14 @@ package org.rhq.modules.plugins.jbossas7;
*/
public class AS7CommandLineOption {
- private Character shortName;
+ private String shortName;
private String longName;
- public AS7CommandLineOption(Character shortName, String longName) {
+ public AS7CommandLineOption(char shortName, String longName) {
+ this(new String(new char[] {shortName}), longName);
+ }
+
+ public AS7CommandLineOption(String shortName, String longName) {
if ((shortName == null) && (longName == null)) {
throw new IllegalArgumentException("ShortName and longName cannot both
be null.");
}
@@ -19,7 +23,8 @@ public class AS7CommandLineOption {
this.longName = longName;
}
- public Character getShortName() {
+
+ public String getShortName() {
return shortName;
}
@@ -27,4 +32,12 @@ public class AS7CommandLineOption {
return longName;
}
+ @Override
+ public String toString() {
+ return "AS7CommandLineOption{" +
+ "shortName='" + shortName + '\'' +
+ ", longName='" + 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 8641df1..c3214ed 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
@@ -48,7 +48,7 @@ public class AbstractBaseDiscovery {
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");
+ private AS7CommandLineOption BIND_ADDRESS_MANAGEMENT_OPTION = new
AS7CommandLineOption("bmanagement", null);
static final int DEFAULT_MGMT_PORT = 9990;
private static final String JBOSS_AS_PREFIX = "jboss-as-";
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 f6dc975..67f70cd 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
@@ -117,7 +117,7 @@ public abstract class BaseProcessDiscovery extends
AbstractBaseDiscovery
pluginConfig.put(new PropertySimple("configDir", configDir));
pluginConfig.put(new PropertySimple("startScript",
getMode().getStartScript()));
pluginConfig.put(new PropertySimple("domainHost",
findHost(getHostXmlFile(process, configDir))));
- fillUserPassFromFile(pluginConfig, getMode(), homeDir.getPath());
+ fillUserPassFromFile(pluginConfig, getMode(), homeDir);
File logFile = getLogFile(getLogDir(process, baseDir));
initLogEventSourcesConfigProp(logFile.getPath(), pluginConfig);
HostPort managementHostPort = getManagementPortFromHostXml(commandLine);
@@ -316,8 +316,7 @@ public abstract class BaseProcessDiscovery extends
AbstractBaseDiscovery
return (String) res.getResult();
}
- private void fillUserPassFromFile(Configuration config, AS7Mode mode, String baseDir)
{
-
+ private void fillUserPassFromFile(Configuration config, AS7Mode mode, File baseDir)
{
// String configDir = baseDir + File.separator + mode + File.separator +
"configuration";
String realm = getManagementSecurityRealmFromHostXml();
String fileName = getSecurityPropertyFileFromHostXml(baseDir, mode, realm);
@@ -329,6 +328,7 @@ public abstract class BaseProcessDiscovery extends
AbstractBaseDiscovery
+ "] or file is not readable");
return;
}
+ // TODO (ips): Can't we use Properties.load() to read the file?
BufferedReader br = null;
try {
FileReader fileReader = new FileReader(file);
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 68e407c..bdf8a66 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -55,7 +55,8 @@ import org.rhq.modules.plugins.jbossas7.json.ReadResource;
import org.rhq.modules.plugins.jbossas7.json.Result;
/**
- * Base component for functionality that is common to Standalone AS and HostControllers
+ * Base component for functionality that is common to Standalone Servers and Host
Controllers.
+ *
* @author Heiko W. Rupp
*/
public class BaseServerComponent extends BaseComponent implements MeasurementFacet {
@@ -273,11 +274,12 @@ public class BaseServerComponent extends BaseComponent implements
MeasurementFac
return result;
}
- String homeDir = pluginConfig.getSimpleValue("homeDir", "");
- if (homeDir.isEmpty()) {
- result.setErrorMessage("No homeDir found, can not continue");
+ String homeDirString = pluginConfig.getSimpleValue("homeDir",
"");
+ if (homeDirString.isEmpty()) {
+ result.setErrorMessage("No homeDir found - cannot continue.");
return result;
}
+ File homeDir = new File(homeDirString);
String configFile;
BaseProcessDiscovery processDiscovery;
@@ -318,8 +320,8 @@ public class BaseServerComponent extends BaseComponent implements
MeasurementFac
log.error(nsae.getMessage());
result.setErrorMessage(nsae.getMessage());
}
- result.setSimpleResult("User/Password set or updated");
- log.info("Installed management user [" + user + "].");
+ result.setSimpleResult("Management user [" + user + "] added or
updated.");
+ log.info("Added or updated management user [" + user +
"].");
context.getAvailabilityContext().requestAvailabilityCheck();
@@ -362,7 +364,6 @@ public class BaseServerComponent extends BaseComponent implements
MeasurementFac
else if (!requestName.startsWith("_skm:")) { // handled below
leftovers.add(request);
}
-
}
// Now handle the skm
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 a4a46df..225468f 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
@@ -95,7 +95,7 @@ public class HostControllerDiscovery extends BaseProcessDiscovery {
@Override
protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContext
discoveryContext,
- ProcessScanResult psr) {
+ ProcessScanResult psr)
throws Exception {
DiscoveredResourceDetails details = super.buildResourceDetails(discoveryContext,
psr);
ProcessInfo process = psr.getProcessInfo();
Configuration pluginConfig = details.getPluginConfiguration();
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 9102b21..4a80c60 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
@@ -107,7 +107,7 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
@Override
protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContext
discoveryContext,
- ProcessScanResult psr) {
+ ProcessScanResult psr)
throws Exception {
DiscoveredResourceDetails details = super.buildResourceDetails(discoveryContext,
psr);
ProcessInfo process = psr.getProcessInfo();
Configuration pluginConfig = details.getPluginConfiguration();
commit e73c75134200da25d45abb25401bda5148a0c558
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 28 21:29:26 2012 -0400
tone down some INFO logging to DEBUG; remove some dead code
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AutoDiscoveryExecutor.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AutoDiscoveryExecutor.java
index ce3eab7..67094b5 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AutoDiscoveryExecutor.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AutoDiscoveryExecutor.java
@@ -60,7 +60,7 @@ import org.rhq.core.util.exception.ExceptionPackage;
import org.rhq.core.util.exception.Severity;
/**
- * Standard platform/server inventory detection execution. This is typically called in a
non-blocking fashion and the
+ * Standard platform/server inventory detection execution. This is typically called in a
non-blocking fashion, and the
* report is returned asynchronously to the server. It is available for direct execution
via a Future when running in an
* embedded mode.
*
@@ -84,11 +84,6 @@ public class AutoDiscoveryExecutor implements Runnable,
Callable<InventoryReport
this.configuration = configuration;
}
- public AutoDiscoveryExecutor() {
- autoDiscoveryRequest = new AutoDiscoveryRequest();
- autoDiscoveryRequest.getScanTypes().add(AutoDiscoveryScanType.Plugin);
- }
-
public void run() {
call();
}
@@ -167,7 +162,6 @@ public class AutoDiscoveryExecutor implements Runnable,
Callable<InventoryReport
Set<ResourceType> serverTypes =
pluginManager.getMetadataManager().getTypesForCategory(ResourceCategory.SERVER);
ResourceContainer platformContainer =
inventoryManager.getResourceContainer(inventoryManager.getPlatform());
- ResourceComponent platformComponent = platformContainer.getResourceComponent();
Resource platformResource = platformContainer.getResource();
for (ResourceType serverType : serverTypes) {
@@ -195,7 +189,6 @@ public class AutoDiscoveryExecutor implements Runnable,
Callable<InventoryReport
component, platformContainer, scanResults);
for (Resource discoveredServer : discoveredServers) {
- log.debug("Detected server " + discoveredServer);
Resource inventoriedResource =
this.inventoryManager.mergeResourceFromDiscovery(discoveredServer,
platformResource);
@@ -237,8 +230,10 @@ public class AutoDiscoveryExecutor implements Runnable,
Callable<InventoryReport
if ((queryResults != null) && (queryResults.size() > 0)) {
for (ProcessInfo autoDiscoveredProcess : queryResults) {
scanResults.add(new ProcessScanResult(processScan,
autoDiscoveredProcess));
- log.info("Process scan auto-detected new server resource:
scan=[" + processScan
- + "], discovered-process=[" + autoDiscoveredProcess
+ "]");
+ if (log.isDebugEnabled()) {
+ log.debug("Process scan auto-detected potential new
server Resource: scan=[" + processScan
+ + "], discovered-process=[" +
autoDiscoveredProcess + "]");
+ }
}
}
}
@@ -248,8 +243,7 @@ public class AutoDiscoveryExecutor implements Runnable,
Callable<InventoryReport
private boolean verifyComponentCompatibility(ResourceDiscoveryComponent component,
ResourceComponent parentResourceComponent) throws PluginContainerException {
- Method discoveryCall = null;
-
+ Method discoveryCall;
try {
discoveryCall = component.getClass().getMethod("discoverResources",
ResourceCategory.class);
} catch (NoSuchMethodException e) {