modules/core/dbutils/pom.xml
| 2
modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
| 2
modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
| 1
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 8
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionLog.java
| 8
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
| 75 ---
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/PartitionEventType.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
| 29 -
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
| 139 -----
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
| 81 ---
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
| 35 -
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
| 32 -
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
| 73 +--
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
| 7
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyGroupDefinition.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupPluginConfigurationUpdate.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupResourceConfigurationUpdate.java
| 10
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
| 9
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
| 15
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
| 10
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/discovery/AvailabilityReport.java
| 93 +--
modules/core/domain/src/main/java/org/rhq/core/domain/discovery/InventoryReportResponse.java
| 58 --
modules/core/domain/src/main/java/org/rhq/core/domain/discovery/ResourceSyncInfo.java
| 20
modules/core/domain/src/main/java/org/rhq/core/domain/event/Event.java
| 20
modules/core/domain/src/main/java/org/rhq/core/domain/event/EventSource.java
| 19
modules/core/domain/src/main/java/org/rhq/core/domain/event/transfer/EventReport.java
| 21
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1D.java
| 59 +-
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1H.java
| 55 +-
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric6H.java
| 70 +-
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
| 13
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
| 90 ---
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementSchedule.java
| 1
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
| 112 +++-
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
| 72 +--
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataValue.java
| 32 -
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementNumericValueAndUnits.java
| 50 +-
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementStringValueAndUnits.java
| 51 +-
modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
| 12
modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
| 12
modules/core/domain/src/main/java/org/rhq/core/domain/resource/CreateResourceHistory.java
| 19
modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
| 22
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
| 164 ------
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceError.java
| 40 -
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
| 14
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
| 99 ----
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/Group.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/util/AuthzConstants.java
| 45 -
modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java
| 11
modules/core/domain/src/main/java/org/rhq/core/server/ExternalizableStrategy.java
| 5
modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
| 42 -
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
| 235 ----------
modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceTest.java
| 86 ---
modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/TokenGenerationTest.java
| 85 ---
modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
| 49 --
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ResponseTimeLogParser.java
| 7
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
| 9
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
| 5
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
| 36 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
| 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ResourceGroupUIBean.java
| 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/GroupForm.java
| 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/NewGroupAction.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceGroupAdapter.java
| 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationSchedule.java
| 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
| 22
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
| 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
| 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/DiscoveryTestBean.java
| 30 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
| 8
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
| 1
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
| 1
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
| 3
modules/plugins/iis/src/main/java/org/rhq/plugins/iis/IISResponseTimeDelegate.java
| 7
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java
| 13
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB2BeanComponent.java
| 13
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB3BeanComponent.java
| 60 +-
79 files changed, 612 insertions(+), 2008 deletions(-)
New commits:
commit 388d8209f97e91f044ef2855e5f59def58111ad4
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 01:13:05 2010 -0400
remove unused methods in PersistenceUtility
diff --git a/modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
b/modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
index 53e871a..82c315e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
@@ -73,6 +73,7 @@ public class PersistenceUtility {
public static final String HIBERNATE_STATISTICS_MBEAN_OBJECTNAME =
"Hibernate:type=statistics,application=RHQ";
@SuppressWarnings("unchecked")
+ // used in hibernate.jsp
public static String getDisplayString(Type hibernateType) {
if (hibernateType instanceof EntityType) {
return hibernateType.getName() + " (enter integer of ID / primary key
field)";
@@ -99,6 +100,7 @@ public class PersistenceUtility {
}
@SuppressWarnings("unchecked")
+ // used in hibernate.jsp
public static Object cast(String value, Type hibernateType) {
if (hibernateType instanceof PrimitiveType) {
Class<?> type = ((PrimitiveType) hibernateType).getPrimitiveClass();
@@ -202,33 +204,6 @@ public class PersistenceUtility {
return entityManager.createQuery(query.toString());
}
- public static Query createNonNamedQueryWithOrderBy(EntityManager entityManager,
String queryText,
- PageControl pageControl) {
- Query query;
-
- if (pageControl.getPrimarySortColumn() != null) {
- query = createNonNamedQueryWithOrderBy(entityManager, queryText,
pageControl.getOrderingFieldsAsArray());
- } else {
- StackTraceElement caller = new
Throwable().fillInStackTrace().getStackTrace()[1];
- LOG.warn("Queries should really supply default sort columns. Caller did
not: " + caller);
-
- // Use the standard named query if no sorting is specified
- query = entityManager.createQuery(queryText);
- }
-
- setDataPage(query, pageControl);
-
- return query;
- }
-
- public static Query createNonNamedQueryWithOrderBy(EntityManager entityManager,
String queryText,
- OrderingField... orderByFields) {
-
- StringBuilder query = new StringBuilder(queryText);
- buildOrderBy(query, orderByFields);
- return entityManager.createQuery(query.toString());
- }
-
private static StringBuilder buildOrderBy(StringBuilder query, OrderingField...
orderByFields) {
boolean first = true;
for (OrderingField orderingField : orderByFields) {
@@ -342,8 +317,7 @@ public class PersistenceUtility {
if (pageControl.getPrimarySortColumn() != null) {
PageOrdering order = (pageControl.getPrimarySortOrder() == null) ?
PageOrdering.ASC : pageControl
.getPrimarySortOrder();
- filter = buildOrderBy(new StringBuilder(), new
OrderingField(pageControl.getPrimarySortColumn(), order))
- .toString();
+ filter = getOrderByFragment(new
OrderingField(pageControl.getPrimarySortColumn(), order));
}
org.hibernate.Query query =
getHibernateSession(entityManager).createFilter(collection, filter);
@@ -422,12 +396,6 @@ public class PersistenceUtility {
return hibernateStatistics;
}
- public static String getQueryDefinitionFromNamedQuery(EntityManager entityManager,
String queryName) {
-
- NamedQueryDefinition ndc = getNamedQueryDefinition(entityManager, queryName);
- return ndc.getQueryString();
- }
-
private static NamedQueryDefinition getNamedQueryDefinition(EntityManager
entityManager, String queryName) {
SessionFactoryImplementor sessionFactory =
getHibernateSessionFactoryImplementor(entityManager);
NamedQueryDefinition namedQueryDefinition =
sessionFactory.getNamedQuery(queryName);
@@ -462,7 +430,7 @@ public class PersistenceUtility {
queryWithPagingSorting.append("SELECT innerResults.*, ROWNUM rnum FROM (
");
queryWithPagingSorting.append(query);
// for oracle, order by occurs at the end of the original query, whether grouped
or not
- buildOrderBy(queryWithPagingSorting, pageControl.getOrderingFieldsAsArray());
+
queryWithPagingSorting.append(getOrderByFragment(pageControl.getOrderingFieldsAsArray()));
queryWithPagingSorting.append(" ) innerResults ");
// for oracle, paginate high off of the inner projection
@@ -584,7 +552,7 @@ public class PersistenceUtility {
queryWithPagingSorting.append(query);
// for postgres, first order by
- buildOrderBy(queryWithPagingSorting, pageControl.getOrderingFieldsAsArray());
+
queryWithPagingSorting.append(getOrderByFragment(pageControl.getOrderingFieldsAsArray()));
// for postgres, then paginate
queryWithPagingSorting.append(" LIMIT
").append(pageControl.getPageSize());
commit 841aef8571e5abe1bfb5dc12c2b5697346929b38
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 00:44:56 2010 -0400
fix todos in MeasurementUnits
* it is possible for MeasurementUnits (especially from different
MeasurementUnit.Family's) to have the same displayUnits names
* fix enum formatting
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
index a2ff4db..0c4e682 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
@@ -1,25 +1,25 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement;
import org.rhq.core.domain.measurement.util.MeasurementConversionException;
@@ -27,29 +27,48 @@ import
org.rhq.core.domain.measurement.util.MeasurementConversionException;
/**
* Metric data values can be in one of the following known units of measurement. These
enum values should correspond to
* the "units" attribute enumerated type values as defined in the plugin
descriptor's <metric> element.
+ *
+ * @author Joseph Marques
*/
public enum MeasurementUnits {
// Simple Metric Types - Absolute and Relative
- NONE("", Family.ABSOLUTE, Scale.ONE), PERCENTAGE("%",
Family.RELATIVE, Scale.HECTO),
+ NONE("", Family.ABSOLUTE, Scale.ONE), //
+ PERCENTAGE("%", Family.RELATIVE, Scale.HECTO), //
// Absolute Sizes in Bytes (utilization)
- BYTES("B", Family.BYTES, Scale.ONE), KILOBYTES("KB",
Family.BYTES, Scale.KILO), MEGABYTES("MB", Family.BYTES,
- Scale.MEGA), GIGABYTES("GB", Family.BYTES, Scale.GIGA),
TERABYTES("TB", Family.BYTES, Scale.TERA), PETABYTES(
- "PB", Family.BYTES, Scale.PETA),
+ BYTES("B", Family.BYTES, Scale.ONE), //
+ KILOBYTES("KB", Family.BYTES, Scale.KILO), //
+ MEGABYTES("MB", Family.BYTES, Scale.MEGA), //
+ GIGABYTES("GB", Family.BYTES, Scale.GIGA), //
+ TERABYTES("TB", Family.BYTES, Scale.TERA), //
+ PETABYTES("PB", Family.BYTES, Scale.PETA), //
// Absolute Sizes in Bits (throughput)
- BITS("b", Family.BITS, Scale.ONE), KILOBITS("Kb", Family.BITS,
Scale.KILO), MEGABITS("Mb", Family.BITS, Scale.MEGA), GIGABITS(
- "Gb", Family.BITS, Scale.GIGA), TERABITS("Tb", Family.BITS,
Scale.TERA), PETABITS("Pb", Family.BITS, Scale.PETA),
+ BITS("b", Family.BITS, Scale.ONE), //
+ KILOBITS("Kb", Family.BITS, Scale.KILO), //
+ MEGABITS("Mb", Family.BITS, Scale.MEGA), //
+ GIGABITS("Gb", Family.BITS, Scale.GIGA), //
+ TERABITS("Tb", Family.BITS, Scale.TERA), //
+ PETABITS("Pb", Family.BITS, Scale.PETA), //
// Absolute Time - no display, only hints to the UI how to display
- EPOCH_MILLISECONDS("", Family.DURATION, Scale.MILLI),
EPOCH_SECONDS("", Family.DURATION, Scale.SEC),
+ EPOCH_MILLISECONDS("", Family.DURATION, Scale.MILLI), //
+ EPOCH_SECONDS("", Family.DURATION, Scale.SEC), //
// Relative Time
- JIFFYS("j", Family.TIME, Scale.JIFFY), NANOSECONDS("ns",
Family.TIME, Scale.NANO), MICROSECONDS("us", Family.TIME,
- Scale.MICRO), MILLISECONDS("ms", Family.TIME, Scale.MILLI),
SECONDS("s", Family.TIME, Scale.SEC), MINUTES("m",
- Family.TIME, Scale.MIN), HOURS("h", Family.TIME, Scale.HOUR),
DAYS("d", Family.TIME, Scale.DAY),
-
- CELSIUS("C", Family.TEMPERATURE, Scale.ONE), KELVIN("K",
Family.TEMPERATURE, Scale.ONE), FAHRENHEIGHT("F", Family.TEMPERATURE,
Scale.ONE);
+ JIFFYS("j", Family.TIME, Scale.JIFFY), //
+ NANOSECONDS("ns", Family.TIME, Scale.NANO), //
+ MICROSECONDS("us", Family.TIME, Scale.MICRO), //
+ MILLISECONDS("ms", Family.TIME, Scale.MILLI), //
+ SECONDS("s", Family.TIME, Scale.SEC), //
+ MINUTES("m", Family.TIME, Scale.MIN), //
+ HOURS("h", Family.TIME, Scale.HOUR), //
+ DAYS("d", Family.TIME, Scale.DAY), //
+
+ // Temperature
+ CELSIUS("C", Family.TEMPERATURE, Scale.ONE), //
+ KELVIN("K", Family.TEMPERATURE, Scale.ONE), //
+ FAHRENHEIGHT("F", Family.TEMPERATURE, Scale.ONE);
private String displayUnits;
private Family family;
@@ -60,7 +79,6 @@ public enum MeasurementUnits {
throw new RuntimeException("Screen real estate is expensive;
displayUnits must be 5 characters or less");
}
- // TODO check for duplicate displayUnits names
this.displayUnits = displayUnits;
this.family = family;
this.scale = scale;
@@ -158,14 +176,26 @@ public enum MeasurementUnits {
public enum Scale {
// Binary based scaling factors
- CENTI(Type.SIZE), ONE(Type.SIZE, CENTI, 100), HECTO(Type.SIZE, ONE, 100),
KILO(Type.SIZE, ONE, 1024), MEGA(
- Type.SIZE, KILO, 1024), GIGA(Type.SIZE, MEGA, 1024), TERA(Type.SIZE, GIGA,
1024), PETA(Type.SIZE, TERA,
- 1024),
+ CENTI(Type.SIZE), //
+ ONE(Type.SIZE, CENTI, 100), //
+ HECTO(Type.SIZE, ONE, 100), //
+ KILO(Type.SIZE, ONE, 1024), //
+ MEGA(Type.SIZE, KILO, 1024), //
+ GIGA(Type.SIZE, MEGA, 1024), //
+ TERA(Type.SIZE, GIGA, 1024), //
+ PETA(Type.SIZE, TERA, 1024), //
// Time based scaling factors
- JIFFY(Type.TIME), NANO(Type.TIME, JIFFY, 1000), MICRO(Type.TIME, NANO, 1000),
MILLI(Type.TIME, MICRO, 1000), SEC(
- Type.TIME, MILLI, 1000), MIN(Type.TIME, SEC, 60), HOUR(Type.TIME, MIN, 60),
DAY(Type.TIME, HOUR, 24), WEEK(
- Type.TIME, DAY, 7), YEAR(Type.TIME, WEEK, 52);
+ JIFFY(Type.TIME), //
+ NANO(Type.TIME, JIFFY, 1000), //
+ MICRO(Type.TIME, NANO, 1000), //
+ MILLI(Type.TIME, MICRO, 1000), //
+ SEC(Type.TIME, MILLI, 1000), //
+ MIN(Type.TIME, SEC, 60), //
+ HOUR(Type.TIME, MIN, 60), //
+ DAY(Type.TIME, HOUR, 24), //
+ WEEK(Type.TIME, DAY, 7), //
+ YEAR(Type.TIME, WEEK, 52);
enum Type {
NONE, SIZE, TIME;
commit b294d0f91fb957dddc9052480f12e2bb6703bdc9
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 00:37:34 2010 -0400
fix todos in ResourceTest
* remove testCompositeLookup - it's not actually testing composites,
and the previously commented out portion references methods in
PersistenceUtility that no longer exist
* remove testPlatformLookup - it has no test harness, it tests nothing
* remove testSeucirtyQuery - see AuthorizationManagerBeanTest
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceTest.java
index a40a07e..c3b5667 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceTest.java
@@ -28,69 +28,18 @@ import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
import org.testng.annotations.Test;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.test.AbstractEJB3Test;
public class ResourceTest extends AbstractEJB3Test {
- // TODO GH: Fixme @Test(groups = "integration.ejb3")
- public void testCompositeLookup() throws Exception {
- EntityManager em = getEntityManager();
- getTransactionManager().begin();
- try {
- Subject s = em.getReference(Subject.class, new Integer(502550));
- // ResourceComposite c = new ResourceComposite();
- System.out.println("HELLOWORLD2");
-
- Query query = em.createQuery("SELECT count(res) " + "FROM
Resource res "
- + " JOIN res.resourceGroups g JOIN g.roles r JOIN r.subjects s
" + "WHERE s = :subject "
- + " AND (:category = res.resourceType.category OR :category is null)
"
- + " AND (:resourceType = res.resourceType OR :resourceType is null)
"
- + " AND (res.inventoryStatus = :inventoryStatus OR :inventoryStatus
is null) "
- + " AND (res.name LIKE :search OR res.description LIKE :search OR
:search is null)) ");
-
- ResourceType t = em.getReference(ResourceType.class, new Integer(501064));
-
- query.setParameter("subject", s);
- query.setParameter("category", ResourceCategory.SERVER);
- query.setParameter("resourceType", t);
- query.setParameter("inventoryStatus", InventoryStatus.COMMITTED);
- query.setParameter("search", "%");
- System.out.println("Found stuff");
- for (Object o : query.getResultList()) {
- System.out.println(o);
- }
-
- //Permission.CONTROL
- /*Query query = em.createQuery("SELECT p FROM Role r LEFT JOIN
r.permissions p WHERE p = 3");
- * //org.rhq.core.domain.authz.Permission.CONTROL");
- * for (Object o : query.getResultList()) { System.out.println("["
+ o.getClass().getSimpleName() + "]: " +
- * o);}*/
-
- /*Query query = em.createNamedQuery(Resource.QUERY_FIND_COMPOSITE);
- *
PersistenceUtility.setNullableParameter(query,"search",null,String.class);
- * query.setParameter("subject",s); //
query.setParameter("inventoryStatus", null);
- * PersistenceUtility.setNullableParameter(query,"inventoryStatus",
null, Integer.class);
- * List<ResourceComposite> resourceComposites = query.getResultList();
for (ResourceComposite composite :
- * resourceComposites) { System.out.println(composite);}*/
-
- } finally {
- getTransactionManager().rollback();
- }
- }
@Test(groups = "integration.ejb3")
public void testCreateAlotOfResources() throws Exception {
@@ -194,41 +143,6 @@ public class ResourceTest extends AbstractEJB3Test {
+ "] resources with availabilities");
}
- @SuppressWarnings("unchecked")
- @Test(groups = "integration.ejb3")
- public void testPlatformLookup() throws Exception {
- EntityManager em = getEntityManager();
- getTransactionManager().begin();
- try {
- Query query = em.createQuery("SELECT e FROM Resource e WHERE
e.resourceType = 0"); // TODO hibernate enum query bug:
ResourceCategory.PLATFORM");
- List<Resource> platforms = query.getResultList();
- for (Resource platform : platforms) {
- System.out.println("Platform: " + platform);
- @SuppressWarnings("unused")
- Configuration config = platform.getPluginConfiguration();
- }
- } finally {
- getTransactionManager().rollback();
- }
- }
-
- @Test(groups = "integration.ejb3")
- public void testSecurityQuery() throws SystemException, NotSupportedException {
- EntityManager em = getEntityManager();
- getTransactionManager().begin();
- try {
- // TODO: Make this test resource, group, authz linkage
- Query query = em.createQuery("SELECT r FROM Role r JOIN r.permissions p
WHERE p = :perm");
-
- //"SELECT res FROM Subject s join s.roles as r join r.permissions p join
r.resourceGroups g join g.resources res WHERE p = :perm AND s.id = :sid");
- query.setParameter("perm", Permission.MANAGE_SECURITY);
- // query.setParameter("sid", 0);
- System.out.println("Admin user count: " +
query.getResultList().size());
- } finally {
- getTransactionManager().rollback();
- }
- }
-
@Test(groups = "integration.ejb3")
public void testMediumPlatformCreate() {
int id = 0;
commit af3f28e3bbce631ae88f66da0329107e61d3d9f1
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 00:19:01 2010 -0400
fix todos in ResourceType
* remove todo in toString, default impl doesn't need to print parents
* remove todo in compareTo, name comparison is a sufficient default impl
* implement addFilterParentId to ResourceTypeCriteria
** this new filter will enable implementation of todos in the @NamedQueries section
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
index 93ba523..f7435f3 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
@@ -45,6 +45,7 @@ public class ResourceTypeCriteria extends Criteria {
private static final long serialVersionUID = 1L;
private Integer filterId;
+ private Integer filterParentId; // required overrides
private List<Integer> filterIds; // requires overrides
private String filterName;
@@ -75,6 +76,12 @@ public class ResourceTypeCriteria extends Criteria {
private PageOrdering sortPluginName; // needs overrides
public ResourceTypeCriteria() {
+ filterOverrides.put("parentId", "" //
+ + "id IN ( SELECT innerRt.id " //
+ + " FROM ResourceType innerRt " //
+ + " JOIN innerRt.parentResourceTypes innerParentRt " //
+ + " WHERE innerParentRt.id IN ( ? ) )");
+
filterOverrides.put("pluginName", "plugin like ?");
filterOverrides.put("ids", "id in ( ? )");
filterOverrides.put("bundleTypeId", "bundleType.id = ?");
@@ -91,6 +98,10 @@ public class ResourceTypeCriteria extends Criteria {
this.filterId = filterId;
}
+ public void addFilterParentId(Integer filterParentId) {
+ this.filterParentId = filterParentId;
+ }
+
public void addFilterIds(Integer... filterIds) {
this.filterIds = Arrays.asList(filterIds);
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index f7dba02..19cdd11 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -746,7 +746,6 @@ public class ResourceType implements Serializable,
Comparable<ResourceType> {
public int compareTo(ResourceType that) {
return this.name.compareTo(that.getName());
- // TODO: Order by category too?
}
public String getHelpText() {
@@ -804,17 +803,8 @@ public class ResourceType implements Serializable,
Comparable<ResourceType> {
@Override
public String toString() {
- /* TODO GH: Not safe, may not have been loaded (lazy initialization exceptions)
- StringBuffer parents = new StringBuffer();
- for (ResourceType parent : parentResourceTypes)
- {
- if (parents.length() > 0)
- parents.append(',');
- parents.append(parent.getName());
- }*/
-
return "ResourceType[id=" + this.id + ", category=" +
this.category + ", name=" + this.name + ", plugin="
- + this.plugin + /*", parents=" + parents +*/"]";
+ + this.plugin + "]";
}
}
commit aae28aa1c6d164be4f3ded2e15c17d5c32c4edb5
Author: Joseph Marques <joseph(a)redhat.com>
Date: Sun Oct 10 23:16:37 2010 -0400
expose internal doc for Criteria as full JavaDoc
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 4ad0376..2d8a6b7 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -111,7 +111,7 @@ public abstract class Criteria implements Serializable {
this.pageSize = pageSize;
}
- /*
+ /**
* If the pageControl is set, then this criteria object will completely ignore any
* calls made to setPaging(pageNumber, pageSize) as well as addSortField(fieldName),
* which is useful from a server-side calling context where the PageControl object
@@ -121,7 +121,7 @@ public abstract class Criteria implements Serializable {
this.pageControlOverrides = pageControl;
}
- /*
+ /**
* By default, the ordering fields are automatically prepend with the alias of entity
that this criteria object
* wraps. However, some authors of criteria objects want full control of this alias
during sort operations. if
* this method returns true, then the alias will not be prepend to the generated
"order by" clause, which makes
@@ -138,7 +138,7 @@ public abstract class Criteria implements Serializable {
this.pageControlOverrides = null;
}
- /*
+ /**
* If set to true, then results will come back if they match ANY filter;
* Default is 'false', which means results must match all set filters.
*/
@@ -150,7 +150,7 @@ public abstract class Criteria implements Serializable {
return filtersOptional;
}
- /*
+ /**
* If set to true, string-based filters will use case-sensitive matching;
* Default is 'false', which means results will match case-insensitively
*/
@@ -162,7 +162,7 @@ public abstract class Criteria implements Serializable {
return this.caseSensitive;
}
- /*
+ /**
* If set to true, string-based filters will use exact string matches;
* Default is 'false', which means we'll fuzzy match
*/
commit 8e4ecf09283606fbc0420186919f4c145e87e6a2
Author: Joseph Marques <joseph(a)redhat.com>
Date: Sun Oct 10 23:11:13 2010 -0400
fix todo in TokenGenerationTest
* switched from using Agent.generateRandomToken (which is what was being tested)
to using SecureRandom.getInstance("SHA1PRNG"), which resides directly in
CoreServerServiceImpl
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/TokenGenerationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/TokenGenerationTest.java
deleted file mode 100644
index 8e75a2c..0000000
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/TokenGenerationTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
- /*
- * 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.resource.test;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import org.testng.annotations.Test;
-import org.rhq.core.domain.resource.Agent;
-
-@Test
-public class TokenGenerationTest {
- /*
- TODO: GWT
- (This is no longer needed... switched to using SecureRandom generation from the
CoreServerServiceImpl)
-
- public void testUniqueTokenGeneration1() throws Exception {
- final Collection<String> tokens = Collections.synchronizedSet(new
HashSet<String>());
- final int maxThreads = 20;
- final CountDownLatch latch = new CountDownLatch(maxThreads); // will open when
all threads are done
-
- for (int i = 0; i < maxThreads; i++) {
- new Thread(new Runnable() {
- public void run() {
- String token = Agent.generateRandomToken("seed"); //
purposefully pass in the same string, see if we can break it
- if (!tokens.add(token)) {
- System.out.println("DUPLICATE TOKEN=" + token);
- }
-
- latch.countDown();
- }
- }).start();
- }
-
- assert latch.await(120, TimeUnit.SECONDS) : "Did not wait long enough for
the threads to finish";
- assert tokens.size() == maxThreads : "One or more generated tokens were
duplicated: " + maxThreads + " : "
- + tokens.size() + " : " + tokens;
- }
-
- public void testUniqueTokenGeneration2() throws Exception {
- final Collection<String> tokens = Collections.synchronizedSet(new
HashSet<String>());
- final int maxThreads = 20;
- final CountDownLatch latch = new CountDownLatch(maxThreads); // will open when
all threads are done
-
- for (int i = 0; i < maxThreads; i++) {
- final String seed = "seed" + i; // pass in a unique seed for each
call to generate the token
- new Thread(new Runnable() {
- public void run() {
- String token = Agent.generateRandomToken(seed);
- if (!tokens.add(token)) {
- System.out.println("DUPLICATE TOKEN=" + token);
- }
-
- latch.countDown();
- }
- }).start();
- }
-
- assert latch.await(120, TimeUnit.SECONDS) : "Did not wait long enough for
the threads to finish";
- assert tokens.size() == maxThreads : "One or more generated tokens were
duplicated: " + maxThreads + " : "
- + tokens.size() + " : " + tokens;
- }*/
-}
\ No newline at end of file
commit 05c128f449c0f9e00102e4793813a5537a2fe6e0
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Oct 8 03:30:57 2010 -0400
fix todo in EventReport
* remove Log.warn from EventReport and instead print a report of how many
events for each EventSource were dropped in the EventManager
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/event/transfer/EventReport.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/event/transfer/EventReport.java
index 50a492b..9b150c8 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/event/transfer/EventReport.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/event/transfer/EventReport.java
@@ -23,13 +23,12 @@
package org.rhq.core.domain.event.transfer;
import java.io.Serializable;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.event.Event;
@@ -147,10 +146,12 @@ public class EventReport implements Serializable {
* (i.e. the method will do nothing and return immediately). Therefore, it is
recommended
* you call this method only after the report is done and you are ready to send the
* report to the server for further processing.
+ *
+ * @return true if some events in teh current report were dropped due to limits
*/
- public void addLimitWarningEvents() {
+ public boolean addLimitWarningEvents() {
if (this.addedLimitWarningEvents || this.eventsDropped == null) {
- return; // we already added them or there is nothing to add
+ return false; // we already added them or there is nothing to add
}
Event warningEvent;
@@ -172,9 +173,6 @@ public class EventReport implements Serializable {
+ this.maxEventsPerReport + "] - dropped [" + droppedCount
+ "] events";
}
- /* TODO: GWT
- LOG.warn(warningMessage + ": source=[" + eventSource +
"]");
- */
warningEvent = new Event(eventSource.getEventDefinition().getName(),
eventSource.getLocation(), now,
EventSeverity.WARN, warningMessage, eventSource);
eventSet.add(warningEvent);
@@ -182,7 +180,11 @@ public class EventReport implements Serializable {
this.addedLimitWarningEvents = true;
}
- return;
+ return this.eventsDropped.size() > 0;
+ }
+
+ public Map<EventSource, Integer> getDroppedEvents() {
+ return Collections.unmodifiableMap(eventsDropped);
}
public int getMaxEventsPerSource() {
@@ -195,6 +197,7 @@ public class EventReport implements Serializable {
@Override
public String toString() {
- return
this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1)
+ "[" + this.events + "]";
+ return
this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") +
1) + "[" + this.events
+ + "]";
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
index 98d8573..4ad5c50 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
@@ -127,7 +127,14 @@ public class EventManager implements ContainerService {
* @param report the Event report to be sent (this report should be closed from
getting any more events added to it)
*/
void sendEventReport(EventReport report) {
- report.addLimitWarningEvents(); // add any limit warning events if events were
dropped
+ if (report.addLimitWarningEvents()) { // add any limit warning events if events
were dropped
+ Map<EventSource, Integer> droppedEvents = report.getDroppedEvents();
+ log.warn("Begin dropped events report");
+ for (Map.Entry<EventSource, Integer> next : droppedEvents.entrySet())
{
+ log.warn("There were " + next.getValue() + " dropped
events for source '" + next.getKey() + "'");
+ }
+ log.warn("Finish dropped events report");
+ }
if (!report.getEvents().isEmpty() && this.pcConfig.getServerServices() !=
null) {
try {
this.pcConfig.getServerServices().getEventServerService().mergeEventReport(report);
commit bbb3f3aa541da6c3697afe40da7c58a5d6372d05
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Oct 8 03:30:03 2010 -0400
remove todo from ResourceType
* eliminate ResourceType.findByName query, replaced by criteria-based finder
* also, delete unnecessary composite-finder in ResourceManagerBean
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index 079b8f5..f7dba02 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -79,8 +79,6 @@ import org.rhq.core.domain.util.Summary;
@Table(name = ResourceType.TABLE_NAME)
@SequenceGenerator(name = "SEQ", sequenceName =
"RHQ_RESOURCE_TYPE_ID_SEQ")
@NamedQueries( {
- @NamedQuery(name = ResourceType.QUERY_FIND_BY_NAME, // TODO: QUERY: This breaks
rules, names may not be unique between plugins
- query = "SELECT rt FROM ResourceType AS rt WHERE LOWER(rt.name) =
LOWER(:name)"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_PLUGIN, query = "SELECT rt FROM
ResourceType AS rt WHERE rt.plugin = :plugin"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_NAME_AND_PLUGIN, // TODO: QUERY: names
are case-sensitive
query = "SELECT rt FROM ResourceType AS rt WHERE LOWER(rt.name) = LOWER(:name)
AND rt.plugin = :plugin"),
@@ -237,7 +235,6 @@ public class ResourceType implements Serializable,
Comparable<ResourceType> {
public static final ResourceType ANY_PLATFORM_TYPE = null;
- public static final String QUERY_FIND_BY_NAME = "ResourceType.findByName";
public static final String QUERY_GET_EXPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP =
"ResourceType.getExplicitResourceTypeCountsByGroup";
public static final String QUERY_GET_IMPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP =
"ResourceType.getImplicitResourceTypeCountsByGroup";
public static final String QUERY_FIND_BY_NAME_AND_PLUGIN =
"ResourceType.findByNameAndPlugin";
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 62091bc..6f4d21e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -939,28 +939,6 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return new PageList<Resource>(results, (int) count, pageControl);
}
- public PageList<ResourceComposite> findResourceComposites(Subject user,
ResourceCategory category, String typeName,
- int parentResourceId, String searchString, PageControl pageControl) {
-
- ResourceType type = null;
- Resource parentResource = null;
-
- if (null != typeName) {
- Query query =
entityManager.createNamedQuery(ResourceType.QUERY_FIND_BY_NAME);
- query.setParameter("name", typeName);
- type = (ResourceType) query.getSingleResult();
- // TODO: why is this being fetched after it was just loaded?!
- type = entityManager.find(ResourceType.class, type.getId());
- }
- if (parentResourceId > 0) {
- parentResource = getResourceById(user, parentResourceId);
- }
-
- String typeNameFilter = type == null ? null : type.getName();
- return findResourceComposites(user, category, typeNameFilter, null,
parentResource, searchString, false,
- pageControl);
- }
-
/**
* This finder query can be used to find resources with various combinations of
attributes in their composite form.
* Except for the user parameter, the other parameters can be left null so that the
query will not filter by that
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 4414504..a94bcc4 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -202,14 +202,6 @@ public interface ResourceManagerLocal {
PageList<Resource> findResourcesByCategory(Subject user, ResourceCategory
category,
InventoryStatus inventoryStatus, PageControl pageControl);
- PageList<ResourceComposite> findResourceComposites( //
- Subject user, //
- ResourceCategory category, //
- String typeName, //
- int parentResourceId, //
- String searchString, //
- PageControl pageControl);
-
/**
* @see ResourceManagerRemote#findResourceComposites(Subject, ResourceCategory,
String, int, String, PageControl)
*/
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
index 8f8604d..46b8e08 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
@@ -31,8 +31,6 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.ResourceAvailability;
import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceCategory;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.jaxb.adapter.ResourceListAdapter;
@@ -126,15 +124,6 @@ public interface ResourceManagerRemote {
@WebParam(name = "resourceIds") int[] resourceIds);
@WebMethod
- PageList<ResourceComposite> findResourceComposites( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "category") ResourceCategory category, //
- @WebParam(name = "typeName") String typeName, //
- @WebParam(name = "parentResourceId") int parentResourceId, //
- @WebParam(name = "searchString") String searchString, //
- @WebParam(name = "pageControl") PageControl pageControl);
-
- @WebMethod
PageList<Resource> findResourcesByCriteria( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "criteria") ResourceCriteria criteria);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/DiscoveryTestBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/DiscoveryTestBean.java
index 709b95a..39f8635 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/DiscoveryTestBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/DiscoveryTestBean.java
@@ -41,6 +41,7 @@ import
org.rhq.core.clientapi.server.discovery.InvalidInventoryReportException;
import org.rhq.core.clientapi.server.discovery.InventoryReport;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.plugin.Plugin;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.InventoryStatus;
@@ -53,6 +54,7 @@ import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.core.CoreServerServiceImpl;
import org.rhq.enterprise.server.discovery.DiscoveryServerServiceImpl;
+import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
/**
* An EJB for testing the discovery subsystem - used by TestControl.jsp.
@@ -87,6 +89,9 @@ public class DiscoveryTestBean implements DiscoveryTestLocal {
@EJB
private SubjectManagerLocal subjectManager;
+ @EJB
+ private ResourceTypeManagerLocal resourceTypeManager;
+
public void registerTestPluginAndTypeInfo() {
//System.out.println("CALLER: " + ctx.getCallerPrincipal() + "
(" + ctx.getCallerPrincipal().getName() + ")");
try {
@@ -194,16 +199,6 @@ public class DiscoveryTestBean implements DiscoveryTestLocal {
}
}
- /*private void checkUserCanManageAgent(LatherContext ctx, String user,
- * String pword, String operation) throws
PermissionException { // TODO: Implement
- * check (gh: what is with all the crazy caching?)
- */
- /*sessionId = this.getAuthManager().getSessionId(user, pword);
- * subject =
- *
this.sessionManager.getSubject(sessionId);this.getServerManager().checkCreatePlatformPermission(subject);*/
- /*
- *}*/
-
public void createTestMixedGroup(String groupName) {
List<Resource> resources = PersistenceUtility
.findByCriteria(entityManager, Resource.class,
Restrictions.like("name", "BogusServer 0",
@@ -238,18 +233,21 @@ public class DiscoveryTestBean implements DiscoveryTestLocal {
}
private ResourceType getTestPlatformType() {
- return (ResourceType)
entityManager.createNamedQuery(ResourceType.QUERY_FIND_BY_NAME).setParameter("name",
- TEST_PLATFORM_TYPE_NAME).getSingleResult();
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterName(TEST_PLATFORM_TYPE_NAME);
+ return
resourceTypeManager.findResourceTypesByCriteria(subjectManager.getOverlord(),
criteria).get(0);
}
private ResourceType getTestServerType() {
- return (ResourceType)
entityManager.createNamedQuery(ResourceType.QUERY_FIND_BY_NAME).setParameter("name",
- TEST_SERVER_TYPE_NAME).getSingleResult();
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterName(TEST_SERVER_TYPE_NAME);
+ return
resourceTypeManager.findResourceTypesByCriteria(subjectManager.getOverlord(),
criteria).get(0);
}
private ResourceType getTestServiceType() {
- return (ResourceType)
entityManager.createNamedQuery(ResourceType.QUERY_FIND_BY_NAME).setParameter("name",
- TEST_SERVICE_TYPE_NAME).getSingleResult();
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterName(TEST_SERVICE_TYPE_NAME);
+ return
resourceTypeManager.findResourceTypesByCriteria(subjectManager.getOverlord(),
criteria).get(0);
}
private Resource createTestPlatform(String address, int servers, int
servicesPerServer) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index d5f3cce..a91a832 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -107,10 +107,8 @@ import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.resource.CreateResourceHistory;
import org.rhq.core.domain.resource.DeleteResourceHistory;
import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageControl;
@@ -812,12 +810,6 @@ public class WebservicesManagerBean implements WebservicesRemote {
//RESOURCEFACTORYMANAGER: END ----------------------------------
//RESOURCEMANAGER: BEGIN ----------------------------------
- public PageList<ResourceComposite> findResourceComposites(Subject subject,
ResourceCategory category,
- String typeName, int parentResourceId, String searchString, PageControl
pageControl) {
- return resourceManager.findResourceComposites(subject, category, typeName,
parentResourceId, searchString,
- pageControl);
- }
-
public List<Resource> findResourceLineage(Subject subject, int resourceId) {
return resourceManager.findResourceLineage(subject, resourceId);
}
commit 9d595a68fc784a7e78ed39b541b65a219ddf3e0c
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Oct 8 02:51:38 2010 -0400
fix todos with OperationHistory, ResourceOperationHistory, and OperationSchedule
* remove conditional printing of parameters/results in toString() override
* if tests need to see these values, they can still be gotten via
getParameters()/getResults()
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
index 2556406..84a494a 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
@@ -364,6 +364,10 @@ public abstract class OperationHistory implements Serializable {
return end - start;
}
+ /*
+ * there may be some operations whose parameters are sensitive values, such as
passwords - do not show them
+ * as part of the toString. they can still be gotten by explicitly calling
getParameters()
+ */
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
@@ -372,14 +376,6 @@ public abstract class OperationHistory implements Serializable {
buf.append("], job-group=[" + this.jobGroup);
buf.append("], status=[" + this.status);
buf.append("], subject-name=[" + this.subjectName);
-
- // there may be some operations whose parameters are sensitive values, like
passwords
- // do not show them by default - but allow testers to see them via a system
property
- /* TODO: GWT
- if (Boolean.getBoolean("rhq.test.operation.show-values")) {
- buf.append("], parameters=[" + this.parameters);
- }*/
-
buf.append("], ctime=[" + new java.util.Date(this.createdTime));
buf.append("], mtime=[" + new java.util.Date(this.modifiedTime));
buf.append("], duration-millis=[" + getDuration());
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
index 6b5fab3..4b002b1 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
@@ -169,18 +169,14 @@ public class ResourceOperationHistory extends OperationHistory {
}
}
+ /*
+ * there may be some operations whose results are sensitive values, such as passwords
- do not show them
+ * as part of the toString. they can still be gotten by explicitly calling
getResults()
+ */
@Override
public String toString() {
StringBuilder str = new StringBuilder("ResourceOperationHistory: ");
str.append("resource=[" + this.resource);
-
- // there may be some operations whose results are sensitive values, like
passwords
- // do not show them by default - but allow testers to see them via a system
property
- /* TODO: GWT
- if
(Boolean.valueOf(System.getProperty("rhq.test.operation.show-values"))) {
- str.append("], results=[" + this.results);
- }*/
-
str.append("], group-history=[" + this.groupOperationHistory);
str.append("], " + super.toString());
str.append("]");
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationSchedule.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationSchedule.java
index b4db99b..bb5a636 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationSchedule.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationSchedule.java
@@ -136,6 +136,10 @@ public abstract class OperationSchedule implements Serializable {
return new JobId(this.jobName, this.jobGroup);
}
+ /*
+ * there may be some operations whose parameters are sensitive values, such as
passwords - do not show them
+ * as part of the toString. they can still be gotten by explicitly calling
getParameters()
+ */
@Override
public String toString() {
StringBuilder str = new StringBuilder();
@@ -144,13 +148,6 @@ public abstract class OperationSchedule implements Serializable {
str.append("], operation-name=[" + this.operationName);
str.append("], subject=[" + this.subject);
str.append("], description=[" + this.description);
-
- // there may be some operations whose parameters are sensitive values, like
passwords
- // do not show them by default - but allow testers to see them via a system
property
- if (Boolean.getBoolean("rhq.test.operation.show-values")) {
- str.append("], parameters=[" + this.parameters);
- }
-
str.append("]");
return str.toString();
}
commit a6ebf98311e348c732458f491303fd4d4a685550
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Oct 8 02:45:21 2010 -0400
fix todos in ResourceFacets
* although this object is not technically immutable anymore via private final
member variables, it is still effectively immutable because there is no way
to modify the member variables after object construction. furthermore, this
class is accessed through the ResourceFacetsCache, which guarantees correct
multi-threaded access.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
index c05d5ef..b72f409 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
@@ -39,10 +39,7 @@ public class ResourceFacets implements Serializable {
public static ResourceFacets NONE = new ResourceFacets(-1, false, false, false,
false, false, false, false, false);
public static ResourceFacets ALL = new ResourceFacets(-1, true, true, true, true,
true, true, true, true);
- /*
- * immutable private member data makes this object safe to use in a concurrent
environment, such as a
- * concurrent-access cache of ResourceFacets objects (TODO (ips): make these final
again?)
- */
+
private int resourceTypeId;
private boolean measurement;
private boolean event;
commit 058831208d21c315516094a7dbba858c50fa38a9
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Oct 8 02:27:10 2010 -0400
remove todos concerning Externalizable from all entities
* for the UI migration to GWT, core/domain was directly exposed as
GWT-compilable resources. accordingly, all references to classes
that were not GWT-compilable had to be removed.
* ExternalizableStrategy and corresponding hooks are being kept, in
case they are needed in the future.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index 4a93c1f..ff8ef88 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -498,80 +498,5 @@ public class Subject implements Serializable, Recordizable {
return true;
}
- /*
- public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy =
ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
- writeExternalRemote(out);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION ==
strategy) {
- EntitySerializer.writeExternalRemote(this, out);
- // reflective serialization misses sessionId because it's not a
persistence annotated
- out.writeInt(this.sessionId == null ? 0 : this.sessionId);
- } else {
- writeExternalAgent(out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- char c = in.readChar();
- if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
- readExternalRemote(in);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() ==
c) {
- EntitySerializer.readExternalRemote(this, in);
- // reflective serialization misses sessionId because it's not a
persistence annotated
- this.sessionId = in.readInt();
- } else {
- readExternalAgent(in);
- }
- }
-
- public void writeExternalAgent(ObjectOutput out) throws IOException {
- out.writeInt(this.id);
- out.writeUTF(this.name);
- out.writeInt(this.sessionId);
- }
-
- public void readExternalAgent(ObjectInput in) throws IOException,
ClassNotFoundException {
- this.id = in.readInt();
- this.name = in.readUTF();
- this.sessionId = in.readInt();
- }
-
- // It is assumed that the object is clean of Hibernate proxies (i.e.
HibernateDetachUtility has been run if necessary)
- public void writeExternalRemote(ObjectOutput out) throws IOException {
- out.writeInt(this.id);
- out.writeUTF(this.name);
- out.writeUTF((null == firstName) ? "" : firstName);
- out.writeUTF((null == lastName) ? "" : lastName);
- out.writeUTF((null == emailAddress) ? "" : emailAddress);
- out.writeUTF((null == smsAddress) ? "" : smsAddress);
- out.writeUTF((null == phoneNumber) ? "" : phoneNumber);
- out.writeUTF((null == department) ? "" : department);
- out.writeBoolean(factive);
- out.writeBoolean(fsystem);
- out.writeObject(configuration);
- out.writeObject(roles);
- // not supplied by remote: subjectNotifications
- out.writeInt(this.sessionId == null ? 0 : this.sessionId);
- }
-
- @SuppressWarnings("unchecked")
- public void readExternalRemote(ObjectInput in) throws IOException,
ClassNotFoundException {
- this.id = in.readInt();
- this.name = in.readUTF();
- this.firstName = in.readUTF();
- this.lastName = in.readUTF();
- this.emailAddress = in.readUTF();
- this.smsAddress = in.readUTF();
- this.phoneNumber = in.readUTF();
- this.department = in.readUTF();
- this.factive = in.readBoolean();
- this.fsystem = in.readBoolean();
- this.configuration = (Configuration) in.readObject();
- this.roles = (Set<Role>) in.readObject();
- this.sessionId = in.readInt();
- }*/
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
index fe4510e..a38bbd4 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
@@ -196,35 +196,6 @@ public class FailoverListComposite implements
Iterator<FailoverListComposite.Ser
return new FailoverListComposite(servers);
}
- /* TODO: GWT
- private void writeObject(ObjectOutputStream out) throws IOException {
- out.writeInt(size());
- for (ServerEntry entry : servers) {
- out.writeUTF(entry.address);
- out.writeInt(entry.port);
- out.writeInt(entry.securePort);
- }
- }
-
- private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
- int size = in.readInt();
-
- List<ServerEntry> entries = new ArrayList<ServerEntry>();
- for (int i = 0; i < size; i++) {
- String address = in.readUTF();
- int port = in.readInt();
- int securePort = in.readInt();
- entries.add(new ServerEntry(address, port, securePort));
- }
-
- *//*
- * no need to wrap 'entries' in a new list before putting them into the
immutable wrapper;
- * as long as the 'entries' reference does not escape this method, we
can be assured that
- * 'servers' is correctly immutable.
- *//*
- servers = Collections.unmodifiableList(entries);
- }*/
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder("\nServerList:\n ");
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
index 99488d3..e2754eb 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
@@ -567,92 +567,6 @@ public class Configuration implements Serializable, Cloneable,
AbstractPropertyM
return builder.append("]").toString();
}
- /*
-
- public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy =
ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (isAgentOrRemoteAPISerialization(strategy.id())) {
- writeExternalAgentOrRemote(out);
- }
- else {
- EntitySerializer.writeExternalRemote(this, out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- char c = in.readChar();
-
- if (isAgentOrRemoteAPISerialization(c)) {
- readExternalAgentOrRemote(in);
- }
- else {
- EntitySerializer.readExternalRemote(this, in);
- }
- }
-
- private boolean isAgentOrRemoteAPISerialization(char strategy) {
- return strategy == ExternalizableStrategy.Subsystem.AGENT.id() ||
- strategy == ExternalizableStrategy.Subsystem.REMOTEAPI.id();
- }
-
- */
- /**
- * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
- */
- /*
-
- public void writeExternalAgentOrRemote(ObjectOutput out) throws IOException {
- Configuration copy = deepCopyWithoutProxies();
-
- out.writeInt(id);
- out.writeObject(createDeepCopyOfMap());
- out.writeObject(createDeepCopyOfRawConfigs());
- out.writeUTF((notes == null) ? "null" : notes);
- out.writeLong(version);
- out.writeLong(ctime);
- out.writeLong(mtime);
- }
-
- private Map<String, Property> createDeepCopyOfMap() {
- Map<String, Property> copy = new HashMap<String, Property>();
- for (Map.Entry<String, Property> entry : this.properties.entrySet()) {
- Property copiedProperty = entry.getValue().deepCopy(true);
- copiedProperty.setConfiguration(this);
- copy.put(entry.getKey(), copiedProperty);
- }
- return copy;
- }
-
- private Set<RawConfiguration> createDeepCopyOfRawConfigs() {
- Set<RawConfiguration> copy = new HashSet<RawConfiguration>();
- for (RawConfiguration rawConfig : this.rawConfigurations) {
- RawConfiguration copiedRawConfig = rawConfig.deepCopy(true);
- copiedRawConfig.setConfiguration(this);
- copy.add(copiedRawConfig);
- }
- return copy;
- }
-
- */
- /**
- * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
- */
- /*
-
- @SuppressWarnings("unchecked")
- public void readExternalAgentOrRemote(ObjectInput in) throws IOException,
ClassNotFoundException {
- id = in.readInt();
- properties = (HashMap<String, Property>) in.readObject();
- rawConfigurations = (Set<RawConfiguration>) in.readObject();
- notes = in.readUTF();
- version = in.readLong();
- ctime = in.readLong();
- mtime = in.readLong();
- }
- */
-
/**
* This listener runs after jaxb unmarshalling and reconnects children properties to
their parent configurations (as
* we don't send them avoiding cyclic references).
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
index 3518159..be176e4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
@@ -266,72 +266,6 @@ public class Property implements Serializable,
DeepCopyable<Property>, Comparabl
return null;
}
- /*
- // It's not clear to me why this class implements Externalizable. It seems to
write out every field
- // using standard serialization. Also, it's sub-classes seem to write out
every field. To be safe I'm leaving
- // it as is and also applying the new strategy logic, in case there are (future)
differences between agent and
- // remoteAPI serialization.
- public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy =
ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
- writeExternalRemote(out);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION ==
strategy) {
- EntitySerializer.writeExternalRemote(this, out);
- } else {
- writeExternalAgent(out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- char c = in.readChar();
- if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
- readExternalRemote(in);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() ==
c) {
- EntitySerializer.readExternalRemote(this, in);
- } else {
- readExternalAgent(in);
- }
- }
-
- public void writeExternalAgent(ObjectOutput out) throws IOException {
- out.writeInt(id);
- out.writeObject(configuration);
- out.writeUTF(name);
- out.writeObject(parentList);
- out.writeObject(parentMap);
- out.writeObject(errorMessage);
- }
-
- public void readExternalAgent(ObjectInput in) throws IOException,
ClassNotFoundException {
- id = in.readInt();
- configuration = (Configuration) in.readObject();
- name = in.readUTF();
- parentList = (PropertyList) in.readObject();
- parentMap = (PropertyMap) in.readObject();
- errorMessage = (String) in.readObject();
- }
-
- // It is assumed that the object is clean of Hibernate proxies (i.e.
HibernateDetachUtility has been run if necessary)
- public void writeExternalRemote(ObjectOutput out) throws IOException {
- out.writeInt(id);
- out.writeObject(configuration);
- out.writeUTF(name);
- out.writeObject(errorMessage);
- out.writeObject(parentList);
- out.writeObject(parentMap);
- }
-
- public void readExternalRemote(ObjectInput in) throws IOException,
ClassNotFoundException {
- id = in.readInt();
- configuration = (Configuration) in.readObject();
- name = in.readUTF();
- errorMessage = (String) in.readObject();
- parentList = (PropertyList) in.readObject();
- parentMap = (PropertyMap) in.readObject();
- }*/
-
@Override
public String toString() {
StringBuilder str = new StringBuilder(this.getClass().getName().substring(
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
index ce51bcc..a5f7e2a 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
@@ -22,9 +22,8 @@
*/
package org.rhq.core.domain.configuration;
-import org.hibernate.annotations.Cascade;
-import org.hibernate.annotations.CascadeType;
-import org.jetbrains.annotations.NotNull;
+import java.util.ArrayList;
+import java.util.List;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
@@ -35,8 +34,9 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
-import java.util.ArrayList;
-import java.util.List;
+import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.CascadeType;
+import org.jetbrains.annotations.NotNull;
/**
* Holds an indexed list of child {@link Property properties}. This can hold any number
of properties, including
@@ -146,34 +146,15 @@ public class PropertyList extends Property {
}
if (!property.getName().equals(this.memberPropertyName)) {
- throw new IllegalStateException("All properties in a PropertyList
(id=[" + getId() + "], name=[" + getName()
- + "]) must have the same name: [" + property.getName() +
"] != [" + this.memberPropertyName + "]");
+ throw new IllegalStateException("All properties in a PropertyList
(id=[" + getId() + "], name=["
+ + getName() + "]) must have the same name: [" +
property.getName() + "] != [" + this.memberPropertyName
+ + "]");
}
getList().add(property);
property.setParentList(this);
}
- /* TODO: GWT
- * *//**
- * @see
org.rhq.core.domain.configuration.Property#writeExternal(java.io.ObjectOutput)
- *//*
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(HibernateUtil.safeList(list));
- }
-
- *//**
- * @see org.rhq.core.domain.configuration.Property#readExternal(java.io.ObjectInput)
- *//*
- @Override
- @SuppressWarnings("unchecked")
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- super.readExternal(in);
- list = (List<Property>) in.readObject();
- }
-*/
/**
* NOTE: An PropertyList containing a null list is considered equal to a PropertyList
containing an empty list.
*/
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
index 90b391c..19e16c0 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
@@ -204,27 +204,6 @@ public class PropertyMap extends Property implements
AbstractPropertyMap {
return (PropertyMap) get(name);
}
- /* TODO: GWT *
-
- //**
- * @see
org.rhq.core.domain.configuration.Property#readExternal(java.io.ObjectInput)
- *//*
- @Override
- @SuppressWarnings("unchecked")
- public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- super.readExternal(in);
- map = (Map<String, Property>) in.readObject();
- }
-
- //**
- * @see
org.rhq.core.domain.configuration.Property#writeExternal(java.io.ObjectOutput)
- *//*
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(HibernateUtil.safeMap(map));
- }*/
-
/**
* NOTE: An PropertyMap containing a null map is considered equal to a PropertyMap
containing an empty map.
*/
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
index a4c4858..f8d4cea 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
@@ -1,28 +1,28 @@
- /*
- * 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.
- */
+/*
+ * 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.configuration;
-import java.io.*;
+import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
@@ -174,8 +174,7 @@ public class PropertySimple extends Property implements Serializable
{
*
* @param value
*/
- public void setLongValue(@Nullable
- Long value) {
+ public void setLongValue(@Nullable Long value) {
this.setValue(value);
}
@@ -267,30 +266,6 @@ public class PropertySimple extends Property implements Serializable
{
this.unmaskedStringValue = unmaskedStringValue;
}
-/* *//**
- * @see org.rhq.core.domain.configuration.Property#readExternal(java.io.ObjectInput)
- *//*
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- super.readExternal(in);
- stringValue = (String) in.readObject();
- override = in.readBoolean();
- }
-
- *//**
- * @see
org.rhq.core.domain.configuration.Property#writeExternal(java.io.ObjectOutput)
- *//*
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(stringValue);
- if (override == null) {
- out.writeBoolean(Boolean.FALSE);
- } else {
- out.writeBoolean(override);
- }
- }*/
-
@Override
public boolean equals(Object obj) {
if (this == obj) {
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/AvailabilityReport.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/AvailabilityReport.java
index 15b2613..a0015a6 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/AvailabilityReport.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/AvailabilityReport.java
@@ -1,34 +1,33 @@
- /*
- * 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.
- */
+/*
+ * 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.discovery;
-import java.io.*;
+import java.io.Externalizable;
+import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
+
import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.resource.Resource;
/**
* Contains a set of one or more {@link Availability} values used to indicate the
statuses of a set of resources. Note
@@ -134,46 +133,4 @@ public class AvailabilityReport implements Serializable {
return str.toString();
}
-
- /* public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(this.agentName);
- out.writeBoolean(this.changesOnly);
-
- out.writeInt(availabilities.size());
- for (Availability availability : availabilities) {
- out.writeInt(availability.getResource().getId());
-
- if (availability.getAvailabilityType() != null) {
- out.writeInt(availability.getAvailabilityType().ordinal());
- } else {
- out.writeInt(-1);
- }
-
- out.writeLong(availability.getStartTime().getTime());
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.agentName = (String) in.readObject();
- this.changesOnly = in.readBoolean();
-
- int count = in.readInt();
- for (int i = 0; i < count; i++) {
- int resourceId = in.readInt();
-
- AvailabilityType at;
- int avail = in.readInt();
- if (avail > -1) {
- at = AvailabilityType.values()[avail];
- } else {
- at = null;
- }
-
- Date startTime = new Date(in.readLong());
-
- Resource r = new Resource(resourceId);
- Availability a = new Availability(r, startTime, at);
- availabilities.add(a);
- }
- }*/
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/ResourceSyncInfo.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/ResourceSyncInfo.java
index db3ce89..4bcc267 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/ResourceSyncInfo.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/ResourceSyncInfo.java
@@ -22,9 +22,8 @@
*/
package org.rhq.core.domain.discovery;
-import java.io.*;
+import java.io.Serializable;
import java.util.Collection;
-import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -104,21 +103,4 @@ public class ResourceSyncInfo implements Serializable {
return childSyncInfos;
}
- /* TODO: GWT
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(id);
- out.writeUTF(uuid);
- out.writeLong(mtime);
- out.writeInt(inventoryStatus.ordinal());
- out.writeObject(HibernateUtil.safeCollection(childSyncInfos));
- }
-
- @SuppressWarnings("unchecked")
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- id = in.readInt();
- uuid = in.readUTF();
- mtime = in.readLong();
- inventoryStatus = InventoryStatus.values()[in.readInt()];
- childSyncInfos = (Set<ResourceSyncInfo>) in.readObject();
- }*/
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/event/EventSource.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/event/EventSource.java
index d339592..2424edb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/event/EventSource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/event/EventSource.java
@@ -22,7 +22,7 @@
*/
package org.rhq.core.domain.event;
-import java.io.*;
+import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@@ -158,23 +158,10 @@ public class EventSource implements Serializable {
@Override
public String toString() {
- return
this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1)
+ "[" + "id=" + this.id + ", " +
"eventDefinition.name="
+ return
this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") +
1) + "[" + "id="
+ + this.id + ", " + "eventDefinition.name="
+ ((this.eventDefinition != null) ? this.eventDefinition.getName() :
"null") + ", " + "resource.name="
+ ((this.resource != null) ? this.resource.getName() : "null") +
", " + "location=" + this.location + "]";
}
-/*
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(this.eventDefinition);
- out.writeInt((this.resource != null) ? this.resource.getId() : 0);
- // this can be null when serializing a containing referencing Event, in which it
is lazy loaded
- out.writeUTF((null == this.location) ? "" : this.location);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.eventDefinition = (EventDefinition) in.readObject();
- int resourceId = in.readInt();
- this.resource = new Resource(resourceId);
- this.location = in.readUTF();
- }*/
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
index 15cceb5..1933139 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
@@ -136,53 +136,4 @@ public class MeasurementReport implements Serializable {
public void incrementCollectionTime(long collectionTime) {
this.collectionTime += collectionTime;
}
-
- /* TODO: GWT
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(measurementNumericData.size());
- for (MeasurementDataNumeric datum : measurementNumericData) {
- out.writeInt(datum.getScheduleId());
- out.writeLong(datum.getTimestamp());
- // We can serialize a null value as Double.NaN, since, semantically, both
mean "no data available".
- out.writeDouble((datum.getValue() != null) ? datum.getValue() : Double.NaN);
- }
-
- out.writeInt(measurementTraitData.size());
- for (MeasurementDataTrait datum : measurementTraitData) {
- out.writeInt(datum.getScheduleId());
- out.writeLong(datum.getTimestamp());
- String value = datum.getValue();
- out.writeUTF((value != null) ? value : "");
- }
-
- out.writeObject(this.callTimeData);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- int count = in.readInt();
- for (int i = 0; i < count; i++) {
- int scheduleId = in.readInt();
- long timestamp = in.readLong();
- double doubleValue = in.readDouble();
- measurementNumericData.add(new MeasurementDataNumeric(new
MeasurementDataPK(timestamp, scheduleId),
- doubleValue));
- }
-
- count = in.readInt();
- for (int i = 0; i < count; i++) {
- int scheduleId = in.readInt();
- long timestamp = in.readLong();
- String stringValue = in.readUTF();
-
- // This should never be null, but I'm paranoid
- if (stringValue == null) {
- stringValue = "";
- }
-
- measurementTraitData
- .add(new MeasurementDataTrait(new MeasurementDataPK(timestamp,
scheduleId), stringValue));
- }
-
- this.callTimeData = (Set<CallTimeData>) in.readObject();
- }*/
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataValue.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataValue.java
index e336ce6..c231bb7 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataValue.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataValue.java
@@ -22,7 +22,8 @@
*/
package org.rhq.core.domain.measurement.calltime;
-import org.jetbrains.annotations.Nullable;
+import java.io.Serializable;
+import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -36,8 +37,7 @@ import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
-import java.io.Serializable;
-import java.util.Date;
+import org.jetbrains.annotations.Nullable;
/**
* Measurement data for a set of calls to a particular destination over a certain time
span.
@@ -181,30 +181,12 @@ public class CallTimeDataValue implements Serializable {
this.maximum = callTime;
}
}
-/*
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeLong(this.beginTime);
- out.writeLong(this.endTime);
- out.writeDouble(this.minimum);
- out.writeDouble(this.maximum);
- out.writeDouble(this.total);
- out.writeLong(this.count);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.beginTime = in.readLong();
- this.endTime = in.readLong();
- this.minimum = in.readDouble();
- this.maximum = in.readDouble();
- this.total = in.readDouble();
- this.count = in.readLong();
- }*/
@Override
public String toString() {
- return
this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1)
+ "[" + "key=" + this.key + ", " + "beginTime="
- + new Date(this.beginTime) + ", " + "endTime="
- + new Date(this.endTime) + ", " + "minimum=" +
this.minimum + ", " + "maximum="
- + this.maximum + ", " + "total=" + this.total + ",
" + "count=" + this.count + "]";
+ return
this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") +
1) + "[" + "key="
+ + this.key + ", " + "beginTime=" + new
Date(this.beginTime) + ", " + "endTime=" + new Date(this.endTime)
+ + ", " + "minimum=" + this.minimum + ", " +
"maximum=" + this.maximum + ", " + "total=" + this.total +
", "
+ + "count=" + this.count + "]";
}
}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index 6726bbb..71ccd30 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -1696,170 +1696,6 @@ public class Resource implements Comparable<Resource>,
Serializable {
return buffer.toString();
}
- /* public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy =
ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
- writeExternalRemote(out);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION ==
strategy) {
- EntitySerializer.writeExternalRemote(this, out);
- } else {
- writeExternalAgent(out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- char c = in.readChar();
- if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
- readExternalRemote(in);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() == c)
{
- EntitySerializer.readExternalRemote(this, in);
- } else {
- readExternalAgent(in);
- }
- }
-
- public void writeExternalAgent(ObjectOutput out) throws IOException {
- // Note that a Resource may have been constructed with id only. Check for
uninitialized fields.
- out.writeInt(id);
- out.writeUTF(uuid);
- out.writeUTF((null == resourceKey) ? "" : resourceKey);
- out.writeUTF((null == name) ? "" : name);
- out.writeInt(inventoryStatus.ordinal());
- out.writeUTF((null == version) ? "" : version);
- out.writeUTF((null == description) ? "" : description);
- out.writeLong(ctime);
- out.writeLong(mtime);
- out.writeLong(itime);
-
- //Subject modifiedBy;
- //Subject owner;
- //String location;
- out.writeObject(parentResource);
-
- if (null == resourceType) {
- out.writeUTF("");
- out.writeUTF("");
- out.writeObject(null);
- } else {
- out.writeUTF(resourceType.getName());
- out.writeUTF(resourceType.getPlugin());
- out.writeObject(resourceType.getCategory());
- }
-
- // We make a copy of the childResources Set for two reasons: 1) to avoid
calling writeObject() on the Set if it
- // happens to be a Hibernate proxy (which would only ever be true on the Server
side), and 2) to reduce the
- // chances of a ConcurrentModificationException occurring in some other thread
that is iterating the original Set.
- out.writeObject((null == childResources) ? null : new
LinkedHashSet<Resource>(childResources));
-
- // Don't write plugin configs out if they are a lazy proxy
- if (pluginConfiguration != null &&
pluginConfiguration.getClass().getName().contains("hibernate")) {
- out.writeObject(null);
- } else {
- out.writeObject(pluginConfiguration);
- }
-
- //Set<MeasurementSchedule> schedules = new
LinkedHashSet<MeasurementSchedule>();
- //Agent agent;
- //Set<ResourceGroup> resourceGroups = new
HashSet<ResourceGroup>();
- }
-
- @SuppressWarnings("unchecked")
- public void readExternalAgent(ObjectInput in) throws IOException,
ClassNotFoundException {
- id = in.readInt();
- uuid = in.readUTF();
- resourceKey = in.readUTF();
- name = in.readUTF();
- inventoryStatus = InventoryStatus.values()[in.readInt()];
- version = in.readUTF();
- description = in.readUTF();
- ctime = in.readLong();
- mtime = in.readLong();
- itime = in.readLong();
-
- //Subject modifiedBy;
- //Subject owner;
- //String location;
- parentResource = (Resource) in.readObject();
- resourceType = new ResourceType(in.readUTF(), in.readUTF(), (ResourceCategory)
in.readObject(),
- (parentResource != null) ? parentResource.getResourceType() : null);
- childResources = (Set<Resource>) in.readObject();
-
- pluginConfiguration = (Configuration) in.readObject();
- }
-
- // It is assumed that the object is clean of Hibernate proxies (i.e.
HibernateDetachUtility has been run if necessary)
- public void writeExternalRemote(ObjectOutput out) throws IOException {
- // Note that a Resource may have been constructed with id only. Check for
uninitialized fields.
- out.writeInt(id);
- out.writeUTF(uuid);
- out.writeUTF(resourceKey);
- out.writeUTF(name);
- out.writeInt(inventoryStatus.ordinal());
- out.writeUTF((null == version) ? "" : version);
- out.writeUTF((null == description) ? "" : description);
- out.writeLong(ctime);
- out.writeLong(mtime);
- out.writeLong(itime);
- // not supplied by remote: modifiedBy
- out.writeUTF((null == location) ? "" : location);
- out.writeObject(resourceType);
- // making a copy reduces chances of ConcurrentModificationException in a thread
iterating the original
- out.writeObject((null == childResources) ? null : new
LinkedHashSet<Resource>(childResources));
- out.writeObject(parentResource);
- out.writeObject(resourceConfiguration);
- out.writeObject(pluginConfiguration);
- out.writeObject(agent);
- // not supplied by remote: alertDefinitions
- // not supplied by remote: resourceConfigurationUpdates
- // not supplied by remote: pluginConfigurationUpdates
- // making a copy reduces chances of ConcurrentModificationException in a thread
iterating the original
- out.writeObject((null == implicitGroups) ? null : new
LinkedHashSet<ResourceGroup>(implicitGroups));
- // making a copy reduces chances of ConcurrentModificationException in a thread
iterating the original
- out.writeObject((null == explicitGroups) ? null : new
LinkedHashSet<ResourceGroup>(explicitGroups));
- // not supplied by remote: contentServiceRequests
- // not supplied by remote: createChildResourceRequests
- // not supplied by remote: deleteResourceRequests
- // not supplied by remote: operationHistories
- // not supplied by remote: installedPackages
- // not supplied by remote: installedPackageHistory
- // not supplied by remote: resourceRepos
- // not supplied by remote: schedules
- out.writeObject(availability);
- out.writeObject(currentAvailability);
- out.writeObject(resourceErrors);
- // not supplied by remote: eventSources
- out.writeObject(productVersion);
- }
-
- @SuppressWarnings("unchecked")
- public void readExternalRemote(ObjectInput in) throws IOException,
ClassNotFoundException {
- id = in.readInt();
- uuid = in.readUTF();
- resourceKey = in.readUTF();
- name = in.readUTF();
- inventoryStatus = InventoryStatus.values()[in.readInt()];
- version = in.readUTF();
- description = in.readUTF();
- ctime = in.readLong();
- mtime = in.readLong();
- itime = in.readLong();
- location = in.readUTF();
- resourceType = (ResourceType) in.readObject();
- childResources = (Set<Resource>) in.readObject();
- parentResource = (Resource) in.readObject();
- resourceConfiguration = (Configuration) in.readObject();
- pluginConfiguration = (Configuration) in.readObject();
- agent = (Agent) in.readObject();
- implicitGroups = (Set<ResourceGroup>) in.readObject();
- explicitGroups = (Set<ResourceGroup>) in.readObject();
- availability = (List<Availability>) in.readObject();
- currentAvailability = (ResourceAvailability) in.readObject();
- resourceErrors = (List<ResourceError>) in.readObject();
- productVersion = (ProductVersion) in.readObject();
- }*/
-
public void afterUnmarshal(Object u, Object parent) {
this.parentResource = (Resource) parent;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
index b3790fe..2a48bd2 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
@@ -307,15 +307,4 @@ public class ResourceSubCategory implements
Comparable<ResourceSubCategory>, Ser
return "ResourceSubCategory[id=" + id + ", name=" + name +
"]";
}
- // public void writeExternal(ObjectOutput out) throws IOException
- // {
- // out.writeUTF(name);
- // // out.writeUTF(plugin);
- // }
-
- // public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException
- // {
- // name = in.readUTF();
- // // plugin = in.readUTF();
- // }
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index a94560d..079b8f5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -820,86 +820,4 @@ public class ResourceType implements Serializable,
Comparable<ResourceType> {
+ this.plugin + /*", parents=" + parents +*/"]";
}
- /*
- TODO: GWT
- public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy =
ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
- writeExternalRemote(out);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION ==
strategy) {
- EntitySerializer.writeExternalRemote(this, out);
- } else {
- writeExternalAgent(out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- char c = in.readChar();
- if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
- readExternalRemote(in);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() ==
c) {
- EntitySerializer.readExternalRemote(this, in);
- } else {
- readExternalAgent(in);
- }
- }
-
- public void writeExternalAgent(ObjectOutput out) throws IOException {
- out.writeUTF(this.name);
- out.writeUTF(this.plugin);
- }
-
- public void readExternalAgent(ObjectInput in) throws IOException,
ClassNotFoundException {
- this.name = in.readUTF();
- this.plugin = in.readUTF();
- }
-
- public void writeExternalRemote(ObjectOutput out) throws IOException {
- out.writeInt(this.id);
- out.writeUTF(this.name);
- out.writeUTF((null == this.description) ? "" : this.description);
- out.writeObject(this.category);
- out.writeObject(this.creationDataType);
- out.writeObject(this.createDeletePolicy);
- out.writeBoolean(this.supportsManualAdd);
- out.writeBoolean(this.singleton);
- out.writeUTF(this.plugin);
- out.writeLong(this.ctime);
- out.writeLong(this.mtime);
- out.writeObject(this.subCategory);
- out.writeObject(this.bundleType);
- out.writeObject((null == childResourceTypes) ? null : new
LinkedHashSet<ResourceType>(childResourceTypes));
- out.writeObject((null == parentResourceTypes) ? null : new
LinkedHashSet<ResourceType>(parentResourceTypes));
- out.writeObject(pluginConfigurationDefinition);
- out.writeObject(resourceConfigurationDefinition);
- out.writeObject((null == metricDefinitions) ? null
- : new LinkedHashSet<MeasurementDefinition>(metricDefinitions));
- out.writeObject((null == eventDefinitions) ? null : new
LinkedHashSet<EventDefinition>(eventDefinitions));
- out.writeObject((null == operationDefinitions) ? null : new
LinkedHashSet<OperationDefinition>(
- operationDefinitions));
- out.writeObject((null == processScans) ? null : new
LinkedHashSet<ProcessScan>(processScans));
- out.writeObject((null == packageTypes) ? null : new
LinkedHashSet<PackageType>(packageTypes));
- out.writeObject((null == subCategories) ? null : new
LinkedHashSet<ResourceSubCategory>(subCategories));
- out.writeObject((null == resources) ? null : new
LinkedHashSet<Resource>(resources));
- out.writeObject((null == productVersions) ? null : new
LinkedHashSet<ProductVersion>(productVersions));
- // not supplied by remote: helpText
- }
-
- public void readExternalRemote(ObjectInput in) throws IOException,
ClassNotFoundException {
- this.id = in.readInt();
- this.name = in.readUTF();
- this.description = in.readUTF();
- this.category = (ResourceCategory) in.readObject();
- this.creationDataType = (ResourceCreationDataType) in.readObject();
- this.createDeletePolicy = (CreateDeletePolicy) in.readObject();
- this.supportsManualAdd = in.readBoolean();
- this.singleton = in.readBoolean();
- this.plugin = in.readUTF();
- this.ctime = in.readLong();
- this.mtime = in.readLong();
- }
- */
-
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/server/ExternalizableStrategy.java
b/modules/core/domain/src/main/java/org/rhq/core/server/ExternalizableStrategy.java
index 48214a6..a43fcdc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/server/ExternalizableStrategy.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/server/ExternalizableStrategy.java
@@ -33,9 +33,8 @@ package org.rhq.core.server;
public class ExternalizableStrategy {
public enum Subsystem {
- AGENT((char) 1), //
- REMOTEAPI((char) 2), //
- REFLECTIVE_SERIALIZATION((char) 3);
+ AGENT((char) 1), // set bidirectionally for agent<--->server communication
+ REFLECTIVE_SERIALIZATION((char) 3); // set unidirectionally for both
CLI-->server and WS-->server communication
private char id;
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
index 32d0efb..f785e86 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
@@ -34,7 +34,6 @@ import java.util.Set;
import org.testng.annotations.Test;
-import org.rhq.core.server.ExternalizableStrategy;
import org.rhq.core.util.MessageDigestGenerator;
/**
@@ -444,238 +443,4 @@ public class ConfigurationTest {
return copy;
}
- @Test
- public void agentSerializationShouldCopyId() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertIdFieldSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldNotCopyId() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertIdFieldSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyId() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertIdFieldSerialized();
- }
-
- private void assertIdFieldSerialized() throws Exception {
- int id = -1;
-
- Configuration config = new Configuration();
- config.setId(id);
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(serializedConfig.getId(), id, "Failed to properly serialize the
id property");
- }
-
- @Test
- public void agentSerializationShouldCopyPropertiesMap() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertPropertiesFieldIsSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldCopyPropertiesMap() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertPropertiesFieldIsSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyPropertiesMap() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertPropertiesFieldIsSerialized();
- }
-
- private void assertPropertiesFieldIsSerialized() throws Exception {
- Configuration config = new Configuration();
- config.put(new PropertySimple("x", "1"));
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(serializedConfig.getMap(), config.getMap(), "Failed to property
serialize the map property");
- for (Property property : serializedConfig.getProperties()) {
- assertEquals(property.getConfiguration(), serializedConfig,
- "Failed to update parent reference of property during
serialization");
- }
- }
-
- @Test
- public void agentSerializationShouldCopyNotes() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertNotesFieldSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldCopyNotes() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertNotesFieldSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyNotes() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertNotesFieldSerialized();
- }
-
- private void assertNotesFieldSerialized() throws Exception {
-
- Configuration config = new Configuration();
- config.setNotes("notes");
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(serializedConfig.getNotes(), config.getNotes(), "Failed to
properly serialize the notes property");
- }
-
- @Test
- public void agentSerializationShouldCopyVersion() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertVersionFieldIsSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldCopyVersion() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertVersionFieldIsSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyVersion() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertVersionFieldIsSerialized();
- }
-
- private void assertVersionFieldIsSerialized() throws Exception {
- Configuration config = new Configuration();
- config.setVersion(1L);
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(serializedConfig.getVersion(), config.getVersion(),
- "Failed to properly serialize the version property");
- }
-
- @Test
- public void agentSerializationShouldCopyModifiedTime() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertModifiedTimeIsSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldCopyModifiedTime() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertModifiedTimeIsSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyModifiedTime() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertModifiedTimeIsSerialized();
- }
-
- private void assertModifiedTimeIsSerialized() throws Exception {
- Configuration config = new Configuration();
- updateModifiedTime(config);
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(serializedConfig.getModifiedTime(), config.getModifiedTime(),
- "Failed to properly serialize the modifiedTime property");
- }
-
- @Test
- public void agentSerializationShouldCopyCreatedTime() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertCreatedTimeIsSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldCopyCreatedTime() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertCreatedTimeIsSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyCreatedTime() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertCreatedTimeIsSerialized();
- }
-
- private void assertCreatedTimeIsSerialized() throws Exception {
- Configuration config = new Configuration();
- updateCreatedTime(config);
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(serializedConfig.getCreatedTime(), config.getCreatedTime(),
- "Failed to properly serialize the createdTime property");
- }
-
- @Test
- public void agentSerializationShouldCopyRawConfigurations() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.AGENT);
-
- assertRawConfigurationsIsSerialized();
- }
-
- @Test
- public void reflectiveSerializationShouldCopyRawConfigurations() throws Exception {
-
ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION);
-
- assertRawConfigurationsIsSerialized();
- }
-
- @Test
- public void remoteAPISerializationShouldCopyRawConfigurations() throws Exception {
- ExternalizableStrategy.setStrategy(ExternalizableStrategy.Subsystem.REMOTEAPI);
-
- assertRawConfigurationsIsSerialized();
- }
-
- private void assertRawConfigurationsIsSerialized() throws Exception {
- Configuration config = new Configuration();
- config.addRawConfiguration(createRawConfiguration("/tmp/foo.txt"));
- config.addRawConfiguration(createRawConfiguration("/tmp/bar.txt"));
-
- Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertRawConfigurationsEquals(serializedConfig.getRawConfigurations(),
config.getRawConfigurations(),
- "Failed to properly serialize rawConfigurations property");
- for (RawConfiguration rawConfig : serializedConfig.getRawConfigurations()) {
- assertEquals(rawConfig.getConfiguration(), serializedConfig,
- "Failed to update parent reference of raw config during
serialization");
- }
- }
-
- private void updateModifiedTime(Configuration config) {
- config.onUpdate();
- }
-
- private void updateCreatedTime(Configuration config) {
- config.onPersist();
- }
-
}
commit 05c9f66dd64f0f6efd29ddbefbaf3b368cf723e7
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 15:10:29 2010 -0400
fix todos in ResourceSubCategory
* if enterprise wishes to find resources types via query, criteria objects
should be used. this need has not arisen since the creation of the
ResourceSubCategory.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
index 14fd30f..b3790fe 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
@@ -119,7 +119,6 @@ public class ResourceSubCategory implements
Comparable<ResourceSubCategory>, Ser
*
* @return the resource types that belong to this subcategory; the Set of types is
sorted by name
*/
- // TODO enterprise may want to do this differently using a query
@NotNull
public Set<ResourceType> findTaggedResourceTypes() {
ResourceType parentResourceType = findParentResourceType();
@@ -139,7 +138,6 @@ public class ResourceSubCategory implements
Comparable<ResourceSubCategory>, Ser
}
}
- // TODO enterprise may want to do this differently using a query
@NotNull
public ResourceType findParentResourceType() {
ResourceSubCategory subCategory = this;
@@ -150,7 +148,6 @@ public class ResourceSubCategory implements
Comparable<ResourceSubCategory>, Ser
return subCategory.getResourceType();
}
- // TODO enterprise may want to do this differently using a query
public boolean isCreatable() {
for (ResourceType taggedResourceType : findTaggedResourceTypes()) {
// if any resourceType is creatable then this subCategory is
commit e5295162b8c842e6955d713a82eb228912788e01
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 11:45:36 2010 -0400
fix todos in MeasurementOOB
* replace todos with ample explanation of the current limitations of the
algorithm used to compute "problem" metrics, indicating what the issues
are preventing further accuracy as well as how to overcome these
limitations in the future.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
index 0ec1ce0..c586c87 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
@@ -130,6 +130,15 @@ public class MeasurementOOB {
public static final String DELETE_FOR_RESOURCES = "DeleteOOBForResurces";
+ /*
+ * (Jan 16, 2009) - The new OOB system uses a threshold to determine whether a metric
is a "problem" or not.
+ * The current threshold is a static value - 0.1 - and does not
change based on any characteristic
+ * of the metric data collected. Dynamic metrics, however, can have
either naturally narrow or
+ * naturally wide baseline ranges; this makes the static threshold
of 0.1 either too sensitive
+ * or not sensitive enough, respectively. The next improvement to
the baseline system probably
+ * needs to use a sliding scale for this threshold, to more
accurately characterize "problem"
+ * metrics across varying magnitudes of metric baseline deltas.
+ */
public static final String INSERT_QUERY = "" //
+ "INSERT INTO rhq_measurement_oob_tmp (oob_factor, schedule_id, time_stamp
) \n" //
+ " ( SELECT max(mx*100) as mxdiff, id, ? \n" // ?1 = begin
@@ -139,7 +148,7 @@ public class MeasurementOOB {
+ " AND sc.id = b.schedule_id \n" //
+ " AND d.value > b.bl_max \n" //
+ " AND d.time_stamp = ? \n" // ?2 = begin
- + " AND (b.bl_max - b.bl_min) > 0.1 \n" // TODO
delta depending on max value ?
+ + " AND (b.bl_max - b.bl_min) > 0.1 \n" //
+ " AND (d.maxvalue - b.bl_max) >0 \n " //
+ " AND sc.enabled = %TRUE% \n" //
+ " AND sc.definition = def.id \n" //
@@ -152,7 +161,7 @@ public class MeasurementOOB {
+ " AND sc.id = b.schedule_id \n" //
+ " AND d.value < b.bl_max \n" //
+ " AND d.time_stamp = ? \n" // ?3 = begin
- + " AND (b.bl_max - b.bl_min) > 0.1 \n" // TODO delta
depending on max value ?
+ + " AND (b.bl_max - b.bl_min) > 0.1 \n" //
+ " AND (b.bl_min - d.minvalue) >0 \n" //
+ " AND sc.enabled = %TRUE% \n" //
+ " AND sc.definition = def.id \n" //
commit a9c14fc3bd1619a7e45d4d204b04a1bd5e454182
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 11:03:31 2010 -0400
fix todo in PartitionEventType
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/PartitionEventType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/PartitionEventType.java
index c6462f5..2ec71db 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/PartitionEventType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/PartitionEventType.java
@@ -31,7 +31,7 @@ public enum PartitionEventType {
AGENT_REGISTRATION(false), // Agent registers with server defined in setup, or
previously connected server from server list.
AGENT_CONNECT(false), // Agent connects to server on server list
AGENT_SHUTDOWN(false), // Agent notifies server of agent shutdown
- AGENT_LEAVE(false), // TODO (jshaughn) Not currently used, may work this into the
suspect job logic
+ AGENT_LEAVE(false), // Not currently used - should this be worked into suspect agent
logic?
SERVER_DELETION(true), //
SERVER_COMPUTE_POWER_CHANGE(true), // Not yet implemented
commit e0412cb2f5c5695bcea883092f4f4cf58c7e9045
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 11:01:35 2010 -0400
fix todo in PageList
* change to throw new IllegalArgumentException instead of Log.warn,
forcing callers to deal with invalid PageList state
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java
index de663fc..2746172 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java
@@ -28,9 +28,6 @@ import java.util.Collection;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Tracks the result set for a paginated data lookup. Includes the data and the total
rows that are available.
*
@@ -64,7 +61,13 @@ public class PageList<E> extends ArrayList<E> implements
Serializable {
super(collection);
this.totalSize = totalSize;
if (collection.size() == 0 && totalSize > 0) {
- // TODO: GWT LOG.warn("PageList was passed an empty collection but
'totalSize' was " + totalSize + ", " + pageControl);
+ /*
+ * this can be seen attempting to navigate to a non-existent page of the
result set (e.g. page 10 in a
+ * collection of 3 items). The mechanism controlling pagination at the user
level should be notified of
+ * this, so it can decide how to gracefully handle this condition.
+ */
+ throw new IllegalArgumentException("PageList was passed an empty
collection but 'totalSize' was "
+ + totalSize + ", " + pageControl);
}
this.isUnbounded = false;
this.pageControl = pageControl;
commit 6d93007453a7cda00ca333df6d52f06132d7ba75
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 10:39:59 2010 -0400
fix todos on Property & PropertyGroupDefinition entities
* Property - remove method no longer used, all callers use setErrorMessage(String) and
leverage ThrowableUtil.getStackAsString
* PropertyGroupDefinition - fix jdoc and remove unnecessary todo
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
index 67d1df4..3518159 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
@@ -239,21 +239,6 @@ public class Property implements Serializable,
DeepCopyable<Property>, Comparabl
this.errorMessage = (errorMessage != null) ? errorMessage.trim() : errorMessage;
}
- /**
- * Convienence method that sets the error message to the given throwable's stack
trace dump. If the given throwable
- * is <code>null</code>, the error message will be set to
<code>null</code> as if passing <code>null</code> to
- * {@link #setErrorMessage(String)}.
- *
- * @param t throwable whose message and stack trace will make up the error message
(may be <code>null</code>)
- */
- public void setErrorMessageFromThrowable(Throwable t) {
- if (t != null) {
- setErrorMessage(t.toString()); // TODO: would like this to be the full stack,
but GWT doesn't make it easy so just set this to the throwable msg
- } else {
- setErrorMessage(null);
- }
- }
-
@Override
public boolean equals(Object obj) {
if (this == obj) {
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
index 3e093aa..90b391c 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
@@ -22,22 +22,21 @@
*/
package org.rhq.core.domain.configuration;
-import org.hibernate.annotations.Cascade;
-import org.hibernate.annotations.CascadeType;
-import org.jetbrains.annotations.NotNull;
+import java.util.LinkedHashMap;
+import java.util.Map;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
-import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.CascadeType;
+import org.jetbrains.annotations.NotNull;
/**
* Holds a map of child {@link Property properties}. This can hold any number of
properties, including additional lists
@@ -205,26 +204,26 @@ public class PropertyMap extends Property implements
AbstractPropertyMap {
return (PropertyMap) get(name);
}
- /* TODO: GWT *
+ /* TODO: GWT *
- //**
- * @see org.rhq.core.domain.configuration.Property#readExternal(java.io.ObjectInput)
- *//*
- @Override
- @SuppressWarnings("unchecked")
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- super.readExternal(in);
- map = (Map<String, Property>) in.readObject();
- }
+ //**
+ * @see
org.rhq.core.domain.configuration.Property#readExternal(java.io.ObjectInput)
+ *//*
+ @Override
+ @SuppressWarnings("unchecked")
+ public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
+ super.readExternal(in);
+ map = (Map<String, Property>) in.readObject();
+ }
- *//**
- * @see
org.rhq.core.domain.configuration.Property#writeExternal(java.io.ObjectOutput)
- *//*
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(HibernateUtil.safeMap(map));
- }*/
+ //**
+ * @see
org.rhq.core.domain.configuration.Property#writeExternal(java.io.ObjectOutput)
+ *//*
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(HibernateUtil.safeMap(map));
+ }*/
/**
* NOTE: An PropertyMap containing a null map is considered equal to a PropertyMap
containing an empty map.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyGroupDefinition.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyGroupDefinition.java
index daf4ef3..fcd019c 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyGroupDefinition.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyGroupDefinition.java
@@ -130,7 +130,7 @@ public class PropertyGroupDefinition implements Serializable {
}
/**
- * Two groups are the same if they are identical or share the same name TODO ???
+ * Two groups are the same if they have the identical object references or names.
*/
@Override
public boolean equals(Object o) {
commit 43f68973f1d67d052d2e8b30076a7acf749669d1
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 10:23:39 2010 -0400
fix todos in ResourceError
* remove setDetailFromThrowable and constructor that calls it
* update callers using the deleted constructor to call other existing one
** leverage ThrowableUtil.getStackAsString as a replacement for
setDetailFromThrowable
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceError.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceError.java
index 22f57dc..5738e74 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceError.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceError.java
@@ -22,9 +22,7 @@
*/
package org.rhq.core.domain.resource;
-import java.io.PrintWriter;
import java.io.Serializable;
-import java.io.StringWriter;
import java.util.Date;
import javax.persistence.Column;
@@ -114,24 +112,6 @@ public class ResourceError implements Serializable {
setTimeOccurred(timeOccurred);
}
- /**
- * Constructor for {@link ResourceError} that uses {@link
#setDetailFromThrowable(Throwable)} to convert the given
- * exception to an error message.
- *
- * @param resource the resource that is associated with the error that occurred
- * @param errorType identifies this kind of error this represents
- * @param exception exception whose stack will be used as this object's error
message
- * @param timeOccurred the epoch time when the error occurred
- */
- public ResourceError(@NotNull Resource resource, @NotNull ResourceErrorType
errorType,
- @NotNull Throwable exception, long timeOccurred) {
- setResource(resource);
- setErrorType(errorType);
- setSummary(exception.getLocalizedMessage());
- setDetailFromThrowable(exception);
- setTimeOccurred(timeOccurred);
- }
-
public int getId() {
return id;
}
@@ -176,26 +156,6 @@ public class ResourceError implements Serializable {
this.detail = detail;
}
- /**
- * Convenience method that sets the error message to the given throwable's stack
trace.
- *
- * @param t throwable whose message and stack trace will make up the error message
(must not be <code>null</code>)
- *
- * @throws NullPointerException if <code>t</code> is
<code>null</code>
- */
- public void setDetailFromThrowable(@NotNull Throwable t) {
- //noinspection ConstantConditions
- if (t == null) {
- throw new IllegalArgumentException("t == null");
- }
-
- /* TODO: GWT
- StringWriter stringWriter = new StringWriter();
- t.printStackTrace(new PrintWriter(stringWriter));
- String stackTrace = stringWriter.toString();
- setDetail(stackTrace);*/
- }
-
public long getTimeOccurred() {
return timeOccurred;
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
index b1e39f8..e623cb0 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
@@ -43,6 +43,7 @@ import org.rhq.core.domain.resource.ResourceErrorType;
import org.rhq.core.pc.inventory.ResourceContainer.ResourceComponentState;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.availability.AvailabilityFacet;
+import org.rhq.core.util.exception.ThrowableUtil;
/**
* Runs a periodic scan for resource availability.
@@ -204,8 +205,8 @@ public class AvailabilityExecutor implements Runnable,
Callable<AvailabilityRepo
}
}
} catch (Throwable t) {
- ResourceError resourceError = new ResourceError(resource,
ResourceErrorType.AVAILABILITY_CHECK, t,
- System.currentTimeMillis());
+ ResourceError resourceError = new ResourceError(resource,
ResourceErrorType.AVAILABILITY_CHECK, t
+ .getLocalizedMessage(), ThrowableUtil.getStackAsString(t),
System.currentTimeMillis());
this.inventoryManager.sendResourceErrorToServer(resourceError);
// TODO GH: Put errors in report, rather than sending them to the Server
separately.
if (log.isDebugEnabled()) {
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 351f751..0259c69 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1597,8 +1597,8 @@ public class InventoryManager extends AgentService implements
ContainerService,
resource.setConnected(false); // invalid plugin configuration infers the resource
component is disconnected
// Give the server-side an error message describing the connection failure that
can be
// displayed on the resource's Inventory page.
- ResourceError resourceError = new ResourceError(resource,
ResourceErrorType.INVALID_PLUGIN_CONFIGURATION, t,
- System.currentTimeMillis());
+ ResourceError resourceError = new ResourceError(resource,
ResourceErrorType.INVALID_PLUGIN_CONFIGURATION, t
+ .getLocalizedMessage(), ThrowableUtil.getStackAsString(t),
System.currentTimeMillis());
return sendResourceErrorToServer(resourceError);
}
commit 8187acfced4dfd6b72a0ef5ab4d7d7f162bba46e
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 01:34:00 2010 -0400
fix todos on MeasurementNumericValuesAndUnits and MeasurementStringValuesAndUnits
* since toString methods aren't called, todos can be removed
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementNumericValueAndUnits.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementNumericValueAndUnits.java
index 60e5285..12f9e49 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementNumericValueAndUnits.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementNumericValueAndUnits.java
@@ -1,28 +1,28 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement.composite;
- import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.MeasurementUnits;
public class MeasurementNumericValueAndUnits implements MeasurementValueAndUnits {
/*
@@ -51,9 +51,7 @@ public class MeasurementNumericValueAndUnits implements
MeasurementValueAndUnits
return units;
}
- /** Equivalent to MeasurementConverter.format(value, units, true) */
- @Override
public String toString() {
- return value + " " + units; // TODO: GWT
MeasurementConverter.format(value, units, true);
+ return value + " " + units;
}
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementStringValueAndUnits.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementStringValueAndUnits.java
index 41dab1c..75c19b1 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementStringValueAndUnits.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementStringValueAndUnits.java
@@ -1,30 +1,30 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement.composite;
- import org.rhq.core.domain.measurement.MeasurementUnits;
+import java.io.Serializable;
- import java.io.Serializable;
+import org.rhq.core.domain.measurement.MeasurementUnits;
public class MeasurementStringValueAndUnits implements MeasurementValueAndUnits,
Serializable {
@@ -47,8 +47,7 @@ public class MeasurementStringValueAndUnits implements
MeasurementValueAndUnits,
return units;
}
- @Override
public String toString() {
- return value + " " + units; // TODO: GWT
MeasurementConverter.format(getValue(), getUnits());
+ return value + " " + units;
}
}
\ No newline at end of file
commit 95573c033c4d96af460dac333e3f46022507c2d2
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 01:22:32 2010 -0400
fix todos on MeasurementSchedule
* system currentlysupports @OneToOne for schedules->baseline, remove unnecessary
todo
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementSchedule.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementSchedule.java
index b4e08de..62b2bd5 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementSchedule.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementSchedule.java
@@ -213,7 +213,6 @@ public class MeasurementSchedule implements Serializable {
* calculated for the first time (a merge-persist cascade), or have it updated at
some later point in time (a
* merge-merge cascade).
*/
- // TODO should this be @OneToMany or OneToOne
// Remove now performed by bulk delete
@OneToOne(mappedBy = "schedule", cascade = { CascadeType.MERGE }, fetch =
FetchType.LAZY)
private MeasurementBaseline baseline;
commit 8827910cf8f3aa5726da1186ad3ef3689c48a2b2
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 01:20:48 2010 -0400
fix todos on MeasurementReport
* use synchronized modifier on methods that access unprotected collections in a
threaded environment
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
index 5514013..15cceb5 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java
@@ -22,14 +22,14 @@
*/
package org.rhq.core.domain.measurement;
-import org.rhq.core.domain.measurement.calltime.CallTimeData;
-
-import org.jetbrains.annotations.NotNull;
-
import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;
+import org.jetbrains.annotations.NotNull;
+
+import org.rhq.core.domain.measurement.calltime.CallTimeData;
+
/**
* A report of measurement information. When a plugin collects measurement data that is
emitted from a monitored
* resource, it will store that measurement data in an instance of this type.
@@ -42,17 +42,14 @@ import java.util.Set;
public class MeasurementReport implements Serializable {
private static final long serialVersionUID = 1;
- /* TODO: GWT
- private Set<MeasurementDataNumeric> measurementNumericData =
Collections.synchronizedSet(new LinkedHashSet<MeasurementDataNumeric>());
- private Set<MeasurementDataTrait> measurementTraitData =
Collections.synchronizedSet(new LinkedHashSet<MeasurementDataTrait>());
- private Set<CallTimeData> callTimeData = Collections.synchronizedSet(new
LinkedHashSet<CallTimeData>());
- */
-
+ /*
+ * instead of using synchronized collection wrappers - which won't GWT-compile -
we can use the synchronized
+ * modifier on the various methods that access these collections
+ */
private Set<MeasurementDataNumeric> measurementNumericData = new
LinkedHashSet<MeasurementDataNumeric>();
private Set<MeasurementDataTrait> measurementTraitData = new
LinkedHashSet<MeasurementDataTrait>();
private Set<CallTimeData> callTimeData = new
LinkedHashSet<CallTimeData>();
-
private long collectionTime;
/**
@@ -62,10 +59,8 @@ public class MeasurementReport implements Serializable {
*
* @param value the measurement data to be added
*/
- public void addData(MeasurementDataNumeric value) {
- if (!measurementNumericData.add(value)) {
- // TODO: GWT LOG.info("Measurement collected twice, second value
ignored: " + value);
- }
+ public synchronized void addData(MeasurementDataNumeric value) {
+ measurementNumericData.add(value); // note, duplicates will be silently ignored
}
/**
@@ -75,10 +70,8 @@ public class MeasurementReport implements Serializable {
*
* @param value the measurement data to be added
*/
- public void addData(MeasurementDataTrait value) {
- if (!measurementTraitData.add(value)) {
- // TODO: GWT LOG.info("Measurement collected twice, second value
ignored: " + value);
- }
+ public synchronized void addData(MeasurementDataTrait value) {
+ measurementTraitData.add(value); // note, duplicates will be silently ignored
}
/**
@@ -88,7 +81,7 @@ public class MeasurementReport implements Serializable {
*
* @param data the call-time data to be added
*/
- public void addData(CallTimeData data) {
+ public synchronized void addData(CallTimeData data) {
this.callTimeData.add(data);
}
@@ -98,7 +91,7 @@ public class MeasurementReport implements Serializable {
*
* @return the list of all the numeric data items in this report
*/
- public Set<MeasurementDataNumeric> getNumericData() {
+ public synchronized Set<MeasurementDataNumeric> getNumericData() {
return measurementNumericData;
}
@@ -108,7 +101,7 @@ public class MeasurementReport implements Serializable {
*
* @return the list of all the trait data items in this report
*/
- public Set<MeasurementDataTrait> getTraitData() {
+ public synchronized Set<MeasurementDataTrait> getTraitData() {
return measurementTraitData;
}
@@ -119,7 +112,7 @@ public class MeasurementReport implements Serializable {
* @return the list of all the call-time data items in this report
*/
@NotNull
- public Set<CallTimeData> getCallTimeData() {
+ public synchronized Set<CallTimeData> getCallTimeData() {
return callTimeData;
}
@@ -128,7 +121,7 @@ public class MeasurementReport implements Serializable {
*
* @return the total number of data items (numeric metrics, traits, or call-time
datums) in this report
*/
- public long getDataCount() {
+ public synchronized long getDataCount() {
return this.measurementNumericData.size() + this.measurementTraitData.size() +
this.callTimeData.size();
}
commit 542021e945b78f890ff32815c4b9c0c6401c8b1e
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 01:08:53 2010 -0400
fix todos in MesaurementDataNumericXX entities
* remove GET_NUM_AGGREGATE_MULTI queries, they are legacy and currently unused
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1D.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1D.java
index 07f25b0..33cef49 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1D.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1D.java
@@ -1,28 +1,29 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement;
import java.io.Serializable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
@@ -35,19 +36,14 @@ import javax.persistence.Table;
* @author Greg Hinkle
*/
@Entity
-@NamedQueries( {
- @NamedQuery(name = MeasurementDataNumeric1D.GET_NUM_AGGREGATE, query = "SELECT
min(nmd.min), avg(nmd.value), max(nmd.max) "
- + "FROM MeasurementDataNumeric1D nmd "
- + "WHERE nmd.id.scheduleId = :schedId AND nmd.id.timestamp BETWEEN :start
AND :end"),
- @NamedQuery(name = MeasurementDataNumeric1D.GET_NUM_AGGREGATE_MULTI, query =
"SELECT min(nmd.min), avg(nmd.value), max(nmd.max),sum(nmd.value) " // TODO does
sum() make any sense ?
- + "FROM MeasurementDataNumeric1D nmd "
- + "WHERE nmd.schedule IN (:schedules) AND nmd.id.timestamp BETWEEN :start
AND :end") })
+@NamedQueries( { @NamedQuery(name = MeasurementDataNumeric1D.GET_NUM_AGGREGATE, query =
"SELECT min(nmd.min), avg(nmd.value), max(nmd.max) "
+ + "FROM MeasurementDataNumeric1D nmd "
+ + "WHERE nmd.id.scheduleId = :schedId AND nmd.id.timestamp BETWEEN :start AND
:end") })
@Table(name = "RHQ_MEASUREMENT_DATA_NUM_1D")
public class MeasurementDataNumeric1D extends MeasurementData implements Serializable {
private static final long serialVersionUID = 1L;
public static final String GET_NUM_AGGREGATE =
"MeasurementDataNumeric1D.getNumAggregate";
- public static final String GET_NUM_AGGREGATE_MULTI =
"MeasurementDataNumeric1D.getNumAggregateMulti";
@Column(precision = 24, scale = 3)
private Double value;
@@ -77,7 +73,6 @@ public class MeasurementDataNumeric1D extends MeasurementData implements
Seriali
@Override
public String toString() {
- return "MeasurementDataNumeric1D[" + "average=[" + value +
"], "
- + super.toString() + "]";
+ return "MeasurementDataNumeric1D[" + "average=[" + value +
"], " + super.toString() + "]";
}
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1H.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1H.java
index 1746ac1..1b75d3f 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1H.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1H.java
@@ -1,28 +1,29 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement;
import java.io.Serializable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
@@ -35,16 +36,11 @@ import javax.persistence.Table;
* @author Greg Hinkle
*/
@Entity
-@NamedQueries( { @NamedQuery(name = MeasurementDataNumeric1H.GET_NUM_AGGREGATE_MULTI,
query = "SELECT min(nmd.min), avg(nmd.value), max(nmd.max),sum(nmd.value) " //
TODO does sum() make any sense ?
- + "FROM MeasurementDataNumeric1H nmd "
- + "WHERE nmd.schedule IN (:schedules) AND nmd.id.timestamp BETWEEN :start AND
:end") ,
- @NamedQuery(name=MeasurementDataNumeric1H.GET_MAX_TIMESTAMP, query = "SELECT
max(nmd.id.timestamp) FROM MeasurementDataNumeric1H nmd")})
+@NamedQueries( { @NamedQuery(name = MeasurementDataNumeric1H.GET_MAX_TIMESTAMP, query =
"SELECT max(nmd.id.timestamp) FROM MeasurementDataNumeric1H nmd") })
@Table(name = "RHQ_MEASUREMENT_DATA_NUM_1H")
public class MeasurementDataNumeric1H extends MeasurementData implements Serializable {
private static final long serialVersionUID = 1L;
- public static final String GET_NUM_AGGREGATE_MULTI =
"MeasurementDataNumeric1H.getNumAggregateMulti";
-
public static final String GET_MAX_TIMESTAMP =
"MeasurementDataNumeric1H.getMaxTimestamp";
@Column(precision = 24, scale = 3)
@@ -74,7 +70,6 @@ public class MeasurementDataNumeric1H extends MeasurementData implements
Seriali
@Override
public String toString() {
- return "MeasurementDataNumeric1H[" + "average=[" + value +
"], "
- + super.toString() + "]";
+ return "MeasurementDataNumeric1H[" + "average=[" + value +
"], " + super.toString() + "]";
}
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric6H.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric6H.java
index 414c46f..366d21f 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric6H.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric6H.java
@@ -1,34 +1,34 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.NamedQueries;
- import javax.persistence.NamedQuery;
- import javax.persistence.Table;
+import java.io.Serializable;
- import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
/**
* Subclass for numerical measurement data
@@ -36,19 +36,14 @@ package org.rhq.core.domain.measurement;
* @author Greg Hinkle
*/
@Entity
-@NamedQueries( {
- @NamedQuery(name = MeasurementDataNumeric6H.GET_NUM_AGGREGATE, query = "SELECT
min(nmd.min), avg(nmd.value), max(nmd.max) "
- + "FROM MeasurementDataNumeric6H nmd "
- + "WHERE nmd.id.scheduleId = :schedId AND nmd.id.timestamp BETWEEN :start
AND :end"),
- @NamedQuery(name = MeasurementDataNumeric6H.GET_NUM_AGGREGATE_MULTI, query =
"SELECT min(nmd.min), avg(nmd.value), max(nmd.max),sum(nmd.value) " // TODO does
sum() make any sense ?
- + "FROM MeasurementDataNumeric6H nmd "
- + "WHERE nmd.schedule IN (:schedules) AND nmd.id.timestamp BETWEEN :start
AND :end") })
+@NamedQueries( { @NamedQuery(name = MeasurementDataNumeric6H.GET_NUM_AGGREGATE, query =
"SELECT min(nmd.min), avg(nmd.value), max(nmd.max) "
+ + "FROM MeasurementDataNumeric6H nmd "
+ + "WHERE nmd.id.scheduleId = :schedId AND nmd.id.timestamp BETWEEN :start AND
:end") })
@Table(name = "RHQ_MEASUREMENT_DATA_NUM_6H")
public class MeasurementDataNumeric6H extends MeasurementData implements Serializable {
private static final long serialVersionUID = 1L;
public static final String GET_NUM_AGGREGATE =
"MeasurementDataNumeric6H.getNumAggregate";
- public static final String GET_NUM_AGGREGATE_MULTI =
"MeasurementDataNumeric6H.getNumAggregateMulti";
@Column(precision = 24, scale = 3)
private Double value;
@@ -78,7 +73,6 @@ public class MeasurementDataNumeric6H extends MeasurementData implements
Seriali
@Override
public String toString() {
- return "MeasurementDataNumeric6H[" + "average=[" + value +
"], "
- + super.toString() + "]";
+ return "MeasurementDataNumeric6H[" + "average=[" + value +
"], " + super.toString() + "]";
}
}
\ No newline at end of file
commit 27437a39bd9d13b4d3a52e7c17b617088edeaf36
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 01:03:25 2010 -0400
fix todos on InventoryStatus
* add necessary jdoc to this enum
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
index b3d01db..16d21ab 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventoryStatus.java
@@ -27,10 +27,30 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlEnum;
/**
- * Represents a resource's current inventory status. TODO: Javadoc what the different
statuses mean.
+ * Represents a resource's current inventory status.
*/
@XmlEnum
@XmlAccessorType(XmlAccessType.FIELD)
public enum InventoryStatus {
+ /**
+ * <ul>
+ * <li>NEW: Auto-discovered but not yet imported into the
inventory.</li>
+ *
+ * <li>IGNORED: Auto-discovered but explicitly moved to a state that will
suppress it from showing up in future
+ * discoveries. Resources in this state will not be shown in the
inventory browser.</li>
+ *
+ * <li>COMMITTED: Resources in this state will be visible in the inventory
browser. The act of importing
+ * resources changes their state from NEW to COMMITTED. Note:
resources that are factory-created
+ * or manually added will also appear in the inventory browser and,
thus, will be COMMITTED.</li>
+ *
+ * <li>DELETED: Resources can be removed from the remote box, which will
flip their status to DELETED to suppress
+ * them from showing up in the inventory browser.</li>
+ *
+ * <li>UNINVENTORIED: Resources can be removed from the inventory. Since
this is an expensive operation, these
+ * resources are temporarily marked as UNINVENTORIED which will
suppress them from showing up
+ * in the inventory browser. Then, in the background, all
history will be purged for these
+ * resources, after which they are removed from the database
completely.</li>
+ * </ul>
+ */
NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED
}
\ No newline at end of file
commit 108c57fd7ac5334f81e79e387b0921d0be9cb56b
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 01:02:47 2010 -0400
fix todos in GroupPluginConfigurationUpdate and GroupResourceConfigurationUpdate
* remove todo but keep statement from ips, which is essentially correct
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupPluginConfigurationUpdate.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupPluginConfigurationUpdate.java
index 74e7b85..a7d2f39 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupPluginConfigurationUpdate.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupPluginConfigurationUpdate.java
@@ -72,10 +72,13 @@ public class GroupPluginConfigurationUpdate extends
AbstractGroupConfigurationUp
public GroupPluginConfigurationUpdate(ResourceGroup group, String subjectName) {
super(group, subjectName);
- //this.configuration = groupConfiguration.deepCopy(false);
- // TODO (ips, 02/13/09): This is a temporary workaround - we don't really
need to store a Configuration at all,
- // since it can be recalculated from the member configs when needed, but the
AbstractConfigurationUpdate
- // base class requires the configuration field to be non-null.
+ /*
+ * this.configuration = groupConfiguration.deepCopy(false);
+ *
+ * (ips, 02/13/09): This is a temporary workaround - we don't really need to
store a Configuration at all,
+ * since it can be recalculated from the member configs when needed, but the
AbstractConfigurationUpdate
+ * base class requires the configuration field to be non-null.
+ */
this.configuration = new Configuration();
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupResourceConfigurationUpdate.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupResourceConfigurationUpdate.java
index c601196..38a298c 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupResourceConfigurationUpdate.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupResourceConfigurationUpdate.java
@@ -68,9 +68,13 @@ public class GroupResourceConfigurationUpdate extends
AbstractGroupConfiguration
public GroupResourceConfigurationUpdate(ResourceGroup group, String subjectName) {
super(group, subjectName);
- // TODO (ips, 02/13/09): This is a temporary workaround - we don't really
need to store a Configuration at all,
- // since it can be recalculated from the member configs when needed, but the
AbstractConfigurationUpdate
- // base class requires the configuration field to be non-null.
+ /*
+ * this.configuration = groupConfiguration.deepCopy(false);
+ *
+ * (ips, 02/13/09): This is a temporary workaround - we don't really need to
store a Configuration at all,
+ * since it can be recalculated from the member configs when needed, but the
AbstractConfigurationUpdate
+ * base class requires the configuration field to be non-null.
+ */
this.configuration = new Configuration();
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/InventoryReportResponse.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/InventoryReportResponse.java
deleted file mode 100644
index 30b317a..0000000
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/discovery/InventoryReportResponse.java
+++ /dev/null
@@ -1,58 +0,0 @@
- /*
- * 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.discovery;
-
-import java.io.Serializable;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * This report is sent in response to an InventoryReport being sent to the server. It
tells the agent what the persistent
- * resource ids are. TODO GH: This could also be used for a periodic sync when things get
out of whack. (The collection,
- * transmission and persistence of inventory is not transactional between the server and
agent)
- *
- * @author Greg Hinkle
- */
-@Deprecated
-public class InventoryReportResponse implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * Maps the agent declared uuid to the resource's true "id"
- */
- private Map<String, Integer> uuidToIntegerMapping = new
LinkedHashMap<String, Integer>();
-
- public Map<String, Integer> getUuidToIntegerMapping() {
- return uuidToIntegerMapping;
- }
-
- public void setUuidToIntegerMapping(Map<String, Integer> uuidToIntegerMapping)
{
- this.uuidToIntegerMapping = uuidToIntegerMapping;
- }
-
- public void addIdMapping(String uuid, Integer persistentId) {
- this.uuidToIntegerMapping.put(uuid, persistentId);
- }
-
-
-}
\ No newline at end of file
commit cc4e3fa86c91942e77e9bef1770000ec99bfd68d
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Oct 7 00:05:26 2010 -0400
fix todos in Group
* remove location field - it was only exposed in the struts-based UI, so it hasn't
been seen in years anyway
* dbsetup and db-upgrade bits
* removed or commented out current and legacy uses of it
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 1ce883c..379c31f 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.99</db.schema.version>
+ <db.schema.version>2.100</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
index 5d89c2d..48f9f2a 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
@@ -155,7 +155,6 @@
<!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys -->
<column name="NAME" required="true" size="4000"
type="VARCHAR2"/>
<column name="DESCRIPTION" size="100"
type="VARCHAR2"/>
- <column name="LOCATION" required="false"
size="100" type="VARCHAR2"/>
<column name="RESOURCE_TYPE_ID" type="INTEGER"
references="RHQ_RESOURCE_TYPE"/>
<!-- Compatible groups only -->
<column name="CTIME" type="LONG"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index d6fe7bc..b462cfa 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3250,6 +3250,10 @@
<schema-alterColumn table="RHQ_ALERT_CONDITION_LOG"
column="VALUE" nullable="FALSE" />
</schemaSpec>
+ <schemaSpec version="2.100">
+ <!-- location was only exposed in the struts-based UI, so it
hasn't been seen in years anyway -->
+ <schema-deleteColumn table="RHQ_RESOURCE_GROUP"
column="LOCATION" />
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/Group.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/Group.java
index 4a15ff4..5cc2714 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/Group.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/Group.java
@@ -47,9 +47,6 @@ public abstract class Group implements Serializable {
@Column(name = "DESCRIPTION")
private String description;
- @Column(name = "LOCATION")
- private String location; // TODO (ips): I don't think this field makes sense for
groups.
-
@Column(name = "CTIME")
private Long ctime;
@@ -84,14 +81,6 @@ public abstract class Group implements Serializable {
this.description = description;
}
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
public Long getCtime() {
return ctime;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
index 2c3f364..2027fd2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
@@ -164,42 +164,6 @@ public class OverviewView extends LocatableVLayout {
}
formItems.add(descriptionItem);
- final FormItem locationItem = (dynamic) ? new StaticTextItem() : new
TogglableTextItem();
- locationItem.setName("location");
- locationItem.setTitle("Location");
- locationItem.setValue(group.getLocation());
- if (locationItem instanceof TogglableTextItem) {
- final TogglableTextItem togglableLocationItem = (TogglableTextItem)
locationItem;
- togglableLocationItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newLocation) {
- final String oldLocation = group.getLocation();
- if (newLocation.equals(oldLocation)) {
- return;
- }
- group.setLocation(newLocation);
- OverviewView.this.resourceGroupService.updateResourceGroup(group,
false, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- "Failed to change location of Resource group with id
" + group.getId() + " from \""
- + oldLocation + "\" to \"" +
newLocation + "\".", caught);
- // We failed to update it on the Server, so change back the
ResourceGroup and the form item
- // to the original value.
- group.setLocation(oldLocation);
- locationItem.setValue(oldLocation);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Location of Resource group with id
" + group.getId()
- + " was changed from \"" + oldLocation
+ "\" to \"" + newLocation + "\".",
- Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(locationItem);
-
StaticTextItem dynamicItem = new StaticTextItem("dynamic",
"Dynamic?");
dynamicItem.setValue(dynamic ? "yes" : "no");
formItems.add(dynamicItem);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
index 6b4664a..61c1cc1 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
@@ -57,12 +57,9 @@ public class GroupCreateStep extends AbstractWizardStep {
TextAreaItem description = new AutoFitTextAreaItem("description",
"Description");
description.setWidth(300);
- TextItem location = new TextItem("location",
"Location");
- location.setWidth(300);
-
CheckboxItem recursive = new CheckboxItem("recursive",
"Recursive");
- form.setFields(name, description, location, recursive);
+ form.setFields(name, description, recursive);
}
return form;
@@ -79,7 +76,6 @@ public class GroupCreateStep extends AbstractWizardStep {
public ResourceGroup getGroup() {
ResourceGroup group = new
ResourceGroup(form.getValueAsString("name"));
group.setDescription(form.getValueAsString("description"));
- group.setLocation(form.getValueAsString("location"));
group.setRecursive(form.getValue("recursive") != null ? true : false);
return group;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ResourceGroupUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ResourceGroupUIBean.java
index cb15696..b2cda55 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ResourceGroupUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ResourceGroupUIBean.java
@@ -118,10 +118,6 @@ public class ResourceGroupUIBean {
return this.resourceGroup.getModifiedBy();
}
- public String getLocation() {
- return this.resourceGroup.getLocation();
- }
-
public Boolean getRecursive() {
return this.resourceGroup.isRecursive();
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/GroupForm.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/GroupForm.java
index 2cca7c0..c222819 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/GroupForm.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/GroupForm.java
@@ -308,7 +308,7 @@ public class GroupForm extends BaseValidatorForm {
public void loadResourceGroup(ResourceGroup group) {
this.name = group.getName();
this.description = group.getDescription();
- this.location = group.getLocation();
+ this.location = "";
this.groupId = group.getId();
}
@@ -321,9 +321,11 @@ public class GroupForm extends BaseValidatorForm {
group.setDescription(description);
}
+ /*
if (location != null) {
group.setLocation(location);
}
+ */
}
public boolean isRecursive() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/NewGroupAction.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/NewGroupAction.java
index f41b148..affa42a 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/NewGroupAction.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/NewGroupAction.java
@@ -94,7 +94,7 @@ public class NewGroupAction extends BaseAction {
try {
newGroup.setDescription(description);
- newGroup.setLocation(location);
+ //newGroup.setLocation(location);
newGroup.setRecursive(recursive);
log.trace("creating group [" + newForm.getName() + "]" +
" with attributes " + newForm);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceGroupAdapter.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceGroupAdapter.java
index ca8d4df..a6fedea 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceGroupAdapter.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceGroupAdapter.java
@@ -94,7 +94,6 @@ public class ResourceGroupAdapter extends
XmlAdapter<WsResourceGroupWrapper, Res
destination.setGroupDefinition(source.getGroupDefinition());
destination.setId(source.getId());
destination.setImplicitResources(source.getImplicitResources());
- destination.setLocation(source.getLocation());
destination.setModifiedBy(source.getModifiedBy());
destination.setMtime(source.getMtime());
destination.setName(source.getName());
commit 87b5e3d93a98db2380f8057802d801d7c19528e6
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 18:26:51 2010 -0400
fix todos in Event
* remove unused detailExcerpt attribute, and corresponding getter/setter combo
* remove "lazify" comment, because composites or alterProjection on criteria
can be used instead
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/event/Event.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/event/Event.java
index 8335fdd..c12ce08 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/event/Event.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/event/Event.java
@@ -116,10 +116,7 @@ public class Event implements Serializable {
private EventSeverity severity;
@Column(name = "DETAIL", length = 4000, nullable = false)
- private String detail; // TODO lazify
-
- @Transient
- private transient String detailExcerpt;
+ private String detail;
/** The event's type (i.e. the name of its {@link EventDefinition}). */
@Transient
@@ -215,21 +212,6 @@ public class Event implements Serializable {
return this.detail;
}
- public String getDetailExcerpt() { // TODO get from DB
- int len = 100;
- if (detailExcerpt != null)
- return detailExcerpt;
-
- if (detail.length() < len)
- len = detail.length();
- detailExcerpt = detail.substring(0, len); // TODO
- return detailExcerpt;
- }
-
- public void setDetailExcerpt(String detailExcerpt) {
- this.detailExcerpt = detailExcerpt;
- }
-
@Override
public boolean equals(Object obj) {
if (this == obj)
commit 7f08c6a478f51c6ba21b60c5505e4d451eac039d
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 18:21:35 2010 -0400
fix todos in CreateResourceHistory
* setErrorMessageFromThrowable has been replaced by ThrowableUtil.getStackAsString
* calling contexts have already been updated, see git commit ebf6963
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CreateResourceHistory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CreateResourceHistory.java
index 1e2af92..b4d9ac4 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CreateResourceHistory.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CreateResourceHistory.java
@@ -22,8 +22,6 @@
*/
package org.rhq.core.domain.resource;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
import java.io.Serializable;
import java.util.Date;
@@ -246,23 +244,6 @@ public class CreateResourceHistory implements Serializable {
setStatus(CreateResourceStatus.FAILURE);
}
}
-/*TODO: GWT
- *//**
- * Convienence method that sets the error message to the given throwable's stack
trace dump. If the given throwable
- * is <code>null</code>, the error message will be set to
<code>null</code> as if passing <code>null</code> to
- * {@link #setErrorMessage(String)}.
- *
- * @param t throwable whose message and stack trace will make up the error message
(may be <code>null</code>)
- *//*
- public void setErrorMessageFromThrowable(Throwable t) {
- if (t != null) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- t.printStackTrace(new PrintStream(baos));
- setErrorMessage(baos.toString());
- } else {
- setErrorMessage(null);
- }
- }*/
public String getSubjectName() {
return subjectName;
commit 30b522ae0086f454ecbc7a51167a0f27f770f5fd
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 18:10:18 2010 -0400
fix todos in ContentSourceType
* contentSourceApiClass is not a transient property, remove todo about that
* update jdoc to point to the ContentProvider interface that the attribute represents
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
index 5a046ab..2c6b41d 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
@@ -54,7 +54,7 @@ import
org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
* @author Jason Dobies
*/
@Entity
-@NamedQueries({
+@NamedQueries( {
@NamedQuery(name = ContentSourceType.QUERY_FIND_ALL, query = "SELECT cst "
+ " FROM ContentSourceType cst "
+ " LEFT JOIN FETCH cst.contentSourceConfigurationDefinition d "
+ " LEFT JOIN FETCH d.templates "),
@NamedQuery(name = ContentSourceType.QUERY_FIND_BY_NAME_WITH_CONFIG_DEF, query =
"SELECT cst "
@@ -116,7 +116,7 @@ public class ContentSourceType implements Serializable {
public ContentSourceType(String name) {
this.name = name;
- this.contentSourceApiClass = "undefined"; // TODO: I think we want this
@Transient
+ this.contentSourceApiClass = "undefined";
}
public int getId() {
@@ -235,8 +235,9 @@ public class ContentSourceType implements Serializable {
/**
* Indicates the Java class that should be instantiated to be the content source and
used to connect to the
- * underlying external source. This class will be an implementation the content
source connector interface (jdob:
- * I'll add a javadoc link to it when I write it).
+ * underlying external source.
+ *
+ * This class will be an implementation of {@link
org.rhq.enterprise.server.plugin.pc.content.ContentProvider}.
*/
public String getContentSourceApiClass() {
return contentSourceApiClass;
commit 13275de25b4da73c35df6169486703223b618a37
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 17:40:42 2010 -0400
fix todos on ConfigurationDefinition
* if needed, criteria objects can be used for filtering and sorting
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
index 1bbd810..6adee0f 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
@@ -56,11 +56,10 @@ import org.jetbrains.annotations.Nullable;
/**
* The entire definition for a {@link import
javax.persistence.CascadeType.Configuration}. This includes mapped property
* definitions of arbitrary complexity, made up of {@link PropertyDefinitionSimple}s,
{@link PropertyDefinitionList}s,
- * and {@link PropertyDefinitionMap}s. TODO GH: Groups aren't required right now...
do we want to make them required?
+ * and {@link PropertyDefinitionMap}s.
*
* @author Greg Hinkle
*/
-//@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Entity
@NamedQueries( {
@NamedQuery(name = ConfigurationDefinition.QUERY_FIND_DEPLOYMENT_BY_PACKAGE_TYPE_ID,
query = "SELECT cd FROM PackageType pt JOIN pt.deploymentConfigurationDefinition cd
"
@@ -224,7 +223,6 @@ public class ConfigurationDefinition implements Serializable {
groups.add(group);
}
- // TODO: Do this sorting at the DB query level instead.
Collections.sort(groups, new GroupComparator());
return groups;
}
@@ -249,7 +247,6 @@ public class ConfigurationDefinition implements Serializable {
}
}
- // TODO: Do this sorting at the DB query level instead.
Collections.sort(propertyDefinitions, new PropertyDefinitionComparator());
return propertyDefinitions;
}
@@ -276,7 +273,6 @@ public class ConfigurationDefinition implements Serializable {
}
}
- // TODO: Do this sorting at the DB query level instead.
Collections.sort(propertyDefinitions, new PropertyDefinitionComparator());
return propertyDefinitions;
}
commit af9b949eb349a6f4118f82a6673f31d8d991a37d
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 17:33:21 2010 -0400
fix todo on BundleResourceDeploymentCriteria
* add more detail to jdoc to explain criteria-based authz
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
index 98f77c1..ea8385a 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
@@ -85,14 +85,15 @@ public class BundleResourceDeploymentCriteria extends Criteria {
this.fetchBundleDeployment = fetchBundleDeployment;
}
- // TODO: MANAGE_INVENTORY was too restrictive as a bundle manager could not then
- // see his resource deployments. Until we can handle granular authorization checks
on
- // optionally fetched resource member data, allow a bundle manager to see
- // resouce deployments to any platform.
/**
- * Requires MANAGE_INVENTORY or MANAGE_BUNDLE
- *
- * @param fetchResource
+ * By setting this fetch to true, it will cause {@link #isInventoryManagerRequired()}
to return true as well.
+ *
+ * In practice, however, MANAGE_INVENTORY is too restrictive; a bundle manager who
has MANAGE_BUNDLE but not
+ * MANAGE_INVENTORY would not be able to see any resource deployments. So, until it
is possible to handle granular
+ * authorization checks on optionally fetched criteria data, a bundle manager will be
allowed to see resource
+ * deployments to any platform.
+ *
+ * @see
org.rhq.enterprise.server.bundle.BundleManagerBean#findBundleResourceDeploymentsByCriteria(org.rhq.core.domain.auth.Subject,
BundleResourceDeploymentCriteria)
*/
public void fetchResource(boolean fetchResource) {
this.fetchResource = fetchResource;
commit 379ec9db15f14f8aea55e8c9f7bb5bb4d4348db7
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 15:37:24 2010 -0400
fix todo in Configuration
* clone is now implemented using deepCopy
* old impl using streams has been removed
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
index 618ad9c..99488d3 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java
@@ -427,10 +427,23 @@ public class Configuration implements Serializable, Cloneable,
AbstractPropertyM
}
/**
+ * Clones this object in the same manner as {@link #deepCopy()}.
+ *
+ * @return a clone of this configuration
+ *
+ * @throws CloneNotSupportedException
+ *
+ * @see #deepCopy()
+ */
+ public Configuration clone() {
+ return deepCopy();
+ }
+
+ /**
* Makes a fully independent copy of this object and returns it. This means all
children N-levels deep in the
* hierarchy of this Configuration object are copied.
*
- * <p>This is the same behavior as that of this object's {@link #clone()}
method.</p>
+ * <p>This is the underlying implementation for the {@link #clone()}
method.</p>
*
* @return a clone of this configuration
*/
@@ -487,44 +500,6 @@ public class Configuration implements Serializable, Cloneable,
AbstractPropertyM
}
/**
- * Clones this object in the same manner as {@link #deepCopy()}.
- *
- * @return a clone of this configuration
- *
- * @throws CloneNotSupportedException
- *
- * @see #deepCopy()
- */
- public Configuration clone() {
- return deepCopy();
-
- /* TODO: GWT
-
- // TODO GH: This may be a performance problem when it comes to runtime
scans...
- // do some profiling
- Object obj = null;
- try {
- // Write the object out to a byte array
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bos);
- out.writeObject(this);
- out.flush();
- out.close();
-
- // Make an input stream from the byte array and read
- // a copy of the object back in.
- ObjectInputStream in = new ObjectInputStream(new
ByteArrayInputStream(bos.toByteArray()));
- obj = in.readObject();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException cnfe) {
- cnfe.printStackTrace();
- }
-
- return (Configuration) obj;*/
- }
-
- /**
* NOTE: An Configuration containing a null map is considered equal to a
Configuration containing an empty map.
*/
@Override
commit b1dc47c0efd067037a89bcfb31976e0135348666
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 15:31:43 2010 -0400
type information can generally be accessed by all
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
index 36c62f0..1bbd810 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
@@ -62,7 +62,6 @@ import org.jetbrains.annotations.Nullable;
*/
//@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Entity
-// TODO: non-admin version of the below query
@NamedQueries( {
@NamedQuery(name = ConfigurationDefinition.QUERY_FIND_DEPLOYMENT_BY_PACKAGE_TYPE_ID,
query = "SELECT cd FROM PackageType pt JOIN pt.deploymentConfigurationDefinition cd
"
+ "WHERE pt.id = :packageTypeId"),
commit a5d2a351c511b455812b2be26b9d8a395be3f76a
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 15:09:01 2010 -0400
fix todo in CallTimeData
* throw IllegalArgumentException if invalid args passed to addValue
* fix calling contexts to use try...catch(IllegalArgumentException) { log } pattern
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
index c8f4837..d53627d 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
@@ -115,11 +115,9 @@ public class CallTimeData implements Serializable {
}
if (destination.length() > CallTimeDataKey.DESTINATION_MAX_LENGTH) {
- /* TODO: GWT
- LOG.warn("Call destination is longer than the maximum length (" +
CallTimeDataKey.DESTINATION_MAX_LENGTH
- + " characters) - truncating it to " +
CallTimeDataKey.DESTINATION_MAX_LENGTH + " characters...");
- */
- destination = destination.substring(0,
CallTimeDataKey.DESTINATION_MAX_LENGTH);
+ throw new IllegalArgumentException("Call destination is longer than the
maximum length ("
+ + CallTimeDataKey.DESTINATION_MAX_LENGTH + " characters) - please
modify your response time transform "
+ + "to generate smaller URLs");
}
CallTimeDataValue value = this.values.get(destination);
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ResponseTimeLogParser.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ResponseTimeLogParser.java
index a3efb74..6e49ce0 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ResponseTimeLogParser.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ResponseTimeLogParser.java
@@ -128,7 +128,12 @@ public class ResponseTimeLogParser {
}
String transformedUrl = applyTransforms(url);
- callTimeData.addCallData(transformedUrl, new
Date(logEntry.getStartTime()), logEntry.getDuration());
+ try {
+ callTimeData.addCallData(transformedUrl, new
Date(logEntry.getStartTime()), logEntry.getDuration());
+ } catch (IllegalArgumentException iae) {
+ // if any issue with the data, log them and continue processing the
rest of the report
+ log.error(iae);
+ }
}
} catch (FileNotFoundException e) {
log.warn("Response-time log file '" + this.logFile +
"' does not exist.");
diff --git
a/modules/plugins/iis/src/main/java/org/rhq/plugins/iis/IISResponseTimeDelegate.java
b/modules/plugins/iis/src/main/java/org/rhq/plugins/iis/IISResponseTimeDelegate.java
index 3b12499..a9406d9 100644
--- a/modules/plugins/iis/src/main/java/org/rhq/plugins/iis/IISResponseTimeDelegate.java
+++ b/modules/plugins/iis/src/main/java/org/rhq/plugins/iis/IISResponseTimeDelegate.java
@@ -254,7 +254,12 @@ public class IISResponseTimeDelegate {
String transformedUrl = applyTransforms(url);
log.info("Original URL: " + url);
log.info("Transformed: " + transformedUrl);
- callTimeData.addCallData(transformedUrl, new
Date(logEntry.getStartTime()), logEntry.getDuration());
+ try {
+ callTimeData.addCallData(transformedUrl, new
Date(logEntry.getStartTime()), logEntry.getDuration());
+ } catch (IllegalArgumentException iae) {
+ // if any issue with the data, log them and continue processing the
rest of the report
+ log.error(iae);
+ }
}
log.info("Results...");
commit 0c0c834ead8744fa85fba08b07487306ba7880a3
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 14:28:42 2010 -0400
fix todo in CallTimeData
* throw IllegalArgumentException if invalid args passed to addAggregatedCallData
* fix calling contexts to use try...catch(IllegalArgumentException) { log } pattern
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
index a7b3ad3..c8f4837 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java
@@ -1,25 +1,25 @@
- /*
- * 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.
- */
+/*
+ * 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.measurement.calltime;
import java.io.Serializable;
@@ -28,8 +28,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
@@ -63,9 +61,7 @@ public class CallTimeData implements Serializable {
* @param beginTime the time when the call was initiated
* @param duration the duration of the call, in milliseconds
*/
- public void addCallData(@NotNull
- String destination, @NotNull
- Date beginTime, long duration) {
+ public void addCallData(@NotNull String destination, @NotNull Date beginTime, long
duration) {
Date endTime = new Date(beginTime.getTime() + duration);
CallTimeDataValue value = addValue(beginTime, endTime, destination);
value.mergeCallTime(duration);
@@ -82,16 +78,12 @@ public class CallTimeData implements Serializable {
* @param total ...
* @param count ...
*/
- public void addAggregatedCallData(@NotNull
- String destination, @NotNull
- Date beginTime, @NotNull
- Date endTime, double minimum, double maximum, double total, long count) {
+ public void addAggregatedCallData(@NotNull String destination, @NotNull Date
beginTime, @NotNull Date endTime,
+ double minimum, double maximum, double total, long count) {
if (count == 0) {
- /* TODO: GWT
- LOG.warn("Plugin attempted to add aggregated call data with a call count
of 0 for destination '"
- + destination + "' - data will not be added.");
- */
- return;
+ throw new IllegalArgumentException(
+ "Plugin attempted to add aggregated call data with a call count of 0
for destination '" + destination
+ + "' - data will not be added.");
}
CallTimeDataValue value = addValue(beginTime, endTime, destination);
diff --git
a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java
b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java
index c4c51c2..5f63261 100644
---
a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java
+++
b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java
@@ -30,10 +30,12 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.values.CompositeValue;
import org.jboss.metatype.api.values.SimpleValue;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
@@ -53,7 +55,7 @@ import org.rhq.core.pluginapi.operation.OperationResult;
*/
public abstract class AbstractEjbBeanComponent extends ManagedComponentComponent
implements OperationFacet {
private final Log log = LogFactory.getLog(this.getClass());
-
+
private static final String VIEW_INVOCATION_STATS_OPERATION_NAME =
"viewInvocationStats";
@Override
@@ -144,8 +146,13 @@ public abstract class AbstractEjbBeanComponent extends
ManagedComponentComponent
Date beginDate = new Date(invocationStats.beginTime);
Date endDate = new Date(invocationStats.endTime);
for (MethodStats methodStats : invocationStats.methodStats) {
- callTimeData.addAggregatedCallData(methodStats.name, beginDate, endDate,
methodStats.minTime,
- methodStats.maxTime, methodStats.totalTime, methodStats.count);
+ try {
+ callTimeData.addAggregatedCallData(methodStats.name, beginDate, endDate,
methodStats.minTime,
+ methodStats.maxTime, methodStats.totalTime, methodStats.count);
+ } catch (IllegalArgumentException iae) {
+ // if any issue with the data, log them and continue processing the rest
of the report
+ log.error(iae);
+ }
}
return callTimeData;
}
diff --git
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB2BeanComponent.java
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB2BeanComponent.java
index e073ed8..07fa732 100644
---
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB2BeanComponent.java
+++
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB2BeanComponent.java
@@ -95,18 +95,21 @@ public class EJB2BeanComponent extends
MBeanResourceComponent<JBossASServerCompo
CallTimeData callTimeData = new CallTimeData(schedule);
for (String methodName : stats.keySet()) {
Stat timeStatistic = stats.get(methodName);
+
long minTime = timeStatistic.min;
long maxTime = timeStatistic.max;
long totalTime = timeStatistic.total;
long count = timeStatistic.count;
- if (count == 0) {
- // Don't bother even adding data for this method if the call count is
0.
+
+ try {
+ rawCallTimeData.addAggregatedCallData(methodName, lastResetTime,
collectionTime, minTime, maxTime,
+ totalTime, count);
+ } catch (IllegalArgumentException iae) {
+ // if any issue with the data, log them and continue processing the rest
of the report
+ log.error(iae);
continue;
}
- rawCallTimeData.addAggregatedCallData(methodName, lastResetTime,
collectionTime, minTime, maxTime,
- totalTime, count);
-
// Now compute the adjusted data, which is what we will report back to the
server.
CallTimeDataValue previousValue = (previousRawCallTimeData != null) ?
previousRawCallTimeData.getValues()
.get(methodName) : null;
diff --git
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB3BeanComponent.java
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB3BeanComponent.java
index ae254b5..af96d54 100644
---
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB3BeanComponent.java
+++
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EJB3BeanComponent.java
@@ -1,25 +1,25 @@
- /*
- * Jopr 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.
- */
+/*
+ * Jopr 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.plugins.jbossas;
import java.lang.reflect.Field;
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -55,7 +56,7 @@ import org.rhq.plugins.jmx.MBeanResourceComponent;
public class EJB3BeanComponent extends
MBeanResourceComponent<JBossASServerComponent> {
private final Log log = LogFactory.getLog(EJB3BeanComponent.class);
- private Map<Integer, CallTimeData> previousRawCallTimeDatas = new
HashMap<Integer,CallTimeData>();
+ private Map<Integer, CallTimeData> previousRawCallTimeDatas = new
HashMap<Integer, CallTimeData>();
@Override
public AvailabilityType getAvailability() {
@@ -135,18 +136,21 @@ public class EJB3BeanComponent extends
MBeanResourceComponent<JBossASServerCompo
CallTimeData callTimeData = new CallTimeData(schedule);
for (String methodName : stats.keySet()) {
Object timeStatistic = stats.get(methodName);
+
long minTime = (Long)
timeStatistic.getClass().getField("minTime").get(timeStatistic);
long maxTime = (Long)
timeStatistic.getClass().getField("maxTime").get(timeStatistic);
long totalTime = (Long)
timeStatistic.getClass().getField("totalTime").get(timeStatistic);
long count = (Long)
timeStatistic.getClass().getField("count").get(timeStatistic);
- if (count == 0) {
- // Don't bother even adding data for this method if the call count is
0.
+
+ try {
+ rawCallTimeData.addAggregatedCallData(methodName, lastResetTime,
collectionTime, minTime, maxTime,
+ totalTime, count);
+ } catch (IllegalArgumentException iae) {
+ // if any issue with the data, log them and continue processing the rest
of the report
+ log.error(iae);
continue;
}
- rawCallTimeData.addAggregatedCallData(methodName, lastResetTime,
collectionTime, minTime, maxTime,
- totalTime, count);
-
// Now compute the adjusted data, which is what we will report back to the
server.
CallTimeDataValue previousValue = (previousRawCallTimeData != null) ?
previousRawCallTimeData.getValues()
.get(methodName) : null;
commit a733eb45ab0b918e3f6b1d1e77a0e6ce42b03845
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 14:27:31 2010 -0400
remove unnecessary todo
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/util/AuthzConstants.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/util/AuthzConstants.java
index fca6a8c..6ef9b87 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/AuthzConstants.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/AuthzConstants.java
@@ -1,25 +1,25 @@
- /*
- * 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.
- */
+/*
+ * 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.util;
import org.rhq.core.domain.auth.Subject;
@@ -162,7 +162,6 @@ public final class AuthzConstants {
public static final Integer authzApplication = new Integer(308);
public static final Integer authzLocation = new Integer(309);
- // TODO: see AuthorizationManager.isBuiltInSuperuser()
public static boolean isOverlord(Integer subject) {
return subject.equals(AuthzConstants.overlordIdInteger);
}
commit e11f2ed9fa4e6601afbd45b233fce479a2cdd999
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 14:09:16 2010 -0400
mark AlertConditionLog.value as required / not null
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index cb7f1d7..1ce883c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.98</db.schema.version>
+ <db.schema.version>2.99</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
index 68e7635..100296c 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
@@ -105,7 +105,7 @@
<column name="CTIME" required="true"
type="LONG"/>
<column name="ALERT_ID" required="false"
type="INTEGER" references="RHQ_ALERT(ID)"/>
<column name="CONDITION_ID" required="true"
type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/>
- <column name="VALUE" required="false" size="250"
type="VARCHAR2"/>
+ <column name="VALUE" required="true" size="250"
type="VARCHAR2"/>
<index name="RHQ_ALERT_COND_LOG_IDX_TIME">
<field ref="CTIME" />
</index>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 70e4c46..d6fe7bc 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3246,6 +3246,10 @@
<schema-deleteColumn ignoreError="true"
table="RHQ_CONF_PROP_DEF_ENUM" column="IS_DEFAULT" />
</schemaSpec>
+ <schemaSpec version="2.99">
+ <schema-alterColumn table="RHQ_ALERT_CONDITION_LOG"
column="VALUE" nullable="FALSE" />
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionLog.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionLog.java
index ddcf92e..2979bc2 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionLog.java
@@ -61,8 +61,7 @@ import javax.persistence.Table;
+ " WHERE acl.id IN ( SELECT iacl.id " //
+ " FROM AlertConditionLog iacl" //
+ " WHERE iacl.condition.alertDefinition.id =
:alertDefinitionId )" //
- + " AND acl.alert IS NULL")
-})
+ + " AND acl.alert IS NULL") })
@SequenceGenerator(name = "RHQ_ALERT_CONDITION_LOG_ID_SEQ", sequenceName =
"RHQ_ALERT_CONDITION_LOG_ID_SEQ")
@Table(name = "RHQ_ALERT_CONDITION_LOG")
public class AlertConditionLog implements Serializable {
@@ -92,10 +91,7 @@ public class AlertConditionLog implements Serializable {
@Column(name = "CTIME", nullable = false)
private long ctime;
- /*
- * TODO: jmarques - should this be non-null?
- */
- @Column(name = "VALUE")
+ @Column(name = "VALUE", nullable = false)
private String value;
@JoinColumn(name = "ALERT_ID", referencedColumnName = "ID")
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
index 79fcb3b..95897e3 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
@@ -111,6 +111,7 @@ public class AlertManagerBeanTest extends AbstractEJB3Test {
em.persist(ac);
AlertConditionLog acl = new AlertConditionLog(ac, now);
+ acl.setValue("dummy value");
em.persist(acl);
Alert a = new Alert(ad, now);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
index 3145682..b499997 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
@@ -434,6 +434,7 @@ public class DataPurgeJobTest extends AbstractEJB3Test {
AlertCondition ac = ad.getConditions().iterator().next();
AlertConditionLog acl = new AlertConditionLog(ac, timestamp);
acl.setAlert(a);
+ acl.setValue("dummy value");
em.persist(acl);
return a;
commit 3fccdaa26f06bd74909255f4f6673754f1b1c0f3
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Oct 6 14:06:52 2010 -0400
remove unnecessary todos in AbstractEJB3Test
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
index 0724ac6..ccf205f 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
@@ -1,25 +1,25 @@
- /*
- * 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.
- */
+/*
+ * 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.test;
import java.io.File;
@@ -40,7 +40,7 @@ import org.testng.annotations.BeforeSuite;
import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap;
import org.jboss.ejb3.embedded.EJB3StandaloneDeployer;
- public abstract class AbstractEJB3Test extends AssertJUnit {
+public abstract class AbstractEJB3Test extends AssertJUnit {
@BeforeSuite(groups = "integration.ejb3")
public static void startupEmbeddedJboss() {
System.out.println("Starting ejb3...");
@@ -66,9 +66,6 @@ import org.jboss.ejb3.embedded.EJB3StandaloneDeployer;
System.err.println("...... deploying MM ejb3.....");
System.err.println("...... ejb3 deployed....");
- // Set the hibernate dialect
-//
System.setProperty("hibernate.dialect","org.hibernate.dialect.Oracle10gDialect");
// TODO
-
// Deploy everything we got
deployer.setKernel(EJB3StandaloneBootstrap.getKernel());
deployer.create();
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
index 3425ebb..7991b89 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
@@ -106,9 +106,6 @@ public abstract class AbstractEJB3Test extends AssertJUnit {
deployer.create();
System.err.println("...... deployer created....");
- // Set the hibernate dialect
- //
System.setProperty("hibernate.dialect","org.hibernate.dialect.Oracle10gDialect");
// TODO
-
deployer.start();
System.err.println("...... deployer started....");