[rhq] modules/enterprise
by ips
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java | 15 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java | 15 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java | 15 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java | 15 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java | 15 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java | 14 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java | 14 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java | 14 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java | 14 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 14 -
modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml | 139 +++++++++-
11 files changed, 137 insertions(+), 147 deletions(-)
New commits:
commit d18f97331b8e56d0bb5a47b61e2e66420be66a83
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue May 10 14:10:40 2011 -0400
v2 of the SLSB leak fix, which configures the SLSBs to use the strict max pool via the jboss.xml deployment descriptor, rather than PoolClass annotations on the SLSB classes (https://bugzilla.redhat.com/show_bug.cgi?id=693232)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java
index 8ee77c9..a26472e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java
@@ -34,8 +34,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.exception.ConstraintViolationException;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.AlertDampeningEvent;
@@ -47,19 +45,6 @@ import org.rhq.enterprise.server.RHQConstants;
* @author Joseph Marques
*/
@Stateless
-// NOTE: The AlertConditionLogManagerBean, AlertConditionManagerBean, AlertDampeningManagerBean,
-// AlertDefinitionManagerBean, and CachedConditionManagerBean SLSB's are all invoked, either directly or
-// indirectly, by the AlertConditionConsumerBean MDB. Since MDB invocations are always done in new threads, using
-// the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of this SLSB to be created
-// every time it was invoked by AlertConditionConsumerBean. This would be bad because an existing instance would
-// not be reused, but it is really bad because the instance would also never get destroyed, causing heap space to
-// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
-// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
-// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
-// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
-// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertConditionLogManagerBean implements AlertConditionLogManagerLocal {
private final Log log = LogFactory.getLog(AlertConditionLogManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java
index 3094fc8..ef2ac95 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java
@@ -32,8 +32,6 @@ import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertDefinition;
@@ -51,19 +49,6 @@ import org.rhq.enterprise.server.authz.PermissionException;
* @author Joseph Marques
*/
@Stateless
-// NOTE: The AlertConditionLogManagerBean, AlertConditionManagerBean, AlertDampeningManagerBean,
-// AlertDefinitionManagerBean, and CachedConditionManagerBean SLSB's are all invoked, either directly or
-// indirectly, by the AlertConditionConsumerBean MDB. Since MDB invocations are always done in new threads, using
-// the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of this SLSB to be created
-// every time it was invoked by AlertConditionConsumerBean. This would be bad because an existing instance would
-// not be reused, but it is really bad because the instance would also never get destroyed, causing heap space to
-// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
-// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
-// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
-// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
-// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertConditionManagerBean implements AlertConditionManagerLocal {
private static final Log LOG = LogFactory.getLog(AlertConditionManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java
index 8d36704..dc5a2d4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java
@@ -31,8 +31,6 @@ import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDampeningEvent;
import org.rhq.core.domain.alert.AlertDefinition;
@@ -43,19 +41,6 @@ import org.rhq.enterprise.server.RHQConstants;
* @author Joseph Marques
*/
@Stateless
-// NOTE: The AlertConditionLogManagerBean, AlertConditionManagerBean, AlertDampeningManagerBean,
-// AlertDefinitionManagerBean, and CachedConditionManagerBean SLSB's are all invoked, either directly or
-// indirectly, by the AlertConditionConsumerBean MDB. Since MDB invocations are always done in new threads, using
-// the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of this SLSB to be created
-// every time it was invoked by AlertConditionConsumerBean. This would be bad because an existing instance would
-// not be reused, but it is really bad because the instance would also never get destroyed, causing heap space to
-// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
-// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
-// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
-// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
-// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertDampeningManagerBean implements AlertDampeningManagerLocal {
private final Log log = LogFactory.getLog(AlertDampeningManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
index 828e2bb..22a2e21 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
@@ -34,8 +34,6 @@ import org.apache.commons.logging.LogFactory;
import org.jboss.annotation.IgnoreDependency;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertConditionLog;
@@ -69,19 +67,6 @@ import org.rhq.enterprise.server.util.CriteriaQueryGenerator.AuthorizationTokenT
* @author Joseph Marques
*/
@Stateless
-// NOTE: The AlertConditionLogManagerBean, AlertConditionManagerBean, AlertDampeningManagerBean,
-// AlertDefinitionManagerBean, and CachedConditionManagerBean SLSB's are all invoked, either directly or
-// indirectly, by the AlertConditionConsumerBean MDB. Since MDB invocations are always done in new threads, using
-// the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of this SLSB to be created
-// every time it was invoked by AlertConditionConsumerBean. This would be bad because an existing instance would
-// not be reused, but it is really bad because the instance would also never get destroyed, causing heap space to
-// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
-// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
-// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
-// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
-// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertDefinitionManagerBean implements AlertDefinitionManagerLocal, AlertDefinitionManagerRemote {
private static final Log LOG = LogFactory.getLog(AlertDefinitionManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java
index 685f461..de2b789 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java
@@ -28,8 +28,6 @@ import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.alert.AlertDampeningEvent;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.enterprise.server.RHQConstants;
@@ -45,19 +43,6 @@ import org.rhq.enterprise.server.alert.engine.jms.model.InactiveAlertConditionMe
* @author Joseph Marques
*/
@Stateless
-// NOTE: The AlertConditionLogManagerBean, AlertConditionManagerBean, AlertDampeningManagerBean,
-// AlertDefinitionManagerBean, and CachedConditionManagerBean SLSB's are all invoked, either directly or
-// indirectly, by the AlertConditionConsumerBean MDB. Since MDB invocations are always done in new threads, using
-// the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of this SLSB to be created
-// every time it was invoked by AlertConditionConsumerBean. This would be bad because an existing instance would
-// not be reused, but it is really bad because the instance would also never get destroyed, causing heap space to
-// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
-// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
-// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
-// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
-// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class CachedConditionManagerBean implements CachedConditionManagerLocal {
private final Log log = LogFactory.getLog(CachedConditionManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
index 35394d6..4b98c67 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
@@ -32,8 +32,6 @@ import org.apache.commons.logging.LogFactory;
import org.jboss.annotation.IgnoreDependency;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.cloud.FailoverListDetails;
@@ -58,18 +56,6 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Joseph Marques
*/
@Stateless
-// NOTE: The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean, StatusManagerBean, and SystemManagerBean
-// SLSB's are all invoked, either directly or indirectly, by EJB timers. Since EJB timer invocations are always
-// done in new threads, using the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of
-// this SLSB to be created every time it was invoked by an EJB timer. This would be bad because an existing
-// instance would not be reused, but it is really bad because the instance would also never get destroyed, causing
-// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
-// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
-// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
-// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
-// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class CloudManagerBean implements CloudManagerLocal {
private final Log log = LogFactory.getLog(CloudManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
index eeeb812..dfd1990 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
@@ -33,8 +33,6 @@ import org.apache.commons.logging.LogFactory;
import org.jboss.annotation.IgnoreDependency;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.cloud.Server;
@@ -67,18 +65,6 @@ import org.rhq.enterprise.server.util.LookupUtil;
* require holding these locks as part of their processing.
*/
@Stateless
-// NOTE: The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean, StatusManagerBean, and SystemManagerBean
-// SLSB's are all invoked, either directly or indirectly, by EJB timers. Since EJB timer invocations are always
-// done in new threads, using the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of
-// this SLSB to be created every time it was invoked by an EJB timer. This would be bad because an existing
-// instance would not be reused, but it is really bad because the instance would also never get destroyed, causing
-// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
-// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
-// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
-// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
-// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class StatusManagerBean implements StatusManagerLocal {
private final Log log = LogFactory.getLog(StatusManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java
index a8b5499..2de7bad 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java
@@ -34,8 +34,6 @@ import javax.ejb.TransactionAttributeType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerLocal;
/**
@@ -46,18 +44,6 @@ import org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerLocal;
* @author Joseph Marques
*/
@Stateless
-// NOTE: The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean, StatusManagerBean, and SystemManagerBean
-// SLSB's are all invoked, either directly or indirectly, by EJB timers. Since EJB timer invocations are always
-// done in new threads, using the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of
-// this SLSB to be created every time it was invoked by an EJB timer. This would be bad because an existing
-// instance would not be reused, but it is really bad because the instance would also never get destroyed, causing
-// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
-// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
-// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
-// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
-// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class CacheConsistencyManagerBean implements CacheConsistencyManagerLocal {
private final Log log = LogFactory.getLog(CacheConsistencyManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
index dd7790b..be91c65 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
@@ -38,8 +38,6 @@ import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.annotation.ejb.PoolClass;
-import org.jboss.ejb3.StrictMaxPool;
import org.rhq.core.domain.cloud.PartitionEventType;
import org.rhq.core.domain.cloud.Server;
import org.rhq.core.domain.resource.Agent;
@@ -66,18 +64,6 @@ import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil;
* @author Joseph Marques
*/
@Stateless
-// NOTE: The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean, StatusManagerBean, and SystemManagerBean
-// SLSB's are all invoked, either directly or indirectly, by EJB timers. Since EJB timer invocations are always
-// done in new threads, using the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of
-// this SLSB to be created every time it was invoked by an EJB timer. This would be bad because an existing
-// instance would not be reused, but it is really bad because the instance would also never get destroyed, causing
-// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
-// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
-// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
-// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
-// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class ServerManagerBean implements ServerManagerLocal {
private final Log log = LogFactory.getLog(ServerManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
index 67184cf..19a454a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
@@ -51,9 +51,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.annotation.IgnoreDependency;
-import org.jboss.annotation.ejb.PoolClass;
import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.ejb3.StrictMaxPool;
import org.jboss.mx.util.MBeanServerLocator;
import org.rhq.core.db.DatabaseType;
@@ -76,18 +74,6 @@ import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.SystemDatabaseInformation;
@Stateless
-// NOTE: The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean, StatusManagerBean, and SystemManagerBean
-// SLSB's are all invoked, either directly or indirectly, by EJB timers. Since EJB timer invocations are always
-// done in new threads, using the default SLSB pool impl ({@link ThreadlocalPool}) would cause a new instance of
-// this SLSB to be created every time it was invoked by an EJB timer. This would be bad because an existing
-// instance would not be reused, but it is really bad because the instance would also never get destroyed, causing
-// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
-// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
-// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
-// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
-// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemote {
private final String SQL_VACUUM = "VACUUM ANALYZE {0}";
diff --git a/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml b/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
index eef6d52..8892da8 100644
--- a/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
+++ b/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
@@ -1,6 +1,141 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
-<jboss>
+<jboss xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+ version="3.0">
+
+ <enterprise-beans>
+
+ <!--
+ The AlertConditionLogManagerBean, AlertConditionManagerBean, AlertDampeningManagerBean,
+ AlertDefinitionManagerBean, and CachedConditionManagerBean SLSB's are all invoked, either directly or
+ indirectly, by the AlertConditionConsumerBean MDB. Since MDB invocations are always done in new threads, using
+ the default SLSB pool impl (ThreadlocalPool) would cause a new instance of this SLSB to be created
+ every time it was invoked by AlertConditionConsumerBean. This would be bad if only because an existing instance would
+ not be reused, but it is really bad because the instance would also never get destroyed, causing heap space to
+ gradually leak until the Server eventually ran out of memory. Hence, we must use a StrictMaxPool, which
+ will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because lots of alert
+ definitions could result in many concurrent calls to AlertConditionConsumerBean, and because most of these
+ SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's), we set the max pool size to 100 to
+ minimize the chances of AlertConditionConsumerBean invocations, which are the most critical, from having to
+ block and potentially getting backed up in the queue. We set the pool timeout extremely high to essentially
+ prevent queued callers from timing out. Note, MDB's are configured in ejb3-interceptors-aop.xml to use a strict
+ max pool with a max of 15 and a timeout of 10000, so AlertConditionConsumerBean could become a bottleneck for
+ systems with a lot of alerts defined. (ips, 05/10/11)
+
+ For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 .
+ -->
+
+ <session>
+ <ejb-name>AlertConditionLogManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>100</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>AlertConditionManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>100</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>AlertDampeningManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>100</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>AlertDefinitionManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>100</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>CachedConditionManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>100</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+
+ <!--
+ The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean, StatusManagerBean, and SystemManagerBean
+ SLSB's are all invoked, either directly or indirectly, by EJB timers. Since EJB timer invocations are always
+ done in new threads, using the default SLSB pool impl (ThreadlocalPool) would cause a new instance of this
+ SLSB to be created every time it was invoked by an EJB timer. This would be bad if only because an existing
+ instance would not be reused, but it is really bad because the instance would also never get destroyed, causing
+ heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
+ StrictMaxPool, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
+ The timer invocations will only require one or two instances at any given time, but because most of these
+ SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's, we set the max pool size to 30, to
+ minimize the chances of EJB timer invocations, which are the most critical, from having to block and
+ potentially getting backed up in the queue. We set the pool timeout extremely high to essentially prevent
+ queued callers from timing out. (ips, 05/10/11)
+
+ For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 .
+ -->
+
+ <session>
+ <ejb-name>CacheConsistencyManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>30</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>CloudManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>30</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>ServerManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>30</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>StatusManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>30</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ <session>
+ <ejb-name>SystemManagerBean</ejb-name>
+ <pool-config>
+ <pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
+ <pool-max-size>30</pool-max-size>
+ <pool-timeout>1000000000</pool-timeout>
+ </pool-config>
+ </session>
+
+ </enterprise-beans>
</jboss>
13 years, 1 month
[rhq] Branch 'release-4.0.0' - 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java | 213 ++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 240 +++++++---
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java | 34 +
4 files changed, 372 insertions(+), 116 deletions(-)
New commits:
commit 610b23bf0b88470c76727b81a6c9bc032ab3f147
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu May 5 13:35:01 2011 -0400
BZ 702109 - skip fields that are static final or transient since they won't be serialized anyway.
diff --git a/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java b/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java
index 6cea6b8..de57afb 100644
--- a/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java
+++ b/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java
@@ -24,9 +24,9 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -55,6 +55,20 @@ public class HibernateDetachUtility {
SERIALIZATION, JAXB
}
+ // be able to configure the deepest recursion this utility will be allowed to go (see BZ 702109 that precipitated this need)
+ private static final String DEPTH_ALLOWED_SYSPROP = "rhq.server.hibernate-detach-utility.depth-allowed";
+ private static final int depthAllowed;
+ static {
+ int value;
+ try {
+ String str = System.getProperty(DEPTH_ALLOWED_SYSPROP, "50");
+ value = Integer.parseInt(str);
+ } catch (Throwable t) {
+ value = 50;
+ }
+ depthAllowed = value;
+ }
+
public static void nullOutUninitializedFields(Object value, SerializationType serializationType) throws Exception {
long start = System.currentTimeMillis();
Map<Integer, Object> checkedObjects = new HashMap<Integer, Object>();
@@ -71,8 +85,13 @@ public class HibernateDetachUtility {
private static void nullOutUninitializedFields(Object value, Map<Integer, Object> checkedObjects, int depth,
SerializationType serializationType) throws Exception {
- if (depth > 50) {
- LOG.warn("Getting different object hierarchies back from calls: " + value.getClass().getName());
+ if (depth > depthAllowed) {
+ LOG.warn("Recursed too deep [" + depth + " > " + depthAllowed
+ + "], will not attempt to detach object of type ["
+ + ((value != null) ? value.getClass().getName() : "N/A")
+ + "]. This may cause serialization errors later. If so, "
+ + "you can try to work around this by setting the system property [" + DEPTH_ALLOWED_SYSPROP
+ + "] to a value higher than [" + depth + "].");
return;
}
@@ -163,7 +182,14 @@ public class HibernateDetachUtility {
Class tmpClass = object.getClass();
List<Field> fieldsToClean = new ArrayList<Field>();
while (tmpClass != null && tmpClass != Object.class) {
- Collections.addAll(fieldsToClean, tmpClass.getDeclaredFields());
+ Field[] declaredFields = tmpClass.getDeclaredFields();
+ for (Field declaredField : declaredFields) {
+ // do not process static final or transient fields since they won't be serialized anyway
+ int modifiers = declaredField.getModifiers();
+ if (!((Modifier.isFinal(modifiers) && Modifier.isStatic(modifiers)) || Modifier.isTransient(modifiers))) {
+ fieldsToClean.add(declaredField);
+ }
+ }
tmpClass = tmpClass.getSuperclass();
}
commit d3b9181df416bfb018b18ba102d92229970e948b
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu May 5 15:02:02 2011 -0400
BZ: 698100: ability to add graphable elements to monitor/graphs tab.
-additionally pruned out traits from being listed for measurement additions to default dash and to graphs views.
-added sorting to Resource/Group menu item lists for Operations,Measurements and Imports.
-removed autogroup specific url bits as all are persisted groups now.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
index bc2da4f..525f92c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
@@ -23,7 +23,17 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import java.util.EnumSet;
-
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeSet;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
@@ -36,6 +46,7 @@ import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.ResourceType;
@@ -143,10 +154,11 @@ public class ResourceGroupContextMenu extends LocatableMenu {
pluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
if (isAutoGroup) {
- CoreGUI.goToView(LinkManager.getAutoGroupTabLink(group.getId(), "Inventory", "ConnectionSettings"));
+ CoreGUI.goToView(LinkManager.getAutoGroupTabLink(group.getId(), "Inventory",
+ "ConnectionSettings"));
} else if (isAutoCluster) {
- CoreGUI.goToView(LinkManager
- .getAutoClusterTabLink(group.getId(), "Inventory", "ConnectionSettings"));
+ CoreGUI.goToView(LinkManager.getAutoClusterTabLink(group.getId(), "Inventory",
+ "ConnectionSettings"));
} else {
CoreGUI.goToView(LinkManager.getResourceGroupTabLink(group.getId(), "Inventory",
"ConnectionSettings"));
@@ -182,18 +194,28 @@ public class ResourceGroupContextMenu extends LocatableMenu {
// Operations Menu
MenuItem operations = new MenuItem(MSG.view_tree_common_contextMenu_operations());
- boolean operationsEnabled = (groupComposite.getResourcePermission().isControl() && null != resourceType.getOperationDefinitions() && !resourceType
- .getOperationDefinitions().isEmpty());
+ boolean operationsEnabled = (groupComposite.getResourcePermission().isControl()
+ && null != resourceType.getOperationDefinitions() && !resourceType.getOperationDefinitions().isEmpty());
operations.setEnabled(operationsEnabled);
if (operationsEnabled) {
Menu opSubMenu = new Menu();
- for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, OperationDefinition> definitionMap = new HashMap<String, OperationDefinition>();
+ for (OperationDefinition o : resourceType.getOperationDefinitions()) {
+ ordered.add(o.getDisplayName());
+ definitionMap.put(o.getDisplayName(), o);
+ }
+
+ for (String displayName : ordered) {
+ final OperationDefinition operationDefinition = definitionMap.get(displayName);
+
MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
operationItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- String viewPath = LinkManager.getResourceGroupTabLink(group,
- ResourceDetailView.Tab.OPERATIONS, ResourceDetailView.OperationsSubTab.SCHEDULES)
- + "/0/" + operationDefinition.getId();
+ String viewPath = LinkManager.getResourceGroupTabLink(group, ResourceDetailView.Tab.OPERATIONS,
+ ResourceDetailView.OperationsSubTab.SCHEDULES)
+ + "/0/" + operationDefinition.getId();
CoreGUI.goToView(viewPath);
}
});
@@ -284,57 +306,135 @@ public class ResourceGroupContextMenu extends LocatableMenu {
public void onSuccess(PageList<Dashboard> result) {
if (type.getMetricDefinitions() != null) {
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new MenuItem(MSG
- .view_tree_common_contextMenu_addChartToDashboard(d.getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
-
- DashboardPortlet p = new DashboardPortlet(MSG
- .view_tree_common_contextMenu_groupGraph(), ResourceGroupGraphPortlet.KEY,
- 250);
- p.getConfiguration().put(
- new PropertySimple(ResourceGroupGraphPortlet.CFG_RESOURCE_GROUP_ID, group
- .getId()));
- p.getConfiguration()
- .put(
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, MeasurementDefinition> definitionMap = new HashMap<String, MeasurementDefinition>();
+ for (MeasurementDefinition m : type.getMetricDefinitions()) {
+ ordered.add(m.getDisplayName());
+ definitionMap.put(m.getDisplayName(), m);
+ }
+
+ for (String displayName : ordered) {
+ final MeasurementDefinition def = definitionMap.get(displayName);
+ //only add menu items for Measurement
+ if (def.getDataType().equals(DataType.MEASUREMENT)) {
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem(MSG
+ .view_tree_common_contextMenu_addChartToDashboard(d.getName()));
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+
+ DashboardPortlet p = new DashboardPortlet(MSG
+ .view_tree_common_contextMenu_groupGraph(),
+ ResourceGroupGraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(ResourceGroupGraphPortlet.CFG_RESOURCE_GROUP_ID,
+ group.getId()));
+ p.getConfiguration().put(
new PropertySimple(ResourceGroupGraphPortlet.CFG_DEFINITION_ID, def
.getId()));
- d.addPortlet(p);
-
- GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
- caught);
+ d.addPortlet(p);
+
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI
+ .getErrorHandler()
+ .handleError(
+ MSG
+ .view_tree_common_contextMenu_saveChartToDashboardFailure(),
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ String msg = MSG
+ .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
+ .getName());
+ CoreGUI.getMessageCenter().notify(
+ new Message(msg, Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+
+ //add new menu item for adding current graphable element to view if on Monitor/Graphs tab
+ String currentViewPath = History.getToken();
+ if (currentViewPath.indexOf("Monitoring/Graphs") > -1) {
+ MenuItem addGraphItem = new MenuItem(MSG.common_title_add_graph_to_view());
+ defSubItem.addItem(addGraphItem);
+
+ addGraphItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+ //generate javascript to call out to.
+ //Ex. menuLayers.hide();addMetric('${metric.resourceId},${metric.scheduleId}')
+ String grpGraphElements = "";
+ if (isAutoGroup) {
+ grpGraphElements += "ag,";
+ } else {
+ grpGraphElements += "cg,";
}
-
- public void onSuccess(Dashboard result) {
- String msg = MSG
- .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName());
- CoreGUI.getMessageCenter().notify(
- new Message(msg, Message.Severity.Info));
+ grpGraphElements += group.getId() + "," + def.getId();
+ if (isAutoGroup) {//need to postpend the resource type as third element
+ grpGraphElements += "," + group.getResourceType().getId();
}
- });
-
- }
- });
-
- }
-
- }
+ //construct portal.war url to access
+ String baseUrl = "/resource/common/monitor/visibility/IndicatorCharts.do";
+ //No need to rebuild the autogroup url as everything handled as a compatible group now
+ // if (isAutoGroup) {
+ // //Ex. ?parent=10001&ctype=1013&view=Default
+ // baseUrl += "?parent=" + group.getAutoGroupParentResource().getId()
+ // + "&ctype="
+ // + group.getResourceType().getId();
+ // jsCode = "ag," + group.getAutoGroupParentResource().getId() + ","
+ // + def.getId() + ","
+ // + group.getResourceType().getId();
+ // } else {
+ //Ex. ?groupId=10001&view=Default
+ baseUrl += "?groupId=" + group.getId();
+ baseUrl += "&view=Default";
+ baseUrl += "&action=addChart&metric=" + grpGraphElements;
+ baseUrl += "&view=Default";
+ final String url = baseUrl;
+ //initiate HTTP request
+ final RequestBuilder b = new RequestBuilder(RequestBuilder.GET, baseUrl);
+
+ try {
+ b.setCallback(new RequestCallback() {
+ public void onResponseReceived(final Request request,
+ final Response response) {
+ Log
+ .trace("Successfully submitted request to add graph to view:"
+ + url);
+
+ //kick off a page reload.
+ String currentViewPath = History.getToken();
+ CoreGUI.goToView(currentViewPath, true);
+ }
+
+ @Override
+ public void onError(Request request, Throwable t) {
+ Log.trace("Error adding Metric:" + url, t);
+ }
+ });
+ b.send();
+ } catch (RequestException e) {
+ Log.trace("Error adding Metric:" + url, e);
+ }
+ }//end of onClick definition
+ });//end of onClick Handler definition
+ }//end of Monitoring/Graphs view check
+ }//end of dashabord iteration
+ }//end of check for Measurement
+ }//end of metric definition iteration
}
}
@@ -342,4 +442,5 @@ public class ResourceGroupContextMenu extends LocatableMenu {
measurements.setSubmenu(measurementsSubMenu);
return measurements;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index ceb74c1..7149726 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -27,8 +27,14 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeSet;
import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSCallback;
@@ -57,7 +63,9 @@ import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.MeasurementSchedule;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
@@ -344,6 +352,7 @@ public class ResourceTreeView extends LocatableVLayout {
// fetch the resource composite, we need resource permission info for enablement decisions
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
+ criteria.fetchSchedules(true);
GWTServiceLookup.getResourceService().findResourceCompositesByCriteria(criteria,
new AsyncCallback<PageList<ResourceComposite>>() {
@@ -405,7 +414,8 @@ public class ResourceTreeView extends LocatableVLayout {
pluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Inventory", "ConnectionSettings"));
+ CoreGUI.goToView(LinkManager
+ .getResourceTabLink(resource.getId(), "Inventory", "ConnectionSettings"));
}
});
}
@@ -436,14 +446,24 @@ public class ResourceTreeView extends LocatableVLayout {
operations.setEnabled(operationsEnabled);
if (operationsEnabled) {
Menu opSubMenu = new Menu();
- for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
+
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, OperationDefinition> definitionMap = new HashMap<String, OperationDefinition>();
+ for (OperationDefinition o : resourceType.getOperationDefinitions()) {
+ ordered.add(o.getDisplayName());
+ definitionMap.put(o.getDisplayName(), o);
+ }
+ for (String displayName : ordered) {
+ final OperationDefinition operationDefinition = definitionMap.get(displayName);
+
MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
operationItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
String viewPath = LinkManager.getResourceTabLink(resource.getId(),
- ResourceDetailView.Tab.OPERATIONS, ResourceDetailView.OperationsSubTab.SCHEDULES)
- + "/0/" + operationDefinition.getId();
+ ResourceDetailView.Tab.OPERATIONS, ResourceDetailView.OperationsSubTab.SCHEDULES)
+ + "/0/" + operationDefinition.getId();
CoreGUI.goToView(viewPath);
}
});
@@ -461,7 +481,16 @@ public class ResourceTreeView extends LocatableVLayout {
boolean createChildResourcesEnabled = resourcePermission.isCreateChildResources();
if (createChildResourcesEnabled) {
Menu createChildSubMenu = new Menu();
- for (final ResourceType childType : resourceType.getChildResourceTypes()) {
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, ResourceType> typeMap = new HashMap<String, ResourceType>();
+ for (ResourceType o : resourceType.getChildResourceTypes()) {
+ ordered.add(o.getName());
+ typeMap.put(o.getName(), o);
+ }
+
+ for (String type : ordered) {
+ final ResourceType childType = typeMap.get(type);
if (childType.isCreatable()) {
MenuItem createItem = new MenuItem(childType.getName());
@@ -487,7 +516,16 @@ public class ResourceTreeView extends LocatableVLayout {
boolean manualImportEnabled = resourcePermission.isCreateChildResources();
if (manualImportEnabled) {
Menu importChildSubMenu = new Menu();
- for (final ResourceType childType : resourceType.getChildResourceTypes()) {
+
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, ResourceType> typeMap = new HashMap<String, ResourceType>();
+ for (ResourceType o : resourceType.getChildResourceTypes()) {
+ ordered.add(o.getName());
+ typeMap.put(o.getName(), o);
+ }
+ for (String name : ordered) {
+ final ResourceType childType = typeMap.get(name);
if (childType.isSupportsManualAdd()) {
MenuItem importItem = new MenuItem(childType.getName());
@@ -501,7 +539,6 @@ public class ResourceTreeView extends LocatableVLayout {
importChildSubMenu.addItem(importItem);
}
}
-
if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
loadManuallyAddServersToPlatforms(importChildSubMenu, resource);
}
@@ -527,7 +564,17 @@ public class ResourceTreeView extends LocatableVLayout {
}
public void onSuccess(PageList<ResourceType> result) {
- for (final ResourceType type : result) {
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, ResourceType> displayTypes = new HashMap<String, ResourceType>();
+ for (ResourceType type : result) {
+ displayTypes.put(type.getName(), type);
+ ordered.add(type.getName());
+ }
+
+ int idx = 0;
+ for (String displayType : ordered) {
+ final ResourceType type = displayTypes.get(displayType);
if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
MenuItem item = new MenuItem(type.getName());
@@ -538,7 +585,7 @@ public class ResourceTreeView extends LocatableVLayout {
}
});
- manuallyAddMenu.addItem(item);
+ manuallyAddMenu.addItem(item, idx++);
}
}
}
@@ -559,57 +606,118 @@ public class ResourceTreeView extends LocatableVLayout {
}
public void onSuccess(PageList<Dashboard> result) {
+ //sort the display items alphabetically
+ TreeSet<String> ordered = new TreeSet<String>();
+ Map<String, MeasurementDefinition> definitionMap = new HashMap<String, MeasurementDefinition>();
+ for (MeasurementDefinition m : type.getMetricDefinitions()) {
+ ordered.add(m.getDisplayName());
+ definitionMap.put(m.getDisplayName(), m);
+ }
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
- .getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
-
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
- DashboardPortlet p = new DashboardPortlet(MSG
- .view_tree_common_contextMenu_resourceGraph(), ResourceGraphPortlet.KEY, 250);
- p.getConfiguration().put(
- new PropertySimple(ResourceGraphPortlet.CFG_RESOURCE_ID, resource.getId()));
- p.getConfiguration().put(
- new PropertySimple(ResourceGraphPortlet.CFG_DEFINITION_ID, def.getId()));
-
- d.addPortlet(p);
-
- GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
- caught);
- }
+ for (String displayName : ordered) {
+ final MeasurementDefinition def = definitionMap.get(displayName);
+ //only add menu items for Measurement
+ if (def.getDataType().equals(DataType.MEASUREMENT)) {
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem(MSG
+ .view_tree_common_contextMenu_addChartToDashboard(d.getName()));
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+ DashboardPortlet p = new DashboardPortlet(MSG
+ .view_tree_common_contextMenu_resourceGraph(), ResourceGraphPortlet.KEY,
+ 250);
+ p.getConfiguration().put(
+ new PropertySimple(ResourceGraphPortlet.CFG_RESOURCE_ID, resource.getId()));
+ p.getConfiguration().put(
+ new PropertySimple(ResourceGraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p);
+
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ CoreGUI
+ .getMessageCenter()
+ .notify(
+ new Message(
+ MSG
+ .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
+ .getName()), Message.Severity.Info));
+ }
+ });
- public void onSuccess(Dashboard result) {
- CoreGUI
- .getMessageCenter()
- .notify(
- new Message(
- MSG
- .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName()), Message.Severity.Info));
+ }
+ });
+
+ //add new menu item for adding current graphable element to view if on Monitor/Graphs tab
+ String currentViewPath = History.getToken();
+ if (currentViewPath.indexOf("Monitoring/Graphs") > -1) {
+ MenuItem addGraphItem = new MenuItem(MSG.common_title_add_graph_to_view());
+ defSubItem.addItem(addGraphItem);
+
+ addGraphItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+ //generate javascript to call out to.
+ //Ex. menuLayers.hide();addMetric('${metric.resourceId},${metric.scheduleId}')
+ if (getScheduleDefinitionId(resource, def.getName()) > -1) {
+ String resourceGraphElements = resource.getId() + ","
+ + getScheduleDefinitionId(resource, def.getName());
+
+ //construct portal.war url to access
+ String baseUrl = "/resource/common/monitor/visibility/IndicatorCharts.do";
+ baseUrl += "?id=" + resource.getId();
+ baseUrl += "&view=Default";
+ baseUrl += "&action=addChart&metric=" + resourceGraphElements;
+ baseUrl += "&view=Default";
+ final String url = baseUrl;
+ //initiate HTTP request
+ final RequestBuilder b = new RequestBuilder(RequestBuilder.GET, baseUrl);
+
+ try {
+ b.setCallback(new RequestCallback() {
+ public void onResponseReceived(final Request request,
+ final Response response) {
+ Log
+ .trace("Successfully submitted request to add graph to view:"
+ + url);
+
+ //kick off a page reload.
+ String currentViewPath = History.getToken();
+ CoreGUI.goToView(currentViewPath, true);
+ }
+
+ @Override
+ public void onError(Request request, Throwable t) {
+ Log.trace("Error adding Metric:" + url, t);
+ }
+ });
+ b.send();
+ } catch (RequestException e) {
+ Log.trace("Error adding Metric:" + url, e);
+ }
}
- });
-
+ }
+ });
}
- });
-
- }
-
- }
+ // }//end trait check
+ }//end dashboard iteration
+ }//end trait exclusion
+ }//end measurement def iteration
}
});
@@ -617,6 +725,26 @@ public class ResourceTreeView extends LocatableVLayout {
return measurements;
}
+ /** Locate the specific schedule definition using the definition identifier.
+ */
+ private int getScheduleDefinitionId(Resource resource, String definitionName) {
+ int id = -1;
+ if (resource.getSchedules() != null) {
+ boolean located = false;
+ MeasurementSchedule[] schedules = new MeasurementSchedule[resource.getSchedules().size()];
+ resource.getSchedules().toArray(schedules);
+ for (int i = 0; (!located && i < resource.getSchedules().size()); i++) {
+ MeasurementSchedule schedule = schedules[i];
+ MeasurementDefinition definition = schedule.getDefinition();
+ if ((definition != null) && definition.getName().equals(definitionName)) {
+ located = true;
+ id = schedule.getId();
+ }
+ }
+ }
+ return id;
+ }
+
private void setRootResource(Resource rootResource) {
this.rootResource = rootResource;
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 50138b7..9f5684b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -94,6 +94,7 @@ common_severity_fatal = Fatal
#--------------
common_title_address = Address
common_title_add_column = Add Column
+common_title_add_graph_to_view = Add Graph to Monitor View
common_title_add_portlet = Add Portlet
common_title_alert_range = Alert Range
common_title_ancestry = Ancestry
13 years, 1 month
[rhq] Branch 'release-4.0.0' - 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java | 5 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java | 20 ++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java | 28 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java | 23 ++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java | 19 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java | 19 ++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java | 27 +++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java | 20 ++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationSchedulePortlet.java | 5 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceBundleDeploymentsPortlet.java | 6 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java | 3 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java | 6 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java | 4 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOobsPortlet.java | 6 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java | 6 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 4 -
16 files changed, 129 insertions(+), 72 deletions(-)
New commits:
commit 64fd52bb1fb072f79f8e5f02793d11fcd31e6225
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Apr 27 16:06:30 2011 -0400
[BZ 699842 - ORA-00907: missing right parenthesis]
This is actually a fix to workaround HHH-3096 where hibernate generates
invalid SQL for "Select Count(entity)" if entity has a composite key.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 9b8c2ec..4bf2bae 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -306,13 +306,13 @@ public final class CriteriaQueryGenerator {
return EnumType.STRING; // catch-all
}
- // for testing purposes only, should use getQuery(EntityManager) or getCountQuery(EntityManager) instead
public String getQueryString(boolean countQuery) {
StringBuilder results = new StringBuilder();
results.append("SELECT ");
if (countQuery) {
if (groupByClause == null) { // non-grouped method
- results.append("COUNT(").append(alias).append(")").append(NL);
+ // use count(*) instead of count(alias) due to https://bugzilla.redhat.com/show_bug.cgi?id=699842
+ results.append("COUNT(*)").append(NL);
} else {
// gets the count of the number of aggregate/grouped rows
// NOTE: this only works when the groupBy is a single element, as opposed to a list of elements
commit 4f170f279de765614c4a9570630bd3640696e8f3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Apr 27 12:57:16 2011 -0400
[BZ 700176 - Several refresh issues in resource portlets]
There were a variety of contributing factors. In several cases the
resource portlets were not resetting the "loading" flag on initialization
which prevented subsequent refreshes from doing any work. And several
were locally caching config data that could go stale.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
index e8d51d1..530ed35 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
@@ -95,9 +95,12 @@ public class PortletWindow extends LocatableWindow {
};
private ClickHandler refreshHandler = new ClickHandler() {
+
@SuppressWarnings("unchecked")
public void onClick(ClickEvent clickEvent) {
- if (PortletWindow.this.view instanceof Table) {
+ if (PortletWindow.this.view instanceof AutoRefreshPortlet) {
+ ((AutoRefreshPortlet) PortletWindow.this.view).refresh();
+ } else if (PortletWindow.this.view instanceof Table) {
((Table) PortletWindow.this.view).refresh();
} else {
((Canvas) PortletWindow.this.view).redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
index f54ea54..944b674 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
@@ -70,8 +70,6 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
protected LocatableCanvas recentBundleDeployContent = new LocatableCanvas(
extendLocatorId("RecentBundleDeployments"));
protected boolean currentlyLoading = false;
- protected Configuration portletConfig = null;
- protected DashboardPortlet storedPortlet;
// A non-displayed, persisted identifier for the portlet
public static final String KEY = "GroupBundleDeployments";
@@ -123,8 +121,8 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -154,6 +152,9 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
@Override
public DynamicForm getCustomSettingsForm() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
//build editor form container
@@ -170,12 +171,13 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
public void onSubmitValues(SubmitValuesEvent event) {
//results count
- portletConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector, portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector,
+ portletConfig);
//persist
- storedPortlet.setConfiguration(portletConfig);
+ storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
- loadData();
+ refresh();
}
});
@@ -187,6 +189,8 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
/** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
*/
protected void getRecentBundleDeployments() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final int groupId = this.groupId;
GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
@@ -256,8 +260,8 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
}
recentBundleDeployContent.addChild(column);
recentBundleDeployContent.markForRedraw();
- markForRedraw();
currentlyLoading = false;
+ markForRedraw();
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
index c36b320..f4fa675 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
@@ -106,8 +106,6 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
protected Canvas containerCanvas;
protected Timer refreshTimer;
- protected DashboardPortlet storedPortlet;
- protected Configuration portletConfig;
private ResourceGroupComposite groupComposite;
protected boolean portletConfigInitialized = false;
protected boolean currentlyLoading = false;
@@ -155,8 +153,8 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -173,6 +171,8 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
@Override
public DynamicForm getCustomSettingsForm() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
//build editor form container
@@ -201,8 +201,6 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
@Override
public void onSubmitValues(SubmitValuesEvent event) {
- String selectedValue;
-
// //result sort order
// selectedValue = resultSortSelector.getValue().toString();
// if ((selectedValue.trim().isEmpty()) || (selectedValue.equalsIgnoreCase(PageOrdering.DESC.name()))) {//then desc
@@ -211,21 +209,20 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
// portletConfig.put(new PropertySimple(Constant.RESULT_SORT_ORDER, PageOrdering.ASC));
// }
//config status
- portletConfig = AbstractActivityView.saveConfigUpdateStatusSelectorSettings(resultStatusSelector,
- portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveConfigUpdateStatusSelectorSettings(
+ resultStatusSelector, portletConfig);
//result count
- portletConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector, portletConfig);
+ updatedConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector, updatedConfig);
//time range settings
- portletConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
- portletConfig);
+ updatedConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
+ updatedConfig);
//persist and reload portlet
storedPortlet.setConfiguration(portletConfig);
configure(portletWindow, storedPortlet);
- // refresh();
- redraw();
+ refresh();
}
});
form.markForRedraw();
@@ -297,6 +294,9 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
}
protected void loadData() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
//populate composite data
//locate resourceGroupRef
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
@@ -352,7 +352,7 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
groupComposite);
}
- //update table for portlet display.
+ //update table for portlet display.
groupHistoryTable.setDataSource(new GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
groupId));
groupHistoryTable.setShowHeader(false);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
index f88774f..9b5fb96 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
@@ -88,8 +88,6 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
private int groupId = -1;
protected LocatableCanvas recentEventsContent = new LocatableCanvas(extendLocatorId("RecentEvents"));
protected boolean currentlyLoading = false;
- protected Configuration portletConfig = null;
- protected DashboardPortlet storedPortlet;
public GroupEventsPortlet(String locatorId) {
super(locatorId);
@@ -126,8 +124,8 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -159,6 +157,9 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
final LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
//add range selector
final CustomConfigMeasurementRangeEditor measurementRangeEditor = PortletConfigurationEditorComponent
.getMeasurementRangeEditor(portletConfig);
@@ -170,14 +171,13 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
public void onSubmitValues(SubmitValuesEvent event) {
//persist the measurement range selections
- portletConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
- portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(
+ measurementRangeEditor, portletConfig);
//persist
- storedPortlet.setConfiguration(portletConfig);
+ storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
- redraw();
- customSettings.markForRedraw();
+ refresh();
}
});
page.addMember(measurementRangeEditor);
@@ -193,6 +193,9 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
long end = System.currentTimeMillis();
long start = end - (24 * 60 * 60 * 1000);
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
//result timeframe if enabled
PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
@@ -287,8 +290,8 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
}
recentEventsContent.addChild(column);
recentEventsContent.markForRedraw();
- markForRedraw();
setCurrentlyRefreshing(false);
+ markForRedraw();
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index 7198004..1c5b526 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -84,8 +84,6 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
private int groupId = -1;
protected LocatableCanvas recentMeasurementsContent = new LocatableCanvas(extendLocatorId("RecentMetrics"));
protected boolean currentlyLoading = false;
- protected Configuration portletConfig = null;
- protected DashboardPortlet storedPortlet;
protected String baseViewPath = "";
protected long start = -1;
protected long end = -1;
@@ -148,8 +146,8 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -185,6 +183,8 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
//embed range editor in it own container
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final CustomConfigMeasurementRangeEditor measurementRangeEditor = PortletConfigurationEditorComponent
.getMeasurementRangeEditor(portletConfig);
@@ -193,13 +193,13 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
@Override
public void onSubmitValues(SubmitValuesEvent event) {
//retrieve range editor values
- portletConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
- portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(
+ measurementRangeEditor, portletConfig);
//persist
- storedPortlet.setConfiguration(portletConfig);
+ storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
- loadData();
+ refresh();
}
});
page.addMember(measurementRangeEditor);
@@ -212,6 +212,9 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
* digits.
*/
protected void getRecentMetrics() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
//display container
final VLayout column = new VLayout();
column.setHeight(10);//pack
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
index 69ee7ee..aa1fdca 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
@@ -74,8 +74,6 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
private int groupId = -1;
protected LocatableCanvas recentOobContent = new LocatableCanvas(extendLocatorId("RecentOobs"));
protected boolean currentlyLoading = false;
- protected Configuration portletConfig = null;
- protected DashboardPortlet storedPortlet;
// set on initial configuration, the window for this portlet view.
protected PortletWindow portletWindow;
@@ -122,8 +120,8 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -153,6 +151,9 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
@Override
public DynamicForm getCustomSettingsForm() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
//build editor form container
@@ -169,12 +170,13 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
public void onSubmitValues(SubmitValuesEvent event) {
//results count
- portletConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector, portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector,
+ portletConfig);
//persist
- storedPortlet.setConfiguration(portletConfig);
+ storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
- loadData();
+ refresh();
}
});
@@ -187,6 +189,9 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
* oob change details.
*/
protected void getRecentOobs() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
final int groupId = this.groupId;
int resultCount = 5;//default to
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
index 196b55d..9606874 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
@@ -103,8 +103,6 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
protected Canvas containerCanvas;
protected Timer refreshTimer;
- protected DashboardPortlet storedPortlet;
- protected Configuration portletConfig;
protected int groupId;
protected boolean portletConfigInitialized = false;
private ResourceGroupComposite groupComposite;
@@ -117,7 +115,7 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
this.locatorId = locatorId;
//figure out which page we're loading
String currentPage = History.getToken();
- String[] elements = currentPage.split("/");
+ //String[] elements = currentPage.split("/");
int groupId = AbstractActivityView.groupIdLookup(currentPage);
this.groupId = groupId;
//populate basepath
@@ -134,6 +132,9 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
}
private void loadData() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
//populate composite data
//locate resourceGroupRef
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
@@ -189,8 +190,8 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
child.destroy();
}
recentOperationsContent.addChild(groupOperations);
- recentOperationsContent.markForRedraw();
currentlyRefreshing = false;
+ recentOperationsContent.markForRedraw();
}
});
}
@@ -218,8 +219,8 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -236,6 +237,9 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
@Override
public DynamicForm getCustomSettingsForm() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
//build editor form container
@@ -265,23 +269,24 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
public void onSubmitValues(SubmitValuesEvent event) {
//result count
- portletConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector, portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector,
+ portletConfig);
//time range configuration
- portletConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
+ updatedConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
portletConfig);
//operation priority
- portletConfig = AbstractActivityView.saveOperationStatusSelectorSettings(operationStatusSelector,
+ updatedConfig = AbstractActivityView.saveOperationStatusSelectorSettings(operationStatusSelector,
portletConfig);
//persist and reload portlet
- storedPortlet.setConfiguration(portletConfig);
+ storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
//resynch the config object in the datasource
groupOperations.setDatasource(new GroupOperationsCriteriaDataSource(portletConfig));
//apply latest settings to the visible result set
- redraw();
+ refresh();
}
});
form.markForRedraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
index 7e02ec9..742c0a7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
@@ -71,8 +71,6 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
private int groupId = -1;
protected LocatableCanvas recentPkgHistoryContent = new LocatableCanvas(extendLocatorId("RecentPkgHistory"));
protected boolean currentlyLoading = false;
- protected Configuration portletConfig = null;
- protected DashboardPortlet storedPortlet;
public static final String ID = "id";
@@ -120,8 +118,8 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
return;
}
- this.storedPortlet = storedPortlet;
- portletConfig = storedPortlet.getConfiguration();
+
+ Configuration portletConfig = storedPortlet.getConfiguration();
//lazy init any elements not yet configured.
for (String key : PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
@@ -151,6 +149,9 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
@Override
public DynamicForm getCustomSettingsForm() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
+
LocatableDynamicForm customSettings = new LocatableDynamicForm(extendLocatorId("customSettings"));
LocatableVLayout page = new LocatableVLayout(customSettings.extendLocatorId("page"));
//build editor form container
@@ -167,12 +168,13 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
public void onSubmitValues(SubmitValuesEvent event) {
//results count
- portletConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector, portletConfig);
+ Configuration updatedConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector,
+ portletConfig);
//persist
- storedPortlet.setConfiguration(portletConfig);
+ storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
- loadData();
+ refresh();
}
});
@@ -184,6 +186,8 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
/** Fetches recent package history information and updates the DynamicForm instance with details.
*/
protected void getRecentPkgHistory() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final int groupId = this.groupId;
InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
@@ -255,8 +259,8 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
}
recentPkgHistoryContent.addChild(column);
recentPkgHistoryContent.markForRedraw();
- markForRedraw();
currentlyLoading = false;
+ markForRedraw();
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationSchedulePortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationSchedulePortlet.java
index 3d7521d..b26405b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationSchedulePortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationSchedulePortlet.java
@@ -289,10 +289,9 @@ public class OperationSchedulePortlet extends LocatableVLayout implements Custom
new PropertySimple(OPERATIONS_RANGE_SCHEDULED_ENABLED, form
.getValue(OPERATIONS_RANGE_SCHEDULED_ENABLED)));
}
-
+ storedPortlet.setConfiguration(storedPortlet.getConfiguration());
configure(portletWindow, storedPortlet);
-
- redraw();
+ refresh();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceBundleDeploymentsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceBundleDeploymentsPortlet.java
index 72a2449..be2dc7c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceBundleDeploymentsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceBundleDeploymentsPortlet.java
@@ -27,8 +27,10 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.ResourceBundleDeploymentCriteria;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -76,6 +78,8 @@ public class ResourceBundleDeploymentsPortlet extends GroupBundleDeploymentsPort
*/
@Override
protected void getRecentBundleDeployments() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final int resourceId = this.resourceId;
ResourceBundleDeploymentCriteria criteria = new ResourceBundleDeploymentCriteria();
@@ -104,6 +108,7 @@ public class ResourceBundleDeploymentsPortlet extends GroupBundleDeploymentsPort
public void onFailure(Throwable caught) {
Log.debug("Error retrieving installed bundle deployments for resource [" + resourceId + "]:"
+ caught.getMessage());
+ currentlyLoading = false;
}
@Override
@@ -146,6 +151,7 @@ public class ResourceBundleDeploymentsPortlet extends GroupBundleDeploymentsPort
column.markForRedraw();
recentBundleDeployContent.addChild(column);
recentBundleDeployContent.markForRedraw();
+ currentlyLoading = false;
markForRedraw();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
index 4ab8396..f9b2d9d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
@@ -35,6 +35,7 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -98,6 +99,8 @@ public class ResourceConfigurationUpdatesPortlet extends GroupConfigurationUpdat
@Override
protected void loadData() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
//populate composite data
//locate resourceRef
ResourceCriteria criteria = new ResourceCriteria();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
index 7ceef8c..eb52924 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
@@ -28,7 +28,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
@@ -77,6 +79,8 @@ public class ResourceEventsPortlet extends GroupEventsPortlet {
*/
@Override
protected void getRecentEventUpdates() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final int resourceId = this.resourceId;
long end = System.currentTimeMillis();
long start = end - (24 * 60 * 60 * 1000);
@@ -120,6 +124,7 @@ public class ResourceEventsPortlet extends GroupEventsPortlet {
@Override
public void onFailure(Throwable caught) {
Log.debug("Error retrieving event counts for resource [" + resourceId + "]:" + caught.getMessage());
+ setCurrentlyRefreshing(false);
}
@Override
@@ -171,6 +176,7 @@ public class ResourceEventsPortlet extends GroupEventsPortlet {
child.destroy();
}
recentEventsContent.addChild(column);
+ setCurrentlyRefreshing(false);
recentEventsContent.markForRedraw();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index 1adc6f3..0adf94b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -38,8 +38,10 @@ import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.resource.Resource;
@@ -97,6 +99,8 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
*/
@Override
protected void getRecentMetrics() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
//display container
final VLayout column = new VLayout();
column.setHeight(10);//pack
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOobsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOobsPortlet.java
index a6c8005..a2dc372 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOobsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOobsPortlet.java
@@ -28,7 +28,9 @@ import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
@@ -76,6 +78,8 @@ public class ResourceOobsPortlet extends GroupOobsPortlet {
*/
@Override
protected void getRecentOobs() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final int resourceId = this.resourceId;
int resultCount = 5;//default to
@@ -96,6 +100,7 @@ public class ResourceOobsPortlet extends GroupOobsPortlet {
public void onFailure(Throwable caught) {
Log.debug("Error retrieving out of bound metrics for resource [" + resourceId + "]:"
+ caught.getMessage());
+ currentlyLoading = false;
}
@Override
@@ -142,6 +147,7 @@ public class ResourceOobsPortlet extends GroupOobsPortlet {
child.destroy();
}
recentOobContent.addChild(column);
+ currentlyLoading = false;
recentOobContent.markForRedraw();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
index 6071704..0d91bd2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
@@ -25,9 +25,11 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -74,6 +76,8 @@ public class ResourcePkgHistoryPortlet extends GroupPkgHistoryPortlet {
*/
@Override
protected void getRecentPkgHistory() {
+ final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
+ final Configuration portletConfig = storedPortlet.getConfiguration();
final int resourceId = this.resourceId;
InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
@@ -101,6 +105,7 @@ public class ResourcePkgHistoryPortlet extends GroupPkgHistoryPortlet {
public void onFailure(Throwable caught) {
Log.debug("Error retrieving installed package history for group [" + resourceId + "]:"
+ caught.getMessage());
+ currentlyLoading = false;
}
@Override
@@ -144,6 +149,7 @@ public class ResourcePkgHistoryPortlet extends GroupPkgHistoryPortlet {
}
recentPkgHistoryContent.addChild(column);
recentPkgHistoryContent.markForRedraw();
+ currentlyLoading = false;
markForRedraw();
}
});
13 years, 1 month
[rhq] Branch 'release-4.0.0' - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 2 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java | 13 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 3 ++
3 files changed, 16 insertions(+), 2 deletions(-)
New commits:
commit 9b953bd567a507e890c7ee2688c1e9c803cee88e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue May 3 14:45:16 2011 -0400
BZ 696753 and 701314
bump up the timeout when importing, ignoring and unignoring from the auto-discovery queue.
in addition, if any timeout occurs anywhere in the ui, we'll log it as a Warning now and give the user
some information about what is happening (i.e the request timed out, the server may still be processing the request and to wait and see if it succeeded)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index a1d1403..6dde533 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -74,7 +74,7 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
private ToolStrip footer;
private DataSource dataSource;
- private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(60000);
public ResourceAutodiscoveryView(String locatorId) {
super(locatorId);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
index e54ee38..3ce2f52 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
@@ -25,6 +25,7 @@ import com.allen_sauer.gwt.log.client.Log;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Greg Hinkle
@@ -42,7 +43,17 @@ public class ErrorHandler {
}
public void handleError(String message, Throwable t) {
- Message errorMessage = new Message(message, t, Message.Severity.Error);
+ Severity severity;
+
+ if ((t != null) && (t instanceof com.google.gwt.http.client.RequestTimeoutException)) {
+ // if its a timeout exception, log it as a warning since the request might still complete on the server
+ severity = Message.Severity.Warning;
+ message = MSG.common_msg_asyncTimeout(message);
+ } else {
+ severity = Message.Severity.Error;
+ }
+
+ Message errorMessage = new Message(message, t, severity);
CoreGUI.getMessageCenter().notify(errorMessage);
if (t != null) {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 01045ce..50138b7 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -231,6 +231,9 @@ common_msg_noItemsToShow = No items to show
common_msg_notYetImplemented = Not Yet Implemented
common_msg_see_more = see more...
common_msg_step_x_of_y = Step {0} of {1}
+common_msg_asyncTimeout = {0}. This occurred because the server is taking a long time to complete this request. \
+Please be aware that the server may still be processing your request and it may complete shortly. \
+You can check the server logs to see if any abnormal errors occurred.
# Common Values
#--------------
13 years, 1 month
[rhq] Branch 'release-3.0.1' - 2 commits - modules/plugins
by lkrejci
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java | 33 +++++++++-
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java | 3
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 19 +++++
3 files changed, 52 insertions(+), 3 deletions(-)
New commits:
commit 5e55fb232d2496961477debd9d5eaf94837d69d4
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue May 10 16:58:28 2011 +0200
BZ 700616 - make sure to call getVersion() instead of resourceContext.getVersion() directly. This is just to workaround the possible null version being returned from the resourceContext in rare circumstances.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index b83a18c..5ddc1fc 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -910,7 +910,7 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
}
public HttpdAddressUtility getAddressUtility() {
- String version = resourceContext.getVersion();
+ String version = getVersion();
return HttpdAddressUtility.get(version);
}
@@ -963,7 +963,7 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
log.error("Augeas is enabled in configuration but was not found on the system.");
throw new RuntimeException(CONFIGURATION_NOT_SUPPORTED_ERROR_MESSAGE);
}
- String version = resourceContext.getVersion();
+ String version = getVersion();
if (!version.startsWith("2.")) {
log.error(CONFIGURATION_NOT_SUPPORTED_ERROR_MESSAGE);
commit dc92e3b118d14e0aadaf2a2143b566f79662d6d9
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue May 10 16:57:15 2011 +0200
BZ 700616 - ported over the code from master to handle the user provided module name <-> source file mappings for apache modules.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index 22e3f66..b83a18c 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -38,7 +38,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-
import org.rhq.augeas.AugeasProxy;
import org.rhq.augeas.config.AugeasModuleConfig;
import org.rhq.augeas.node.AugeasNode;
@@ -47,6 +46,9 @@ import org.rhq.augeas.util.Glob;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+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.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.event.EventSeverity;
@@ -126,6 +128,11 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
public static final String PLUGIN_CONFIG_VHOST_IN_SINGLE_FILE_PROP_VALUE = "single-file";
public static final String PLUGIN_CONFIG_VHOST_PER_FILE_PROP_VALUE = "vhost-per-file";
+ public static final String PLUGIN_CONFIG_CUSTOM_MODULE_NAMES = "customModuleNames";
+ public static final String PLUGIN_CONFIG_MODULE_MAPPING = "moduleMapping";
+ public static final String PLUGIN_CONFIG_MODULE_NAME = "moduleName";
+ public static final String PLUGIN_CONFIG_MODULE_SOURCE_FILE = "moduleSourceFile";
+
public static final String AUXILIARY_INDEX_PROP = "_index";
public static final String SERVER_BUILT_TRAIT = "serverBuilt";
@@ -217,6 +224,26 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
//init the module names with the defaults
moduleNames = new HashMap<String, String>(ApacheServerDiscoveryComponent.getDefaultModuleNames(binaryInfo.getVersion()));
+
+ //and add the user-provided overrides/additions
+ PropertyList list = resourceContext.getPluginConfiguration().getList(PLUGIN_CONFIG_CUSTOM_MODULE_NAMES);
+
+ if (list != null) {
+ for (Property p : list.getList()) {
+ PropertyMap map = (PropertyMap) p;
+ String sourceFile = map.getSimpleValue(PLUGIN_CONFIG_MODULE_SOURCE_FILE, null);
+ String moduleName = map.getSimpleValue(PLUGIN_CONFIG_MODULE_NAME, null);
+
+ if (sourceFile == null || moduleName == null) {
+ log.info("A corrupted module name mapping found (" + sourceFile + " = " + moduleName
+ + "). Check your module mappings in the plugin configuration for the server: "
+ + resourceContext.getResourceKey());
+ continue;
+ }
+
+ moduleNames.put(sourceFile, moduleName);
+ }
+ }
startEventPollers();
} catch (Exception e) {
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
index 56ac57a..6d4156d 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
@@ -39,6 +39,7 @@ import org.rhq.augeas.util.Glob;
import org.rhq.augeas.util.GlobFilter;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
@@ -309,6 +310,8 @@ public class ApacheServerDiscoveryComponent implements ResourceDiscoveryComponen
PluginDescriptorBasedAugeasConfiguration.INCLUDE_GLOBS_PROP, serverConfigFile);
pluginConfig.put(inclusionGlobs);
+ pluginConfig.put(new PropertyList(ApacheServerComponent.PLUGIN_CONFIG_CUSTOM_MODULE_NAMES));
+
ApacheDirectiveTree serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
serverConfig = RuntimeApacheConfiguration.extract(serverConfig, process.getProcessInfo(), binaryInfo, getDefaultModuleNames(binaryInfo.getVersion()));
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index a59c209..2ad29e4 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -354,6 +354,25 @@
</c:group>
+ <c:group name="Advanced">
+ <c:list-property name="customModuleNames">
+ <c:description>
+ Apache can use 2 values to identify a module. Either its module name that is used in the LoadModule directive
+ or its source file that can be used in the IfModule directive (as of Apache 2.1 the IfModule directive can but doesn't have to
+ use the module name, too).
+
+ The plugin contains the mappings of the module names to module files for all the standard apache modules mentioned
+ on the http://httpd.apache.org/docs/current/mod/ plus the SNMP module and mod_jk.
+
+ If you use any non-standard modules and use their source file in the IfModule directives, you have to add the module-name-to-module-file
+ mapping to this list so that the plugin can determine the correct runtime configuration of the apache instance.
+ </c:description>
+ <c:map-property name="moduleMapping">
+ <c:simple-property name="moduleSourceFile" description="The source file of the module (as used in IfModule directives)"/>
+ <c:simple-property name="moduleName" description="The name of the module (as used in LoadModule directives)"/>
+ </c:map-property>
+ </c:list-property>
+ </c:group>
</plugin-configuration>
<!-- all httpd processes that are not child processes of another httpd process -->
13 years, 1 month
[rhq] modules/enterprise
by ips
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 4 ++--
modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml | 3 ++-
11 files changed, 22 insertions(+), 21 deletions(-)
New commits:
commit ae6d42eef44bf5c03f1e9d24694ad1adb9d261fc
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon May 9 22:59:47 2011 -0400
bump up max size of strict thread pools for the alert SLSBs called by the alert condition consumer MDB, since that MDB can potentially be called quite often if there are a lot of alerts configured (refinement of fix for https://bugzilla.redhat.com/show_bug.cgi?id=693232)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java
index 0804736..8ee77c9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionLogManagerBean.java
@@ -56,10 +56,10 @@ import org.rhq.enterprise.server.RHQConstants;
// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 60, which is double the default value, to minimize the chances of AlertConditionConsumerBean
+// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertConditionLogManagerBean implements AlertConditionLogManagerLocal {
private final Log log = LogFactory.getLog(AlertConditionLogManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java
index 3d49479..3094fc8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java
@@ -60,10 +60,10 @@ import org.rhq.enterprise.server.authz.PermissionException;
// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 60, which is double the default value, to minimize the chances of AlertConditionConsumerBean
+// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertConditionManagerBean implements AlertConditionManagerLocal {
private static final Log LOG = LogFactory.getLog(AlertConditionManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java
index 5df78c5..8d36704 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDampeningManagerBean.java
@@ -52,10 +52,10 @@ import org.rhq.enterprise.server.RHQConstants;
// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 60, which is double the default value, to minimize the chances of AlertConditionConsumerBean
+// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertDampeningManagerBean implements AlertDampeningManagerLocal {
private final Log log = LogFactory.getLog(AlertDampeningManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
index ba3b045..828e2bb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
@@ -78,10 +78,10 @@ import org.rhq.enterprise.server.util.CriteriaQueryGenerator.AuthorizationTokenT
// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 60, which is double the default value, to minimize the chances of AlertConditionConsumerBean
+// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class AlertDefinitionManagerBean implements AlertDefinitionManagerLocal, AlertDefinitionManagerRemote {
private static final Log LOG = LogFactory.getLog(AlertDefinitionManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java
index 55aa2a4..685f461 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/CachedConditionManagerBean.java
@@ -54,10 +54,10 @@ import org.rhq.enterprise.server.alert.engine.jms.model.InactiveAlertConditionMe
// gradually leak until the Server eventually ran out of memory. Hence, we must use a {@link StrictMaxPool}, which
// will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool. Because most of these SLSB's are
// also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides AlertConditionConsumerBean, we set the max
-// pool size to 60, which is double the default value, to minimize the chances of AlertConditionConsumerBean
+// pool size to 100 (30 is the default value), to lower the chances of AlertConditionConsumerBean
// invocations, which are the most critical, from having to block and potentially getting backed up in the queue.
// For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 100)
public class CachedConditionManagerBean implements CachedConditionManagerLocal {
private final Log log = LogFactory.getLog(CachedConditionManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
index 919149d..35394d6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
@@ -66,10 +66,10 @@ import org.rhq.enterprise.server.util.LookupUtil;
// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 60, which is double the default value, to minimize the chances of EJB
+// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class CloudManagerBean implements CloudManagerLocal {
private final Log log = LogFactory.getLog(CloudManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
index 526f801..eeeb812 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
@@ -75,10 +75,10 @@ import org.rhq.enterprise.server.util.LookupUtil;
// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 60, which is double the default value, to minimize the chances of EJB
+// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class StatusManagerBean implements StatusManagerLocal {
private final Log log = LogFactory.getLog(StatusManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java
index 6cbf361..a8b5499 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/CacheConsistencyManagerBean.java
@@ -54,10 +54,10 @@ import org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerLocal;
// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 60, which is double the default value, to minimize the chances of EJB
+// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class CacheConsistencyManagerBean implements CacheConsistencyManagerLocal {
private final Log log = LogFactory.getLog(CacheConsistencyManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
index 588d8e8..dd7790b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
@@ -74,10 +74,10 @@ import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil;
// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 60, which is double the default value, to minimize the chances of EJB
+// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class ServerManagerBean implements ServerManagerLocal {
private final Log log = LogFactory.getLog(ServerManagerBean.class);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
index a03f525..67184cf 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
@@ -84,10 +84,10 @@ import org.rhq.enterprise.server.util.SystemDatabaseInformation;
// heap space to gradually leak until the Server eventually ran out of memory. Hence, we must use a
// {@link StrictMaxPool}, which will use a fixed pool of instances of this SLSB, instead of a ThreadlocalPool.
// Because most of these SLSB's are also invoked by other callers (i.e. Agents, GUI's, or CLI's) besides EJB
-// timers, we set the max pool size to 60, which is double the default value, to minimize the chances of EJB
+// timers, we set the max pool size to 50 (the default is 30) to lower the chances of EJB
// timer invocations, which are the most critical, from having to block and potentially getting backed up in the
// queue. For more details, see https://bugzilla.redhat.com/show_bug.cgi?id=693232 (ips, 05/05/11).
-@PoolClass(value = StrictMaxPool.class, maxSize = 60)
+@PoolClass(value = StrictMaxPool.class, maxSize = 50)
public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemote {
private final String SQL_VACUUM = "VACUUM ANALYZE {0}";
diff --git a/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml b/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
index 95354d8..eef6d52 100644
--- a/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
+++ b/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
@@ -1,5 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<jboss>
</jboss>
+
13 years, 1 month
[rhq] 3 commits - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java | 12
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeployment.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeploymentHistory.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverList.java | 356 +++++-----
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java | 338 ++++-----
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java | 15
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 6
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 1
11 files changed, 382 insertions(+), 364 deletions(-)
New commits:
commit dc67f7b6b6750537b253aaf21acbebcc6b72fc0d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon May 9 17:11:45 2011 -0400
[BZ 697751 - ResourcePackageDetails.getFileName() returns "c:\fakepath\xa.rar" when uploading file in Chrome and IE]
IE and Chrome provide an absolute filename for the uploaded item,
which needs to be trimmed down to what FF provides, just the name portion.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
index 2c8e514..e8265a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
@@ -179,7 +179,20 @@ public class FileUploadServlet extends HttpServlet {
protected File forceToFile(FileItem fileItem) throws IOException, ServletException {
if (fileItem.isInMemory()) {
- File tmpFile = File.createTempFile("" + fileItem.getName(), null);
+ String name = fileItem.getName();
+
+ if (null == name) {
+ throw new IllegalArgumentException("FileItem has null name");
+ }
+
+ // some browsers (IE, Chrome) pass an absolute filename, we just want the name of the file, no paths
+ name = name.replace('\\', '/');
+ if (name.length() > 2 && name.charAt(1) == ':') {
+ name = name.substring(2);
+ }
+ name = new File(name).getName();
+
+ File tmpFile = File.createTempFile(name, null);
try {
fileItem.write(tmpFile);
return tmpFile;
commit aa5e5ba286997779ba1e735e5680f73c3854fd6d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon May 9 17:06:07 2011 -0400
[BZ 703252 - IE (IE7, IE8) unable to load CoreGUI]
- Add DOCTYPE to CoreGUI.html. This directs IE to use standards mode as
opposed to quirks mode.
- Comment out the gwt standard.css from CoreGUI.gwt.xml. This should not
be here as suggested by smartgwt, seems to not help us, and seemed link
to failed app loads in IE.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index c2ba874..4c2ee34 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -10,7 +10,11 @@
<inherits name='com.smartgwt.SmartGwt' />
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
- <!--<inherits name='com.google.gwt.user.theme.standard.Standard'/>-->
+ <!-- removing this, we can add it back if we find something that looks odd. But,
+ 1) it seemed like a trouble spot during initial load for certain IE configurations
+ 2) we probably don't want to be defaulting to GWT standards as opposed to SmartGWT.
+ <inherits name='com.google.gwt.user.theme.standard.Standard'/>
+ -->
<!--
<inherits name="com.smartclient.theme.graphite.Graphite"/>
-->
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index 5432ecb..1b96d09 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -1,3 +1,4 @@
+<!doctype html>
<html>
<head>
<title>RHQ Core Application</title>
commit 76bd674107fefba2344279cabe256c02344be5ea
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon May 9 17:03:40 2011 -0400
Related to [BZ 702390 - Large number of BundleDeployments for a single Bundle causes fetch serialization issues]
Ensure (optional=false) set for LAZY load required (i.e. nullable = false) associations.
This should ensure lazy load.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
index e288428..bc9d927 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
@@ -50,7 +50,7 @@ import org.rhq.core.domain.alert.notification.AlertNotificationLog;
* @author Joseph Marques
*/
@Entity
-@NamedQueries({
+@NamedQueries( {
@NamedQuery(name = Alert.QUERY_FIND_BY_MEASUREMENT_DEFINITION_ID, query = "SELECT a " + " FROM Alert AS a "
+ " JOIN a.alertDefinition definition " + " JOIN definition.conditions condition "
+ " WHERE condition.measurementDefinition.id = :measurementDefinitionId "
@@ -123,10 +123,8 @@ import org.rhq.core.domain.alert.notification.AlertNotificationLog;
+ " FROM AlertDefinition ad " //
+ " JOIN ad.alerts innerA " //
+ " WHERE ad.resource.id IN ( :resourceIds ) )"),
- @NamedQuery(name = Alert.QUERY_DELETE_BY_RESOURCE_TEMPLATE, query =
- "DELETE FROM Alert alert "
- + "WHERE alert.id IN (SELECT innerAlerts.id "
- + " FROM AlertDefinition alertDef "
+ @NamedQuery(name = Alert.QUERY_DELETE_BY_RESOURCE_TEMPLATE, query = "DELETE FROM Alert alert "
+ + "WHERE alert.id IN (SELECT innerAlerts.id " + " FROM AlertDefinition alertDef "
+ " JOIN alertDef.alerts innerAlerts "
+ " WHERE alertDef.resourceType.id = :resourceTypeId)"),
@NamedQuery(name = Alert.QUERY_DELETE_BY_RESOURCE_GROUPS, query = "" //
@@ -272,8 +270,8 @@ public class Alert implements Serializable {
@Column(name = "RECOVERY_ID")
private Integer recoveryId;
- @JoinColumn(name = "RECOVERY_ID", referencedColumnName = "ID", insertable = false, updatable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "RECOVERY_ID", referencedColumnName = "ID", insertable = false, updatable = false, nullable = false)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private AlertDefinition recoveryAlertDefinition;
@Column(name = "WILL_RECOVER", nullable = false)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
index f6b5c29..dfba7d4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
@@ -67,7 +67,7 @@ public class BundleFile implements Serializable {
private int id;
@JoinColumn(name = "BUNDLE_VERSION_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private BundleVersion bundleVersion;
// Note, currently we cascade remove the PackageVersion because BundleVersions do not share
@@ -75,7 +75,7 @@ public class BundleFile implements Serializable {
// the future (e.e reuse of PVs if the sha256 is not different) then this will will have to change
// to reflect the fact that multiple BundleFiles could reference the same PackageVersion.
@JoinColumn(name = "PACKAGE_VERSION_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.REMOVE)
private PackageVersion packageVersion;
public BundleFile() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeployment.java
index 7cd7b50..fec79da 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeployment.java
@@ -78,11 +78,11 @@ public class BundleResourceDeployment implements Serializable {
private int id;
@JoinColumn(name = "BUNDLE_DEPLOYMENT_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private BundleDeployment bundleDeployment;
@JoinColumn(name = "RESOURCE_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private Resource resource;
@Column(name = "STATUS", nullable = false)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeploymentHistory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeploymentHistory.java
index b04e257..6337c4e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeploymentHistory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleResourceDeploymentHistory.java
@@ -68,7 +68,7 @@ public class BundleResourceDeploymentHistory implements Serializable {
private int id;
@JoinColumn(name = "BUNDLE_RES_DEPLOY_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private BundleResourceDeployment resourceDeployment;
@Column(name = "SUBJECT_NAME", nullable = true)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverList.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverList.java
index 40dd426..000284d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverList.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverList.java
@@ -1,178 +1,178 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.cloud;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
-import javax.persistence.PrePersist;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
-import org.rhq.core.domain.resource.Agent;
-
-/**
- * An object to capture a snapshot of the order in which particular agents
- * will fail over to particular servers. The {@link FailoverListDetails}
- * will contain the ordered references back to other {@link Server}s.
- *
- * @author jmarques
- *
- */
-@Entity(name = "FailoverList")
-@NamedQueries( //
-{
- @NamedQuery(name = FailoverList.QUERY_DELETE_VIA_AGENT, query = "DELETE FROM FailoverList fl WHERE fl.agent = :agent"),
- @NamedQuery(name = FailoverList.QUERY_DELETE_VIA_PARTITION_EVENT, query = "DELETE FROM FailoverList fl WHERE fl.partitionEvent = :partitionEvent"),
- @NamedQuery(name = FailoverList.QUERY_GET_VIA_AGENT, query = "SELECT fl FROM FailoverList fl WHERE fl.agent = :agent"),
- @NamedQuery(name = FailoverList.QUERY_TRUNCATE, query = "DELETE FROM FailoverList") })
-@SequenceGenerator(name = "id", sequenceName = "RHQ_FAILOVER_LIST_ID_SEQ")
-@Table(name = "RHQ_FAILOVER_LIST")
-public class FailoverList implements Serializable {
-
- public static final long serialVersionUID = 1L;
-
- public static final String QUERY_DELETE_VIA_AGENT = "FailoverList.deletViaAgent";
- public static final String QUERY_DELETE_VIA_PARTITION_EVENT = "FailoverList.deletViaPartitionEvent";
- public static final String QUERY_GET_VIA_AGENT = "FailoverList.getViaAgent";
- public static final String QUERY_TRUNCATE = "FailoverList.truncate";
-
- @Column(name = "ID", nullable = false)
- @GeneratedValue(strategy = GenerationType.AUTO, generator = "id")
- @Id
- private int id;
-
- @JoinColumn(name = "PARTITION_EVENT_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne
- protected PartitionEvent partitionEvent;
-
- @JoinColumn(name = "AGENT_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
- protected Agent agent;
-
- @Column(name = "AGENT_ID", insertable = false, updatable = false)
- private int agentId;
-
- @Column(name = "CTIME", nullable = false)
- private long ctime;
-
- @OneToMany(mappedBy = "failoverList", cascade = CascadeType.ALL)
- @OrderBy("ordinal ASC")
- private List<FailoverListDetails> serverList = new ArrayList<FailoverListDetails>();
-
- // required for JPA
- protected FailoverList() {
- }
-
- public FailoverList(PartitionEvent event, Agent agent) {
- this.partitionEvent = event;
- this.agent = agent;
- }
-
- public PartitionEvent getPartitionEvent() {
- return partitionEvent;
- }
-
- public void setPartitionEvent(PartitionEvent partitionEvent) {
- this.partitionEvent = partitionEvent;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public Agent getAgent() {
- return agent;
- }
-
- public void setAgent(Agent agent) {
- this.agent = agent;
- }
-
- public long getCtime() {
- return ctime;
- }
-
- public List<FailoverListDetails> getServerList() {
- return serverList;
- }
-
- public void setServerList(List<FailoverListDetails> serverList) {
- this.serverList = serverList;
- }
-
- @PrePersist
- void onPersist() {
- this.ctime = System.currentTimeMillis();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + agentId;
- result = prime * result + (int) (ctime ^ (ctime >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || !(obj instanceof FailoverList)) {
- return false;
- }
-
- final FailoverList other = (FailoverList) obj;
-
- if (agentId != other.agentId) {
- return false;
- }
-
- if (ctime != other.ctime) {
- return false;
- }
-
- return true;
- }
-}
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.cloud;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+import org.rhq.core.domain.resource.Agent;
+
+/**
+ * An object to capture a snapshot of the order in which particular agents
+ * will fail over to particular servers. The {@link FailoverListDetails}
+ * will contain the ordered references back to other {@link Server}s.
+ *
+ * @author jmarques
+ *
+ */
+@Entity(name = "FailoverList")
+@NamedQueries( //
+{
+ @NamedQuery(name = FailoverList.QUERY_DELETE_VIA_AGENT, query = "DELETE FROM FailoverList fl WHERE fl.agent = :agent"),
+ @NamedQuery(name = FailoverList.QUERY_DELETE_VIA_PARTITION_EVENT, query = "DELETE FROM FailoverList fl WHERE fl.partitionEvent = :partitionEvent"),
+ @NamedQuery(name = FailoverList.QUERY_GET_VIA_AGENT, query = "SELECT fl FROM FailoverList fl WHERE fl.agent = :agent"),
+ @NamedQuery(name = FailoverList.QUERY_TRUNCATE, query = "DELETE FROM FailoverList") })
+@SequenceGenerator(name = "id", sequenceName = "RHQ_FAILOVER_LIST_ID_SEQ")
+@Table(name = "RHQ_FAILOVER_LIST")
+public class FailoverList implements Serializable {
+
+ public static final long serialVersionUID = 1L;
+
+ public static final String QUERY_DELETE_VIA_AGENT = "FailoverList.deletViaAgent";
+ public static final String QUERY_DELETE_VIA_PARTITION_EVENT = "FailoverList.deletViaPartitionEvent";
+ public static final String QUERY_GET_VIA_AGENT = "FailoverList.getViaAgent";
+ public static final String QUERY_TRUNCATE = "FailoverList.truncate";
+
+ @Column(name = "ID", nullable = false)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "id")
+ @Id
+ private int id;
+
+ @JoinColumn(name = "PARTITION_EVENT_ID", referencedColumnName = "ID", nullable = false)
+ @ManyToOne(optional = false)
+ protected PartitionEvent partitionEvent;
+
+ @JoinColumn(name = "AGENT_ID", referencedColumnName = "ID", nullable = false)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ protected Agent agent;
+
+ @Column(name = "AGENT_ID", insertable = false, updatable = false)
+ private int agentId;
+
+ @Column(name = "CTIME", nullable = false)
+ private long ctime;
+
+ @OneToMany(mappedBy = "failoverList", cascade = CascadeType.ALL)
+ @OrderBy("ordinal ASC")
+ private List<FailoverListDetails> serverList = new ArrayList<FailoverListDetails>();
+
+ // required for JPA
+ protected FailoverList() {
+ }
+
+ public FailoverList(PartitionEvent event, Agent agent) {
+ this.partitionEvent = event;
+ this.agent = agent;
+ }
+
+ public PartitionEvent getPartitionEvent() {
+ return partitionEvent;
+ }
+
+ public void setPartitionEvent(PartitionEvent partitionEvent) {
+ this.partitionEvent = partitionEvent;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Agent getAgent() {
+ return agent;
+ }
+
+ public void setAgent(Agent agent) {
+ this.agent = agent;
+ }
+
+ public long getCtime() {
+ return ctime;
+ }
+
+ public List<FailoverListDetails> getServerList() {
+ return serverList;
+ }
+
+ public void setServerList(List<FailoverListDetails> serverList) {
+ this.serverList = serverList;
+ }
+
+ @PrePersist
+ void onPersist() {
+ this.ctime = System.currentTimeMillis();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + agentId;
+ result = prime * result + (int) (ctime ^ (ctime >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || !(obj instanceof FailoverList)) {
+ return false;
+ }
+
+ final FailoverList other = (FailoverList) obj;
+
+ if (agentId != other.agentId) {
+ return false;
+ }
+
+ if (ctime != other.ctime) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java
index 51ae161..53b98b0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java
@@ -1,169 +1,169 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.cloud;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
-/**
- * An object to capture a snapshot of the order in which particular agents
- * will fail over to particular servers. The {@link FailoverListDetails}
- * will contain the ordered references back to other {@link Server}s.
- *
- * @author jmarques
- * @author jshaughnessy
- *
- */
-@Entity(name = "FailoverListDetails")
-@NamedQueries( //
-{
- @NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID, query = "SELECT fld FROM FailoverListDetails fld WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
- @NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID_WITH_SERVERS, query = "SELECT fld FROM FailoverListDetails fld JOIN FETCH fld.server WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
- @NamedQuery(name = FailoverListDetails.QUERY_DELETE_VIA_AGENT, query = "DELETE FROM FailoverListDetails fld WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent = :agent )"),
- @NamedQuery(name = FailoverListDetails.QUERY_DELETE_VIA_SERVER, query = "DELETE FROM FailoverListDetails fld WHERE fld.server.id = :serverId"),
- @NamedQuery(name = FailoverListDetails.QUERY_GET_ASSIGNED_LOADS, query = "SELECT new org.rhq.core.domain.cloud.composite.FailoverListDetailsComposite(fld.ordinal, fld.serverId, COUNT(fld.serverId)) FROM FailoverListDetails fld GROUP BY fld.ordinal, fld.serverId ORDER BY fld.ordinal ASC"),
- @NamedQuery(name = FailoverListDetails.QUERY_TRUNCATE, query = "DELETE FROM FailoverListDetails") })
-@SequenceGenerator(name = "id", sequenceName = "RHQ_FAILOVER_DETAILS_ID_SEQ")
-@Table(name = "RHQ_FAILOVER_DETAILS")
-public class FailoverListDetails implements Serializable {
-
- public static final long serialVersionUID = 1L;
-
- public static final String QUERY_GET_VIA_AGENT_ID = "FailoverListDetails.getViaAgentId";
- public static final String QUERY_GET_VIA_AGENT_ID_WITH_SERVERS = "FailoverListDetails.getViaAgentIdWithServers";
- public static final String QUERY_DELETE_VIA_AGENT = "FailoverListDetails.deleteViaAgent";
- public static final String QUERY_DELETE_VIA_SERVER = "FailoverListDetails.deleteViaServer";
- public static final String QUERY_GET_ASSIGNED_LOADS = "FailoverListDetails.getAssignedLoads";
- public static final String QUERY_TRUNCATE = "FailoverListDetails.truncate";
-
- @Column(name = "ID", nullable = false)
- @GeneratedValue(strategy = GenerationType.AUTO, generator = "id")
- @Id
- private int id;
-
- @JoinColumn(name = "FAILOVER_LIST_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne
- protected FailoverList failoverList;
-
- @Column(name = "ORDINAL", nullable = false)
- private int ordinal;
-
- @JoinColumn(name = "SERVER_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
- protected Server server;
-
- @Column(name = "SERVER_ID", insertable = false, updatable = false)
- private int serverId;
-
- // required for JPA
- protected FailoverListDetails() {
- }
-
- public FailoverListDetails(FailoverList failoverList, int ordinal, Server server) {
- super();
- this.failoverList = failoverList;
- this.ordinal = ordinal;
- this.server = server;
- this.serverId = server.getId();
- }
-
- public FailoverList getFailoverList() {
- return failoverList;
- }
-
- public void setFailoverList(FailoverList failoverList) {
- this.failoverList = failoverList;
- }
-
- public int getOrdinal() {
- return ordinal;
- }
-
- public void setOrdinal(int ordinal) {
- this.ordinal = ordinal;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public Server getServer() {
- return server;
- }
-
- public void setServer(Server agent) {
- this.server = agent;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + serverId;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || !(obj instanceof FailoverListDetails)) {
- return false;
- }
-
- final FailoverListDetails other = (FailoverListDetails) obj;
-
- if (failoverList == null) {
- if (other.failoverList != null) {
- return false;
- }
- } else if (!failoverList.equals(other.failoverList)) {
- return false;
- }
-
- if (ordinal != other.ordinal) {
- return false;
- }
-
- return true;
- }
-
-}
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.cloud;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+/**
+ * An object to capture a snapshot of the order in which particular agents
+ * will fail over to particular servers. The {@link FailoverListDetails}
+ * will contain the ordered references back to other {@link Server}s.
+ *
+ * @author jmarques
+ * @author jshaughnessy
+ *
+ */
+@Entity(name = "FailoverListDetails")
+@NamedQueries( //
+{
+ @NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID, query = "SELECT fld FROM FailoverListDetails fld WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
+ @NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID_WITH_SERVERS, query = "SELECT fld FROM FailoverListDetails fld JOIN FETCH fld.server WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
+ @NamedQuery(name = FailoverListDetails.QUERY_DELETE_VIA_AGENT, query = "DELETE FROM FailoverListDetails fld WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent = :agent )"),
+ @NamedQuery(name = FailoverListDetails.QUERY_DELETE_VIA_SERVER, query = "DELETE FROM FailoverListDetails fld WHERE fld.server.id = :serverId"),
+ @NamedQuery(name = FailoverListDetails.QUERY_GET_ASSIGNED_LOADS, query = "SELECT new org.rhq.core.domain.cloud.composite.FailoverListDetailsComposite(fld.ordinal, fld.serverId, COUNT(fld.serverId)) FROM FailoverListDetails fld GROUP BY fld.ordinal, fld.serverId ORDER BY fld.ordinal ASC"),
+ @NamedQuery(name = FailoverListDetails.QUERY_TRUNCATE, query = "DELETE FROM FailoverListDetails") })
+@SequenceGenerator(name = "id", sequenceName = "RHQ_FAILOVER_DETAILS_ID_SEQ")
+@Table(name = "RHQ_FAILOVER_DETAILS")
+public class FailoverListDetails implements Serializable {
+
+ public static final long serialVersionUID = 1L;
+
+ public static final String QUERY_GET_VIA_AGENT_ID = "FailoverListDetails.getViaAgentId";
+ public static final String QUERY_GET_VIA_AGENT_ID_WITH_SERVERS = "FailoverListDetails.getViaAgentIdWithServers";
+ public static final String QUERY_DELETE_VIA_AGENT = "FailoverListDetails.deleteViaAgent";
+ public static final String QUERY_DELETE_VIA_SERVER = "FailoverListDetails.deleteViaServer";
+ public static final String QUERY_GET_ASSIGNED_LOADS = "FailoverListDetails.getAssignedLoads";
+ public static final String QUERY_TRUNCATE = "FailoverListDetails.truncate";
+
+ @Column(name = "ID", nullable = false)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "id")
+ @Id
+ private int id;
+
+ @JoinColumn(name = "FAILOVER_LIST_ID", referencedColumnName = "ID", nullable = false)
+ @ManyToOne(optional = false)
+ protected FailoverList failoverList;
+
+ @Column(name = "ORDINAL", nullable = false)
+ private int ordinal;
+
+ @JoinColumn(name = "SERVER_ID", referencedColumnName = "ID", nullable = false)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ protected Server server;
+
+ @Column(name = "SERVER_ID", insertable = false, updatable = false)
+ private int serverId;
+
+ // required for JPA
+ protected FailoverListDetails() {
+ }
+
+ public FailoverListDetails(FailoverList failoverList, int ordinal, Server server) {
+ super();
+ this.failoverList = failoverList;
+ this.ordinal = ordinal;
+ this.server = server;
+ this.serverId = server.getId();
+ }
+
+ public FailoverList getFailoverList() {
+ return failoverList;
+ }
+
+ public void setFailoverList(FailoverList failoverList) {
+ this.failoverList = failoverList;
+ }
+
+ public int getOrdinal() {
+ return ordinal;
+ }
+
+ public void setOrdinal(int ordinal) {
+ this.ordinal = ordinal;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Server getServer() {
+ return server;
+ }
+
+ public void setServer(Server agent) {
+ this.server = agent;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + serverId;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || !(obj instanceof FailoverListDetails)) {
+ return false;
+ }
+
+ final FailoverListDetails other = (FailoverListDetails) obj;
+
+ if (failoverList == null) {
+ if (other.failoverList != null) {
+ return false;
+ }
+ } else if (!failoverList.equals(other.failoverList)) {
+ return false;
+ }
+
+ if (ordinal != other.ordinal) {
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java
index b72c52a..86521d4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java
@@ -67,7 +67,7 @@ public class ContentSourceSyncResults implements ContentSyncResults, Serializabl
private int id;
@JoinColumn(name = "CONTENT_SRC_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private ContentSource contentSource;
@Column(name = "STATUS", nullable = false)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java
index e37de93..d88ab97 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java
@@ -66,7 +66,7 @@ public class RepoSyncResults implements Serializable, ContentSyncResults {
private int id;
@JoinColumn(name = "REPO_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(fetch = FetchType.LAZY)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private Repo repo;
@Column(name = "STATUS", nullable = false)
@@ -168,7 +168,9 @@ public class RepoSyncResults implements Serializable, ContentSyncResults {
@Override
public String toString() {
- StringBuilder str = new StringBuilder(this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1) + ": ");
+ StringBuilder str = new StringBuilder(this.getClass().getName().substring(
+ this.getClass().getName().lastIndexOf(".") + 1)
+ + ": ");
str.append("start-time=[" + new Date(startTime));
str.append("], end-time=[" + ((endTime != null) ? new Date(endTime) : "---"));
str.append("], percentComplete=[" + status);
13 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 23 ++++++++--
1 file changed, 19 insertions(+), 4 deletions(-)
New commits:
commit 310d34c51ab650b47c652d4d8f60846f781c5fb2
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon May 9 17:01:16 2011 -0400
BZ 702748 - be able to revert back multiple deployments
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 7a6e08a..7b45a70 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -915,7 +915,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
@RequiredPermission(Permission.MANAGE_BUNDLE)
public BundleDeployment scheduleBundleDeployment(Subject subject, int bundleDeploymentId, boolean isCleanDeployment)
throws Exception {
- return scheduleBundleDeploymentImpl(subject, bundleDeploymentId, isCleanDeployment, false);
+ return scheduleBundleDeploymentImpl(subject, bundleDeploymentId, isCleanDeployment, false, null);
}
@Override
@@ -960,11 +960,13 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleDeployment revertDeployment = bundleManager.createBundleDeploymentInNewTrans(subject, prevDeployment
.getBundleVersion().getId(), bundleDestinationId, name, desc, config);
- return scheduleBundleDeploymentImpl(subject, revertDeployment.getId(), isCleanDeployment, true);
+ return scheduleBundleDeploymentImpl(subject, revertDeployment.getId(), isCleanDeployment, true, prevDeployment
+ .getReplacedBundleDeploymentId());
}
+ // revertedDeploymentReplacedDeployment is only meaningful if isRevert is true
private BundleDeployment scheduleBundleDeploymentImpl(Subject subject, int bundleDeploymentId,
- boolean isCleanDeployment, boolean isRevert) throws Exception {
+ boolean isCleanDeployment, boolean isRevert, Integer revertedDeploymentReplacedDeployment) throws Exception {
BundleDeployment newDeployment = entityManager.find(BundleDeployment.class, bundleDeploymentId);
if (null == newDeployment) {
@@ -998,9 +1000,22 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
for (BundleDeployment d : currentDeployments) {
if (d.isLive()) {
d.setLive(false);
- // you can not revert a revert, it does not logically replace anything
if (!isRevert) {
newDeployment.setReplacedBundleDeploymentId(d.getId());
+ } else {
+ // we are doing a revert; so our "replacedDeployment" should be what the deployment we
+ // are reverting to replaced. For example, assume I deployed three bundles:
+ // Deployment #1 - replaced nothing (hence replacedBundleDeploymentId == null)
+ // Deployment #2 - replaced #1
+ // Deployment #3 - replaced #2
+ // Now do a revert. Reverting the live deployment #3 means we really want to re-deploy #2.
+ // This new deployment gets a new ID of #4, but it is actually a deployment equivalent to #2.
+ // If our deploy #4 is actually a redeploy of #2, we need to prepare for the user wanting
+ // to revert #4 by setting the replacedBundleDeploymentId to that which #2 had - this being #1.
+ // Deployment #4 - replaced #1
+ // Now if we ask to revert #4, we will actually be re-deploying #1, which is what we want.
+ // This allows us to revert back multiple steps.
+ newDeployment.setReplacedBundleDeploymentId(revertedDeploymentReplacedDeployment);
}
break;
}
13 years, 1 month
[rhq] Branch 'release-3.0.1' - 2 commits - modules/plugins
by lkrejci
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java | 2
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java | 235 ++++++++--
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java | 12
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 3
4 files changed, 204 insertions(+), 48 deletions(-)
New commits:
commit 5d9ebbfb39f859099048e24e7c23bc4e7cbe4ef1
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon May 9 20:37:04 2011 +0200
BZ 700616 - using the legacy code to create the virtual host resource keys to ensure the backwards compatibility with previous versions of the plugin.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index 5822f38..22e3f66 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -416,7 +416,7 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
if (!matcher.matches())
throw new Exception("Wrong format of virtual host resource name. The right format is Address:Port.");
- addr = getAddressUtility().getVirtualHostSampleAddress(parserTree, vhostDefs[0], serverName);
+ addr = getAddressUtility().getVirtualHostSampleAddress(parserTree, vhostDefs[0], serverName, false);
} catch (Exception e) {
report.setStatus(CreateResourceStatus.FAILURE);
report.setErrorMessage("Wrong format of virtual host resource name.");
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java
index 9abbabe..0867e77 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java
@@ -23,6 +23,7 @@ import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -115,7 +116,7 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
Configuration pluginConfiguration = context.getDefaultPluginConfiguration();
- Address address = serverComponent.getAddressUtility().getVirtualHostSampleAddress(tree, firstAddress, serverName);
+ Address address = serverComponent.getAddressUtility().getVirtualHostSampleAddress(tree, firstAddress, serverName, false);
if (address != null) {
String scheme = address.scheme;
String hostToPing = address.host;
@@ -216,30 +217,30 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
discoveredResources.add(mainServer);
}
-// /**
-// * @deprecated remove this once we have resource upgrade
-// * @param discoveryContext
-// * @param newStyleResourceKey
-// * @param snmpDiscoveries
-// * @return
-// */
-// @Deprecated
-// private String getLegacyResourceKey(ResourceDiscoveryContext<ApacheServerComponent> discoveryContext, String newStyleResourceKey, SnmpWwwServiceIndexes snmpDiscoveries) {
-// int snmpWwwServiceIndex = ApacheVirtualHostServiceComponent.getMatchingWwwServiceIndex(discoveryContext.getParentResourceComponent(), newStyleResourceKey, snmpDiscoveries.names, snmpDiscoveries.ports);
-//
-// if (snmpWwwServiceIndex < 1) {
-// return null;
-// } else {
-// String host = snmpDiscoveries.names.get(snmpWwwServiceIndex - 1).toString();
-// String fullPort = snmpDiscoveries.ports.get(snmpWwwServiceIndex - 1).toString();
-//
-// // The port value will be in the form "1.3.6.1.2.1.6.XXXXX",
-// // where "1.3.6.1.2.1.6" represents the TCP protocol ID,
-// // and XXXXX is the actual port number
-// String port = fullPort.substring(fullPort.lastIndexOf(".") + 1);
-// return host + ":" + port;
-// }
-// }
+ /**
+ * @deprecated remove this once we have resource upgrade
+ * @param discoveryContext
+ * @param newStyleResourceKey
+ * @param snmpDiscoveries
+ * @return
+ */
+ @Deprecated
+ private static String getLegacyResourceKey(ApacheServerComponent serverComponent, String newStyleResourceKey, SnmpWwwServiceIndexes snmpDiscoveries) {
+ int snmpWwwServiceIndex = getMatchingWwwServiceIndex(serverComponent, newStyleResourceKey, snmpDiscoveries.names, snmpDiscoveries.ports);
+
+ if (snmpWwwServiceIndex < 1) {
+ return null;
+ } else {
+ String host = snmpDiscoveries.names.get(snmpWwwServiceIndex - 1).toString();
+ String fullPort = snmpDiscoveries.ports.get(snmpWwwServiceIndex - 1).toString();
+
+ // The port value will be in the form "1.3.6.1.2.1.6.XXXXX",
+ // where "1.3.6.1.2.1.6" represents the TCP protocol ID,
+ // and XXXXX is the actual port number
+ String port = fullPort.substring(fullPort.lastIndexOf(".") + 1);
+ return host + ":" + port;
+ }
+ }
public static String createMainServerResourceKey(ApacheServerComponent serverComponent, ApacheDirectiveTree runtimeConfig, SnmpWwwServiceIndexes snmpDiscoveries) throws Exception {
String mainServerUrl = serverComponent.getServerUrl();
@@ -260,13 +261,9 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
}
//BZ 612189 - remove this once we have resource upgrade
- //ok, this is hacky, but...
- //in order not to change the semantics of the resource key creation
- //we use the legacy resource key (i.e. the one based on SNMP) only
- //if SNMP is available, even though we now have algorithm that can
- //determine the SNMP resource key without it being available.
if (snmpDiscoveries != null) {
- key = serverComponent.getAddressUtility().getHttpdInternalMainServerAddressRepresentation(runtimeConfig).toString(false, false);
+ String legacyKey = getLegacyResourceKey(serverComponent, key, snmpDiscoveries);
+ key = legacyKey != null ? legacyKey : key;
}
return key;
@@ -287,16 +284,6 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
//
// return keyBuilder.toString();
- //BZ 612189 - remove this once we have resource upgrade
- //ok, this is hacky, but...
- //in order not to change the semantics of the resource key creation
- //we use the legacy resource key (i.e. the one based on SNMP) only
- //if SNMP is available, even though we now have algorithm that can
- //determine the SNMP resource key without it being available.
- if (snmpDiscoveries != null) {
- return serverComponent.getAddressUtility().getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, hosts.get(0), serverName).toString(false, false);
- }
-
//try to derive the same resource key as the SNMP would have... this is to prevent the duplication of
//vhost resources after the SNMP was configured - how I wish resource upgrade made it to 3.0 to prevent this
//kind of guessing being necessary.
@@ -315,7 +302,15 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
log.debug("Host " + hostAddr.host + " is not resolvable.", e);
}
- return hostAddr.host + ":" + hostAddr.port;
+ String key = hostAddr.host + ":" + hostAddr.port;
+
+ //BZ 612189 - remove this once we have resource upgrade
+ if (snmpDiscoveries != null) {
+ String legacyResourceKey = getLegacyResourceKey(serverComponent, key, snmpDiscoveries);
+ key = legacyResourceKey != null ? legacyResourceKey : key;
+ }
+
+ return key;
}
/**
@@ -376,4 +371,160 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
public List<SNMPValue> ports;
public SNMPValue desc;
}
+
+ /**
+ * @deprecated used only in the {@link ApacheVirtualHostServiceDiscoveryComponent#getLegacyResourceKey(ApacheServerComponent, String, SnmpWwwServiceIndexes)}
+ * to figure out what the resource key should in a way compatible with the previous incarnations of the plugin in RHQ 3.
+ * <p>
+ * This method used to reside in the {@link ApacheVirtualHostServiceComponent} and was used to match a vhost with an SNMP index at runtime.
+ * Because of the non-deterministic nature of this method, it is no longer used there but we still need it in the discovery so that we
+ * maintain the same behavior and obtain the same resource keys as the previous versions of the plugin. This is to not create duplicate
+ * resources after a new version of the plugin is deployed.
+ */
+ @Deprecated
+ private static int getMatchingWwwServiceIndex(ApacheServerComponent parent, String resourceKey, List<SNMPValue> names, List<SNMPValue> ports) {
+ int ret = -1;
+ Iterator<SNMPValue> namesIterator = names.iterator();
+ Iterator<SNMPValue> portsIterator = ports.iterator();
+
+ //figure out the servername and addresses of this virtual host
+ //from the resource key.
+ String vhostServerName = null;
+ String[] vhostAddressStrings = null;
+ int pipeIdx = resourceKey.indexOf('|');
+ if (pipeIdx >= 0) {
+ vhostServerName = resourceKey.substring(0, pipeIdx);
+ }
+ vhostAddressStrings = resourceKey.substring(pipeIdx + 1).split(" ");
+
+ ApacheDirectiveTree tree = parent.loadParser();
+
+ //convert the vhost addresses into fully qualified ip/port addresses
+ List<HttpdAddressUtility.Address> vhostAddresses = new ArrayList<HttpdAddressUtility.Address>(
+ vhostAddressStrings.length);
+
+ if (vhostAddressStrings.length == 1 && ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY.equals(vhostAddressStrings[0])) {
+ HttpdAddressUtility.Address serverAddr = parent.getAddressUtility().getMainServerSampleAddress(tree, null, 0);
+ if (serverAddr != null) {
+ vhostAddresses.add(serverAddr);
+ }
+ } else {
+ for (int i = 0; i < vhostAddressStrings.length; ++i) {
+ HttpdAddressUtility.Address vhostAddr = parent.getAddressUtility().getVirtualHostSampleAddress(tree, vhostAddressStrings[i],
+ vhostServerName, true);
+ if (vhostAddr != null) {
+ vhostAddresses.add(vhostAddr);
+ } else {
+ //this is not to choke on the old style resource keys for the main server. without this, we'd never be able
+ //to match the main server with its snmp index below.
+ HttpdAddressUtility.Address addr = HttpdAddressUtility.Address.parse(vhostAddressStrings[i]);
+ vhostAddr = parent.getAddressUtility().getMainServerSampleAddress(tree, addr.host, addr.port);
+ if (vhostAddr != null) {
+ vhostAddresses.add(vhostAddr);
+ }
+ }
+ }
+ }
+
+ //finding the snmp index that corresponds to the address(es) of the vhost isn't that simple
+ //because the snmp module in apache always resolves the IPs to hostnames.
+ //on the other hand, the resource key tries to be more accurate about what a
+ //vhost can actually be represented as. A vhost is represented by at most 1 hostname (i.e. ServerName)
+ //and possibly multiple IP addresses.
+ SNMPValue bestMatch = null;
+ int bestMatchRate = 0;
+
+ while (namesIterator.hasNext()) {
+ SNMPValue nameValue = namesIterator.next();
+ SNMPValue portValue = portsIterator.next();
+
+ String snmpHost = nameValue.toString();
+ String fullPort = portValue.toString();
+
+ int snmpPort = Integer.parseInt(fullPort.substring(fullPort.lastIndexOf(".") + 1));
+
+ HttpdAddressUtility.Address snmpAddress = new HttpdAddressUtility.Address(snmpHost, snmpPort);
+
+ int matchRate = matchRate(vhostAddresses, snmpAddress);
+ if (matchRate > bestMatchRate) {
+ bestMatch = nameValue;
+ bestMatchRate = matchRate;
+ }
+ }
+
+ if (bestMatch != null) {
+ String nameOID = bestMatch.getOID();
+ ret = Integer.parseInt(nameOID.substring(nameOID.lastIndexOf(".") + 1));
+ } else {
+ log.debug("Unable to match the Virtual Host [" + resourceKey + "] with any of the SNMP advertised vhosts: " + names + ". The discovery will fallback to using the resource key not derived from an SNMP entry.");
+ }
+ return ret;
+ }
+
+ /**
+ * @deprecated this is only used inside {@link #getMatchingWwwServiceIndex(ApacheServerComponent, String, List, List)}, which is
+ * kept only for backwards compatibility reasons. Don't use it anywhere else ever!
+ */
+ @Deprecated
+ private static int matchRate(List<HttpdAddressUtility.Address> addresses, HttpdAddressUtility.Address addressToCheck) {
+ for(HttpdAddressUtility.Address a : addresses) {
+ if (HttpdAddressUtility.isAddressConforming(addressToCheck, a.host, a.port, true)) {
+ return 3;
+ }
+ }
+
+ //try to get the IP of the address to check
+ InetAddress[] ipAddresses;
+ try {
+ ipAddresses = InetAddress.getAllByName(addressToCheck.host);
+ for(InetAddress ip : ipAddresses) {
+ HttpdAddressUtility.Address newCheck = new HttpdAddressUtility.Address(ip.getHostAddress(), addressToCheck.port);
+
+ for(HttpdAddressUtility.Address a : addresses) {
+ if (HttpdAddressUtility.isAddressConforming(newCheck, a.host, a.port, true)) {
+ return 2;
+ }
+ }
+ }
+ } catch (UnknownHostException e) {
+ log.debug("Unknown host encountered in the httpd configuration: " + addressToCheck.host);
+ return 0;
+ }
+
+ //this stupid 80 = 0 rule is to conform with snmp module
+ //the problem is that snmp module represents both 80 and * port defs as 0,
+ //so whatever we do, we might mismatch the vhost. But there's no working around that
+ //but to modify the snmp module itself.
+
+ int addressPort = addressToCheck.port;
+ if (addressPort == 80) {
+ addressPort = 0;
+ }
+
+ //ok, try the hardest...
+ for(HttpdAddressUtility.Address listAddress: addresses) {
+ int listPort = listAddress.port;
+ if (listPort == 80) {
+ listPort = 0;
+ }
+
+ InetAddress[] listAddresses;
+ try {
+ listAddresses = InetAddress.getAllByName(listAddress.host);
+ } catch (UnknownHostException e) {
+ log.debug("Unknown host encountered in the httpd configuration: " + listAddress.host);
+ return 0;
+ }
+
+ for (InetAddress listInetAddr : listAddresses) {
+ for (InetAddress ip : ipAddresses) {
+ if (ip.equals(listInetAddr) && addressPort == listPort) {
+ return 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+ }
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
index ebb315b..405d38b 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
@@ -322,14 +322,20 @@ public enum HttpdAddressUtility {
* @param ag the augeas tree of the httpd configuration
* @param virtualHost the port or address:port of the virtual host
* @param serverName the server name for the namebased virtual hosts (or null if the virtual host is ip based)
+ * @param legacyWildcardHostHandling use the legacy handling of wildcard hosts. This should always be false unless you have to maintain
+ * the backwards compatibility in the vhost resource key generation code.
* @return the address on which the virtual host can be accessed or null on error
*/
- public Address getVirtualHostSampleAddress(ApacheDirectiveTree ag, String virtualHost, String serverName) {
+ public Address getVirtualHostSampleAddress(ApacheDirectiveTree ag, String virtualHost, String serverName, boolean legacyWildcardHostHandling) {
try {
Address addr = Address.parse(virtualHost);
if (addr.isHostDefault() || addr.isHostWildcard()) {
Address serverAddr = null;
- serverAddr = getMainServerSampleAddress(ag, null, addr.port);
+ if (legacyWildcardHostHandling) {
+ serverAddr = getLocalhost(addr.port);
+ } else {
+ serverAddr = getMainServerSampleAddress(ag, null, addr.port);
+ }
if (serverAddr == null)
return null;
addr.host = serverAddr.host;
@@ -461,7 +467,7 @@ public enum HttpdAddressUtility {
* If this flag is set to true, this method takes that into account.
* @return
*/
- private static boolean isAddressConforming(Address listen, String limitingHost, int limitingPort, boolean snmpModuleCompatibleMode) {
+ public static boolean isAddressConforming(Address listen, String limitingHost, int limitingPort, boolean snmpModuleCompatibleMode) {
if (Address.DEFAULT_HOST.equals(limitingHost) || Address.WILDCARD.equals(limitingHost)) {
limitingHost = null;
}
commit 34371638426c8d83444f9aa1e2e5ec622c157543
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon May 9 12:57:31 2011 +0200
BZ 700616 - adding a default value to the new snmpWwwServiceIndex property so that updating the plugin actually works when there are some inventoried vhosts already on the server. Also removing the constraint so that the user is free to enter < 1 values to disable monitoring.
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index aa97738..a59c209 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -509,7 +509,7 @@
description="The http or https URL that will be used to check availability for this
virtual host. Note that SSL certificate validation is disabled during availability
checks if this is an HTTPS URL."/>
- <c:simple-property name="snmpWwwServiceIndex" displayName="SNMP WWW Service Index" type="integer" readOnly="false">
+ <c:simple-property name="snmpWwwServiceIndex" displayName="SNMP WWW Service Index" type="integer" readOnly="false" default="-1">
<c:description>
The row index for this virtual host in the MIB table of WWW services (i.e. virtual hosts).
This value can either be read out of the SNMP (using utilities like snmpwalk) or can be determined
@@ -520,7 +520,6 @@
Index is the reverse order of the corresponding VirtualHost directive in such joined configuration. I.e.
the last virtual host directive has index 2, the second last has 3, etc.
</c:description>
- <c:constraint><c:integer-constraint minimum="1" /></c:constraint>
</c:simple-property>
<c:group name="ResponseTime">
<c:simple-property name="responseTimeLogFile" required="false"
13 years, 1 month
[rhq] .classpath
by mazz
.classpath | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 90090e092f59a2e431255defbc16e36a6ece1e2b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon May 9 14:39:24 2011 -0400
switch eclipse to use 4.1.0-snapshot version
diff --git a/.classpath b/.classpath
index 1cb3205..2ca408f 100644
--- a/.classpath
+++ b/.classpath
@@ -115,7 +115,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/unitils/unitils-dbunit/3.1/unitils-dbunit-3.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/unitils/unitils-orm/3.1/unitils-orm-3.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/unitils/unitils-testng/3.1/unitils-testng-3.1.jar"/>
- <classpathentry exported="true" kind="lib" path="modules/enterprise/remoting/webservices/target/rhq-remoting-webservices-4.0.0-SNAPSHOT/wsconsume-output"/>
+ <classpathentry exported="true" kind="lib" path="modules/enterprise/remoting/webservices/target/rhq-remoting-webservices-4.1.0-SNAPSHOT/wsconsume-output"/>
<classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/common/ant-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/common/filetemplate-bundle/src/main/java"/>
13 years, 1 month