[rhq] Branch 'bug/902406' - 2 commits - modules/core
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 38 +++++++---
2 files changed, 28 insertions(+), 12 deletions(-)
New commits:
commit a2d3d1ba9278c2d2847a0eb4381ce09ee1475b0d
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Feb 1 15:32:38 2013 -0500
InventoryManager tweeks
- return to debug logging
- make the sync batch size configurable
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 7043c1f..f1746da 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
@@ -145,6 +145,19 @@ public class InventoryManager extends AgentService implements ContainerService,
private static final int COMPONENT_START_TIMEOUT = 60 * 1000; // 60 seconds
private static final int COMPONENT_STOP_TIMEOUT = 5 * 1000; // 5 seconds
+ static private final int SYNC_BATCH_SIZE;
+
+ static {
+
+ int syncBatchSize = 500;
+ try {
+ syncBatchSize = Integer.parseInt(System.getProperty("rhq.agent.sync.batch.size", "500"));
+ } catch (Throwable t) {
+ //
+ }
+ SYNC_BATCH_SIZE = syncBatchSize;
+ }
+
private final Log log = LogFactory.getLog(InventoryManager.class);
private PluginContainerConfiguration configuration;
@@ -2832,10 +2845,10 @@ public class InventoryManager extends AgentService implements ContainerService,
}
private void mergeUnknownResources(Set<ResourceSyncInfo> unknownResourceSyncInfos) {
- //TODO if (log.isDebugEnabled()) {
- log.info("Merging [" + unknownResourceSyncInfos.size()
- + "] unknown Resources and their descendants into local inventory...");
- //}
+ if (log.isDebugEnabled()) {
+ log.debug("Merging [" + unknownResourceSyncInfos.size()
+ + "] unknown Resources and their descendants into local inventory...");
+ }
if (!unknownResourceSyncInfos.isEmpty()) {
PluginMetadataManager pmm = this.pluginManager.getMetadataManager();
@@ -2875,8 +2888,6 @@ public class InventoryManager extends AgentService implements ContainerService,
return result;
}
- static final int BATCH_SIZE = 500;
-
private Resource getResourceFromSyncInfo(ResourceSyncInfo syncInfo) {
Resource result;
@@ -2886,7 +2897,7 @@ public class InventoryManager extends AgentService implements ContainerService,
while (!resourceIdList.isEmpty()) {
int size = resourceIdList.size();
- int end = (BATCH_SIZE < size) ? BATCH_SIZE : size;
+ int end = (SYNC_BATCH_SIZE < size) ? SYNC_BATCH_SIZE : size;
List<Integer> resourceIdBatch = resourceIdList.subList(0, end);
Integer[] resourceIdArray = resourceIdBatch.toArray(new Integer[resourceIdBatch.size()]);
@@ -2915,13 +2926,18 @@ public class InventoryManager extends AgentService implements ContainerService,
+ "] resources when fetching from server");
}
- StopWatch stopWatch = new StopWatch();
+ boolean isDebugEnabled = log.isDebugEnabled();
+ StopWatch stopWatch = null;
+
+ if (isDebugEnabled) {
+ stopWatch = new StopWatch();
+ }
result = syncInfoTreeToResourceTree(syncInfo, resourceMap);
- //TODO if (log.isDebugEnabled()) {
- log.info("syncInfoTreeToResourceTree time=[" + stopWatch + "]");
- //}
+ if (isDebugEnabled) {
+ log.debug("syncInfoTreeToResourceTree time=[" + stopWatch + "]");
+ }
return result;
}
commit a9d9edd07ce3a53df0c994b098df078273aa91eb
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Feb 1 15:00:41 2013 -0500
Change to private vars I guess means a change to Serialization id
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 96b51fa..1618b09 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -43,7 +43,7 @@ import org.rhq.core.domain.util.PageOrdering;
@XmlAccessorType(XmlAccessType.FIELD)
@SuppressWarnings("unused")
public class ResourceCriteria extends TaggedCriteria {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
private Integer filterId;
private String filterName;
11 years, 4 months
[rhq] Branch 'bug/902406' - 2 commits - modules/core
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 16 +++-------
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 4 ++
2 files changed, 9 insertions(+), 11 deletions(-)
New commits:
commit 2e223b0da5b8643d38cc970482a513c8f8dd4ee8
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Feb 1 14:33:00 2013 -0500
Protect against NotNull assumptions
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 59a669e..7043c1f 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
@@ -2899,6 +2899,10 @@ public class InventoryManager extends AgentService implements ContainerService,
// add the newly fetched resources to the end of our master list
for (Resource r : resourceBatch) {
+ // protect against childResources notNull assumptions downstream
+ if (null == r.getChildResources()) {
+ r.setChildResources(null); // this will actually initialize to an empty Set
+ }
resourceMap.put(r.getId(), r);
}
commit 03175821fa0cf8ad77d01691f72e71c8a920327c
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Feb 1 14:31:53 2013 -0500
Add some null protection to addChildResource
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index 5134451..be29fd6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -55,9 +55,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
@@ -1125,10 +1122,7 @@ public class Resource implements Comparable<Resource>, Serializable {
this.id = id;
}
- public Resource( //
- @NotNull String resourceKey, //
- String name, //
- @NotNull ResourceType type) {
+ public Resource(String resourceKey, String name, ResourceType type) {
this();
this.resourceKey = resourceKey;
this.name = name;
@@ -1371,13 +1365,15 @@ public class Resource implements Comparable<Resource>, Serializable {
this.location = location;
}
- @NotNull
public Set<Resource> getChildResources() {
return this.childResources;
}
public void addChildResource(Resource childResource) {
childResource.setParentResource(this);
+ if (null == this.childResources) {
+ this.childResources = new HashSet<Resource>(1);
+ }
this.childResources.add(childResource);
}
@@ -1399,12 +1395,11 @@ public class Resource implements Comparable<Resource>, Serializable {
}
}
- @Nullable
public Resource getParentResource() {
return parentResource;
}
- public void setParentResource(@Nullable Resource parentResource) {
+ public void setParentResource(Resource parentResource) {
this.parentResource = parentResource;
updateAncestryForResource();
}
@@ -1559,7 +1554,6 @@ public class Resource implements Comparable<Resource>, Serializable {
this.explicitGroups.remove(explicitGroup);
}
- @NotNull
public List<ResourceOperationHistory> getOperationHistories() {
if (this.operationHistories == null) {
this.operationHistories = new ArrayList<ResourceOperationHistory>();
11 years, 4 months
[rhq] Branch 'bug/902406' - 2 commits - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 20 +++++++++-
modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java | 12 +++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryServerServiceImpl.java | 16 +++-----
3 files changed, 37 insertions(+), 11 deletions(-)
New commits:
commit 5c08fe27afdd5712622fb2f212e6496bdd082976
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Feb 1 12:50:50 2013 -0500
Fix up some stuff in getResourcesAsList
- new filtering for better perf
- pull optional data we need to send to the agent
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryServerServiceImpl.java
index 4a269da..70e993a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryServerServiceImpl.java
@@ -176,21 +176,19 @@ public class DiscoveryServerServiceImpl implements DiscoveryServerService {
long start = System.currentTimeMillis();
ResourceCriteria criteria = new ResourceCriteria();
+ // get all of the resources for the supplied ids
criteria.addFilterIds(resourceIds);
- criteria.addFilterInventoryStatus(null); // get them all and remove some later
+ // filter out any that are not actually in inventory
+ criteria.addFilterInventoryStatuses(new ArrayList<InventoryStatus>(InventoryStatus.getInInventorySet()));
+ // get all of them, don't limit to default paging
criteria.clearPaging();
+ criteria.fetchResourceType(true);
+ criteria.fetchPluginConfiguration(true);
ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
- List<Resource> resources = resourceManager.findResourcesByCriteria(overlord, criteria);
- List<Resource> result = new ArrayList<Resource>(resources.size());
+ List<Resource> result = resourceManager.findResourcesByCriteria(overlord, criteria);
- for (Resource r : resources) {
- if (isVisibleInInventory(r)) {
- Resource resourcePojo = convertToPojoResource(r, false);
- result.add(resourcePojo);
- }
- }
if (log.isDebugEnabled()) {
log.debug("Performance: get ResourcesAsList [" + resourceIds + "], timing ("
+ (System.currentTimeMillis() - start) + ")ms");
commit 5c6b126d93845163b2d8138995cd9d70538084cf
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Feb 1 12:50:01 2013 -0500
Add a new filter for ResourceCriteria, for a list of
InventoryStatuses. And also add a convenience method
to InventoryStatus to get just the set of enums for resources
in Inventory.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 066c84f..96b51fa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -49,6 +49,7 @@ public class ResourceCriteria extends TaggedCriteria {
private String filterName;
private String filterResourceKey;
private InventoryStatus filterInventoryStatus = InventoryStatus.COMMITTED; // default
+ private List<InventoryStatus> filterInventoryStatuses; // needs overrides
private String filterVersion;
private String filterDescription;
private Integer filterResourceTypeId; // needs overrides
@@ -68,7 +69,7 @@ public class ResourceCriteria extends TaggedCriteria {
private List<Integer> filterIds; // needs overrides
private List<Integer> filterExplicitGroupIds; // requires overrides
private List<Integer> filterImplicitGroupIds; // requires overrides
- private Integer filterRootResourceId; // requires overrides
+ private Integer filterRootResourceId; // requires overrides
private boolean fetchResourceType;
private boolean fetchChildResources;
@@ -133,6 +134,7 @@ public class ResourceCriteria extends TaggedCriteria {
+ " WHERE implicitGroup.id IN ( ? ) )");
filterOverrides.put("rootResourceId", "agent.id = (SELECT r2.agent.id FROM Resource r2 where r2.id = ?)");
filterOverrides.put("resourceTypeIds", "resourceType.id IN (?)");
+ filterOverrides.put("inventoryStatuses", "inventoryStatus IN ( ? )");
sortOverrides.put("resourceTypeName", "resourceType.name");
sortOverrides.put("resourceCategory", "resourceType.category");
@@ -160,10 +162,26 @@ public class ResourceCriteria extends TaggedCriteria {
this.filterResourceKey = filterResourceKey;
}
+ /**
+ * Note, by default this filter is set to COMMITTED. This must be explicitly set to null to get all
+ * Resources.
+ *
+ * @param filterInventoryStatus
+ */
public void addFilterInventoryStatus(InventoryStatus filterInventoryStatus) {
this.filterInventoryStatus = filterInventoryStatus;
}
+ /**
+ * Note, setting this filter will set filterInventoryStatus to null since that is a mutually exclusive filter.
+ *
+ * @param filterInventoryStatus
+ */
+ public void addFilterInventoryStatuses(List<InventoryStatus> filterInventoryStatuses) {
+ this.filterInventoryStatuses = filterInventoryStatuses;
+ this.filterInventoryStatus = null;
+ }
+
public void addFilterVersion(String filterVersion) {
this.filterVersion = filterVersion;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
index 16d21ab..e8d8797 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
@@ -22,6 +22,8 @@
*/
package org.rhq.core.domain.resource;
+import java.util.EnumSet;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlEnum;
@@ -52,5 +54,13 @@ public enum InventoryStatus {
* resources, after which they are removed from the database completely.</li>
* </ul>
*/
- NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED
+ NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED;
+
+ /**
+ * @return Returns the InventoryStatus set representing the resources currently in inventory, omitting
+ * the resources marked for special processing (like UNINVNETORIED).
+ */
+ static public EnumSet<InventoryStatus> getInInventorySet() {
+ return EnumSet.of(NEW, IGNORED, COMMITTED);
+ }
}
\ No newline at end of file
11 years, 4 months
[rhq] Branch 'bug/902406' - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
New commits:
commit 76a2ad16d3e45fc6a7aab59d273e7626deed23ad
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 1 11:46:41 2013 -0500
just make it easier to debug this - rather than pass the find results directly in the argument list, put it in a local var
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index d5d7128..38636b3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -386,11 +386,13 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
* @param servers the servers in inventory
*/
public void updateAgentInventoryStatus(List<Resource> platforms, List<Resource> servers) {
+ ResourceSyncInfo syncInfo;
+
for (Resource platform : platforms) {
AgentClient agentClient = agentManager.getAgentClient(platform.getAgent());
try {
- agentClient.getDiscoveryAgentService().synchronizeInventory(
- entityManager.find(ResourceSyncInfo.class, platform.getId()));
+ syncInfo = entityManager.find(ResourceSyncInfo.class, platform.getId());
+ agentClient.getDiscoveryAgentService().synchronizeInventory(syncInfo);
} catch (Exception e) {
log.warn("Could not perform commit synchronization with agent for platform [" + platform.getName()
+ "]", e);
@@ -401,8 +403,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
if (!platforms.contains(server.getParentResource())) {
AgentClient agentClient = agentManager.getAgentClient(server.getAgent());
try {
- agentClient.getDiscoveryAgentService().synchronizeInventory(
- entityManager.find(ResourceSyncInfo.class, server.getId()));
+ syncInfo = entityManager.find(ResourceSyncInfo.class, server.getId());
+ agentClient.getDiscoveryAgentService().synchronizeInventory(syncInfo);
} catch (Exception e) {
log.warn("Could not perform commit synchronization with agent for server [" + server.getName()
+ "]", e);
11 years, 4 months
[rhq] 2 commits - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 8 +
modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml | 78 +++++-----
3 files changed, 52 insertions(+), 38 deletions(-)
New commits:
commit bdcd5f13b9943fae99c35749bec4710c8c08f16a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 1 10:48:06 2013 -0500
[Bug 906500 - quartz throwing NoClassDefFoundError: oracle/sql/BLOB]
I believe this is fixed. I added an optional module dependency on the
Oracle driver, for the server jar. Our datasources had no problem, they
are defined correctly to find/use the oracle driver, but since Quartz
wants to perform a test directly against a driver class, we had to ensure
the driver jar was accessible to the classloader.
diff --git a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml
index f3d48d1..2616e7f 100644
--- a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml
+++ b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml
@@ -1,46 +1,48 @@
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
- <!-- Explicitly indicate that we do not want sub deployments isolated; subdeployments need to see each other's classes -->
- <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
+ <!-- Explicitly indicate that we do not want sub deployments isolated; subdeployments need to see each other's classes -->
+ <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
- <!-- This corresponds to the top level deployment - which in this case in the EAR module -->
- <deployment>
- <dependencies>
- <module name="org.jboss.common-core" export="true" /> <!-- needed to fix https://issues.jboss.org/browse/AS7-5336 -->
- <module name="org.jboss.jts" export="true" /> <!-- needed for Arjuna CheckedAction related classes and our custom tx interceptor -->
- <module name="org.apache.commons.logging" export="true" /> <!-- needed as per https://docs.jboss.org/author/display/AS71/How+do+I+migrate+my+applicatio... -->
- <module name="org.hibernate" export="true" /> <!-- because we need hibernate specific APIs, e.g. for the HibernateDetachUtility -->
- <module name="org.infinispan" export="true" /> <!-- because we use an Infinispan cache for REST services -->
- <module name="org.antlr" export="true" /> <!-- rhq ejb jar module wants this - i think for dynagroup syntax? -->
- <module name="org.dom4j" export="true" /> <!-- rhq ejb jar module declares this with runtime/provided scope -->
- <module name="javax.mail.api" export="true" /> <!-- for sending email notifications -->
- <module name="org.picketbox" export="true" /> <!-- for obfuscating passwords -->
- <module name="org.jboss.as.naming" export="true" />
- </dependencies>
- </deployment>
+ <!-- This corresponds to the top level deployment - which in this case in the EAR module -->
+ <deployment>
+ <dependencies>
+ <module name="org.jboss.common-core" export="true" /> <!-- needed to fix https://issues.jboss.org/browse/AS7-5336 -->
+ <module name="org.jboss.jts" export="true" /> <!-- needed for Arjuna CheckedAction related classes and our custom tx interceptor -->
+ <module name="org.apache.commons.logging" export="true" /> <!-- needed as per https://docs.jboss.org/author/display/AS71/How+do+I+migrate+my+applicatio... -->
+ <module name="org.hibernate" export="true" /> <!-- because we need hibernate specific APIs, e.g. for the HibernateDetachUtility -->
+ <module name="org.infinispan" export="true" /> <!-- because we use an Infinispan cache for REST services -->
+ <module name="org.antlr" export="true" /> <!-- rhq ejb jar module wants this - i think for dynagroup syntax? -->
+ <module name="org.dom4j" export="true" /> <!-- rhq ejb jar module declares this with runtime/provided scope -->
+ <module name="javax.mail.api" export="true" /> <!-- for sending email notifications -->
+ <module name="org.picketbox" export="true" /> <!-- for obfuscating passwords -->
+ <module name="org.jboss.as.naming" export="true" />
+ </dependencies>
+ </deployment>
- <!-- This corresponds to the Portal WAR - it requires the older JSF version packaged with AS 4.2.3, not the AS7 default -->
- <sub-deployment name="rhq-portal.war">
- <exclusions>
- <module name="javax.faces.api" slot="main" />
- <module name="com.sun.jsf-impl" slot="main" />
- </exclusions>
- <dependencies>
- <module name="javax.faces.api" slot="1.2" />
- <module name="com.sun.jsf-impl" slot="1.2" />
- </dependencies>
- </sub-deployment>
+ <!-- This corresponds to the Portal WAR - it requires the older JSF version packaged with AS 4.2.3, not the AS7 default -->
+ <sub-deployment name="rhq-portal.war">
+ <exclusions>
+ <module name="javax.faces.api" slot="main" />
+ <module name="com.sun.jsf-impl" slot="main" />
+ </exclusions>
+ <dependencies>
+ <module name="javax.faces.api" slot="1.2" />
+ <module name="com.sun.jsf-impl" slot="1.2" />
+ </dependencies>
+ </sub-deployment>
- <!-- This corresponds to the Server EJB3 JAR -->
- <sub-deployment name="rhq-enterprise-server-ejb3.jar">
- <dependencies>
- <module name="org.jboss.msc" export="true" />
- <module name="org.jboss.as.controller" export="true" />
- <module name="org.jboss.as.server" export="true" />
- <module name="org.jboss.modules" export="true" />
- <module name="org.jboss.as.naming" export="true" />
- </dependencies>
- </sub-deployment>
+ <!-- This corresponds to the Server EJB3 JAR -->
+ <sub-deployment name="rhq-enterprise-server-ejb3.jar">
+ <dependencies>
+ <module name="org.jboss.msc" export="true" />
+ <module name="org.jboss.as.controller" export="true" />
+ <module name="org.jboss.as.server" export="true" />
+ <module name="org.jboss.modules" export="true" />
+ <module name="org.jboss.as.naming" export="true" />
+ <!-- Currently Quartz actually does some direct manipulation with Oracle classes -->
+ <module name="org.rhq.oracle" export="true" optional="true" />
+ </dependencies>
+ </sub-deployment>
</jboss-deployment-structure>
commit e56616b116afb4bac77d33e6a1e6a62265eceeb4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 1 10:43:38 2013 -0500
Trivial - some jdoc improvements
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 55201d8..40a2092 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -96,6 +96,10 @@ public abstract class Criteria implements Serializable, BaseCriteria {
private String searchExpression;
+ /**
+ * This default constructor will set default paging to avoid unintended fetch of huge results. The default is:
+ * <pre>setPaging(0, 200);</pre>
+ */
public Criteria() {
this.filterOverrides = new HashMap<String, String>();
this.sortOverrides = new HashMap<String, String>();
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 066c84f..0be7b29 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -106,6 +106,14 @@ public class ResourceCriteria extends TaggedCriteria {
private PageOrdering sortCurrentAvailability; // needs overrides
private PageOrdering sortResourceAncestry; // needs overrides
+ /**
+ * Note: This constructor sets by default:
+ * <pre>filterInventoryStatus = InventoryStatus.COMMITTED</pre>
+ *
+ * <p>For other implicit defaults see {@link Criteria#Criteria()}</p>
+ *
+ * @see Criteria#Criteria()
+ */
public ResourceCriteria() {
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
11 years, 4 months
[rhq] Changes to 'tsegismont/ProcessInfoWithCache'
by Thomas Segismont
New branch 'tsegismont/ProcessInfoWithCache' available with the following commits:
commit bda515a5edd874c5feec21356c26ded384a86f57
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri Feb 1 16:05:48 2013 +0100
Bug 885664 OpenSSHD and MySQL availability check may report stale data part 2
Found the reason why Sigar can return wrong value on consecutive calls to getProcState:
http://communities.vmware.com/message/2187972#2187972
So now:
Get rid of 2 seconds interval check in ProcessInfo#refresh (no longer)
Update regression tests
Add logging for tests
Get rid of state double check in ResourceContext#getNativeProcess
Clean unused things in SigarAccess and OsProcessUtility
11 years, 4 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 76267c6d230bd088ebc09d682f113d11a93202fc
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Feb 1 15:26:25 2013 +0100
[BZ 906754 - It is not possible to delete a resource group which is assigned to more than one roles.] ConcurrentModificationException was thrown when iterating through the set and removing its elements at the same time. I created a copy of the set.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index 37a66b9..7fdff89 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -293,7 +294,10 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
ResourceGroupDeleteException {
ResourceGroup group = getResourceGroupById(subject, groupId, null);
- for (Role doomedRoleRelationship : group.getRoles()) {
+ // create a copy of the collection in order to avoid ConcurrentModificationException
+ // (as a consequence of iterating and modifying it at once).
+ Set<Role> roles = new HashSet<Role>(group.getRoles());
+ for (Role doomedRoleRelationship : roles) {
group.removeRole(doomedRoleRelationship);
entityManager.merge(doomedRoleRelationship);
}
11 years, 4 months
[rhq] modules/enterprise
by Simeon Pinder
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java | 18 ++++++++++
1 file changed, 18 insertions(+)
New commits:
commit d2b2b371c0d840958bf1c8e726950f801fb5b66c
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Jan 31 14:06:50 2013 -0500
[BZ 905632] This is a unit test only fix to defend against regressions here. Failure was undetected before.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
index 7392758..a7f8289 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
@@ -396,6 +396,24 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
addResourcesToGroup(rgFlat, resourcesServiceE4);
createPlugin("remove-types-plugin", "2.0", "remove_types_v2.xml");
+
+ //Removal of this resource type exceeds default criteria page size.
+ ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
+ SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterName("ServiceE4");
+ criteria.addFilterPluginName("RemoveTypesPlugin");
+ List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
+ criteria);
+ if ((resourceTypes != null) && (resourceTypes.size() > 0)) {
+ //spinder 1-31-13: sleep for 30s to see if type removal has then completed
+ //it's possible this could fail on smaller boxes. Not sure how to test this otherwise as
+ //after fix to break resource deletion into chunks[BZ 905632] this should work.
+ Thread.sleep(1000 * 30);
+ resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria);
+ assertEquals("Resource type '" + resourceTypes.get(0).getName() + "' not fully removed", 0,
+ resourceTypes.size());
+ }
}
@Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = { "plugin.resource.metadata.test",
11 years, 4 months
[rhq] modules/enterprise modules/integration-tests
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java | 9 +
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java | 2
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java | 51 ++++++++++
3 files changed, 60 insertions(+), 2 deletions(-)
New commits:
commit 142d9dc590c0bd4ddbdd013600ed252ef6b5a592
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Feb 1 14:22:27 2013 +0100
BZ 906366 If no priority is given for an alert definition, assume LOW and don't bomb.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
index 97200cd..a508ccd 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
@@ -264,7 +264,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@PUT
@Path("/definition/{id}")
- @ApiOperation(value = "Update the alert definition (priority, enablement, dampening, recovery)", notes = "Priority must be HIGH,LOW,MEDIUM")
+ @ApiOperation(value = "Update the alert definition (priority, enablement, dampening, recovery)", notes = "Priority must be HIGH,LOW,MEDIUM. If not provided, LOW is assumed.")
public Response updateDefinition(
@ApiParam("Id of the alert definition to update") @PathParam("id") int definitionId,
@ApiParam("Data for the update") AlertDefinitionRest definitionRest) {
@@ -276,7 +276,12 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
definition = new AlertDefinition(definition); // detach
definition.setEnabled(definitionRest.isEnabled());
- definition.setPriority(AlertPriority.valueOf(definitionRest.getPriority()));
+ if (definitionRest.getPriority()!=null) {
+ definition.setPriority(AlertPriority.valueOf(definitionRest.getPriority()));
+ }
+ else {
+ definition.setPriority(AlertPriority.LOW);
+ }
setDampeningFromRest(definition, definitionRest);
// Set the recovery id if such a definition exists at all
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
index 3dd20e2..7e85193 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
@@ -33,8 +33,10 @@ public abstract class AbstractBase {
static final String APPLICATION_JSON = "application/json";
private static final String APPLICATION_XML = "application/xml";
+ private static final String TEXT_CSV = "text/csv";
static Header acceptJson = new Header("Accept", APPLICATION_JSON);
static Header acceptXml = new Header("Accept", APPLICATION_XML);
+ static Header acceptCsv = new Header("Accept", TEXT_CSV);
@Before
public void setUp() throws Exception {
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
index 8370b6a..aa25197 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
@@ -609,6 +609,57 @@ public class AlertTest extends AbstractBase {
}
@Test
+ public void testCreateDeleteAlertDefinitionWithNoPriority() throws Exception {
+
+ AlertDefinition alertDefinition = new AlertDefinition();
+ alertDefinition.setName("-x-test-definition");
+ alertDefinition.setEnabled(false);
+ alertDefinition.setPriority("LOW");
+ alertDefinition.setDampeningCategory("NONE");
+
+ AlertDefinition result =
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(alertDefinition)
+ .queryParam("resourceId",10001)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/alert/definitions")
+ .as(AlertDefinition.class);
+
+ int definitionId = result.getId();
+
+ // Now update with no priority
+ try {
+ alertDefinition.setId(definitionId);
+ alertDefinition.setPriority(null);
+
+ alertDefinition =
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(alertDefinition)
+ .pathParam("defId",definitionId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .put("/alert/definition/{defId}")
+ .as(AlertDefinition.class);
+
+ assert alertDefinition.getPriority().equals("LOW");
+ }
+
+ finally {
+ // delete the definition again
+ cleanupDefinition(definitionId);
+ }
+ }
+
+ @Test
public void testCreateDeleteAlertDefinitionWith2Notifications() throws Exception {
int definitionId = createEmptyAlertDefinition();
11 years, 4 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit af0936f97b11698157731942134e181db6e11af6
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Feb 1 14:02:40 2013 +0100
[BZ 858282 - Globally uncaught exception when creating duplicate role] RoleManager now explicitly checks whether the role with the same name already exists (without trying to create the role first and then catching the exception like it was done before)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index 3abb7df..b59ca8b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -28,6 +28,7 @@ import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.ExcludeDefaultInterceptors;
+import javax.persistence.EntityExistsException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@@ -136,7 +137,13 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
*/
@RequiredPermission(Permission.MANAGE_SECURITY)
public Role createRole(Subject whoami, Role newRole) {
- // TODO (ips): Do we want to enforce uniqueness of the Role name?
+ // Make sure there's not an existing role with the same name.
+ RoleCriteria criteria = new RoleCriteria();
+ criteria.addFilterName(newRole.getName());
+ PageList<Role> roles = findRolesByCriteria(whoami, criteria);
+ if (!roles.isEmpty()) {
+ throw new EntityExistsException("A user role [" + newRole.getName() + "] already exists.");
+ }
Boolean isSystemRole = newRole.getFsystem();
if (isSystemRole) {
11 years, 4 months