[rhq] 2 commits - modules/core modules/plugins
by snegrea
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java | 24 -
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java | 2
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java | 2
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceComponent.java | 2
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java | 14
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryComponent.java | 2
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java | 13
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java | 27 -
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 177 +++++-----
modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java | 26 -
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/DiscComponent.java | 14
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/ResComponent.java | 14
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseDiscoveryComponent.java | 2
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseResourceComponent.java | 54 +--
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseUpgradingDiscoveryComponent.java | 10
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/NothingDiscoveringDiscoveryComponent.java | 3
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/DiscComponent.java | 4
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/ResComponent.java | 4
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/DiscComponent.java | 8
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/ResComponent.java | 4
modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXComponent.java | 2
22 files changed, 210 insertions(+), 200 deletions(-)
New commits:
commit 50b7ebaa0106ff1995d21ea54b58ef2a49cbd571
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 14 14:28:49 2011 -0500
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
Conflicts:
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
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 416e90a..414c232 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
@@ -23,6 +23,7 @@
package org.rhq.core.pc.inventory;
import static org.rhq.core.domain.drift.DriftConfigurationComparator.CompareMode.BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS;
+import static org.rhq.core.util.file.FileUtil.purge;
import java.io.File;
import java.net.URL;
@@ -125,9 +126,6 @@ import org.rhq.core.system.SystemInfoFactory;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.core.util.exception.WrappedRemotingException;
-import static org.rhq.core.domain.drift.DriftConfigurationComparator.CompareMode.BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS;
-import static org.rhq.core.util.file.FileUtil.purge;
-
/**
* Manages the process of both auto-detection of servers and runtime detection of services across all plugins. Manages
* their scheduling and result sending as well as the general inventory model.
@@ -2178,8 +2176,8 @@ public class InventoryManager extends AgentService implements ContainerService,
}
}
} else {
- log.info("DriftManager is not available. Drift configurations will be persisted but detection will not " +
- "be scheduled.");
+ log.info("DriftManager is not available. Drift configurations will be persisted but detection will not "
+ + "be scheduled.");
// First check for drift configurations that have been deleted
log.debug("Checking for stale drift configurations that need to be purged from inventory");
@@ -2220,8 +2218,8 @@ public class InventoryManager extends AgentService implements ContainerService,
ResourceContainer container = getResourceContainer(resourceId);
for (DriftConfiguration c : configsFromServer.get(resourceId)) {
if (log.isDebugEnabled()) {
- log.debug("Adding DriftConfiguration[name: " + c.getName() + ", resourceId: " + resourceId +
- "]");
+ log.debug("Adding DriftConfiguration[name: " + c.getName() + ", resourceId: " + resourceId
+ + "]");
}
container.addDriftConfiguration(c);
}
commit 8e8c1d9068d0d7ab3da91b9ef3c2b9e3fdb36adb
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 14 13:52:10 2011 -0500
First set of wildcard generic updates. The change was mainly done in the plugin-api module but updated all the code directly affected by the change.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
index 02430c2..962764a 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
@@ -24,23 +24,23 @@ import java.text.SimpleDateFormat;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.pluginapi.event.EventContext;
+import org.rhq.core.pluginapi.event.EventPoller;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.event.EventPoller;
-import org.rhq.core.pluginapi.event.EventContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* @author Ian Springer
*/
-public class LogFileEventResourceComponentHelper
-{
+public class LogFileEventResourceComponentHelper {
public static final String LOG_ENTRY_EVENT_TYPE = "logEntry";
public static final String LOG_EVENT_SOURCES_CONFIG_PROP = "logEventSources";
@@ -56,10 +56,9 @@ public class LogFileEventResourceComponentHelper
private final Log log = LogFactory.getLog(this.getClass());
- private ResourceContext resourceContext;
+ private ResourceContext<?> resourceContext;
- public LogFileEventResourceComponentHelper(ResourceContext resourceContext)
- {
+ public LogFileEventResourceComponentHelper(ResourceContext<?> resourceContext) {
this.resourceContext = resourceContext;
}
@@ -71,13 +70,14 @@ public class LogFileEventResourceComponentHelper
Boolean enabled = Boolean.valueOf(logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED, null));
if (enabled) {
String logFilePathname = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
- if (logFilePathname==null) {
+ if (logFilePathname == null) {
log.info("LOGFILE: No logfile path given, can not watch this event log.");
return;
}
File logFile = new File(logFilePathname);
if (!logFile.exists() || !logFile.canRead()) {
- log.error("LOGFILE: Logfile at location " + logFilePathname + " does not exist or is not readable. Can not start watching the event log.");
+ log.error("LOGFILE: Logfile at location " + logFilePathname
+ + " does not exist or is not readable. Can not start watching the event log.");
return;
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java
index c08449e..df7dc31 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java
@@ -37,7 +37,7 @@ import java.util.List;
*
* @author John Mazzitelli
*/
-public interface ClassLoaderFacet<T extends ResourceComponent> {
+public interface ClassLoaderFacet<T extends ResourceComponent<?>> {
/**
* This method provides the location for additional jars that are needed in the resource's classloader
* in order to properly connect and talk to the managed resource.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java
index 62ef20c..476e8d8 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java
@@ -40,7 +40,7 @@ import org.rhq.core.domain.configuration.Configuration;
*
* @author Ian Springer
*/
-public interface ManualAddFacet<T extends ResourceComponent> {
+public interface ManualAddFacet<T extends ResourceComponent<?>> {
/**
* Using the specified plugin configuration, creates a DiscoveredResourceDetails object describing a new Resource
* to be added to inventory.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceComponent.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceComponent.java
index 6d1147a..aebea7f 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceComponent.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceComponent.java
@@ -54,7 +54,7 @@ import org.rhq.core.pluginapi.support.SupportFacet;
* @param <T> the parent resource component type for this component. This means you can nest a hierarchy of resource
* components that mimic the resource type hierarchy as defined in a plugin deployment descriptor.
*/
-public interface ResourceComponent<T extends ResourceComponent> extends AvailabilityFacet {
+public interface ResourceComponent<T extends ResourceComponent<?>> extends AvailabilityFacet {
/**
* Initializes the resource component, possibly connecting to the managed resource itself. The implementation can be
* custom to the plugin or resource, but the idea is that a resource component can create a single connection to
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
index a86a08d..853345d 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
@@ -58,14 +58,14 @@ import org.rhq.core.system.pquery.ProcessInfoQuery;
* @author John Mazzitelli
*/
@SuppressWarnings("unchecked")
-public class ResourceContext<T extends ResourceComponent> {
+public class ResourceContext<T extends ResourceComponent<?>> {
private final String resourceKey;
private final ResourceType resourceType;
private final String version;
private final T parentResourceComponent;
private final Configuration pluginConfiguration;
private final SystemInfo systemInformation;
- private final ResourceDiscoveryComponent resourceDiscoveryComponent;
+ private final ResourceDiscoveryComponent<T> resourceDiscoveryComponent;
private final File temporaryDirectory;
private final File dataDirectory;
private final String pluginContainerName;
@@ -105,7 +105,7 @@ public class ResourceContext<T extends ResourceComponent> {
* @param pluginContainerDeployment indicates where the plugin container is running
*/
public ResourceContext(Resource resource, T parentResourceComponent,
- ResourceDiscoveryComponent resourceDiscoveryComponent, SystemInfo systemInfo, File temporaryDirectory,
+ ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo, File temporaryDirectory,
File dataDirectory, String pluginContainerName, EventContext eventContext, OperationContext operationContext,
ContentContext contentContext, Executor availCollectorThreadPool,
PluginContainerDeployment pluginContainerDeployment) {
@@ -221,11 +221,11 @@ public class ResourceContext<T extends ResourceComponent> {
if (this.resourceDiscoveryComponent != null) {
try {
Set<DiscoveredResourceDetails> details;
- ResourceDiscoveryContext<ResourceComponent<?>> context;
+ ResourceDiscoveryContext<T> context;
- context = new ResourceDiscoveryContext<ResourceComponent<?>>(this.resourceType,
- this.parentResourceComponent, this, this.systemInformation, getNativeProcessesForType(),
- Collections.EMPTY_LIST, getPluginContainerName(), getPluginContainerDeployment());
+ context = new ResourceDiscoveryContext<T>(this.resourceType, this.parentResourceComponent, this,
+ this.systemInformation, getNativeProcessesForType(), Collections.EMPTY_LIST,
+ getPluginContainerName(), getPluginContainerDeployment());
details = this.resourceDiscoveryComponent.discoverResources(context);
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryComponent.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryComponent.java
index e93a38b..b695290 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryComponent.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryComponent.java
@@ -38,7 +38,7 @@ import java.util.Set;
*
* @see ClassLoaderFacet
*/
-public interface ResourceDiscoveryComponent<T extends ResourceComponent> {
+public interface ResourceDiscoveryComponent<T extends ResourceComponent<?>> {
/**
* <p>Asks the discovery component to discover all of its resources. The plugin container may or may not have already
* {@link ResourceDiscoveryContext#getAutoDiscoveredProcesses() auto-discovered} some resources for this component
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java
index 3c45e79..b9e9bcd 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java
@@ -53,7 +53,7 @@ import org.rhq.core.system.SystemInfo;
*
* @author John Mazzitelli
*/
-public class ResourceDiscoveryContext<T extends ResourceComponent> {
+public class ResourceDiscoveryContext<T extends ResourceComponent<?>> {
private final ResourceType resourceType;
private final T parentComponent;
private final PluginContainerDeployment pluginContainerDeployment;
@@ -61,7 +61,7 @@ public class ResourceDiscoveryContext<T extends ResourceComponent> {
/**
* @since 1.0.1
*/
- private final ResourceContext parentResourceContext;
+ private final ResourceContext<?> parentResourceContext;
private final SystemInfo systemInformation;
private final List<ProcessScanResult> processScanResults;
private final List<Configuration> pluginConfigurations;
@@ -86,12 +86,11 @@ public class ResourceDiscoveryContext<T extends ResourceComponent> {
* can be assured this name is unique across <b>all</b> plugin containers/agents running
* @param pluginContainerDeployment indicates where the plugin container is running
*/
- @SuppressWarnings("unchecked")
public ResourceDiscoveryContext(ResourceType resourceType, T parentComponent,
- ResourceContext parentResourceContext, SystemInfo systemInfo, List<ProcessScanResult> processScanResults,
+ ResourceContext<?> parentResourceContext, SystemInfo systemInfo, List<ProcessScanResult> processScanResults,
String pluginContainerName, PluginContainerDeployment pluginContainerDeployment) {
this(resourceType, parentComponent, parentResourceContext, systemInfo, processScanResults, null,
- pluginContainerName, pluginContainerDeployment);
+ pluginContainerName, pluginContainerDeployment);
}
/**
@@ -119,7 +118,7 @@ public class ResourceDiscoveryContext<T extends ResourceComponent> {
*/
@SuppressWarnings("unchecked")
public ResourceDiscoveryContext(ResourceType resourceType, T parentComponent,
- ResourceContext parentResourceContext, SystemInfo systemInfo, List<ProcessScanResult> processScanResults,
+ ResourceContext<?> parentResourceContext, SystemInfo systemInfo, List<ProcessScanResult> processScanResults,
List<Configuration> pluginConfigurations, String pluginContainerName,
PluginContainerDeployment pluginContainerDeployment) {
this.resourceType = resourceType;
@@ -161,7 +160,7 @@ public class ResourceDiscoveryContext<T extends ResourceComponent> {
* @return the resource context for the parent
* @since 1.0.1
*/
- public ResourceContext getParentResourceContext() {
+ public ResourceContext<?> getParentResourceContext() {
return parentResourceContext;
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
index c56d280..b4c6192 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
@@ -44,27 +44,26 @@ import org.rhq.core.system.SystemInfo;
*
* @author Lukas Krejci
*/
-@SuppressWarnings("rawtypes")
-public class ResourceUpgradeContext<T extends ResourceComponent> extends ResourceContext<T> {
+public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends ResourceContext<T> {
private final Configuration resourceConfiguration;
private final String name;
private final String description;
private ResourceContext<?> parentResourceContext;
-
+
/**
* @see ResourceContext#ResourceContext(Resource, ResourceComponent, ResourceDiscoveryComponent, SystemInfo, File, File, String, EventContext, OperationContext, ContentContext, Executor, PluginContainerDeployment)
*/
- public ResourceUpgradeContext(Resource resource, ResourceContext<?> parentResourceContext, T parentResourceComponent,
- ResourceDiscoveryComponent resourceDiscoveryComponent, SystemInfo systemInfo, File temporaryDirectory,
- File dataDirectory, String pluginContainerName, EventContext eventContext, OperationContext operationContext,
- ContentContext contentContext, Executor availCollectorThreadPool,
+ public ResourceUpgradeContext(Resource resource, ResourceContext<?> parentResourceContext,
+ T parentResourceComponent, ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo,
+ File temporaryDirectory, File dataDirectory, String pluginContainerName, EventContext eventContext,
+ OperationContext operationContext, ContentContext contentContext, Executor availCollectorThreadPool,
PluginContainerDeployment pluginContainerDeployment) {
-
- super(resource, parentResourceComponent, resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory,
- pluginContainerName, eventContext, operationContext, contentContext, availCollectorThreadPool,
- pluginContainerDeployment);
-
+
+ super(resource, parentResourceComponent, resourceDiscoveryComponent, systemInfo, temporaryDirectory,
+ dataDirectory, pluginContainerName, eventContext, operationContext, contentContext,
+ availCollectorThreadPool, pluginContainerDeployment);
+
this.parentResourceContext = parentResourceContext;
this.resourceConfiguration = resource.getResourceConfiguration();
this.name = resource.getName();
@@ -72,9 +71,9 @@ public class ResourceUpgradeContext<T extends ResourceComponent> extends Resourc
}
public ResourceContext<?> getParentResourceContext() {
- return parentResourceContext;
+ return parentResourceContext;
}
-
+
public Configuration getResourceConfiguration() {
return resourceConfiguration;
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java
index 915a9e7..13c155a 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java
@@ -34,7 +34,7 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent;
*
* @author Lukas Krejci
*/
-public interface ResourceUpgradeFacet<T extends ResourceComponent> {
+public interface ResourceUpgradeFacet<T extends ResourceComponent<?>> {
/**
* Specifies what data should change on the provided resource to upgrade it to the current version.
*
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 fe15bb5..416e90a 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
@@ -22,6 +22,8 @@
*/
package org.rhq.core.pc.inventory;
+import static org.rhq.core.domain.drift.DriftConfigurationComparator.CompareMode.BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS;
+
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
@@ -251,16 +253,19 @@ public class InventoryManager extends AgentService implements ContainerService,
// inside EmbJopr).
if (configuration.isInsideAgent()) {
// After an initial delay (5s by default), periodically run an availability check (every 1m by default).
- availabilityThreadPoolExecutor.scheduleWithFixedDelay(availabilityExecutor, configuration
- .getAvailabilityScanInitialDelay(), configuration.getAvailabilityScanPeriod(), TimeUnit.SECONDS);
+ availabilityThreadPoolExecutor.scheduleWithFixedDelay(availabilityExecutor,
+ configuration.getAvailabilityScanInitialDelay(), configuration.getAvailabilityScanPeriod(),
+ TimeUnit.SECONDS);
// After an initial delay (10s by default), periodically run a server discovery scan (every 15m by default).
- inventoryThreadPoolExecutor.scheduleWithFixedDelay(serverScanExecutor, configuration
- .getServerDiscoveryInitialDelay(), configuration.getServerDiscoveryPeriod(), TimeUnit.SECONDS);
+ inventoryThreadPoolExecutor.scheduleWithFixedDelay(serverScanExecutor,
+ configuration.getServerDiscoveryInitialDelay(), configuration.getServerDiscoveryPeriod(),
+ TimeUnit.SECONDS);
// After an initial delay (20s by default), periodically run a service discovery scan (every 1d by default).
- inventoryThreadPoolExecutor.scheduleWithFixedDelay(serviceScanExecutor, configuration
- .getServiceDiscoveryInitialDelay(), configuration.getServiceDiscoveryPeriod(), TimeUnit.SECONDS);
+ inventoryThreadPoolExecutor.scheduleWithFixedDelay(serviceScanExecutor,
+ configuration.getServiceDiscoveryInitialDelay(), configuration.getServiceDiscoveryPeriod(),
+ TimeUnit.SECONDS);
}
} finally {
inventoryLock.writeLock().unlock();
@@ -317,8 +322,8 @@ public class InventoryManager extends AgentService implements ContainerService,
long timeout = getDiscoveryComponentTimeout(context.getResourceType());
try {
- ResourceDiscoveryComponent proxy = this.discoveryComponentProxyFactory.getDiscoveryComponentProxy(context
- .getResourceType(), component, timeout, parentResourceContainer);
+ ResourceDiscoveryComponent proxy = this.discoveryComponentProxyFactory.getDiscoveryComponentProxy(
+ context.getResourceType(), component, timeout, parentResourceContainer);
Set<DiscoveredResourceDetails> results = proxy.discoverResources(context);
return results;
} catch (TimeoutException te) {
@@ -348,13 +353,13 @@ public class InventoryManager extends AgentService implements ContainerService,
* @throws Exception if the discovery component threw an exception
*/
private DiscoveredResourceDetails discoverResource(ResourceDiscoveryComponent component,
- Configuration pluginConfig, ResourceDiscoveryContext context,
- ResourceContainer parentResourceContainer) throws Exception {
+ Configuration pluginConfig, ResourceDiscoveryContext context, ResourceContainer parentResourceContainer)
+ throws Exception {
long timeout = getDiscoveryComponentTimeout(context.getResourceType());
try {
- ManualAddFacet proxy = this.discoveryComponentProxyFactory.getDiscoveryComponentProxy(context
- .getResourceType(), component, timeout, ManualAddFacet.class, parentResourceContainer);
+ ManualAddFacet proxy = this.discoveryComponentProxyFactory.getDiscoveryComponentProxy(
+ context.getResourceType(), component, timeout, ManualAddFacet.class, parentResourceContainer);
DiscoveredResourceDetails result = proxy.discoverResource(pluginConfig, context);
return result;
} catch (TimeoutException te) {
@@ -393,8 +398,8 @@ public class InventoryManager extends AgentService implements ContainerService,
component, timeout, ClassLoaderFacet.class, parentContainer);
ResourceDiscoveryContext discoveryContext = new ResourceDiscoveryContext(resourceType, parentComponent,
- parentResourceContext, SystemInfoFactory.createSystemInfo(), null, null, this.configuration
- .getContainerName(), this.configuration.getPluginContainerDeployment());
+ parentResourceContext, SystemInfoFactory.createSystemInfo(), null, null,
+ this.configuration.getContainerName(), this.configuration.getPluginContainerDeployment());
// Configurations are not immutable, so clone the plugin config, so the plugin will not be able to change the
// actual PC-managed plugin config.
@@ -409,9 +414,9 @@ public class InventoryManager extends AgentService implements ContainerService,
return results;
}
- public <T extends ResourceComponent> ResourceUpgradeReport invokeDiscoveryComponentResourceUpgradeFacet(
- ResourceType resourceType, ResourceDiscoveryComponent<T> component,
- ResourceUpgradeContext<T> inventoriedResource, ResourceContainer parentResourceContainer) throws Throwable {
+ public <T extends ResourceComponent<?>> ResourceUpgradeReport invokeDiscoveryComponentResourceUpgradeFacet(
+ ResourceType resourceType, ResourceDiscoveryComponent<T> component,
+ ResourceUpgradeContext<T> inventoriedResource, ResourceContainer parentResourceContainer) throws Throwable {
long timeout = getDiscoveryComponentTimeout(resourceType);
try {
@@ -679,16 +684,16 @@ public class InventoryManager extends AgentService implements ContainerService,
DiscoveredResourceDetails discoveredResourceDetails;
if (discoveryComponent instanceof ManualAddFacet) {
// The plugin is using the new manual add API.
- ResourceDiscoveryContext<ResourceComponent> discoveryContext = new ResourceDiscoveryContext<ResourceComponent>(
+ ResourceDiscoveryContext<ResourceComponent<?>> discoveryContext = new ResourceDiscoveryContext<ResourceComponent<?>>(
resourceType, parentResourceComponent, parentResourceContainer.getResourceContext(),
SystemInfoFactory.createSystemInfo(), new ArrayList<ProcessScanResult>(0),
- new ArrayList<Configuration>(0), this.configuration.getContainerName(), this.configuration
- .getPluginContainerDeployment());
+ new ArrayList<Configuration>(0), this.configuration.getContainerName(),
+ this.configuration.getPluginContainerDeployment());
// Ask the plugin's discovery component to find the new resource, throwing exceptions if it cannot be
// found at all.
discoveredResourceDetails = discoverResource(discoveryComponent, pluginConfiguration, discoveryContext,
- parentResourceContainer);
+ parentResourceContainer);
if (discoveredResourceDetails == null) {
log.info("Plugin Error: During manual add, discovery component method ["
+ discoveryComponent.getClass().getName() + ".discoverResource()] returned null "
@@ -706,7 +711,7 @@ public class InventoryManager extends AgentService implements ContainerService,
+ "rather than the new ManualAddFacet interface.");
List<Configuration> pluginConfigurations = new ArrayList<Configuration>(1);
pluginConfigurations.add(pluginConfiguration);
- ResourceDiscoveryContext<ResourceComponent> discoveryContext = new ResourceDiscoveryContext<ResourceComponent>(
+ ResourceDiscoveryContext<ResourceComponent<?>> discoveryContext = new ResourceDiscoveryContext<ResourceComponent<?>>(
resourceType, parentResourceComponent, parentResourceContainer.getResourceContext(),
SystemInfoFactory.createSystemInfo(), new ArrayList<ProcessScanResult>(0), pluginConfigurations,
this.configuration.getContainerName(), this.configuration.getPluginContainerDeployment());
@@ -885,8 +890,7 @@ public class InventoryManager extends AgentService implements ContainerService,
if ((this.platform != null) && (this.platform.getInventoryStatus() == InventoryStatus.NEW)
&& newPlatformWasDeletedRecently) {
// let's make sure we are registered; its probable that our platform was deleted and we need to re-register
- log
- .info("No committed resources to send in our availability report - the platform/agent was deleted, let's re-register again");
+ log.info("No committed resources to send in our availability report - the platform/agent was deleted, let's re-register again");
registerWithServer();
newPlatformWasDeletedRecently = false; // we've tried to recover from our platform being deleted, let's not do it again
}
@@ -929,8 +933,8 @@ public class InventoryManager extends AgentService implements ContainerService,
log.debug("Availability report content: " + report.toString(log.isTraceEnabled()));
}
- boolean ok = configuration.getServerServices().getDiscoveryServerService().mergeAvailabilityReport(
- report);
+ boolean ok = configuration.getServerServices().getDiscoveryServerService()
+ .mergeAvailabilityReport(report);
if (!ok) {
// I guess I could immediately call executeAvailabilityScanImmediately and pass its results to
// mergeAvailabilityReport again right now, but what happens if we've queued up a bunch of
@@ -976,9 +980,9 @@ public class InventoryManager extends AgentService implements ContainerService,
(System.currentTimeMillis() - startTime)));
}
} catch (StaleTypeException e) {
- log.error("Failed to merge inventory report with server. The report contains one or more resource types " +
- "that have been marked for deletion. Notifying the plugin container that a reboot is needed to purge " +
- "stale types.");
+ log.error("Failed to merge inventory report with server. The report contains one or more resource types "
+ + "that have been marked for deletion. Notifying the plugin container that a reboot is needed to purge "
+ + "stale types.");
PluginContainer.getInstance().notifyRebootRequestListener();
return false;
} catch (InvalidInventoryReportException e) {
@@ -986,8 +990,7 @@ public class InventoryManager extends AgentService implements ContainerService,
if ((this.platform != null) && (this.platform.getInventoryStatus() == InventoryStatus.NEW)
&& newPlatformWasDeletedRecently) {
// let's make sure we are registered; its probable that our platform was deleted and we need to re-register
- log
- .info("The inventory report was invalid probably because the platform/Agent was deleted; let's re-register...");
+ log.info("The inventory report was invalid probably because the platform/Agent was deleted; let's re-register...");
registerWithServer();
newPlatformWasDeletedRecently = false; // we've tried to recover from our platform being deleted, let's not do it again
}
@@ -1183,8 +1186,8 @@ public class InventoryManager extends AgentService implements ContainerService,
parent.removeChildResource(resource);
}
- PluginContainer.getInstance().getMeasurementManager().unscheduleCollection(
- Collections.singleton(resource.getId()));
+ PluginContainer.getInstance().getMeasurementManager()
+ .unscheduleCollection(Collections.singleton(resource.getId()));
if (this.resourceContainers.remove(resource.getUuid()) == null) {
if (log.isDebugEnabled()) {
@@ -1290,8 +1293,8 @@ public class InventoryManager extends AgentService implements ContainerService,
logMessage.append("description, ");
}
- logMessage.replace(logMessage.length() - 1, logMessage.length(), "to become [").append(
- existingResource.toString()).append("]");
+ logMessage.replace(logMessage.length() - 1, logMessage.length(), "to become [")
+ .append(existingResource.toString()).append("]");
log.info(logMessage.toString());
} else {
@@ -1452,22 +1455,24 @@ public class InventoryManager extends AgentService implements ContainerService,
* @throws PluginContainerException
* @return true the resource has been successfully prepared and can be started. False if the resource should not be started.
*/
- private boolean prepareResourceForActivation(Resource resource, @NotNull ResourceContainer container, boolean forceReinitialization) throws InvalidPluginConfigurationException, PluginContainerException {
+ private boolean prepareResourceForActivation(Resource resource, @NotNull ResourceContainer container,
+ boolean forceReinitialization) throws InvalidPluginConfigurationException, PluginContainerException {
if (resourceUpgradeDelegate.hasUpgradeFailed(resource)) {
if (log.isTraceEnabled()) {
log.trace("Skipping activation of " + resource + " - it has failed to upgrade.");
}
return false;
}
-
+
ResourceComponent component = container.getResourceComponent();
// if the component already exists and is started, and the resource's plugin config has not changed, there is
// nothing to do, so return immediately
- if ((component != null) && (container.getResourceComponentState() == ResourceComponentState.STARTED
- && !forceReinitialization)) {
+ if ((component != null)
+ && (container.getResourceComponentState() == ResourceComponentState.STARTED && !forceReinitialization)) {
if (log.isTraceEnabled()) {
- log.trace("No need to prepare the activation of resource " + resource + " - its component is already started and its plugin "
+ log.trace("No need to prepare the activation of resource " + resource
+ + " - its component is already started and its plugin "
+ "config has not been updated since it was last started.");
}
return false;
@@ -1475,7 +1480,8 @@ public class InventoryManager extends AgentService implements ContainerService,
if (log.isDebugEnabled()) {
log.debug("Preparing component for [" + resource + "] for activation, current state=["
- + container.getResourceComponentState() + "], forcing reinitialization=[" + forceReinitialization + "]...");
+ + container.getResourceComponentState() + "], forcing reinitialization=[" + forceReinitialization
+ + "]...");
}
// If the component does not even exist yet, we need to instantiate it and set it on the container.
@@ -1494,7 +1500,7 @@ public class InventoryManager extends AgentService implements ContainerService,
//this is a transient field, so reinitialize it just in case this is invoked just after
//loadFromDisk()
container.setResourceComponentState(ResourceComponentState.STOPPED);
-
+
// start the resource, but only if its parent component is running. If the parent is null, that means
// the resource is, itself, the root platform and we always activate that.
ResourceContainer parentResourceContainer;
@@ -1524,8 +1530,8 @@ public class InventoryManager extends AgentService implements ContainerService,
log.warn("Cannot give activated resource its discovery component. Cause: " + e);
}
- ConfigurationUtility.normalizeConfiguration(resource.getPluginConfiguration(), type
- .getPluginConfigurationDefinition());
+ ConfigurationUtility.normalizeConfiguration(resource.getPluginConfiguration(),
+ type.getPluginConfigurationDefinition());
ResourceComponent<?> parentComponent = null;
if (resource.getParentResource() != null) {
@@ -1539,13 +1545,14 @@ public class InventoryManager extends AgentService implements ContainerService,
return true;
} else {
if (log.isDebugEnabled()) {
- log.debug("Resource [" + resource + "] not being prepared for activation; parent isn't started: " + parentResourceContainer);
+ log.debug("Resource [" + resource + "] not being prepared for activation; parent isn't started: "
+ + parentResourceContainer);
}
-
+
return false;
}
}
-
+
/**
* This will start the resource's plugin component, creating it first if it has not yet been created. If the
* component is already created and started, this method is a no-op.
@@ -1570,12 +1577,12 @@ public class InventoryManager extends AgentService implements ContainerService,
}
if (prepareResourceForActivation(resource, container, updatedPluginConfig)) {
-
+
ResourceContext context = container.getResourceContext();
-
+
// Wrap the component in a proxy that will provide locking and a timeout for the call to start().
- ResourceComponent component = container.createResourceComponentProxy(ResourceComponent.class, FacetLockType.READ,
- COMPONENT_START_TIMEOUT, true, false);
+ ResourceComponent component = container.createResourceComponentProxy(ResourceComponent.class,
+ FacetLockType.READ, COMPONENT_START_TIMEOUT, true, false);
try {
// One last check to make sure another thread didn't beat us to the punch.
@@ -1613,7 +1620,7 @@ public class InventoryManager extends AgentService implements ContainerService,
}
}
- private <T extends ResourceComponent> ResourceContext<T> createResourceContext(Resource resource,
+ private <T extends ResourceComponent<?>> ResourceContext<T> createResourceContext(Resource resource,
T parentComponent, ResourceDiscoveryComponent<T> discoveryComponent) {
File pluginDataDir = new File(this.configuration.getDataDirectory(), resource.getResourceType().getPlugin());
@@ -1631,7 +1638,7 @@ public class InventoryManager extends AgentService implements ContainerService,
this.configuration.getPluginContainerDeployment()); // helps components make determinations of what to do
}
- public <T extends ResourceComponent> ResourceUpgradeContext<T> createResourceUpgradeContext(Resource resource,
+ public <T extends ResourceComponent<?>> ResourceUpgradeContext<T> createResourceUpgradeContext(Resource resource,
ResourceContext<?> parentResourceContext, T parentComponent, ResourceDiscoveryComponent<T> discoveryComponent) {
File pluginDataDir = new File(this.configuration.getDataDirectory(), resource.getResourceType().getPlugin());
@@ -1662,8 +1669,8 @@ public class InventoryManager extends AgentService implements ContainerService,
resource.setConnected(false); // invalid plugin configuration infers the resource component is disconnected
// Give the server-side an error message describing the connection failure that can be
// displayed on the resource's Inventory page.
- ResourceError resourceError = new ResourceError(resource, ResourceErrorType.INVALID_PLUGIN_CONFIGURATION, t
- .getLocalizedMessage(), ThrowableUtil.getStackAsString(t), System.currentTimeMillis());
+ ResourceError resourceError = new ResourceError(resource, ResourceErrorType.INVALID_PLUGIN_CONFIGURATION,
+ t.getLocalizedMessage(), ThrowableUtil.getStackAsString(t), System.currentTimeMillis());
return sendResourceErrorToServer(resourceError);
}
@@ -1922,8 +1929,7 @@ public class InventoryManager extends AgentService implements ContainerService,
}
} else {
// This is very strange - there are no platform types - we should never be missing the built-in platform plugin.
- log
- .error("Missing platform plugin(s) - falling back to dummy platform impl; this should only occur in tests!");
+ log.error("Missing platform plugin(s) - falling back to dummy platform impl; this should only occur in tests!");
// TODO: Set sysprop (e.g. rhq.test.mode=true) in integration tests,
// and throw a runtime exception here if that sysprop is not set.
return getTestPlatform();
@@ -2133,8 +2139,8 @@ public class InventoryManager extends AgentService implements ContainerService,
log.info("Syncing drift configurations from server with local inventory...");
DriftManager driftMgr = PluginContainer.getInstance().getDriftManager();
if (driftMgr != null && driftMgr.isInitialized()) {
- DriftConfigurationComparator comparator =
- new DriftConfigurationComparator(BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS);
+ DriftConfigurationComparator comparator = new DriftConfigurationComparator(
+ BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS);
ScheduleQueue queue = driftMgr.getSchedulesQueue();
// First check for drift configurations that have been deleted
@@ -2164,8 +2170,8 @@ public class InventoryManager extends AgentService implements ContainerService,
for (DriftConfiguration c : configsFromServer.get(resourceId)) {
if (!queue.contains(resourceId, c, comparator)) {
if (log.isDebugEnabled()) {
- log.debug("Detected new drift configuration. Creating new schedule for " +
- "DriftConfiguration[name: " + c.getName() + ", resourceId: " + resourceId + "]");
+ log.debug("Detected new drift configuration. Creating new schedule for "
+ + "DriftConfiguration[name: " + c.getName() + ", resourceId: " + resourceId + "]");
}
driftMgr.scheduleDriftDetection(resourceId, c);
}
@@ -2190,8 +2196,8 @@ public class InventoryManager extends AgentService implements ContainerService,
for (DriftConfiguration c : container.getDriftConfigurations()) {
if (!resourceConfigs.contains(c)) {
if (log.isDebugEnabled()) {
- log.debug("Detected stale drift configuration. Preparing to delete DriftConfiguration[" +
- "name: " + c.getName() + ", resourceId: " + resourceId + "]");
+ log.debug("Detected stale drift configuration. Preparing to delete DriftConfiguration["
+ + "name: " + c.getName() + ", resourceId: " + resourceId + "]");
}
deleted.add(c);
}
@@ -2394,8 +2400,8 @@ public class InventoryManager extends AgentService implements ContainerService,
try {
ResourceDiscoveryContext context = new ResourceDiscoveryContext(resourceType, parentComponent,
parentResourceContext, SystemInfoFactory.createSystemInfo(), processScanResults,
- Collections.EMPTY_LIST, this.configuration.getContainerName(), this.configuration
- .getPluginContainerDeployment());
+ Collections.EMPTY_LIST, this.configuration.getContainerName(),
+ this.configuration.getPluginContainerDeployment());
newResources = new HashSet<Resource>();
try {
Set<DiscoveredResourceDetails> discoveredResources = invokeDiscoveryComponent(parentContainer,
@@ -2631,8 +2637,8 @@ public class InventoryManager extends AgentService implements ContainerService,
if (log.isDebugEnabled()) {
log.debug("Merging [" + modifiedResourceIds.size() + "] modified Resources into local inventory...");
}
- Set<Resource> modifiedResources = configuration.getServerServices().getDiscoveryServerService().getResources(
- modifiedResourceIds, false);
+ Set<Resource> modifiedResources = configuration.getServerServices().getDiscoveryServerService()
+ .getResources(modifiedResourceIds, false);
syncSchedules(modifiedResources); // RHQ-792, mtime is the indicator that schedules should be sync'ed too
syncDriftConfigurations(modifiedResources);
for (Resource modifiedResource : modifiedResources) {
@@ -2830,7 +2836,7 @@ public class InventoryManager extends AgentService implements ContainerService,
//don't do anything during upgrade. The resources are only started during the upgrade process.
return;
}
-
+
Resource resource = container.getResource();
switch (resource.getInventoryStatus()) {
case COMMITTED: {
@@ -2859,20 +2865,21 @@ public class InventoryManager extends AgentService implements ContainerService,
log.info("Starting resource activation and upgrade.");
long start = System.currentTimeMillis();
-
+
log.info("Executing the initial inventory synchronization before upgrade.");
-
+
boolean syncResult = handleReport(new InventoryReport(getAgent()));
if (!syncResult) {
log.warn("Failed to sync up the inventory with the server. The resource upgrade will be disabled.");
}
log.info("Starting to activate (and upgrade) resources.");
-
+
activateAndUpgradeResourceRecursively(getPlatform(), syncResult);
- log.info("Inventory activated and upgrade requests gathered in " + (System.currentTimeMillis() - start) + "ms.");
-
+ log.info("Inventory activated and upgrade requests gathered in " + (System.currentTimeMillis() - start)
+ + "ms.");
+
log.info("Sending the upgrade requests to the server.");
resourceUpgradeDelegate.sendRequests();
@@ -2880,18 +2887,20 @@ public class InventoryManager extends AgentService implements ContainerService,
log.info("Resource activation and upgrade finished.");
} catch (Throwable t) {
- log.error("Resource activation or upgrade failed with an exception. An attempt to merely activate the resources will be made now.", t);
+ log.error(
+ "Resource activation or upgrade failed with an exception. An attempt to merely activate the resources will be made now.",
+ t);
//make sure to at least activate the resources
activateAndUpgradeResourceRecursively(getPlatform(), false);
}
}
- private void activateAndUpgradeResourceRecursively(Resource resource, boolean doUpgrade) {
+ private void activateAndUpgradeResourceRecursively(Resource resource, boolean doUpgrade) {
ResourceContainer container = initResourceContainer(resource);
-
+
boolean activate = true;
-
+
//only do upgrade inside the agent. it does not make sense in embedded mode.
if (doUpgrade && configuration.isInsideAgent()) {
try {
@@ -2902,7 +2911,7 @@ public class InventoryManager extends AgentService implements ContainerService,
activate = false;
}
}
-
+
if (activate) {
try {
activateResource(resource, container, false);
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
index 6dff613..c32ca97 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
@@ -148,7 +148,7 @@ public class ResourceUpgradeDelegate {
try {
//check the validity of the upgrades now that we have a complete picture
//about the changes and the inventory looks like it was already upgraded.
- for(ResourceUpgradeRequest request : requests) {
+ for (ResourceUpgradeRequest request : requests) {
ResourceContainer container = inventoryManager.getResourceContainer(request.getResourceId());
if (container != null) {
Resource resource = container.getResource();
@@ -158,12 +158,12 @@ public class ResourceUpgradeDelegate {
//in the code below. Let's use the original resource for the error message so that we don't confuse
//the user.
ResourceUpgradeRequest orig = findOriginal(request);
-
+
//orig should never be null, but let's be paranoid
- if (orig != null) {
+ if (orig != null) {
orig.updateResource(resource);
}
-
+
String errorString = "Upgrading the resource [" + resource + "] using these updates ["
+ request + "] would render the inventory invalid because of the following reasons: "
+ upgradeErrors;
@@ -240,7 +240,7 @@ public class ResourceUpgradeDelegate {
}
@SuppressWarnings("unchecked")
- private <T extends ResourceComponent> boolean executeResourceUpgradeFacetAndStoreRequest(
+ private <T extends ResourceComponent<?>> boolean executeResourceUpgradeFacetAndStoreRequest(
ResourceContainer resourceContainer) throws PluginContainerException {
ResourceComponent<T> parentResourceComponent = resourceContainer.getResourceContext()
@@ -318,7 +318,7 @@ public class ResourceUpgradeDelegate {
s.append("After the upgrade, the following resources would have the same resource key which is illegal. This is an issue of either the old or the new version of the plugin '"
+ resource.getResourceType().getPlugin()
+ "'. Please consult the documentation of the plugin to see what are the recommended steps to resolve this situation:\n");
-
+
//ok, this is a little tricky
//this method is called when the inventory is in the state as it would look after a
//successful upgrade.
@@ -330,19 +330,19 @@ public class ResourceUpgradeDelegate {
for (Resource r : duplicitSiblings) {
ResourceUpgradeRequest fakeRequest = new ResourceUpgradeRequest(r.getId());
fakeRequest.fillInFromResource(r);
-
+
ResourceUpgradeRequest orig = findOriginal(fakeRequest);
-
+
//we might not find the original, because this resource might not need an upgrade.
//in that case, the reporting will be accurate because upgrade didn't touch the resource.
if (orig != null) {
orig.updateResource(r);
}
-
+
//now we have the resource as it looked before the upgrade kicked in (which is in this
//case also what it will look like after the upgrade finishes, because we're failing it).
s.append(r).append(",\n");
-
+
//and revert the resource back to what it looked like (i.e. back to the upgraded state so
//that we don't introduce side-effects in this method).
if (orig != null) {
@@ -395,14 +395,14 @@ public class ResourceUpgradeDelegate {
failedResourceTypesInParent.add(resource.getResourceType());
}
-
+
private ResourceUpgradeRequest findOriginal(ResourceUpgradeRequest request) {
- for(ResourceUpgradeRequest original : originalResourceData) {
+ for (ResourceUpgradeRequest original : originalResourceData) {
if (original.equals(request)) {
return original;
}
}
-
+
return null;
}
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/DiscComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/DiscComponent.java
index 75bfbd7..65890c2 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/DiscComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/DiscComponent.java
@@ -37,16 +37,16 @@ import org.rhq.core.pluginapi.upgrade.ResourceUpgradeFacet;
*
* @author Lukas Krejci
*/
-public class DiscComponent implements ResourceDiscoveryComponent<ResourceComponent>,
- ResourceUpgradeFacet<ResourceComponent> {
-
+public class DiscComponent<T extends ResourceComponent<?>> implements ResourceDiscoveryComponent<T>,
+ ResourceUpgradeFacet<T> {
+
private static final String RESOURCE_KEY = "resource-key-failing";
private static final String RESOURCE_NAME = "resource-name-failing";
private static final String RESOURCE_DESCRIPTION = "resource-description-failing";
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent> context)
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
throws InvalidPluginConfigurationException, Exception {
-
+
//create a marker file so that the testing code knows this method has run
File dataDir = context.getParentResourceContext().getDataDirectory();
if (dataDir != null) {
@@ -59,12 +59,12 @@ public class DiscComponent implements ResourceDiscoveryComponent<ResourceCompone
} catch (IOException e) {
}
}
-
+
return Collections.singleton(new DiscoveredResourceDetails(context.getResourceType(), RESOURCE_KEY,
RESOURCE_NAME, null, RESOURCE_DESCRIPTION, context.getDefaultPluginConfiguration(), null));
}
- public ResourceUpgradeReport upgrade(ResourceUpgradeContext<ResourceComponent> inventoriedResource) {
+ public ResourceUpgradeReport upgrade(ResourceUpgradeContext<T> inventoriedResource) {
throw new RuntimeException("Failing the upgrade purposefully.");
}
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/ResComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/ResComponent.java
index 4c33adc..7df5729 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/ResComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/failing/ResComponent.java
@@ -21,6 +21,7 @@ package org.rhq.core.pc.upgrade.plugins.failing;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
@@ -30,17 +31,18 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
*
* @author Lukas Krejci
*/
-public class ResComponent implements ResourceComponent<ResourceComponent> {
+public class ResComponent<T extends ResourceComponent<?>> implements ResourceComponent<T> {
private static final Log log = LogFactory.getLog(ResComponent.class);
-
+
public AvailabilityType getAvailability() {
return AvailabilityType.UP;
}
-
- public void start(ResourceContext<ResourceComponent> context) throws InvalidPluginConfigurationException, Exception {
- log.info("~~~ starting the resource upgrade test failing component with resource key: " + context.getResourceKey());
+
+ public void start(ResourceContext<T> context) throws InvalidPluginConfigurationException, Exception {
+ log.info("~~~ starting the resource upgrade test failing component with resource key: "
+ + context.getResourceKey());
}
-
+
public void stop() {
}
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseDiscoveryComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseDiscoveryComponent.java
index a03dff5..ae5dcbd 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseDiscoveryComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseDiscoveryComponent.java
@@ -34,7 +34,7 @@ import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
*
* @author Lukas Krejci
*/
-public class BaseDiscoveryComponent<T extends ResourceComponent> implements ResourceDiscoveryComponent<T> {
+public class BaseDiscoveryComponent<T extends ResourceComponent<?>> implements ResourceDiscoveryComponent<T> {
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
throws InvalidPluginConfigurationException, Exception {
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseResourceComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseResourceComponent.java
index 04d3767..5b40d2c 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseResourceComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseResourceComponent.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
@@ -40,11 +41,12 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
*
* @author Lukas Krejci
*/
-public class BaseResourceComponent<T extends ResourceComponent> implements ResourceComponent<T>, BaseResourceComponentInterface {
+public class BaseResourceComponent<T extends ResourceComponent<?>> implements ResourceComponent<T>,
+ BaseResourceComponentInterface {
private ResourceContext<T> context;
private final Log log = LogFactory.getLog(getClass());
-
+
public AvailabilityType getAvailability() {
return AvailabilityType.UP;
}
@@ -53,7 +55,7 @@ public class BaseResourceComponent<T extends ResourceComponent> implements Resou
log.info("Starting multi resource child component with resource key '" + context.getResourceKey() + "'.");
this.context = context;
}
-
+
public void stop() {
log.info("Stopping multi resource child component with resource key '" + context.getResourceKey() + "'.");
}
@@ -61,58 +63,58 @@ public class BaseResourceComponent<T extends ResourceComponent> implements Resou
public int getOrdinal() {
return context.getPluginConfiguration().getSimple("ordinal").getIntegerValue();
}
-
+
public Map<String, Set<Integer>> getChildrenToFailUpgrade() {
-
+
Map<String, Set<Integer>> ret = new HashMap<String, Set<Integer>>();
-
+
Configuration pluginConfig = context.getPluginConfiguration();
PropertyList childrenToFail = pluginConfig.getList("childrenToFail");
-
+
if (childrenToFail != null) {
- for(Property p : childrenToFail.getList()) {
+ for (Property p : childrenToFail.getList()) {
PropertyMap entry = (PropertyMap) p;
-
+
String type = entry.getSimpleValue("type", null);
-
+
PropertyList typeList = entry.getList("children");
-
+
if (type != null && typeList != null) {
Set<Integer> ordinals = new HashSet<Integer>();
-
- for(Property pp : typeList.getList()) {
- ordinals.add(((PropertySimple)pp).getIntegerValue());
+
+ for (Property pp : typeList.getList()) {
+ ordinals.add(((PropertySimple) pp).getIntegerValue());
}
-
+
ret.put(type, ordinals);
}
}
}
-
+
return ret;
}
-
+
public Configuration createPluginConfigurationWithMarkedFailures(Map<String, Set<Integer>> childrenToFailUpgrade) {
Configuration ret = context.getPluginConfiguration().clone();
PropertyList list = new PropertyList("childrenToFail");
-
- for(Map.Entry<String, Set<Integer>> entry : childrenToFailUpgrade.entrySet()) {
+
+ for (Map.Entry<String, Set<Integer>> entry : childrenToFailUpgrade.entrySet()) {
PropertyMap configEntry = new PropertyMap("childrenInType");
configEntry.put(new PropertySimple("type", entry.getKey()));
-
+
PropertyList typeList = new PropertyList("children");
-
- for(Integer childOrdinal : entry.getValue()) {
+
+ for (Integer childOrdinal : entry.getValue()) {
typeList.add(new PropertySimple("ordinal", childOrdinal));
}
-
+
configEntry.put(typeList);
-
+
list.add(configEntry);
}
-
+
ret.put(list);
-
+
return ret;
}
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseUpgradingDiscoveryComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseUpgradingDiscoveryComponent.java
index a1acf50..d76328f 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseUpgradingDiscoveryComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/BaseUpgradingDiscoveryComponent.java
@@ -30,7 +30,7 @@ import org.rhq.core.pluginapi.upgrade.ResourceUpgradeFacet;
*
* @author Lukas Krejci
*/
-public class BaseUpgradingDiscoveryComponent<T extends BaseResourceComponent> extends BaseDiscoveryComponent<T>
+public class BaseUpgradingDiscoveryComponent<T extends BaseResourceComponent<?>> extends BaseDiscoveryComponent<T>
implements ResourceUpgradeFacet<T> {
public ResourceUpgradeReport upgrade(ResourceUpgradeContext<T> inventoriedResource) {
@@ -45,16 +45,16 @@ public class BaseUpgradingDiscoveryComponent<T extends BaseResourceComponent> ex
if (!fail && parent != null) {
String typeName = inventoriedResource.getResourceType().getName();
Set<Integer> failingOrdinals = parent.getChildrenToFailUpgrade().get(typeName);
-
+
fail = failingOrdinals != null && failingOrdinals.contains(Integer.valueOf(ordinal));
}
if (fail) {
throw new RuntimeException("Failing the resource upgrade purposefully.");
}
-
+
boolean checkParentUpgraded = Boolean.parseBoolean(pluginConfig.getSimpleValue("checkParentUpgraded", "false"));
-
+
if (checkParentUpgraded) {
if (!inventoriedResource.getParentResourceContext().getResourceKey().startsWith("UPGRADED")) {
throw new RuntimeException("The parent resource ["
@@ -62,7 +62,7 @@ public class BaseUpgradingDiscoveryComponent<T extends BaseResourceComponent> ex
+ "] doesn't seem like it's upgraded but this resource expects it to be.");
}
}
-
+
String newKey = pluginConfig.getSimpleValue("upgradedKey", null);
if (newKey == null) {
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/NothingDiscoveringDiscoveryComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/NothingDiscoveringDiscoveryComponent.java
index b6189e5..a706246 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/NothingDiscoveringDiscoveryComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/multi/base/NothingDiscoveringDiscoveryComponent.java
@@ -32,7 +32,8 @@ import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
*
* @author Lukas Krejci
*/
-public class NothingDiscoveringDiscoveryComponent<T extends ResourceComponent> implements ResourceDiscoveryComponent<T> {
+public class NothingDiscoveringDiscoveryComponent<T extends ResourceComponent<?>> implements
+ ResourceDiscoveryComponent<T> {
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
throws InvalidPluginConfigurationException, Exception {
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/DiscComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/DiscComponent.java
index 5fbca32..7b6bcc7 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/DiscComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/DiscComponent.java
@@ -9,12 +9,12 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-public class DiscComponent implements ResourceDiscoveryComponent<ResourceComponent> {
+public class DiscComponent<T extends ResourceComponent<?>> implements ResourceDiscoveryComponent<T> {
private static final String RESOURCE_KEY = "resource-key-v1";
private static final String RESOURCE_NAME = "resource-name-v1";
private static final String RESOURCE_DESCRIPTION = "resource-description-v1";
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent> context)
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
throws InvalidPluginConfigurationException, Exception {
return Collections.singleton(new DiscoveredResourceDetails(context.getResourceType(), RESOURCE_KEY,
RESOURCE_NAME, null, RESOURCE_DESCRIPTION, context.getDefaultPluginConfiguration(), null));
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/ResComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/ResComponent.java
index cc21fc3..e336987 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/ResComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v1/ResComponent.java
@@ -6,12 +6,12 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
-public class ResComponent implements ResourceComponent<ResourceComponent> {
+public class ResComponent<T extends ResourceComponent<?>> implements ResourceComponent<T> {
public AvailabilityType getAvailability() {
return AvailabilityType.UP;
}
- public void start(ResourceContext<ResourceComponent> context) {
+ public void start(ResourceContext<T> context) {
LogFactory.getLog(this.getClass()).info(
"~~~ Starting resource upgrade test plugin v1 component: key=" + context.getResourceKey());
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/DiscComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/DiscComponent.java
index d113d1c..d6ca18f 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/DiscComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/DiscComponent.java
@@ -14,20 +14,20 @@ import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
import org.rhq.core.pluginapi.upgrade.ResourceUpgradeContext;
import org.rhq.core.pluginapi.upgrade.ResourceUpgradeFacet;
-public class DiscComponent implements ResourceDiscoveryComponent<ResourceComponent>,
- ResourceUpgradeFacet<ResourceComponent> {
+public class DiscComponent<T extends ResourceComponent<?>> implements ResourceDiscoveryComponent<T>,
+ ResourceUpgradeFacet<T> {
private static final String V1_RESOURCE_KEY = "resource-key-v1";
private static final String RESOURCE_KEY = "resource-key-v2";
private static final String RESOURCE_NAME = "resource-name-v2";
private static final String RESOURCE_DESCRIPTION = "resource-description-v2";
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent> context)
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
throws InvalidPluginConfigurationException, Exception {
return Collections.singleton(new DiscoveredResourceDetails(context.getResourceType(), RESOURCE_KEY,
RESOURCE_NAME, null, RESOURCE_DESCRIPTION, context.getDefaultPluginConfiguration(), null));
}
- public ResourceUpgradeReport upgrade(ResourceUpgradeContext<ResourceComponent> inventoriedResource) {
+ public ResourceUpgradeReport upgrade(ResourceUpgradeContext<T> inventoriedResource) {
if (V1_RESOURCE_KEY.equals(inventoriedResource.getResourceKey())) {
ResourceUpgradeReport report = new ResourceUpgradeReport();
report.setNewResourceKey(RESOURCE_KEY);
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/ResComponent.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/ResComponent.java
index 83144b2..2d31236 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/ResComponent.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/plugins/v2/ResComponent.java
@@ -6,12 +6,12 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
-public class ResComponent implements ResourceComponent<ResourceComponent> {
+public class ResComponent<T extends ResourceComponent<?>> implements ResourceComponent<T> {
public AvailabilityType getAvailability() {
return AvailabilityType.UP;
}
- public void start(ResourceContext<ResourceComponent> context) {
+ public void start(ResourceContext<T> context) {
LogFactory.getLog(this.getClass()).info(
"~~~ Starting resource upgrade test plugin v2 component: key=" + context.getResourceKey());
}
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXComponent.java
index e7b1164..d5f08a8 100644
--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXComponent.java
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXComponent.java
@@ -32,7 +32,7 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent;
*
* @author Greg Hinkle
*/
-public interface JMXComponent<T extends ResourceComponent> extends ResourceComponent<T> {
+public interface JMXComponent<T extends ResourceComponent<?>> extends ResourceComponent<T> {
public static final String PRINCIPAL_CONFIG_PROP = "principal";
public static final String CREDENTIALS_CONFIG_PROP = "credentials";
12 years, 9 months
[rhq] Branch 'as7plugin' - modules/plugins
by Simeon Pinder
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 8 ++++----
modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
New commits:
commit cdd920a1afa94855a898e0b33e20856ee118a46f
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 13 08:54:33 2011 -0400
BZ:733019: changed i)plugin display name to be more consistent with AS4 and AS5
ii)renamed HostController to better show relevance to AS7 inleft navigation tree.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index a14b896..bd7e01d 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -42,7 +42,7 @@
]>
<plugin name="jboss-as-7"
- displayName="JBoss-AS-7-Plugin"
+ displayName="JBoss Application Server 7.x"
description="Management of JBossAS 7"
package="org.rhq.modules.plugins.jbossas7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -75,7 +75,7 @@
</server>
-->
- <server name="HostController"
+ <server name="JBossAS7 Host Controller"
discovery="BaseProcessDiscovery"
class="HostControllerComponent"
description="Domain controller (delegate) for this host"
@@ -2012,7 +2012,7 @@ working area for individual server instances</li></ul>"/>
description="A named network interface, along with required criteria for determining the IP address to associate with that interface">
<runs-inside>
- <parent-resource-type name="HostController" plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Host Controller" plugin="jboss-as-7"/>
<parent-resource-type name="Host" plugin="jboss-as-7"/>
<parent-resource-type name="JBossAS7-Standalone" plugin="jboss-as-7"/>
</runs-inside>
@@ -2071,7 +2071,7 @@ working area for individual server instances</li></ul>"/>
class="BaseComponent"
>
<runs-inside>
- <parent-resource-type name="HostController" plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Host Controller" plugin="jboss-as-7"/>
</runs-inside>
diff --git a/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml b/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml
index 42ff024..69201e2 100644
--- a/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml
@@ -1,5 +1,5 @@
<plugin name="jboss-as-7"
- displayName="JBoss-AS-7-Plugin"
+ displayName="JBoss Application Server 7.x"
description="Management of JBossAS 7"
package="org.rhq.modules.plugins.jbossas7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12 years, 9 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java | 30 ++++++++++
1 file changed, 30 insertions(+)
New commits:
commit 78bff76c5e5a860d5ba1e6c8abc169d8a87f3c0c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 14 14:45:09 2011 -0400
make sure we show the proper values in the alert conditions, formatted based on their units.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
index b5a41a1..92913f9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
@@ -42,6 +42,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.Criteria;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.alert.AlertFormatUtility;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
@@ -84,6 +85,23 @@ public class ConditionsEditor extends LocatableVLayout {
public void setConditions(Set<AlertCondition> set) {
conditions = new HashSet<AlertCondition>(); // make our own copy
if (set != null) {
+
+ // we need to make sure we have the full measurement definition, including the units.
+ // this is so we can display the condition values with the proper units. If an alert
+ // condition is a measurement condition, but the measurement definition isn't the full
+ // definition, look up the full definition from the resource type and use it.
+ for (AlertCondition alertCondition : set) {
+ MeasurementDefinition measDef = alertCondition.getMeasurementDefinition();
+ if (measDef != null) {
+ if (measDef.getUnits() == null) {
+ MeasurementDefinition fullMeasDef = findMeasurementDefinition(measDef.getId());
+ if (fullMeasDef != null) {
+ alertCondition.setMeasurementDefinition(fullMeasDef);
+ }
+ }
+ }
+ }
+
conditions.addAll(set);
}
if (table != null) {
@@ -91,6 +109,18 @@ public class ConditionsEditor extends LocatableVLayout {
}
}
+ private MeasurementDefinition findMeasurementDefinition(int measurementDefinitionId) {
+ Set<MeasurementDefinition> measDefs = this.resourceType.getMetricDefinitions();
+ if (measDefs != null) {
+ for (MeasurementDefinition measDef : measDefs) {
+ if (measDef.getId() == measurementDefinitionId) {
+ return measDef;
+ }
+ }
+ }
+ return null;
+ }
+
@Override
protected void onInit() {
super.onInit();
12 years, 9 months
[rhq] modules/core
by John Sanda
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java | 8 +++++
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java | 10 +++++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 14 ++++++----
3 files changed, 24 insertions(+), 8 deletions(-)
New commits:
commit 76a98c3c950f1cda16209e59466403284b4fc736
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 14 14:21:35 2011 -0400
Adding more logging around drift detection and inventory sync
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
index 210fb78..6bad1b1 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
@@ -69,7 +69,12 @@ public class DriftDetector implements Runnable {
@Override
public void run() {
+ log.debug("Starting drift detection..");
+ long startTime = System.currentTimeMillis();
try {
+ if (log.isDebugEnabled()) {
+ log.debug("Fetching next schedule from " + scheduleQueue);
+ }
DriftDetectionSchedule schedule = scheduleQueue.getNextSchedule();
if (schedule == null) {
@@ -78,7 +83,6 @@ public class DriftDetector implements Runnable {
}
if (log.isDebugEnabled()) {
- log.debug("Preparing to run drift detection for the next schedule in " + scheduleQueue);
log.debug("Processing " + schedule);
}
@@ -121,6 +125,8 @@ public class DriftDetector implements Runnable {
} finally {
try {
scheduleQueue.deactivateSchedule();
+ long endTime = System.currentTimeMillis();
+ log.debug("Finished drift detection in " + (endTime - startTime) + " ms");
} catch (Throwable t) {
Throwable cause = t.getCause();
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index 3ee0b7d..56e66f3 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -126,7 +126,7 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
private void initSchedules(Resource r, InventoryManager inventoryMgr) {
if (r.getId() == 0) {
- log.debug("Will not reschedule drift detection schedules for " + r + ". It is not sync'ed yet.");
+ log.debug("Will not reschedule drift detection for " + r + ". It is not sync'ed yet.");
return;
}
@@ -136,7 +136,7 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
return;
}
- log.debug("Rescheduling drift detection schedules for " + r);
+ log.debug("Rescheduling drift detection for " + r);
for (DriftConfiguration c : container.getDriftConfigurations()) {
try {
syncWithServer(r, c);
@@ -166,9 +166,15 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
// drift configuration while the agent is offline for example. At
// this point we just return and allow the agent to generate the
// initial snapshot file.
+ if (log.isDebugEnabled()) {
+ log.debug("The server does not have any change sets for " + toString(resource, configuration) +
+ ". An initial snapshot needs to be generated.");
+ }
return;
}
+ log.info("Preparing to write snapshot at version " + snapshot.getVersion() + " to disk for " +
+ toString(resource, configuration));
ChangeSetWriter writer = changeSetMgr.getChangeSetWriter(resource.getId(), headers);
for (Drift drift : snapshot.getEntries()) {
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 5f04fe5..fe15bb5 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
@@ -2130,6 +2130,7 @@ public class InventoryManager extends AgentService implements ContainerService,
}
private void installDriftConfigurations(Map<Integer, List<DriftConfiguration>> configsFromServer) {
+ log.info("Syncing drift configurations from server with local inventory...");
DriftManager driftMgr = PluginContainer.getInstance().getDriftManager();
if (driftMgr != null && driftMgr.isInitialized()) {
DriftConfigurationComparator comparator =
@@ -2137,6 +2138,7 @@ public class InventoryManager extends AgentService implements ContainerService,
ScheduleQueue queue = driftMgr.getSchedulesQueue();
// First check for drift configurations that have been deleted
+ log.info("Checking for drift configurations that have been deleted on the server");
for (Integer resourceId : configsFromServer.keySet()) {
Set<DriftConfiguration> configsFromServerSet = new TreeSet<DriftConfiguration>(comparator);
configsFromServerSet.addAll(configsFromServer.get(resourceId));
@@ -2157,6 +2159,7 @@ public class InventoryManager extends AgentService implements ContainerService,
}
// add new drift configurations received from the server
+ log.info("Checking for new drift configurations");
for (Integer resourceId : configsFromServer.keySet()) {
for (DriftConfiguration c : configsFromServer.get(resourceId)) {
if (!queue.contains(resourceId, c, comparator)) {
@@ -2169,7 +2172,8 @@ public class InventoryManager extends AgentService implements ContainerService,
}
}
} else {
- log.info("DriftManager is not available. Drift configurations will be persisted but not scheduled.");
+ log.info("DriftManager is not available. Drift configurations will be persisted but detection will not " +
+ "be scheduled.");
// First check for drift configurations that have been deleted
log.debug("Checking for stale drift configurations that need to be purged from inventory");
@@ -2197,6 +2201,7 @@ public class InventoryManager extends AgentService implements ContainerService,
container.removeDriftConfiguration(c);
File changeSetDir = new File(resourceDir, c.getName());
if (changeSetDir.exists()) {
+ log.debug("Purging " + changeSetDir.getPath());
purge(changeSetDir, true);
}
}
@@ -2204,15 +2209,14 @@ public class InventoryManager extends AgentService implements ContainerService,
// Now add any any drift configurations received from the server. These
// could be new or updated configurations.
- log.debug("Checking for new or updated drift configurations");
+ log.debug("Checking for new drift configurations");
for (Integer resourceId : configsFromServer.keySet()) {
ResourceContainer container = getResourceContainer(resourceId);
for (DriftConfiguration c : configsFromServer.get(resourceId)) {
if (log.isDebugEnabled()) {
- log.debug("Adding or updating DriftConfiguration[name: " + c.getName() + ", resourceId: " +
- resourceId + "]");
+ log.debug("Adding DriftConfiguration[name: " + c.getName() + ", resourceId: " + resourceId +
+ "]");
}
- // TODO does this handle renamed configs?
container.addDriftConfiguration(c);
}
}
12 years, 9 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java | 1 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java | 1 +
2 files changed, 2 insertions(+)
New commits:
commit d012274e9e688c2484a5f0196a5a55a08ef59056
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 14 13:44:44 2011 -0400
remove the Refresh button since there is nothing to refresh (the table is always fully populated)
and when you click Refresh, it gets disabled and never re-enables.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 03484a4..966b14e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -334,6 +334,7 @@ public class BundleDeploymentView extends LocatableVLayout implements Bookmarkab
@SuppressWarnings("unchecked")
private Table addMemberDeploymentsTable() {
Table table = new Table(extendLocatorId("Deployments"), MSG.view_bundle_deploy_deploymentPlatforms());
+ table.setShowFooterRefresh(false);
table.setTitleComponent(new HTMLFlow(MSG.view_bundle_deploy_selectARow()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
index 5b33200..5afe667 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
@@ -63,6 +63,7 @@ public class FileListView extends LocatableVLayout {
private void viewFiles(PageList<BundleFile> files) {
Table table = new Table(extendLocatorId("BundleFiles"), MSG.view_bundle_bundleFiles());
+ table.setShowFooterRefresh(false);
ListGridField id = new ListGridField(ID, MSG.common_title_id());
ListGridField name = new ListGridField(NAME, MSG.common_title_name());
12 years, 9 months
[rhq] 2 commits - .classpath modules/core
by mazz
.classpath | 2 +-
modules/core/plugindoc/pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 54dff23edceba487daa2da3868917ad4901080e5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 14 12:32:36 2011 -0400
fix version in pom
diff --git a/modules/core/plugindoc/pom.xml b/modules/core/plugindoc/pom.xml
index 8364995..5586534 100644
--- a/modules/core/plugindoc/pom.xml
+++ b/modules/core/plugindoc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.1.1-BETA1</version>
+ <version>4.1.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
commit 767438de0ce97f10adae37afe99b5e7fccecf24a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 14 12:32:27 2011 -0400
upgrade ems version in eclipse classpath
diff --git a/.classpath b/.classpath
index 93a80cc..36d4e8c 100644
--- a/.classpath
+++ b/.classpath
@@ -56,7 +56,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.15.1/org-mc4j-ems-1.2.15.1.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.15.1/org-mc4j-ems-1.2.15.1-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.16/org-mc4j-ems-1.2.16.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.16/org-mc4j-ems-1.2.16-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar" sourcepath="/M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4.2/mail-1.4.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/>
12 years, 9 months
[rhq] modules/core
by John Sanda
modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftSnapshot.java | 10
modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftSnapshotTest.java | 403 ++++++++++
modules/core/domain/src/test/java/org/rhq/core/domain/drift/SnapshotTest.java | 403 ----------
modules/core/plugin-container/mvn.out | 96 ++
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java | 12
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 8
6 files changed, 525 insertions(+), 407 deletions(-)
New commits:
commit dc9776dc3ac82bd8232f01a8b2d9ec1f7b83bbd7
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 14 12:07:55 2011 -0400
Do not purge change set directories for configs that have not been deleted
Prior to this commit, DriftManager was incorrectly purging change set
directories at start up. This resulted in a new coverage change set
being generated. Now at start up and during inventory sync, when we
detect that a config has been deleted and only when it has been deleted,
we purge its change set directory. There are a couple reasons we purge
those directories. First, we do not want to clutter up the managed
system with old, unused change set data. Secondly, and more importantly,
the deletion has to be done to support renamed configs. A user can
delete a config, and the create a new one with the same name. This might
happen when changing filters for instance. Even though the configs have
the same names, they are different, and the new config cannot use the
old change set data.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftSnapshot.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftSnapshot.java
index 58a11c7..e5b1835 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftSnapshot.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftSnapshot.java
@@ -18,13 +18,13 @@
*/
package org.rhq.core.domain.drift;
-import static org.rhq.core.domain.drift.DriftCategory.FILE_REMOVED;
-
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
+import static org.rhq.core.domain.drift.DriftCategory.FILE_REMOVED;
+
/**
* A representation of an agent's drift file monitoring.
*
@@ -34,7 +34,11 @@ public class DriftSnapshot implements Serializable {
private static final long serialVersionUID = 1L;
- private int version;
+ /**
+ * The version is initially -1 which indicates that there are no
+ * change sets as opposed to an empty change set.
+ */
+ private int version = -1;
private Map<String, Drift<?, ?>> entries = new TreeMap<String, Drift<?, ?>>();
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftSnapshotTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftSnapshotTest.java
new file mode 100644
index 0000000..97f7faa
--- /dev/null
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftSnapshotTest.java
@@ -0,0 +1,403 @@
+package org.rhq.core.domain.drift;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
+
+import static java.util.Arrays.asList;
+import static org.rhq.core.domain.drift.DriftCategory.FILE_ADDED;
+import static org.rhq.core.domain.drift.DriftCategory.FILE_CHANGED;
+import static org.rhq.core.domain.drift.DriftCategory.FILE_REMOVED;
+import static org.rhq.core.domain.drift.DriftChangeSetCategory.COVERAGE;
+import static org.rhq.core.domain.drift.DriftChangeSetCategory.DRIFT;
+import static org.rhq.core.domain.drift.DriftFileStatus.LOADED;
+import static org.rhq.test.AssertUtils.assertCollectionMatchesNoOrder;
+import static org.testng.Assert.assertEquals;
+
+@SuppressWarnings("unchecked")
+public class DriftSnapshotTest {
+
+ @Test
+ public void addChangeSetWithAddedFile() {
+ int configId = 1;
+
+ FakeDriftChangeSet changeSet = new FakeDriftChangeSet(0, COVERAGE, configId).add(new FakeDrift(FILE_ADDED,
+ null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt"));
+
+ DriftSnapshot snapshot = new DriftSnapshot().add(changeSet);
+
+ assertCollectionMatchesNoOrder(changeSet.getDrifts(), snapshot.getEntries(), "Failed to build "
+ + "a snapshot that contains a single change set");
+ assertEquals(snapshot.getVersion(), changeSet.getVersion(), "Snapshot version is wrong");
+ }
+
+ @Test
+ public void addChangeSetsWithAddedFiles() {
+ int configId = 1;
+
+ Drift<?, ?> entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
+ FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
+
+ Drift<?, ?> entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("4a5b6c", 1024, LOADED), "/drift/2.txt");
+ FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry2);
+
+ DriftSnapshot snapshot = new DriftSnapshot().add(changeSet1).add(changeSet2);
+
+ // not sure but asSet with one arg was not working for me, so create Set manually
+ Set set = new HashSet<Drift<?, ?>>();
+ set.add(entry1);
+ set.add(entry2);
+ assertCollectionMatchesNoOrder(set, snapshot.getEntries(), "Failed to build snapshot "
+ + "with two change sets and file added in second change set");
+ assertEquals(snapshot.getVersion(), changeSet2.getVersion(), "Snapshot version is wrong");
+ }
+
+ @Test
+ public void replaceFileWithChangedVersion() {
+ int configId = 1;
+
+ Drift<?, ?> entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
+ FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
+
+ Drift<?, ?> entry2 = new FakeDrift(FILE_CHANGED, new FakeDriftFile("a1b2c3", 1024, LOADED), new FakeDriftFile(
+ "4d5e6f", 1024, LOADED), "/drift/1.txt");
+ FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry2);
+
+ DriftSnapshot snapshot = new DriftSnapshot().add(changeSet1).add(changeSet2);
+
+ // not sure but asSet with one arg was not working for me, so create Set manually
+ Set set = new HashSet<Drift<?, ?>>();
+ set.add(entry2);
+ assertCollectionMatchesNoOrder(set, snapshot.getEntries(), "Failed to build snapshot with file changed");
+ }
+
+ @Test
+ public void deleteFileThatHasBeenRemoved() {
+ int configId = 1;
+
+ Drift<?, ?> entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
+ Drift<?, ?> entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("d1f2a3", 1024, LOADED), "/drift/2.txt");
+ FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1).add(entry2);
+
+ Drift entry3 = new FakeDrift(FILE_REMOVED, new FakeDriftFile("a1b2c3", 1024, LOADED), null, "/drift/1.txt");
+ FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry3);
+
+ DriftSnapshot snapshot = new DriftSnapshot().add(changeSet1).add(changeSet2);
+
+ // not sure but asSet with one arg was not working for me, so create Set manually
+ Set set = new HashSet<Drift<?, ?>>();
+ set.add(entry2);
+ assertCollectionMatchesNoOrder(set, snapshot.getEntries(), "Failed to build snapshot with a file " + "removed.");
+ }
+
+ @Test
+ public void diffShowsEntriesInLeftAndNotInRight() {
+ int configId = 1;
+
+ Drift entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
+ FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
+ DriftSnapshot right = new DriftSnapshot().add(changeSet1);
+
+ Drift entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a3b6c9", 1024, LOADED), "/drift/2.txt");
+ FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1).add(entry2);
+ DriftSnapshot left = new DriftSnapshot().add(changeSet1).add(changeSet2);
+
+ DriftDiffReport diff = left.diff(right);
+
+ assertCollectionMatchesNoOrder(asList(entry2), diff.getElementsNotInRight(), "Diff report does not contain "
+ + "elements that are in the left but not in the right.");
+ }
+
+ @Test
+ public void diffShowsEntriesInRightAndNotInLeft() {
+ int configId = 1;
+
+ Drift entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
+ FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
+ DriftSnapshot right = new DriftSnapshot().add(changeSet1);
+
+ Drift entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a3b6c9", 1024, LOADED), "/drift/2.txt");
+ FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry2);
+ DriftSnapshot left = new DriftSnapshot().add(changeSet2);
+
+ DriftDiffReport diff = left.diff(right);
+
+ assertCollectionMatchesNoOrder(asList(entry1), diff.getElementsNotInLeft(), "Diff report does not contain "
+ + "elements that are in the left but not in the right");
+ }
+
+ @Test
+ public void diffShowsEntriesInLeftAndRightThatAreInConflict() {
+ int configId = 1;
+
+ Drift entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drfit/1.txt");
+ FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
+ DriftSnapshot right = new DriftSnapshot().add(changeSet1);
+
+ Drift entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("c3b2a1", 1024, LOADED), "/drfit/1.txt");
+ FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry2);
+ DriftSnapshot left = new DriftSnapshot().add(changeSet2);
+
+ DriftDiffReport diff = left.diff(right);
+
+ assertCollectionMatchesNoOrder(asList(entry2), diff.getElementsInConflict(), "Diff report does not contain "
+ + "element that are in both left and right and are in conflict");
+ }
+
+ <E> Set<E> asSet(E... elements) {
+ HashSet<E> set = new HashSet<E>();
+ for (E element : elements) {
+ set.add(element);
+ }
+ return set;
+ }
+
+ static class FakeDriftChangeSet implements DriftChangeSet {
+
+ private String id;
+ private int version;
+ private DriftChangeSetCategory category;
+ private int configId;
+ private DriftHandlingMode mode = DriftHandlingMode.normal;
+ private Set<Drift> drifts = new HashSet<Drift>();
+ private long ctime = System.currentTimeMillis();
+
+ public FakeDriftChangeSet() {
+ }
+
+ public FakeDriftChangeSet(int version, DriftChangeSetCategory category, int configId) {
+ this.version = version;
+ this.category = category;
+ this.configId = configId;
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Long getCtime() {
+ return ctime;
+ }
+
+ @Override
+ public int getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ @Override
+ public DriftChangeSetCategory getCategory() {
+ return category;
+ }
+
+ @Override
+ public void setCategory(DriftChangeSetCategory category) {
+ this.category = category;
+ }
+
+ @Override
+ public int getDriftConfigurationId() {
+ return configId;
+ }
+
+ @Override
+ public void setDriftConfigurationId(int id) {
+ configId = id;
+ }
+
+ @Override
+ public int getResourceId() {
+ return 0;
+ }
+
+ @Override
+ public Set getDrifts() {
+ return drifts;
+ }
+
+ @Override
+ public void setDrifts(Set drifts) {
+ this.drifts = drifts;
+ }
+
+ public FakeDriftChangeSet add(Drift drift) {
+ drifts.add(drift);
+ return this;
+ }
+
+ @Override
+ public DriftHandlingMode getDriftHandlingMode() {
+ return this.mode;
+ }
+
+ @Override
+ public void setDriftHandlingMode(DriftHandlingMode mode) {
+ this.mode = mode;
+ }
+ }
+
+ static class FakeDrift implements Drift {
+
+ private String id;
+ private DriftCategory category;
+ private String path;
+ private DriftFile oldFile;
+ private DriftFile newFile;
+ private long ctime = System.currentTimeMillis();
+
+ public FakeDrift() {
+ }
+
+ public FakeDrift(DriftCategory category, DriftFile oldFile, DriftFile newFile, String path) {
+ this.category = category;
+ this.oldFile = oldFile;
+ this.newFile = newFile;
+ this.path = path;
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Long getCtime() {
+ return ctime;
+ }
+
+ @Override
+ public DriftChangeSet getChangeSet() {
+ return null;
+ }
+
+ @Override
+ public void setChangeSet(DriftChangeSet changeSet) {
+
+ }
+
+ @Override
+ public DriftCategory getCategory() {
+ return category;
+ }
+
+ @Override
+ public void setCategory(DriftCategory category) {
+ this.category = category;
+ }
+
+ @Override
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public DriftFile getOldDriftFile() {
+ return oldFile;
+ }
+
+ @Override
+ public void setOldDriftFile(DriftFile oldDriftFile) {
+ this.oldFile = oldDriftFile;
+ }
+
+ @Override
+ public DriftFile getNewDriftFile() {
+ return newFile;
+ }
+
+ @Override
+ public void setNewDriftFile(DriftFile newDriftFile) {
+ newFile = newDriftFile;
+ }
+
+ @Override
+ public String toString() {
+ return "Drift[category: " + category.code() + ", oldFile: " + oldFile + ", newFile: " + newFile
+ + ", path: " + path + "]";
+ }
+ }
+
+ static class FakeDriftFile implements Serializable, DriftFile {
+
+ private static final long serialVersionUID = 1L;
+ private String hash;
+ private long size;
+ private DriftFileStatus status;
+ private long ctime = System.currentTimeMillis();
+
+ public FakeDriftFile() {
+ }
+
+ public FakeDriftFile(String hash, long size, DriftFileStatus status) {
+ this.hash = hash;
+ this.size = size;
+ this.status = status;
+ }
+
+ @Override
+ public String getHashId() {
+ return hash;
+ }
+
+ @Override
+ public void setHashId(String hashId) {
+ hash = hashId;
+ }
+
+ @Override
+ public Long getCtime() {
+ return ctime;
+ }
+
+ @Override
+ public Long getDataSize() {
+ return size;
+ }
+
+ @Override
+ public void setDataSize(Long size) {
+ this.size = size;
+ }
+
+ @Override
+ public DriftFileStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public void setStatus(DriftFileStatus status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return "DriftFile[hashId: " + hash + ", dataSize: " + size + ", status: " + status.ordinal() + "]";
+ }
+ }
+
+}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/SnapshotTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/SnapshotTest.java
deleted file mode 100644
index 42cf146..0000000
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/SnapshotTest.java
+++ /dev/null
@@ -1,403 +0,0 @@
-package org.rhq.core.domain.drift;
-
-import static java.util.Arrays.asList;
-import static org.rhq.core.domain.drift.DriftCategory.FILE_ADDED;
-import static org.rhq.core.domain.drift.DriftCategory.FILE_CHANGED;
-import static org.rhq.core.domain.drift.DriftCategory.FILE_REMOVED;
-import static org.rhq.core.domain.drift.DriftChangeSetCategory.COVERAGE;
-import static org.rhq.core.domain.drift.DriftChangeSetCategory.DRIFT;
-import static org.rhq.core.domain.drift.DriftFileStatus.LOADED;
-import static org.rhq.test.AssertUtils.assertCollectionMatchesNoOrder;
-import static org.testng.Assert.assertEquals;
-
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.testng.annotations.Test;
-
-import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
-
-@SuppressWarnings("unchecked")
-public class SnapshotTest {
-
- @Test
- public void addChangeSetWithAddedFile() {
- int configId = 1;
-
- FakeDriftChangeSet changeSet = new FakeDriftChangeSet(0, COVERAGE, configId).add(new FakeDrift(FILE_ADDED,
- null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt"));
-
- DriftSnapshot snapshot = new DriftSnapshot().add(changeSet);
-
- assertCollectionMatchesNoOrder(changeSet.getDrifts(), snapshot.getEntries(), "Failed to build "
- + "a snapshot that contains a single change set");
- assertEquals(snapshot.getVersion(), changeSet.getVersion(), "Snapshot version is wrong");
- }
-
- @Test
- public void addChangeSetsWithAddedFiles() {
- int configId = 1;
-
- Drift<?, ?> entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
- FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
-
- Drift<?, ?> entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("4a5b6c", 1024, LOADED), "/drift/2.txt");
- FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry2);
-
- DriftSnapshot snapshot = new DriftSnapshot().add(changeSet1).add(changeSet2);
-
- // not sure but asSet with one arg was not working for me, so create Set manually
- Set set = new HashSet<Drift<?, ?>>();
- set.add(entry1);
- set.add(entry2);
- assertCollectionMatchesNoOrder(set, snapshot.getEntries(), "Failed to build snapshot "
- + "with two change sets and file added in second change set");
- assertEquals(snapshot.getVersion(), changeSet2.getVersion(), "Snapshot version is wrong");
- }
-
- @Test
- public void replaceFileWithChangedVersion() {
- int configId = 1;
-
- Drift<?, ?> entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
- FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
-
- Drift<?, ?> entry2 = new FakeDrift(FILE_CHANGED, new FakeDriftFile("a1b2c3", 1024, LOADED), new FakeDriftFile(
- "4d5e6f", 1024, LOADED), "/drift/1.txt");
- FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry2);
-
- DriftSnapshot snapshot = new DriftSnapshot().add(changeSet1).add(changeSet2);
-
- // not sure but asSet with one arg was not working for me, so create Set manually
- Set set = new HashSet<Drift<?, ?>>();
- set.add(entry2);
- assertCollectionMatchesNoOrder(set, snapshot.getEntries(), "Failed to build snapshot with file changed");
- }
-
- @Test
- public void deleteFileThatHasBeenRemoved() {
- int configId = 1;
-
- Drift<?, ?> entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
- Drift<?, ?> entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("d1f2a3", 1024, LOADED), "/drift/2.txt");
- FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1).add(entry2);
-
- Drift entry3 = new FakeDrift(FILE_REMOVED, new FakeDriftFile("a1b2c3", 1024, LOADED), null, "/drift/1.txt");
- FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry3);
-
- DriftSnapshot snapshot = new DriftSnapshot().add(changeSet1).add(changeSet2);
-
- // not sure but asSet with one arg was not working for me, so create Set manually
- Set set = new HashSet<Drift<?, ?>>();
- set.add(entry2);
- assertCollectionMatchesNoOrder(set, snapshot.getEntries(), "Failed to build snapshot with a file " + "removed.");
- }
-
- @Test
- public void diffShowsEntriesInLeftAndNotInRight() {
- int configId = 1;
-
- Drift entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
- FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
- DriftSnapshot right = new DriftSnapshot().add(changeSet1);
-
- Drift entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a3b6c9", 1024, LOADED), "/drift/2.txt");
- FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1).add(entry2);
- DriftSnapshot left = new DriftSnapshot().add(changeSet1).add(changeSet2);
-
- DriftDiffReport diff = left.diff(right);
-
- assertCollectionMatchesNoOrder(asList(entry2), diff.getElementsNotInRight(), "Diff report does not contain "
- + "elements that are in the left but not in the right.");
- }
-
- @Test
- public void diffShowsEntriesInRightAndNotInLeft() {
- int configId = 1;
-
- Drift entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drift/1.txt");
- FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
- DriftSnapshot right = new DriftSnapshot().add(changeSet1);
-
- Drift entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a3b6c9", 1024, LOADED), "/drift/2.txt");
- FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry2);
- DriftSnapshot left = new DriftSnapshot().add(changeSet2);
-
- DriftDiffReport diff = left.diff(right);
-
- assertCollectionMatchesNoOrder(asList(entry1), diff.getElementsNotInLeft(), "Diff report does not contain "
- + "elements that are in the left but not in the right");
- }
-
- @Test
- public void diffShowsEntriesInLeftAndRightThatAreInConflict() {
- int configId = 1;
-
- Drift entry1 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("a1b2c3", 1024, LOADED), "/drfit/1.txt");
- FakeDriftChangeSet changeSet1 = new FakeDriftChangeSet(0, COVERAGE, configId).add(entry1);
- DriftSnapshot right = new DriftSnapshot().add(changeSet1);
-
- Drift entry2 = new FakeDrift(FILE_ADDED, null, new FakeDriftFile("c3b2a1", 1024, LOADED), "/drfit/1.txt");
- FakeDriftChangeSet changeSet2 = new FakeDriftChangeSet(1, DRIFT, configId).add(entry2);
- DriftSnapshot left = new DriftSnapshot().add(changeSet2);
-
- DriftDiffReport diff = left.diff(right);
-
- assertCollectionMatchesNoOrder(asList(entry2), diff.getElementsInConflict(), "Diff report does not contain "
- + "element that are in both left and right and are in conflict");
- }
-
- <E> Set<E> asSet(E... elements) {
- HashSet<E> set = new HashSet<E>();
- for (E element : elements) {
- set.add(element);
- }
- return set;
- }
-
- static class FakeDriftChangeSet implements DriftChangeSet {
-
- private String id;
- private int version;
- private DriftChangeSetCategory category;
- private int configId;
- private DriftHandlingMode mode = DriftHandlingMode.normal;
- private Set<Drift> drifts = new HashSet<Drift>();
- private long ctime = System.currentTimeMillis();
-
- public FakeDriftChangeSet() {
- }
-
- public FakeDriftChangeSet(int version, DriftChangeSetCategory category, int configId) {
- this.version = version;
- this.category = category;
- this.configId = configId;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Long getCtime() {
- return ctime;
- }
-
- @Override
- public int getVersion() {
- return version;
- }
-
- @Override
- public void setVersion(int version) {
- this.version = version;
- }
-
- @Override
- public DriftChangeSetCategory getCategory() {
- return category;
- }
-
- @Override
- public void setCategory(DriftChangeSetCategory category) {
- this.category = category;
- }
-
- @Override
- public int getDriftConfigurationId() {
- return configId;
- }
-
- @Override
- public void setDriftConfigurationId(int id) {
- configId = id;
- }
-
- @Override
- public int getResourceId() {
- return 0;
- }
-
- @Override
- public Set getDrifts() {
- return drifts;
- }
-
- @Override
- public void setDrifts(Set drifts) {
- this.drifts = drifts;
- }
-
- public FakeDriftChangeSet add(Drift drift) {
- drifts.add(drift);
- return this;
- }
-
- @Override
- public DriftHandlingMode getDriftHandlingMode() {
- return this.mode;
- }
-
- @Override
- public void setDriftHandlingMode(DriftHandlingMode mode) {
- this.mode = mode;
- }
- }
-
- static class FakeDrift implements Drift {
-
- private String id;
- private DriftCategory category;
- private String path;
- private DriftFile oldFile;
- private DriftFile newFile;
- private long ctime = System.currentTimeMillis();
-
- public FakeDrift() {
- }
-
- public FakeDrift(DriftCategory category, DriftFile oldFile, DriftFile newFile, String path) {
- this.category = category;
- this.oldFile = oldFile;
- this.newFile = newFile;
- this.path = path;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Long getCtime() {
- return ctime;
- }
-
- @Override
- public DriftChangeSet getChangeSet() {
- return null;
- }
-
- @Override
- public void setChangeSet(DriftChangeSet changeSet) {
-
- }
-
- @Override
- public DriftCategory getCategory() {
- return category;
- }
-
- @Override
- public void setCategory(DriftCategory category) {
- this.category = category;
- }
-
- @Override
- public String getPath() {
- return path;
- }
-
- @Override
- public void setPath(String path) {
- this.path = path;
- }
-
- @Override
- public DriftFile getOldDriftFile() {
- return oldFile;
- }
-
- @Override
- public void setOldDriftFile(DriftFile oldDriftFile) {
- this.oldFile = oldDriftFile;
- }
-
- @Override
- public DriftFile getNewDriftFile() {
- return newFile;
- }
-
- @Override
- public void setNewDriftFile(DriftFile newDriftFile) {
- newFile = newDriftFile;
- }
-
- @Override
- public String toString() {
- return "Drift[category: " + category.code() + ", oldFile: " + oldFile + ", newFile: " + newFile
- + ", path: " + path + "]";
- }
- }
-
- static class FakeDriftFile implements Serializable, DriftFile {
-
- private static final long serialVersionUID = 1L;
- private String hash;
- private long size;
- private DriftFileStatus status;
- private long ctime = System.currentTimeMillis();
-
- public FakeDriftFile() {
- }
-
- public FakeDriftFile(String hash, long size, DriftFileStatus status) {
- this.hash = hash;
- this.size = size;
- this.status = status;
- }
-
- @Override
- public String getHashId() {
- return hash;
- }
-
- @Override
- public void setHashId(String hashId) {
- hash = hashId;
- }
-
- @Override
- public Long getCtime() {
- return ctime;
- }
-
- @Override
- public Long getDataSize() {
- return size;
- }
-
- @Override
- public void setDataSize(Long size) {
- this.size = size;
- }
-
- @Override
- public DriftFileStatus getStatus() {
- return status;
- }
-
- @Override
- public void setStatus(DriftFileStatus status) {
- this.status = status;
- }
-
- @Override
- public String toString() {
- return "DriftFile[hashId: " + hash + ", dataSize: " + size + ", status: " + status.ordinal() + "]";
- }
- }
-
-}
diff --git a/modules/core/plugin-container/mvn.out b/modules/core/plugin-container/mvn.out
new file mode 100644
index 0000000..d269e4d
--- /dev/null
+++ b/modules/core/plugin-container/mvn.out
@@ -0,0 +1,96 @@
+[INFO]
+NOTE: Maven is executing in offline mode. Any artifacts not already in your local
+repository will be inaccessible.
+
+[INFO] Scanning for projects...
+[INFO] ------------------------------------------------------------------------
+[INFO] Building RHQ Plugin Container
+[INFO] task-segment: [clean, install]
+[INFO] ------------------------------------------------------------------------
+[INFO] [clean:clean {execution: default-clean}]
+[INFO] Deleting /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target
+[INFO] [enforcer:enforce {execution: enforce-versions}]
+[INFO] [build-helper:maven-version {execution: default}]
+[INFO] [resources:resources {execution: default-resources}]
+[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
+[INFO] skip non existing resourceDirectory /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/resources
+[INFO] [compiler:compile {execution: default-compile}]
+[INFO] Compiling 105 source files to /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/classes
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/FileSystemPluginFinder.java:[124,32] [deprecation] toURL() in java.io.File has been deprecated
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java:[465,49] [unchecked] unchecked conversion
+found : java.util.concurrent.Callable
+required: java.util.concurrent.Callable<T>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java:[465,48] [unchecked] unchecked method invocation: <T>submit(java.util.concurrent.Callable<T>) in java.util.concurrent.ExecutorService is applied to (java.util.concurrent.Callable)
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[321,76] [unchecked] unchecked call to discoverResources(org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext<T>) as a member of the raw type org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[321,76] [unchecked] unchecked conversion
+found : java.util.Set
+required: java.util.Set<org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[357,69] [unchecked] unchecked call to discoverResource(org.rhq.core.domain.configuration.Configuration,org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext<T>) as a member of the raw type org.rhq.core.pluginapi.inventory.ManualAddFacet
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[394,52] [unchecked] unchecked call to ResourceDiscoveryContext(org.rhq.core.domain.resource.ResourceType,T,org.rhq.core.pluginapi.inventory.ResourceContext,org.rhq.core.system.SystemInfo,java.util.List<org.rhq.core.pluginapi.inventory.ProcessScanResult>,java.util.List<org.rhq.core.domain.configuration.Configuration>,java.lang.String,org.rhq.core.pluginapi.inventory.PluginContainerDeployment) as a member of the raw type org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[406,60] [unchecked] unchecked call to getAdditionalClasspathUrls(org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext<T>,org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails) as a member of the raw type org.rhq.core.pluginapi.inventory.ClassLoaderFacet
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[406,60] [unchecked] unchecked conversion
+found : java.util.List
+required: java.util.List<java.net.URL>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[1534,87] [unchecked] unchecked conversion
+found : org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent
+required: org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent<org.rhq.core.pluginapi.inventory.ResourceComponent<capture#841 of ?>>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[1534,59] [unchecked] unchecked method invocation: <T>createResourceContext(org.rhq.core.domain.resource.Resource,T,org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent<T>) in org.rhq.core.pc.inventory.InventoryManager is applied to (org.rhq.core.domain.resource.Resource,org.rhq.core.pluginapi.inventory.ResourceComponent<capture#841 of ?>,org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent)
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[2383,47] [unchecked] unchecked call to ResourceDiscoveryContext(org.rhq.core.domain.resource.ResourceType,T,org.rhq.core.pluginapi.inventory.ResourceContext,org.rhq.core.system.SystemInfo,java.util.List<org.rhq.core.pluginapi.inventory.ProcessScanResult>,java.util.List<org.rhq.core.domain.configuration.Configuration>,java.lang.String,org.rhq.core.pluginapi.inventory.PluginContainerDeployment) as a member of the raw type org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java:[2436,30] [unchecked] unchecked conversion
+found : java.util.Set
+required: java.util.Set<org.rhq.core.domain.resource.Resource>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java:[111,85] [unchecked] unchecked cast
+found : java.util.Set<capture#736 of ? extends org.rhq.core.domain.measurement.MeasurementScheduleRequest>
+required: java.util.Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryFile.java:[116,85] [unchecked] unchecked cast
+found : java.lang.Object
+required: java.util.Map<java.lang.String,org.rhq.core.pc.inventory.ResourceContainer>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java:[285,41] [unchecked] unchecked call to HashSet(java.util.Collection<? extends E>) as a member of the raw type java.util.HashSet
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java:[285,41] [unchecked] unchecked conversion
+found : java.util.HashSet
+required: java.util.Set<org.rhq.core.domain.resource.Resource>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java:[58,25] [unchecked] unchecked conversion
+found : java.util.Set
+required: java.util.Set<org.rhq.core.domain.configuration.RawConfiguration>
+[WARNING] /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/SnapshotGenerator.java:[106,19] [unchecked] unchecked call to add(E) as a member of the raw type java.util.Collection
+[INFO] [resources:testResources {execution: default-testResources}]
+[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
+[INFO] Copying 5 resources
+[WARNING] DEPRECATED [tasks]: Use target instead
+[INFO] [antrun:run {execution: process-test-resources}]
+[WARNING] Parameter tasks is deprecated, use target instead
+[INFO] Executing tasks
+
+main:
+ [echo] SIGAR java library version used is 1.6.5.132
+ [echo] Copying/unzipping SIGAR native libraries (version 1.6.5.132) to local build directory
+ [mkdir] Created dir: /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/jboss-sigar
+ [copy] Copying 1 file to /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/jboss-sigar
+ [unzip] Expanding: /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/jboss-sigar/sigar-dist-1.6.5.132.zip into /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/jboss-sigar
+ [move] Moving 22 files to /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/jboss-sigar
+[INFO] Executed tasks
+[INFO] [compiler:testCompile {execution: default-testCompile}]
+[INFO] Not compiling test sources
+[WARNING] DEPRECATED [tasks]: Use target instead
+[INFO] [antrun:run {execution: process-test-classes}]
+[WARNING] Parameter tasks is deprecated, use target instead
+[INFO] Executing tasks
+
+main:
+[INFO] Executed tasks
+[INFO] [surefire:test {execution: default-test}]
+[INFO] Tests are skipped.
+[INFO] [jar:jar {execution: default-jar}]
+[INFO] Building jar: /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/rhq-core-plugin-container-4.1.0-SNAPSHOT.jar
+[INFO] [jar:jar {execution: default}]
+[INFO] [jar:test-jar {execution: default}]
+[INFO] Skipping packaging of the test-jar
+[INFO] [install:install {execution: default-install}]
+[INFO] Installing /home/jsanda/Development/redhat/rhq/modules/core/plugin-container/target/rhq-core-plugin-container-4.1.0-SNAPSHOT.jar to /home/jsanda/.m2/repository/org/rhq/rhq-core-plugin-container/4.1.0-SNAPSHOT/rhq-core-plugin-container-4.1.0-SNAPSHOT.jar
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 7 seconds
+[INFO] Finished at: Tue Sep 13 16:43:45 EDT 2011
+[INFO] Final Memory: 59M/481M
+[INFO] ------------------------------------------------------------------------
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index fa0ce28..3ee0b7d 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -159,6 +159,16 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
"server");
DriftSnapshot snapshot = pluginContainerConfiguration.getServerServices().getDriftServerService()
.getCurrentSnapshot(configuration.getId());
+
+ if (snapshot.getVersion() == -1) {
+ // A version of -1 indicates that no change sets have been reported
+ // for this configuration. This can occur when a user creates a
+ // drift configuration while the agent is offline for example. At
+ // this point we just return and allow the agent to generate the
+ // initial snapshot file.
+ return;
+ }
+
ChangeSetWriter writer = changeSetMgr.getChangeSetWriter(resource.getId(), headers);
for (Drift drift : snapshot.getEntries()) {
@@ -187,7 +197,7 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
for (File configDir : resourceDir.listFiles()) {
DriftConfiguration config = new DriftConfiguration(new Configuration());
config.setName(configDir.getName());
- if (!schedulesQueue.contains(resourceId, config, comparator)) {
+ if (!schedulesQueue.contains(resourceId, config)) {
log.info("Detected deleted drift configuration, DriftConfiguration[name: " + config.getName() +
", resourceId: " + resourceId + "]");
log.info("Deleting drift configuration directory " + configDir.getPath());
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 c89575d..5f04fe5 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
@@ -124,6 +124,7 @@ import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.core.util.exception.WrappedRemotingException;
import static org.rhq.core.domain.drift.DriftConfigurationComparator.CompareMode.BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS;
+import static org.rhq.core.util.file.FileUtil.purge;
/**
* Manages the process of both auto-detection of servers and runtime detection of services across all plugins. Manages
@@ -2172,7 +2173,9 @@ public class InventoryManager extends AgentService implements ContainerService,
// First check for drift configurations that have been deleted
log.debug("Checking for stale drift configurations that need to be purged from inventory");
+ File changeSetsDir = new File(configuration.getDataDirectory(), "changesets");
for (Integer resourceId : configsFromServer.keySet()) {
+ File resourceDir = new File(changeSetsDir, resourceId.toString());
ResourceContainer container = getResourceContainer(resourceId);
Set<DriftConfiguration> resourceConfigs = new TreeSet<DriftConfiguration>(
new DriftConfigurationComparator(BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS));
@@ -2192,6 +2195,10 @@ public class InventoryManager extends AgentService implements ContainerService,
for (DriftConfiguration c : deleted) {
container.removeDriftConfiguration(c);
+ File changeSetDir = new File(resourceDir, c.getName());
+ if (changeSetDir.exists()) {
+ purge(changeSetDir, true);
+ }
}
}
@@ -2205,6 +2212,7 @@ public class InventoryManager extends AgentService implements ContainerService,
log.debug("Adding or updating DriftConfiguration[name: " + c.getName() + ", resourceId: " +
resourceId + "]");
}
+ // TODO does this handle renamed configs?
container.addDriftConfiguration(c);
}
}
12 years, 9 months
[rhq] Branch 'feature/performance' - modules/plugins
by ips
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JBossInstanceInfo.java | 9 +++++----
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/JBossConfigurationUtility.java | 2 +-
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/helper/JBossInstanceInfo.java | 9 +++++----
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JBossConfigurationUtility.java | 2 +-
4 files changed, 12 insertions(+), 10 deletions(-)
New commits:
commit 43d0562c62abd1f45f926d4d51c4438489f84061
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Sep 14 11:01:02 2011 -0400
fix minor bug where as/as5 server discovery failed to parse the --properties
command-line option if the cwd was unknown, even if the arg to the option was
a relative path
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JBossInstanceInfo.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JBossInstanceInfo.java
index 991c68c..24083840 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JBossInstanceInfo.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JBossInstanceInfo.java
@@ -150,14 +150,15 @@ public class JBossInstanceInfo {
case 'P': // 'P' (--properties)
{
- // cwd can be null if native support is not able to determine CWD.
- if (null == currentWorkingDir) {
- log.error("Could not determine CWD. Failed to parse argument to --properties option: "
+ String arg = options.getOptarg();
+
+ // cwd can be null if native support (i.e. SIGAR) is not able to determine it.
+ if (!new File(arg).isAbsolute() && currentWorkingDir == null) {
+ log.error("Could not determine current working directory. Failed to parse relative path argument to --properties option: "
+ options.getOptarg());
break;
}
- String arg = options.getOptarg();
URL url;
try {
File workingDir = new File(currentWorkingDir);
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/JBossConfigurationUtility.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/JBossConfigurationUtility.java
index 5554414..553d890 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/JBossConfigurationUtility.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/JBossConfigurationUtility.java
@@ -58,7 +58,7 @@ public class JBossConfigurationUtility
if (url.getProtocol().equals("file"))
{
File file = (new File(url.getFile())).getCanonicalFile();
- url = file.toURL();
+ url = file.toURI().toURL();
}
}
catch (Exception e)
diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/helper/JBossInstanceInfo.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/helper/JBossInstanceInfo.java
index 3ae813e..9dadd39 100644
--- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/helper/JBossInstanceInfo.java
+++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/helper/JBossInstanceInfo.java
@@ -150,14 +150,15 @@ public class JBossInstanceInfo {
case 'P': // 'P' (--properties)
{
- // cwd can be null if native support is not able to determine CWD.
- if (null == currentWorkingDir) {
- log.error("Could not determine CWD. Failed to parse argument to --properties option: "
+ String arg = options.getOptarg();
+
+ // cwd can be null if native support (i.e. SIGAR) is not able to determine it.
+ if (!new File(arg).isAbsolute() && currentWorkingDir == null) {
+ log.error("Could not determine current working directory. Failed to parse relative path argument to --properties option: "
+ options.getOptarg());
break;
}
- String arg = options.getOptarg();
URL url;
try {
File workingDir = new File(currentWorkingDir);
diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JBossConfigurationUtility.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JBossConfigurationUtility.java
index dff5b82..8b94c6e 100644
--- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JBossConfigurationUtility.java
+++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/JBossConfigurationUtility.java
@@ -53,7 +53,7 @@ public class JBossConfigurationUtility {
url = new URL(urlSpec);
if (url.getProtocol().equals("file")) {
File file = (new File(url.getFile())).getCanonicalFile();
- url = file.toURL();
+ url = file.toURI().toURL();
}
}
catch (Exception e) {
12 years, 9 months
[rhq] modules/integration-tests
by snegrea
modules/integration-tests/mod_cluster-plugin-test/pom.xml | 15 +++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
New commits:
commit 95e6afc28475db9bdc8a216500e4650831d63140
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 14 09:56:57 2011 -0500
Integration tests for mod_cluster should be run on JBoss AS6 Final going forward.
diff --git a/modules/integration-tests/mod_cluster-plugin-test/pom.xml b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
index ba94746..32d5429 100644
--- a/modules/integration-tests/mod_cluster-plugin-test/pom.xml
+++ b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
@@ -18,7 +18,8 @@
<properties>
<scm.module.path>modules/integration-tests/mod_cluster-plugin-test</scm.module.path>
<!-- jbossas.version>6.0.0.20100429-M3</jbossas.version-->
- <jbossas.version>6.0.0.M1</jbossas.version>
+ <!-- jbossas.version>6.0.0.M1</jbossas.version-->
+ <jbossas.version>6.0.0.Final</jbossas.version>
</properties>
@@ -49,11 +50,11 @@
<scope>provided</scope>
</dependency>
- <dependency>
+ <!-- dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency-->
<dependency>
<groupId>${rhq.groupId}</groupId>
@@ -82,11 +83,11 @@
<scope>test</scope>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-kernel</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.jboss.jbossas</groupId>
@@ -108,11 +109,11 @@
<scope>test</scope>
</dependency>
- <dependency>
+ <!-- dependency>
<groupId>org.jboss.security</groupId>
<artifactId>jboss-security-spi</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency-->
<!-- dependency>
<groupId>org.jboss.javaee</groupId>
12 years, 9 months
[rhq] pom.xml
by Simeon Pinder
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 866f957378256adfd16f7ec2c8d96380411f4f22
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 13 18:15:45 2011 -0400
Update to use the right build property for brew.
diff --git a/pom.xml b/pom.xml
index 3c84ff1..d4a2fd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1242,7 +1242,7 @@
</tstamp>
<mkdir dir="target"/>
<echo file="${product.buildPropertiesFile}">buildTime = ${buildTime}${line.separator}</echo>
- <echo file="${product.buildPropertiesFile}" append="true">buildNumber = ${buildNumber}${line.separator}</echo>
+ <echo file="${product.buildPropertiesFile}" append="true">buildNumber = ${rhq.build.number}${line.separator}</echo>
</tasks>
</configuration>
</execution>
12 years, 9 months