[rhq] 2 commits - modules/core modules/enterprise
by Joseph Marques
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java | 161 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 31 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 4
6 files changed, 185 insertions(+), 27 deletions(-)
New commits:
commit 769d8fe3e1c2edfce9f0f41a25a50ecc77c302ba
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 11:51:59 2010 -0400
add children/descendent availability columns to the group inventory view
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
index 583fe36..cae33a9 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
@@ -61,6 +61,15 @@ public class ResourceGroupComposite implements Serializable {
public ResourceGroupComposite() {
}
+ public ResourceGroupComposite(Long explicitUp, Long explicitDown, Long implicitUp, Long implicitDown,
+ ResourceGroup resourceGroup) {
+ this(explicitUp + explicitDown, //
+ (double) explicitUp / (explicitUp + explicitDown), //
+ implicitUp + implicitDown, //
+ (double) implicitUp / (implicitUp + implicitDown), //
+ resourceGroup, null);
+ }
+
public ResourceGroupComposite(Long explicitCount, Double explicitAvailability, Long implicitCount,
Double implicitAvailability, ResourceGroup resourceGroup) {
this(explicitCount, explicitAvailability, implicitCount, implicitAvailability, resourceGroup, null);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
new file mode 100644
index 0000000..0da1963
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
@@ -0,0 +1,161 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups;
+
+import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.CATEGORY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.NAME;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.GroupCategory;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Joseph Marques
+ */
+public class ResourceGroupCompositeDataSource extends RPCDataSource<ResourceGroupComposite> {
+
+ ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
+
+ private static ResourceGroupCompositeDataSource INSTANCE;
+
+ public static ResourceGroupCompositeDataSource getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new ResourceGroupCompositeDataSource();
+ }
+ return INSTANCE;
+ }
+
+ public ResourceGroupCompositeDataSource() {
+ super();
+
+ DataSourceTextField nameDataField = new DataSourceTextField("name", "Name", 200);
+ nameDataField.setCanEdit(false);
+
+ DataSourceTextField descriptionDataField = new DataSourceTextField("description", "Description");
+ descriptionDataField.setCanEdit(false);
+
+ DataSourceTextField typeNameDataField = new DataSourceTextField("typeName", "Type");
+ DataSourceTextField pluginNameDataField = new DataSourceTextField("pluginName", "Plugin");
+ DataSourceTextField categoryDataField = new DataSourceTextField("category", "Category");
+
+ setFields(nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField, categoryDataField);
+ }
+
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+ ResourceGroupCriteria criteria = getFetchCriteria(request);
+
+ groupService.findResourceGroupCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to fetch group composite data", caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ protected ResourceGroupCriteria getFetchCriteria(final DSRequest request) {
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setPageControl(getPageControl(request));
+
+ criteria.addFilterName(getFilter(request, NAME.propertyName(), String.class));
+ criteria.addFilterGroupCategory(getFilter(request, CATEGORY.propertyName(), GroupCategory.class));
+ criteria.addFilterDownMemberCount(getFilter(request, "downMemberCount", Integer.class));
+ criteria.addFilterExplicitResourceIds(getFilter(request, "explicitResourceId", Integer.class));
+ criteria.addFilterGroupDefinitionId(getFilter(request, "groupDefinitionId", Integer.class));
+
+ return criteria;
+ }
+
+ @Override
+ public ResourceGroupComposite copyValues(ListGridRecord from) {
+ Integer idAttrib = from.getAttributeAsInt("id");
+ String nameAttrib = from.getAttribute("name");
+ String descriptionAttrib = from.getAttribute("description");
+ String typeNameAttrib = from.getAttribute("typeName");
+ String pluginNameAttrib = from.getAttribute("pluginName");
+ ResourceType rt = null;
+
+ ResourceGroup rg = new ResourceGroup(nameAttrib);
+ rg.setId(idAttrib);
+ rg.setDescription(descriptionAttrib);
+ if (null != typeNameAttrib) {
+ rt = new ResourceType();
+ rt.setName(typeNameAttrib);
+ rt.setPlugin(pluginNameAttrib);
+ rg.setResourceType(rt);
+ }
+
+ Long explicitUp = Long.valueOf(from.getAttribute("explicitUp"));
+ Long explicitDown = Long.valueOf(from.getAttribute("explicitDown"));
+ Long implicitUp = Long.valueOf(from.getAttribute("implicitUp"));
+ Long implicitDown = Long.valueOf(from.getAttribute("implicitDown"));
+
+ ResourceGroupComposite composite = new ResourceGroupComposite(explicitUp, explicitDown, implicitUp,
+ implicitDown, rg);
+
+ return composite;
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceGroupComposite from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("group", from);
+ record.setAttribute("id", from.getResourceGroup().getId());
+ record.setAttribute("name", from.getResourceGroup().getName());
+ record.setAttribute("description", from.getResourceGroup().getDescription());
+ record.setAttribute("category", from.getResourceGroup().getGroupCategory().toString());
+
+ record.setAttribute("explicitUp", String.valueOf(from.getExplicitUp()));
+ record.setAttribute("explicitDown", String.valueOf(from.getExplicitDown()));
+ record.setAttribute("implicitUp", String.valueOf(from.getImplicitUp()));
+ record.setAttribute("implicitDown", String.valueOf(from.getImplicitDown()));
+
+ record.setAttribute("availabilityChildren", from.getExplicitFormatted());
+ record.setAttribute("availabilityDescendents", from.getImplicitFormatted());
+
+ if (from.getResourceGroup().getResourceType() != null) {
+ record.setAttribute("resourceType", from.getResourceGroup().getResourceType());
+ record.setAttribute("typeName", from.getResourceGroup().getResourceType().getName());
+ record.setAttribute("pluginName", from.getResourceGroup().getResourceType().getPlugin());
+ }
+
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 6c64b16..6aa4e65 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -21,8 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -38,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Greg Hinkle
+ * @author Joseph Marques
*/
public class ResourceGroupListView extends Table {
@@ -58,15 +57,13 @@ public class ResourceGroupListView extends Table {
addHeaderIcon(headerIcon);
}
- final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ final ResourceGroupCompositeDataSource datasource = ResourceGroupCompositeDataSource.getInstance();
setDataSource(datasource);
}
@Override
protected void configureTable() {
- ListGridField idField = new ListGridField("id", "Id", 55);
- idField.setType(ListGridFieldType.INTEGER);
- ListGridField nameField = new ListGridField("name", "Name", 250);
+ ListGridField nameField = new ListGridField("name", "Name", 300);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
return "<a href=\"#ResourceGroup/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
@@ -76,13 +73,18 @@ public class ResourceGroupListView extends Table {
ListGridField descriptionField = new ListGridField("description", "Description");
ListGridField typeNameField = new ListGridField("typeName", "Type", 130);
ListGridField pluginNameField = new ListGridField("pluginName", "Plugin", 100);
- ListGridField categoryField = new ListGridField("category", "Category", 60);
+ ListGridField categoryField = new ListGridField("category", "Category", 100);
- ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
+ ListGridField availabilityChildrenField = new ListGridField("availabilityChildren", "Children", 100);
+ availabilityChildrenField.setWrap(false);
+ availabilityChildrenField.setAlign(Alignment.CENTER);
- availabilityField.setAlign(Alignment.CENTER);
- getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField,
- availabilityField);
+ ListGridField availabilityDescendentsField = new ListGridField("availabilityDescendents", "Descendents", 100);
+ availabilityDescendentsField.setWrap(false);
+ availabilityDescendentsField.setAlign(Alignment.CENTER);
+
+ getListGrid().setFields(nameField, descriptionField, typeNameField, pluginNameField, categoryField,
+ availabilityChildrenField, availabilityDescendentsField);
addTableAction(extendLocatorId("Delete"), "Delete", Table.SelectionEnablement.ANY,
"Delete the selected resource groups?", new TableAction() {
commit 3124bc9233f13c9c3f239f0eb6ced1af86d1c26b
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 11:51:12 2010 -0400
move listGrid.setSelectType(SelectionType.SIMPLE) to the Table component
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index d97ccf9..e14f383 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.bundle.list;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.Bundle;
@@ -55,7 +54,6 @@ public class BundlesListView extends Table {
@Override
protected void configureTable() {
-
getListGrid().getField("id").setWidth("60");
getListGrid().getField("link").setWidth("25%");
getListGrid().getField("link").setType(ListGridFieldType.LINK);
@@ -71,9 +69,6 @@ public class BundlesListView extends Table {
getListGrid().getField("latestVersion").setWidth("25%");
getListGrid().getField("versionsCount").setWidth("*");
- getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- // getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
addTableAction(extendLocatorId("New"), "New", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new BundleCreateWizard().startBundleWizard();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 917946a..c573007 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -25,6 +25,7 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
@@ -194,6 +195,7 @@ public class Table extends LocatableHLayout implements RefreshableView {
listGrid.setHeight100();
listGrid.setAlternateRecordStyles(true);
listGrid.setResizeFieldsInRealTime(false);
+ listGrid.setSelectionType(SelectionStyle.SIMPLE);
if (flexRowDisplay) {
listGrid.setAutoFitData(Autofit.HORIZONTAL);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 7053f7c..6c64b16 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -64,13 +64,6 @@ public class ResourceGroupListView extends Table {
@Override
protected void configureTable() {
-
- // setHeaderIcon("?_24.png");
-
- getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- //table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
- getListGrid().setResizeFieldsInRealTime(true);
-
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
ListGridField nameField = new ListGridField("name", "Name", 250);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 6382fcb..eb7175b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -33,7 +33,6 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -104,9 +103,6 @@ public class ResourceSearchView extends Table {
@Override
protected void configureTable() {
-
- getListGrid().setSelectionType(SelectionStyle.SIMPLE);
-
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
ListGridField iconField = new ListGridField("icon", "", 40);
13 years, 8 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 2 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 4423882e067f922081b793c11a99e2a1b6fd3e59
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 11 10:04:08 2010 -0400
Add some null protection
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index 37ec2c9..6359a23 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -515,7 +515,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
// one more thing, delete any owned groups
List<ResourceGroup> ownedGroups = doomedSubject.getOwnedGroups();
- if (!ownedGroups.isEmpty()) {
+ if (null != ownedGroups && !ownedGroups.isEmpty()) {
int size = ownedGroups.size();
int[] ownedGroupIds = new int[size];
for (int i = 0; (i < size); ++i) {
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 6f4d21e..379c69d 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
@@ -402,7 +402,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// one more thing, delete any autogroup backing groups
List<ResourceGroup> backingGroups = attachedResource.getAutoGroupBackingGroups();
- if (!backingGroups.isEmpty()) {
+ if (null != backingGroups && !backingGroups.isEmpty()) {
int size = backingGroups.size();
int[] backingGroupIds = new int[size];
for (int i = 0; (i < size); ++i) {
13 years, 8 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java | 16 ----------
1 file changed, 16 deletions(-)
New commits:
commit f12e3ffb41ee4cbe8c65983ca485390db199b5db
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 11 02:28:27 2010 -0400
delete test method for finder method that was removed
diff --git a/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java b/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
index bb79117..42cbb21 100644
--- a/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
+++ b/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
@@ -87,22 +87,6 @@ public class WsResourceManagerTest extends AssertJUnit implements TestProperties
}
- @Test(enabled = TESTS_ENABLED)
- public void testResourceComposites() throws java.lang.Exception {
- ResourceCategory category = ResourceCategory.SERVER;
-
- String typeName = "RHQ AGENT";
- int parentResourceId = -1;
- String searchString = null;
- PageControl pageControl = WS_OBJECT_FACTORY.createPageControl();
-
- List<ResourceComposite> resourceComposites = WEBSERVICE_REMOTE.findResourceComposites(subject, category,
- typeName, parentResourceId, searchString, pageControl);
- assertNotNull("ResourceComposite is null.", resourceComposites);
- assertTrue("No resourceComposite types were returned.", resourceComposites.size() > 0);
-
- }
-
// function testFindUnfiltered() {
@Test(enabled = TESTS_ENABLED)
public void testUnfilteredFind() {
13 years, 8 months
[rhq] 36 commits - modules/core modules/enterprise modules/plugins
by Joseph Marques
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....");
13 years, 8 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 98 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 14 -
2 files changed, 65 insertions(+), 47 deletions(-)
New commits:
commit e7b6b09dd3cc91c0a974cf0f64c5edede3dda34c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 8 16:37:10 2010 -0400
Fix Bug 640224 - On click of 'Topology->Agents' RHQ not showing agent UI
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 37770eb..8c82506 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -52,6 +52,22 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
public class AdministrationView extends LocatableHLayout implements BookmarkableView {
public static final String VIEW_ID = "Administration";
+ private static final String SECTION_SECURITY_VIEW_ID = "Security";
+ private static final String SECTION_TOPOLOGY_VIEW_ID = "Topology";
+ private static final String SECTION_CONFIGURATION_VIEW_ID = "Configuration";
+
+ // TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available
+ private static final String PAGE_SERVERS_VIEW_ID = "Servers";
+ private static final String PAGE_AGENTS_VIEW_ID = "Agents";
+ private static final String PAGE_AFFINITY_GROUPS_VIEW_ID = "AffinityGroups";
+ private static final String PAGE_PARTITION_EVENTS_VIEW_ID = "PartitionEvents";
+
+ private static final String PAGE_SYSTEM_SETTINGS_VIEW_ID = "SystemSettings";
+ private static final String PAGE_TEMPLATES_VIEW_ID = "Templates";
+ private static final String PAGE_DOWNLOADS_VIEW_ID = "Downloads";
+ private static final String PAGE_LICENSE_VIEW_ID = "License";
+ private static final String PAGE_PLUGINS_VIEW_ID = "Plugins";
+
private ViewId currentSectionViewId;
private ViewId currentPageViewId;
@@ -61,10 +77,6 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
private Canvas currentContent;
private Map<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
- private static final String SECURITY_SECTION_VIEW_ID = "Security";
- private static final String TOPOLOGY_SECTION_VIEW_ID = "Topology";
- private static final String CONFIGURATION_SECTION_VIEW_ID = "Configuration";
-
public AdministrationView(String locatorId) {
super(locatorId);
}
@@ -88,7 +100,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
addSection(buildSecuritySection());
addSection(buildSystemConfigurationSection());
- addSection(buildManagementClusterSection());
+ addSection(buildTopologySection());
addMember(sectionStack);
addMember(contentCanvas);
@@ -101,7 +113,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- TreeNode node = (TreeNode)selectionEvent.getRecord();
+ TreeNode node = (TreeNode) selectionEvent.getRecord();
String pageName = node.getName();
String viewPath = AdministrationView.VIEW_ID + "/" + sectionName + "/" + pageName;
String currentViewPath = History.getToken();
@@ -130,7 +142,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
private TreeGrid buildSecuritySection() {
- final TreeGrid securityTreeGrid = new LocatableTreeGrid(SECURITY_SECTION_VIEW_ID);
+ final TreeGrid securityTreeGrid = new LocatableTreeGrid(SECTION_SECURITY_VIEW_ID);
securityTreeGrid.setLeaveScrollbarGap(false);
securityTreeGrid.setShowHeader(false);
@@ -144,7 +156,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
final TreeNode remoteAgentInstall = new EnhancedTreeNode(RemoteAgentInstallView.VIEW_ID);
remoteAgentInstall.setIcon("global/Agent_16.png");
- TreeNode rootNode = new EnhancedTreeNode(SECURITY_SECTION_VIEW_ID, manageUsersNode, manageRolesNode,
+ TreeNode rootNode = new EnhancedTreeNode(SECTION_SECURITY_VIEW_ID, manageUsersNode, manageRolesNode,
remoteAgentInstall);
tree.setRoot(rootNode);
@@ -153,19 +165,19 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
return securityTreeGrid;
}
- private TreeGrid buildManagementClusterSection() {
+ private TreeGrid buildTopologySection() {
- final TreeGrid mgmtClusterTreeGrid = new LocatableTreeGrid(TOPOLOGY_SECTION_VIEW_ID);
+ final TreeGrid mgmtClusterTreeGrid = new LocatableTreeGrid(SECTION_TOPOLOGY_VIEW_ID);
mgmtClusterTreeGrid.setLeaveScrollbarGap(false);
mgmtClusterTreeGrid.setShowHeader(false);
Tree tree = new Tree();
- final TreeNode manageServersNode = new EnhancedTreeNode("Servers");
- final TreeNode manageAgentsNode = new EnhancedTreeNode("Agents");
- final TreeNode manageAffinityGroupsNode = new EnhancedTreeNode("AffinityGroups");
- final TreeNode managePartitionEventsNode = new EnhancedTreeNode("PartitionEvents");
+ final TreeNode manageServersNode = new EnhancedTreeNode(PAGE_SERVERS_VIEW_ID);
+ final TreeNode manageAgentsNode = new EnhancedTreeNode(PAGE_AGENTS_VIEW_ID);
+ final TreeNode manageAffinityGroupsNode = new EnhancedTreeNode(PAGE_AFFINITY_GROUPS_VIEW_ID);
+ final TreeNode managePartitionEventsNode = new EnhancedTreeNode(PAGE_PARTITION_EVENTS_VIEW_ID);
- TreeNode rootNode = new EnhancedTreeNode(TOPOLOGY_SECTION_VIEW_ID, manageServersNode, manageAgentsNode,
+ TreeNode rootNode = new EnhancedTreeNode(SECTION_TOPOLOGY_VIEW_ID, manageServersNode, manageAgentsNode,
manageAffinityGroupsNode, managePartitionEventsNode);
tree.setRoot(rootNode);
@@ -176,19 +188,19 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
private TreeGrid buildSystemConfigurationSection() {
- final TreeGrid systemConfigTreeGrid = new LocatableTreeGrid(CONFIGURATION_SECTION_VIEW_ID);
+ final TreeGrid systemConfigTreeGrid = new LocatableTreeGrid(SECTION_CONFIGURATION_VIEW_ID);
systemConfigTreeGrid.setLeaveScrollbarGap(false);
systemConfigTreeGrid.setShowHeader(false);
Tree tree = new Tree();
- final TreeNode manageSettings = new EnhancedTreeNode("SystemSettings");
- final TreeNode manageTemplates = new EnhancedTreeNode("Templates");
- final TreeNode manageDownloads = new EnhancedTreeNode("Downloads");
- final TreeNode manageLicense = new EnhancedTreeNode("License");
- final TreeNode managePlugins = new EnhancedTreeNode("Plugins");
-
- TreeNode rootNode = new EnhancedTreeNode(CONFIGURATION_SECTION_VIEW_ID, manageSettings, manageTemplates, manageDownloads,
- manageLicense, managePlugins);
+ final TreeNode manageSettings = new EnhancedTreeNode(PAGE_SYSTEM_SETTINGS_VIEW_ID);
+ final TreeNode manageTemplates = new EnhancedTreeNode(PAGE_TEMPLATES_VIEW_ID);
+ final TreeNode manageDownloads = new EnhancedTreeNode(PAGE_DOWNLOADS_VIEW_ID);
+ final TreeNode manageLicense = new EnhancedTreeNode(PAGE_LICENSE_VIEW_ID);
+ final TreeNode managePlugins = new EnhancedTreeNode(PAGE_PLUGINS_VIEW_ID);
+
+ TreeNode rootNode = new EnhancedTreeNode(SECTION_CONFIGURATION_VIEW_ID, manageSettings, manageTemplates,
+ manageDownloads, manageLicense, managePlugins);
tree.setRoot(rootNode);
systemConfigTreeGrid.setData(tree);
@@ -197,8 +209,13 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
}
public void setContent(Canvas newContent) {
- for (Canvas child : contentCanvas.getChildren()) {
- child.destroy();
+
+ // A call to destroy (e.g. certain IFrames/FullHTMLPane) can actually remove multiple children of the
+ // contentCanvas. As such, we need to query for the children after each destroy to ensure only valid children
+ // are in the array.
+ Canvas[] children;
+ while ((children = contentCanvas.getChildren()).length > 0) {
+ children[0].destroy();
}
contentCanvas.addChild(newContent);
@@ -214,7 +231,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
String pageName = currentPageViewId.getPath();
Canvas content = null;
- if (SECURITY_SECTION_VIEW_ID.equals(sectionName)) {
+ if (SECTION_SECURITY_VIEW_ID.equals(sectionName)) {
if (UsersView.VIEW_ID.equals(pageName)) {
content = new UsersView(this.extendLocatorId("Users"));
@@ -223,42 +240,41 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
} else if (RemoteAgentInstallView.VIEW_ID.equals(pageName)) {
content = new RemoteAgentInstallView(this.extendLocatorId("RemoteAgentInstall"));
}
- } else if (CONFIGURATION_SECTION_VIEW_ID.equals(sectionName)) {
+ } else if (SECTION_CONFIGURATION_VIEW_ID.equals(sectionName)) {
String url = null;
- if ("SystemSettings".equals(pageName)) {
+ if (PAGE_SYSTEM_SETTINGS_VIEW_ID.equals(pageName)) {
url = "/admin/config/Config.do?mode=edit";
- } else if ("Templates".equals(pageName)) {
+ } else if (PAGE_TEMPLATES_VIEW_ID.equals(pageName)) {
url = "/admin/config/EditDefaults.do?mode=monitor&viewMode=all";
- } else if ("Downloads".equals(pageName)) {
+ } else if (PAGE_DOWNLOADS_VIEW_ID.equals(pageName)) {
url = "/rhq/admin/downloads-body.xhtml";
- } else if ("License".equals(pageName)) {
+ } else if (PAGE_LICENSE_VIEW_ID.equals(pageName)) {
url = "/admin/license/LicenseAdmin.do?mode=view";
- } else if ("Plugins".equals(pageName)) {
+ } else if (PAGE_PLUGINS_VIEW_ID.equals(pageName)) {
url = "/rhq/admin/plugin/plugin-list-plain.xhtml";
}
url = addQueryStringParam(url, "nomenu=true");
content = new FullHTMLPane(url);
- } else if (TOPOLOGY_SECTION_VIEW_ID.equals(sectionName)) {
+ } else if (SECTION_TOPOLOGY_VIEW_ID.equals(sectionName)) {
String url = null;
- if ("Servers".equals(pageName)) {
+ if (PAGE_SERVERS_VIEW_ID.equals(pageName)) {
url = "/rhq/ha/listServers-plain.xhtml";
- } else if ("Agents".equals(pageName)) {
+ } else if (PAGE_AGENTS_VIEW_ID.equals(pageName)) {
url = "/rhq/ha/listAgents-plain.xhtml";
- } else if ("Affinity Groups".equals(pageName)) {
+ } else if (PAGE_AFFINITY_GROUPS_VIEW_ID.equals(pageName)) {
url = "/rhq/ha/listAffinityGroups-plain.xhtml";
- } else if ("Partition Events".equals(pageName)) {
+ } else if (PAGE_PARTITION_EVENTS_VIEW_ID.equals(pageName)) {
url = "/rhq/ha/listPartitionEvents-plain.xhtml";
}
content = new FullHTMLPane(url);
}
+ // when changing sections make sure the previous section's selection is deselected
for (String name : treeGrids.keySet()) {
TreeGrid treeGrid = treeGrids.get(name);
- if (name.equals(sectionName)) {
- // treeGrid.setSelectedPaths(page);
- } else {
+ if (!name.equals(sectionName)) {
treeGrid.deselectAllRecords();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 48a4455..0a9359e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -58,7 +58,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
* @author Greg Hinkle
*/
public class ReportTopView extends LocatableHLayout implements BookmarkableView {
- public static final String VIEW_ID = "Reports";
+ public static final String VIEW_ID = "Reports";
private static final String SUBSYSTEMS_SECTION_VIEW_ID = "Subsystems";
private static final String INVENTORY_SECTION_VIEW_ID = "Inventory";
@@ -107,7 +107,7 @@ public class ReportTopView extends LocatableHLayout implements BookmarkableView
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- TreeNode node = (TreeNode)selectionEvent.getRecord();
+ TreeNode node = (TreeNode) selectionEvent.getRecord();
String pageName = node.getName();
String viewPath = ReportTopView.VIEW_ID + "/" + sectionName + "/" + pageName;
String currentViewPath = History.getToken();
@@ -187,10 +187,12 @@ public class ReportTopView extends LocatableHLayout implements BookmarkableView
}
public void setContent(Canvas newContent) {
- if (contentCanvas.getChildren().length > 0) {
- for (Canvas child : contentCanvas.getChildren()) {
- child.destroy();
- }
+ // A call to destroy (e.g. certain IFrames/FullHTMLPane) can actually remove multiple children of the
+ // contentCanvas. As such, we need to query for the children after each destroy to ensure only valid children
+ // are in the array.
+ Canvas[] children;
+ while ((children = contentCanvas.getChildren()).length > 0) {
+ children[0].destroy();
}
contentCanvas.addChild(newContent);
13 years, 8 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NewNotificationEditor.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationInfo.java | 157 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java | 427 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourcePicker.java | 202 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourcePicker.java | 57 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceSelector.java | 47 +
8 files changed, 904 insertions(+), 3 deletions(-)
New commits:
commit 986d0749e6ab2871a3ce07fbf4b223130ee6e87e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 8 15:02:01 2010 -0400
this completesly about 70% of the resource operation notification editor functionality.
need to implement the "relative" feature, finish/cleanup the self/specific resource op modes
and get the new notification to actually save to the db
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NewNotificationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NewNotificationEditor.java
index 40bd990..28d2596 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NewNotificationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NewNotificationEditor.java
@@ -41,6 +41,7 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.notification.AlertNotification;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
@@ -222,7 +223,15 @@ public class NewNotificationEditor extends LocatableDynamicForm {
} else if ("System Roles".equals(sender)) {
newCanvas = new SystemRolesNotificationSenderForm(newLocatorId, notificationToEdit, sender);
} else if ("Resource Operations".equals(sender)) {
- newCanvas = null; // TODO
+ ResourceType rt;
+ if (alertDefinition.getResourceType() != null) {
+ rt = alertDefinition.getResourceType();
+ } else if (alertDefinition.getResourceGroup() != null) {
+ rt = alertDefinition.getResourceGroup().getResourceType();
+ } else {
+ rt = alertDefinition.getResource().getResourceType();
+ }
+ newCanvas = new ResourceOperationNotificationSenderForm(newLocatorId, notificationToEdit, sender, rt);
} else {
// catch all - all other senders are assumed to just have simple configuration definition
// that can be used by our configuration editor UI component to ask for config values.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
index 117fcb0..f707dc1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
@@ -284,8 +284,8 @@ public class NotificationsAlertDefinitionForm extends LocatableVLayout implement
winModal.setShowModalMask(true);
winModal.setAutoSize(true);
winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
+ //winModal.setShowResizer(true);
+ //winModal.setCanDragResize(true);
winModal.centerInPage();
winModal.addCloseClickHandler(new CloseClickHandler() {
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationInfo.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationInfo.java
new file mode 100644
index 0000000..d8f4b46
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationInfo.java
@@ -0,0 +1,157 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.alert.definitions;
+
+import org.rhq.core.domain.configuration.Configuration;
+
+/**
+ * Convienence class that encapsulates the different configuration properties that a notification
+ * needs to support the resource operation notification feature.
+ *
+ * @author John Mazzitelli
+ */
+public class ResourceOperationNotificationInfo {
+ public enum Constants {
+ SELECTION_MODE("selection-mode"), // self, specific, relative
+ SPECIFIC_RESOURCE_ID("selection-specific-resource-id"), //
+ RELATIVE_ANCESTOR_TYPE_ID("selection-relative-ancestor-type-id"), //
+ RELATIVE_DESCENDANT_TYPE_ID("selection-relative-descendant-type-id"), //
+ RELATIVE_DESCENDANT_NAME("selection-relative-descendant-name"), //
+ OPERATION_ID("operation-definition-id");
+
+ private final String propertyName; // the actual name of the property stored in the config object - must match server-side expectations
+
+ private Constants(String propertyName) {
+ this.propertyName = propertyName;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+ }; // gwt compiler needs this semi
+
+ public enum ResourceSelectionMode {
+ SELF, //
+ SPECIFIC, //
+ RELATIVE;
+
+ public String getDisplayString() {
+ switch (ordinal()) {
+ case 0: {
+ return "This Resource";
+ }
+ case 1: {
+ return "Specific Resource";
+ }
+ case 2: {
+ return "Relative Resource";
+ }
+ default: {
+ return "UNKNOWN OPTION - THIS IS A BUG"; // should never happen
+ }
+ }
+ }
+ }; // gwt compiler needs this semi
+
+ private ResourceSelectionMode mode; // will never be null
+ private Integer resourceId;
+ private Integer ancestorTypeId;
+ private Integer descendantTypeId;
+ private String descendantName;
+ private Integer operationId;
+ private Configuration operationArguments; // may be null
+
+ private ResourceOperationNotificationInfo(String mode, String resourceId, String ancestorTypeId,
+ String descendantTypeId, String descendantName, String operationId, Configuration opArgs) {
+
+ ResourceSelectionMode selectionMode = null;
+ try {
+ if (mode != null) {
+ selectionMode = ResourceSelectionMode.valueOf(mode);
+ }
+ } catch (Throwable t) {
+ }
+ this.mode = selectionMode;
+ this.resourceId = getInteger(resourceId);
+ this.ancestorTypeId = getInteger(ancestorTypeId);
+ this.descendantTypeId = getInteger(descendantTypeId);
+ this.descendantName = descendantName;
+ this.operationId = getInteger(operationId);
+ this.operationArguments = opArgs;
+ }
+
+ private Integer getInteger(String data) {
+ if (data == null || data.equals("") || data.equals("none")) {
+ return null;
+ }
+
+ return Integer.parseInt(data);
+ }
+
+ public static ResourceOperationNotificationInfo load(Configuration configuration, Configuration extraConfiguration) {
+ String mode = get(configuration, Constants.SELECTION_MODE, ResourceSelectionMode.SELF.name());
+ String resourceId = get(configuration, Constants.SPECIFIC_RESOURCE_ID, null);
+ String ancestorTypeId = get(configuration, Constants.RELATIVE_ANCESTOR_TYPE_ID, null);
+ String descendantTypeId = get(configuration, Constants.RELATIVE_DESCENDANT_TYPE_ID, null);
+ String descendantName = get(configuration, Constants.RELATIVE_DESCENDANT_NAME, null);
+ String operationId = get(configuration, Constants.OPERATION_ID, null);
+
+ return new ResourceOperationNotificationInfo(mode, resourceId, ancestorTypeId, descendantTypeId,
+ descendantName, operationId, extraConfiguration);
+ }
+
+ private static String get(Configuration configuration, Constants operationInfoConstants, String defaultValue) {
+ return configuration.getSimpleValue(operationInfoConstants.propertyName, defaultValue);
+ }
+
+ /**
+ * Indicates how to interpret the rest of the data in this info object.
+ * If this is <code>null</code>, there is no info that can be gleened from the rest of this object's data.
+ *
+ * @return the operation selection mode - e.g. self, specific or relative
+ */
+ public ResourceSelectionMode getMode() {
+ return mode;
+ }
+
+ public Integer getResourceId() {
+ return resourceId;
+ }
+
+ public Integer getAncestorTypeId() {
+ return ancestorTypeId;
+ }
+
+ public Integer getDescendantTypeId() {
+ return descendantTypeId;
+ }
+
+ public String getDescendantName() {
+ return descendantName;
+ }
+
+ public Integer getOperationId() {
+ return operationId;
+ }
+
+ public Configuration getOperationArguments() {
+ return operationArguments;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java
new file mode 100644
index 0000000..cd50d2c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java
@@ -0,0 +1,427 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+
+import org.rhq.core.domain.alert.notification.AlertNotification;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceOperationNotificationInfo.ResourceSelectionMode;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.SingleResourcePicker;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourcePicker.OkHandler;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+
+/**
+ * This notification form will be used for the Resource Operation sender. This form lets
+ * you pick a resource operation that the sender will invoke when an alert is triggered.
+ *
+ * @author John Mazzitelli
+ */
+public class ResourceOperationNotificationSenderForm extends AbstractNotificationSenderForm {
+
+ private static final String RESOURCE_ID_ATTRIBUTE = "singleResourceId";
+ private static final String OPERATION_DEFS_ATTRIBUTE = "operationDefinitions";
+
+ private final ResourceType resourceType; // the type representing the current resource or the current type being edited
+
+ private LocatableDynamicForm dynamicForm;
+ private StaticTextItem singleResourceTextItem;
+ private SelectItem ancestorTypeSelectItem;
+ private CanvasItem operationArgumentsCanvasItem;
+ private SelectItem operationSelectItem;
+
+ public ResourceOperationNotificationSenderForm(String locatorId, AlertNotification notif, String sender,
+ ResourceType resourceType) {
+
+ super(locatorId, notif, sender);
+ this.resourceType = resourceType;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ dynamicForm = new LocatableDynamicForm(extendLocatorId("resOpForm"));
+ dynamicForm.setNumCols(3);
+
+ operationArgumentsCanvasItem = new CanvasItem();
+ operationArgumentsCanvasItem.setStartRow(true);
+ operationArgumentsCanvasItem.setEndRow(true);
+ operationArgumentsCanvasItem.setShowTitle(false);
+ operationArgumentsCanvasItem.setColSpan(3);
+ operationArgumentsCanvasItem.setCanvas(new Label());
+ operationArgumentsCanvasItem.setWidth("*");
+ operationArgumentsCanvasItem.setVisible(false);
+
+ operationSelectItem = new SelectItem("operationSelectItem", "Operation");
+ operationSelectItem.setStartRow(true);
+ operationSelectItem.setEndRow(true);
+ operationSelectItem.setWrapTitle(false);
+ operationSelectItem.setRedrawOnChange(true);
+ operationSelectItem.setVisible(false);
+ operationSelectItem.setDefaultToFirstOption(true);
+ operationSelectItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent event) {
+ int operationId = Integer.valueOf(event.getValue().toString());
+ selectOperation(operationId);
+ }
+ });
+
+ // for SPECIFIC mode
+
+ singleResourceTextItem = new StaticTextItem("singleResourceTextItem", "Resource");
+ singleResourceTextItem.setStartRow(true);
+ singleResourceTextItem.setEndRow(false);
+ singleResourceTextItem.setValue("Pick a resource...");
+ singleResourceTextItem.setShowIfCondition(new ShowIfModeFunction(ResourceSelectionMode.SPECIFIC));
+ singleResourceTextItem.setAttribute(RESOURCE_ID_ATTRIBUTE, 0); // we hide the resource ID in this attribute
+
+ ButtonItem singleResourceButtonItem = new ButtonItem("singleResourceButtonItem", "Pick");
+ singleResourceButtonItem.setStartRow(false);
+ singleResourceButtonItem.setEndRow(true);
+ singleResourceButtonItem.setShowTitle(false);
+ singleResourceButtonItem.setShowIfCondition(new ShowIfModeFunction(ResourceSelectionMode.SPECIFIC));
+ singleResourceButtonItem.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ SingleResourcePicker singleResourcePicker;
+ singleResourcePicker = new SingleResourcePicker(extendLocatorId("singleResourcePicker"),
+ new OkHandler() {
+ @Override
+ public boolean ok(HashSet<Integer> resourceIdSelection) {
+ final int resourceId = resourceIdSelection.iterator().next().intValue();
+ setSpecificResource(resourceId, null, null);
+ return true;
+ }
+ }, null);
+ singleResourcePicker.show();
+ }
+ });
+
+ // for RELATIVE mode
+
+ ancestorTypeSelectItem = new SelectItem("ancestorTypeSelectItem", "Start Search From");
+ ancestorTypeSelectItem.setStartRow(true);
+ ancestorTypeSelectItem.setEndRow(true);
+ ancestorTypeSelectItem.setWrapTitle(false);
+ ancestorTypeSelectItem.setRedrawOnChange(true);
+ ancestorTypeSelectItem.setVisible(false);
+ ancestorTypeSelectItem.setShowIfCondition(new ShowIfModeFunction(ResourceSelectionMode.RELATIVE));
+
+ // the mode selector menu
+
+ SelectItem modeSelectItem = new SelectItem("modeSelectItem", "Resource Selection Mode");
+ modeSelectItem.setStartRow(true);
+ modeSelectItem.setEndRow(true);
+ modeSelectItem.setWrapTitle(false);
+ modeSelectItem.setRedrawOnChange(true);
+ LinkedHashMap<String, String> modes = new LinkedHashMap<String, String>(3);
+ modes.put(ResourceSelectionMode.SELF.name(), ResourceSelectionMode.SELF.getDisplayString());
+ modes.put(ResourceSelectionMode.SPECIFIC.name(), ResourceSelectionMode.SPECIFIC.getDisplayString());
+ modes.put(ResourceSelectionMode.RELATIVE.name(), ResourceSelectionMode.RELATIVE.getDisplayString());
+ modeSelectItem.setValueMap(modes);
+ modeSelectItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent event) {
+ ResourceSelectionMode mode = ResourceSelectionMode.valueOf(event.getValue().toString());
+ switch (mode) {
+ case SELF: {
+ setOperationDropDownMenuValues(resourceType.getId(), null, null);
+ break;
+ }
+ case SPECIFIC: {
+ singleResourceTextItem.setValue("Pick a resource...");
+ singleResourceTextItem.setAttribute(RESOURCE_ID_ATTRIBUTE, 0);
+ hideOperationDropDownMenu();
+ break;
+ }
+ case RELATIVE: {
+ // TODO
+ hideOperationDropDownMenu();
+ break;
+ }
+ }
+ }
+ });
+
+ dynamicForm.setFields(modeSelectItem, singleResourceTextItem, singleResourceButtonItem, ancestorTypeSelectItem,
+ operationSelectItem, operationArgumentsCanvasItem);
+
+ addMember(dynamicForm);
+
+ // prepopulate the form
+ ResourceOperationNotificationInfo notifInfo;
+ notifInfo = ResourceOperationNotificationInfo.load(getConfiguration(), getExtraConfiguration());
+ ResourceSelectionMode mode = notifInfo.getMode();
+ if (mode != null) {
+ modeSelectItem.setValue(mode.name());
+ switch (mode) {
+ case SELF: {
+ setOperationDropDownMenuValues(resourceType.getId(), notifInfo.getOperationId(), notifInfo
+ .getOperationArguments());
+ break;
+ }
+ case SPECIFIC: {
+ setSpecificResource(notifInfo.getResourceId(), notifInfo.getOperationId(), notifInfo
+ .getOperationArguments());
+ break;
+ }
+ case RELATIVE: {
+ // TODO
+ break;
+ }
+ }
+ } else {
+ modeSelectItem.setValue(ResourceSelectionMode.SELF.name());
+ setOperationDropDownMenuValues(resourceType.getId(), null, getExtraConfiguration());
+ }
+ }
+
+ /**
+ * This assumes the user or our code selected a specific operation from the drop down list.
+ * This will show the operation arguments as appropriate for the selected operation.
+ *
+ * @param operationId the selected operation; if 0 or less, selects the value of the drop down component
+ */
+ @SuppressWarnings("unchecked")
+ private void selectOperation(int operationId) {
+ // someone changed the operation selection.
+ // there is a attribute on the select item that is a map<int,def> of all ops in the drop down list.
+ // if there is a non-empty map (i.e. we know what ops are available) we need to show the arguments.
+ // if there are no parameters needed for this operation, null out the extra config
+ LinkedHashMap<Integer, OperationDefinition> ops = (LinkedHashMap<Integer, OperationDefinition>) operationSelectItem
+ .getAttributeAsObject(OPERATION_DEFS_ATTRIBUTE);
+ if (ops == null || ops.isEmpty()) {
+ // why did this happen? there are no op defs so we should not be able to see any drop down menu anyway
+ hideOperationDropDownMenu();
+ return;
+ }
+
+ if (operationId <= 0) {
+ operationId = Integer.valueOf(operationSelectItem.getValue().toString());
+ }
+
+ OperationDefinition def = ops.get(operationId);
+ if (def != null) {
+ ConfigurationDefinition paramDef = def.getParametersConfigurationDefinition();
+ if (paramDef != null) {
+ Configuration extraConfig = getExtraConfiguration();
+ if (extraConfig != null) {
+ extraConfig.getMap().clear(); // changing the op, the old props are no longer valid
+ } else {
+ extraConfig = new Configuration();
+ setExtraConfiguration(extraConfig);
+ }
+ showOperationArguments(paramDef, extraConfig);
+ } else {
+ setExtraConfiguration(null);
+ hideOperationArguments();
+ }
+ } else {
+ hideOperationDropDownMenu();
+ }
+ }
+
+ /**
+ * Sets up the operation drop down menu by looking up the resource type and gets its operation definitions.
+ * If opId is non-null, the drop down menu will default to that operation.
+ * If args is non-null (and if opId is non-null), this will pre-populate the argument config editor.
+ *
+ * @param resourceTypeId the type whose operation definitions are to be shown in the operation drop down menu
+ * @param opId if not-null, the selected operation
+ * @param args if not-null (and opId is not null), this will prepopulate the argument config
+ */
+ private void setOperationDropDownMenuValues(int resourceTypeId, final Integer opId, final Configuration args) {
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterId(resourceTypeId);
+ criteria.fetchOperationDefinitions(true);
+ GWTServiceLookup.getResourceTypeGWTService().findResourceTypesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceType>>() {
+
+ @Override
+ public void onSuccess(PageList<ResourceType> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getErrorHandler().handleError("Error getting operations: " + result);
+ hideOperationDropDownMenu();
+ return;
+ }
+ Set<OperationDefinition> set = result.get(0).getOperationDefinitions();
+ if (set != null && set.size() > 0) {
+ LinkedHashMap<Integer, OperationDefinition> opDefs;
+ LinkedHashMap<String, String> valueMap;
+ opDefs = new LinkedHashMap<Integer, OperationDefinition>(set.size());
+ valueMap = new LinkedHashMap<String, String>(set.size());
+ for (OperationDefinition def : set) {
+ opDefs.put(def.getId(), def);
+ valueMap.put(String.valueOf(def.getId()), def.getDisplayName());
+ }
+ operationSelectItem.setAttribute(OPERATION_DEFS_ATTRIBUTE, (Object) opDefs);
+ operationSelectItem.setValueMap(valueMap);
+ if (opId != null && opId > 0 && valueMap.containsKey(opId)) {
+ operationSelectItem.setValue(String.valueOf(opId));
+ showOperationArguments(opDefs.get(opId).getParametersConfigurationDefinition(), args);
+ } else {
+ operationSelectItem.clearValue(); // sets it to the default
+ hideOperationArguments();
+ selectOperation(Integer.valueOf(operationSelectItem.getValue().toString()));
+ }
+ operationSelectItem.show();
+ markForRedraw();
+ } else {
+ hideOperationDropDownMenu();
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load the list of available operations", caught);
+ hideOperationDropDownMenu();
+ }
+ });
+ }
+
+ /**
+ * For the SPECIFIC mode, sets the selected resource and optionally the operation.
+ *
+ * @param resourceId the resource selected
+ * @param opId if not-null, the selected operation
+ * @param args if not-null (and opId is not null), this will prepopulate the argument config
+ */
+ private void setSpecificResource(final int resourceId, final Integer opId, final Configuration args) {
+ singleResourceTextItem.setAttribute(RESOURCE_ID_ATTRIBUTE, resourceId);
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resourceId);
+ criteria.fetchResourceType(true);
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ @Override
+ public void onSuccess(PageList<Resource> result) {
+ if (result.size() > 0) {
+ Resource resource = result.get(0);
+ singleResourceTextItem.setValue(resource.getName());
+ setOperationDropDownMenuValues(resource.getResourceType().getId(), opId, args);
+ } else {
+ onFailure(new Exception("query returns no results"));
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Cannot determine resource name", caught);
+ singleResourceTextItem.setValue(resourceId);
+ hideOperationDropDownMenu();
+ }
+ });
+ }
+
+ private void hideOperationDropDownMenu() {
+ LinkedHashMap<Integer, OperationDefinition> ops = new LinkedHashMap<Integer, OperationDefinition>(0);
+ LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(0);
+ operationSelectItem.setAttribute(OPERATION_DEFS_ATTRIBUTE, (Object) ops);
+ operationSelectItem.setValueMap(valueMap);
+ operationSelectItem.hide();
+ hideOperationArguments();
+ }
+
+ private void hideOperationArguments() {
+ Canvas canvas = operationArgumentsCanvasItem.getCanvas();
+ if (canvas != null) {
+ canvas.destroy();
+ }
+
+ operationArgumentsCanvasItem.setCanvas(new Label(""));
+ operationArgumentsCanvasItem.hide();
+ markForRedraw();
+ }
+
+ private void showOperationArguments(ConfigurationDefinition def, Configuration config) {
+ Canvas canvas = operationArgumentsCanvasItem.getCanvas();
+ if (canvas != null) {
+ canvas.destroy();
+ }
+
+ if (def != null) {
+ canvas = new ConfigurationEditor(extendLocatorId("opArgs"), def, config);
+ } else {
+ Label l = new Label("This operation does not take any parameters");
+ l.setWrap(false);
+ canvas = l;
+ }
+
+ operationArgumentsCanvasItem.setCanvas(canvas);
+ operationArgumentsCanvasItem.show();
+ markForRedraw();
+ }
+
+ @Override
+ public boolean validate() {
+ try {
+ return true;
+ } catch (Exception e) {
+ CoreGUI.getErrorHandler().handleError("Cannot save the notification configuration", e);
+ return false;
+ }
+ }
+
+ private class ShowIfModeFunction implements FormItemIfFunction {
+ private final ResourceSelectionMode mode;
+
+ public ShowIfModeFunction(ResourceSelectionMode mode) {
+ this.mode = mode;
+ }
+
+ public boolean execute(FormItem item, Object value, DynamicForm form) {
+ String modeTypeString = form.getValue("modeSelectItem").toString();
+ return mode.name().equals(modeTypeString);
+ }
+ }
+}
commit 8ee9d9adfc34326567c3495f37f32c5c432b39c8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 8 14:59:18 2010 -0400
extend the resource selector component so we have one that only allows a single resource to be selected
extend that further to provide a window dialog "picker" that lets you pick one or more (ResourcePicker) or only one (SingleResourcePicker)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index e5a9d1f..91c622a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -263,6 +263,8 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
}
}
+ updateButtons(); // initialize their state
+
addMember(hlayout);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourcePicker.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourcePicker.java
new file mode 100644
index 0000000..0731396
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourcePicker.java
@@ -0,0 +1,202 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import java.util.HashSet;
+
+import com.google.gwt.user.client.Timer;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+/**
+ * A window dialog box that lets you pick one or more resources.
+ *
+ * @author John Mazzitelli
+ */
+public class ResourcePicker extends LocatableWindow {
+
+ private final OkHandler okHandler;
+ private final CancelHandler cancelHandler;
+
+ private ResourceSelector selector;
+ private Label warningLabel;
+
+ public ResourcePicker(String locatorId, OkHandler okHandler, CancelHandler cancelHandler) {
+ super(locatorId);
+
+ if (okHandler == null) {
+ throw new IllegalArgumentException("okHandler == null");
+ }
+
+ this.okHandler = okHandler;
+ this.cancelHandler = cancelHandler;
+
+ if (getTitle() == null || getTitle().contains("Untitled")) {
+ setTitle(getDefaultTitle());
+ }
+
+ setShowModalMask(true);
+ setShowMinimizeButton(false);
+ setIsModal(true);
+ setWidth(600);
+ setHeight(500);
+ setAutoCenter(true);
+ centerInPage();
+
+ addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ cancel();
+ }
+ });
+
+ LocatableVLayout layout = new LocatableVLayout(extendLocatorId("layout"));
+ layout.setLayoutAlign(Alignment.CENTER);
+ layout.setLayoutMargin(10);
+
+ warningLabel = new Label();
+ warningLabel.setContents("");
+ warningLabel.setAlign(Alignment.CENTER);
+ warningLabel.setStyleName("WarnBlock");
+ warningLabel.setAutoHeight();
+ warningLabel.setWidth100();
+ warningLabel.setWrap(false);
+ warningLabel.setVisible(false);
+
+ selector = getResourceSelector();
+
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("buttons"));
+ form.setLayoutAlign(Alignment.CENTER);
+
+ ButtonItem ok = new ButtonItem("ok", "OK");
+ ok.setStartRow(true);
+ ok.setEndRow(false);
+ ok.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ ok();
+ }
+ });
+ ButtonItem cancel = new ButtonItem("cancel", "Cancel");
+ cancel.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ cancel();
+ }
+ });
+ cancel.setStartRow(false);
+ cancel.setEndRow(true);
+ form.setFields(ok, cancel);
+
+ layout.addMember(warningLabel);
+ layout.addMember(selector);
+ layout.addMember(form);
+ addItem(layout);
+ }
+
+ protected OkHandler getOkHandler() {
+ return okHandler;
+ }
+
+ protected CancelHandler getCancelHandler() {
+ return cancelHandler;
+ }
+
+ protected String getDefaultTitle() {
+ return "Select Resources";
+ }
+
+ protected ResourceSelector getResourceSelector() {
+ if (selector == null) {
+ selector = createResourceSelector();
+ }
+ return selector;
+ }
+
+ protected ResourceSelector createResourceSelector() {
+ return new ResourceSelector(extendLocatorId("resourceSelector"));
+ }
+
+ protected void ok() {
+ OkHandler handler = getOkHandler();
+ HashSet<Integer> selection = selector.getSelection();
+
+ if (selection == null || selection.isEmpty()) {
+ showWarningMessage("Please select one of more resources");
+ } else {
+ if (handler.ok(selection)) {
+ selector = null;
+ markForDestroy();
+ }
+ }
+ }
+
+ protected void cancel() {
+ CancelHandler handler = getCancelHandler();
+ if (handler != null) {
+ handler.cancel();
+ }
+ selector = null;
+ markForDestroy();
+ }
+
+ protected void showWarningMessage(String msg) {
+ warningLabel.setContents(msg);
+ warningLabel.show();
+ markForRedraw();
+
+ // just show the warning message for a short time, hide it after a few seconds
+ Timer timer = new Timer() {
+ @Override
+ public void run() {
+ warningLabel.hide();
+ markForRedraw();
+ }
+ };
+ timer.schedule(15000);
+ }
+
+ /**
+ * The handler type used to be notified when the ok button is pressed.
+ * If false is returned by the ok method, the picker window will not
+ * close - true means the picker can close the window.
+ */
+ public interface OkHandler {
+ public boolean ok(HashSet<Integer> resourceIdSelection);
+ }
+
+ /**
+ * The handler type used to be notified when the cancel button is pressed
+ * or when the close-button in the title bar is pressed.
+ * The picker window will always be closed when canceled.
+ */
+ public interface CancelHandler {
+ public void cancel();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourcePicker.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourcePicker.java
new file mode 100644
index 0000000..74f2a83
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourcePicker.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import java.util.HashSet;
+
+/**
+ * A window dialog box that lets you pick a single resource.
+ *
+ * @author John Mazzitelli
+ */
+public class SingleResourcePicker extends ResourcePicker {
+
+ public SingleResourcePicker(String locatorId, OkHandler okHandler, CancelHandler cancelHandler) {
+ super(locatorId, okHandler, cancelHandler);
+ }
+
+ @Override
+ protected String getDefaultTitle() {
+ return "Select a Resource";
+ }
+
+ @Override
+ protected ResourceSelector createResourceSelector() {
+ return new SingleResourceSelector(extendLocatorId("singleResourceSelector"));
+ }
+
+ protected void ok() {
+ OkHandler handler = getOkHandler();
+ HashSet<Integer> selection = getResourceSelector().getSelection();
+
+ if (selection == null || selection.size() != 1) {
+ showWarningMessage("Please select a resource");
+ } else {
+ if (handler.ok(selection)) {
+ markForDestroy();
+ }
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceSelector.java
new file mode 100644
index 0000000..e9ab0a4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceSelector.java
@@ -0,0 +1,47 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import org.rhq.core.domain.resource.ResourceType;
+
+/**
+ * This forces the user to only be able to select a single resource.
+ *
+ * @author John Mazzitelli
+ */
+public class SingleResourceSelector extends ResourceSelector {
+
+ public SingleResourceSelector(String locatorId) {
+ super(locatorId);
+ }
+
+ public SingleResourceSelector(String locatorId, ResourceType resourceTypeFilter, boolean forceResourceTypeFilter) {
+ super(locatorId, resourceTypeFilter, forceResourceTypeFilter);
+ }
+
+ @Override
+ protected void updateButtons() {
+ addButton.setDisabled(!availableGrid.anySelected() || availableGrid.getTotalRows() == 0
+ || assignedGrid.getTotalRows() > 0);
+ removeButton.setDisabled(!assignedGrid.anySelected());
+ addAllButton.hide();
+ removeAllButton.hide();
+ }
+}
13 years, 8 months
[rhq] modules/core
by ips
modules/core/client-api/src/test/resources/metadata-manager-test-1.xml | 4 ++--
modules/core/client-api/src/test/resources/test-custom-jmx.xml | 9 +++++----
2 files changed, 7 insertions(+), 6 deletions(-)
New commits:
commit f713382a57f067e46b22a55553a005685fb705c4
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 8 11:27:42 2010 -0400
fix metadata test failures
diff --git a/modules/core/client-api/src/test/resources/metadata-manager-test-1.xml b/modules/core/client-api/src/test/resources/metadata-manager-test-1.xml
index 88929d1..bcdf81d 100644
--- a/modules/core/client-api/src/test/resources/metadata-manager-test-1.xml
+++ b/modules/core/client-api/src/test/resources/metadata-manager-test-1.xml
@@ -11,9 +11,9 @@
<c:regex-constraint expression="^\w+(a)[a-zA-Z_]+?\.[a-zA-Z]{2,3}$"/>
</c:constraint>
</c:simple-property>
- <c:simple-property name="bravo" type="string" description="String with options">
+ <c:simple-property name="bravo" type="string" default="FirstOptionValue" description="String with options">
<c:property-options>
- <c:option value="FirstOptionValue" name="First Option Name" default="true"/>
+ <c:option value="FirstOptionValue" name="First Option Name"/>
<c:option value="SecondOptionValue" name="Second Option Name"/>
<c:option value="ThirdOptionValue" name="Third Option Name"/>
<c:option value="FourthOptionValue" name="Fourth Option Name"/>
diff --git a/modules/core/client-api/src/test/resources/test-custom-jmx.xml b/modules/core/client-api/src/test/resources/test-custom-jmx.xml
index 4f1e098..9f3c85f 100644
--- a/modules/core/client-api/src/test/resources/test-custom-jmx.xml
+++ b/modules/core/client-api/src/test/resources/test-custom-jmx.xml
@@ -14,11 +14,12 @@
description="A JMX Server that houses the custom MBeans that are to be managed">
<plugin-configuration>
- <c:simple-property name="type" type="string" description="The EMS connection type for this JMX Server">
+ <c:simple-property name="type" type="string" default="LocalVMTypeDescriptor"
+ description="The EMS connection type for this JMX Server">
<c:property-options>
- <c:option value="LocalVMTypeDescriptor" name="Local" default="true"/>
- <c:option value="org.mc4j.ems.connection.support.metadata.JBossConnectionTypeDescriptor" name="JBoss"/>
- <c:option value="org.mc4j.ems.connection.support.metadata.Tomcat55ConnectionTypeDescriptor" name="Tomcat"/>
+ <c:option value="LocalVMTypeDescriptor" name="Local"/>
+ <c:option value="org.mc4j.ems.connection.support.metadata.JBossConnectionTypeDescriptor" name="JBoss"/>
+ <c:option value="org.mc4j.ems.connection.support.metadata.Tomcat55ConnectionTypeDescriptor" name="Tomcat"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="url" required="true" type="string" description="The connection url in the form of a JMXServiceURL"/>
13 years, 8 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java | 32 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 6 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 17 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 22 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java | 18 +++--
8 files changed, 72 insertions(+), 28 deletions(-)
New commits:
commit 78763d27f78b03215853e6c2340189ea35911ee7
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 8 11:23:05 2010 -0400
make sure a subtab's view is refreshed when the user switches to that subtab
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java
new file mode 100644
index 0000000..162e950
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java
@@ -0,0 +1,32 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client;
+
+/**
+ * A view that can refresh its content.
+ *
+ * @author Ian Springer
+ */
+public interface RefreshableView {
+
+ /**
+ * Refresh this view, i.e. reload its data from the Server.
+ */
+ void refresh();
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 3f01cde..2cbebe4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -128,6 +128,7 @@ import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConst
import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.table.PropertyGrid;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index b25b625..de29950 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -49,6 +49,7 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index f5c9a40..917946a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -56,6 +56,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
@@ -65,7 +66,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class Table extends LocatableHLayout {
+public class Table extends LocatableHLayout implements RefreshableView {
private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ALWAYS;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 74c5ca3..84ccc47 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -31,6 +31,7 @@ import com.smartgwt.client.widgets.layout.Layout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
@@ -221,8 +222,11 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
// Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
Canvas subView = subtab.getCanvas();
+ if (subView instanceof RefreshableView) {
+ ((RefreshableView)subView).refresh();
+ }
if (subView instanceof BookmarkableView) {
- ((BookmarkableView) subView).renderView(viewPath);
+ ((BookmarkableView)subView).renderView(viewPath);
}
this.tabSet.markForRedraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index cef496a..4e9d337 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
@@ -60,7 +61,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*
* @author Ian Springer
*/
-public class GroupResourceConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener {
+public class GroupResourceConfigurationEditView extends LocatableVLayout
+ implements PropertyValueChangeListener, RefreshableView {
private final ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
private ResourceGroup group;
@@ -81,10 +83,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
@Override
protected void onDraw() {
super.onDraw();
- build();
- }
- public void build() {
ToolStrip toolStrip = new ToolStrip();
toolStrip.setWidth100();
@@ -98,9 +97,9 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
}
});
toolStrip.addMember(saveButton);
-
+
addMember(toolStrip);
- reloadConfiguration();
+ refresh();
if (!this.resourcePermission.isConfigureWrite()) {
Message message = new Message("You do not have permission to edit this group's configuration.",
@@ -109,12 +108,14 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
}
}
- private void reloadConfiguration() {
+ @Override
+ public void refresh() {
this.saveButton.disable();
if (editor != null) {
editor.destroy();
removeMember(editor);
}
+ // TODO (ips): If editor != null, use editor.reload() instead.
loadConfigurationDefinition();
loadConfigurations();
@@ -191,7 +192,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
"Configuration update initiated for " + group.getResourceType().getName()
+ " compatible group '" + group.getName() + "'.",
Message.Severity.Info));
- reloadConfiguration();
+ refresh();
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index d616f81..875fc0d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -35,6 +35,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
@@ -50,7 +51,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class ResourceConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener {
+public class ResourceConfigurationEditView extends LocatableVLayout
+ implements PropertyValueChangeListener, RefreshableView {
private Resource resource;
private ResourcePermission resourcePermission;
private ConfigurationEditor editor;
@@ -66,10 +68,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
protected void onDraw() {
super.onDraw();
- build();
- }
- public void build() {
ToolStrip toolStrip = new ToolStrip();
toolStrip.setWidth100();
@@ -82,9 +81,9 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
}
});
toolStrip.addMember(saveButton);
-
+
addMember(toolStrip);
- reloadConfiguration();
+ refresh();
if (!this.resourcePermission.isConfigureWrite()) {
Message message = new Message("You do not have permission to edit this Resource's configuration.",
@@ -93,8 +92,10 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
}
}
- private void reloadConfiguration() {
+ @Override
+ public void refresh() {
this.saveButton.disable();
+
if (editor != null) {
editor.destroy();
removeMember(editor);
@@ -104,9 +105,10 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
editor.setOverflow(Overflow.AUTO);
editor.addPropertyValueChangeListener(this);
editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
- addMember(editor);
+ addMember(editor);
+ // TODO (ips): If editor != null, use editor.reload() instead.
}
-
+
private void save() {
Configuration updatedConfiguration = editor.getConfiguration();
@@ -121,7 +123,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
new Message("Configuration updated.",
"Configuration updated for Resource [" + resource.getName() + "].",
Message.Severity.Info));
- reloadConfiguration();
+ refresh();
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
index 703f9d4..b3a5709 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
@@ -34,6 +34,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
@@ -49,7 +50,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class PluginConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener {
+public class PluginConfigurationEditView extends LocatableVLayout
+ implements PropertyValueChangeListener, RefreshableView {
private Resource resource;
private ResourcePermission resourcePermission;
private ConfigurationEditor editor;
@@ -65,10 +67,7 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
@Override
protected void onDraw() {
super.onDraw();
- build();
- }
- public void build() {
ToolStrip toolStrip = new ToolStrip();
toolStrip.setWidth100();
@@ -82,9 +81,9 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
});
this.saveButton.disable();
toolStrip.addMember(this.saveButton);
-
+
addMember(toolStrip);
- reloadConfiguration();
+ refresh();
if (!this.resourcePermission.isInventory()) {
Message message = new Message("You do not have permission to edit this Resource's connection settings.",
@@ -93,8 +92,10 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
}
}
- private void reloadConfiguration() {
+ @Override
+ public void refresh() {
this.saveButton.disable();
+
if (editor != null) {
editor.destroy();
removeMember(editor);
@@ -105,6 +106,7 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
editor.addPropertyValueChangeListener(this);
editor.setReadOnly(!this.resourcePermission.isInventory());
addMember(editor);
+ // TODO (ips): If editor != null, use editor.reload() instead.
}
private void save() {
@@ -120,7 +122,7 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
CoreGUI.getMessageCenter().notify(
new Message("Connection settings updated.",
"Connection settings updated for Resource [" + resource.getName() + "]."));
- reloadConfiguration();
+ refresh();
}
});
}
13 years, 8 months
[rhq] 2 commits - modules/core modules/enterprise
by ips
modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/MetadataManagerTest.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 121 +++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 133 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 14 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 34 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 90 +++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata/ConfigurationMetadataManagerBean.java | 4
8 files changed, 276 insertions(+), 130 deletions(-)
New commits:
commit f1da64dcb747835917e43e45361236ced104c509
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 8 10:24:39 2010 -0400
fix compile error in ConfigurationMetadataManager; improve PropertyDefinitionEnumeration's toString() impl
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
index a121510..96ca8ac 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
@@ -151,6 +151,11 @@ public class PropertyDefinitionEnumeration implements Serializable {
@Override
public String toString() {
- return "PropertyDefinitionEnumeration: " + value;
+ return "PropertyDefinitionEnumeration{" +
+ "id=" + id +
+ ", name='" + name + '\'' +
+ ", value='" + value + '\'' +
+ ", orderIndex=" + orderIndex +
+ '}';
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata/ConfigurationMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata/ConfigurationMetadataManagerBean.java
index f46c7a4..bcf5e47 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata/ConfigurationMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata/ConfigurationMetadataManagerBean.java
@@ -394,8 +394,8 @@ public class ConfigurationMetadataManagerBean implements ConfigurationMetadataMa
for (PropertyDefinitionEnumeration pde : changed) {
for (PropertyDefinitionEnumeration nPde : newOptions) {
if (nPde.equals(pde)) {
- pde.setDefault(nPde.isDefault());
- pde.setValue(nPde.getValue());
+ pde.setName(nPde.getName());
+ pde.setOrderIndex(nPde.getOrderIndex());
}
}
}
commit b531bbe8b661e46cb872338c2c19a6804faff396
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 8 10:23:30 2010 -0400
first functional cut of resource group config editor!
diff --git a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/MetadataManagerTest.java b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/MetadataManagerTest.java
index 9ef0ca8..2df1e43 100644
--- a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/MetadataManagerTest.java
+++ b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/MetadataManagerTest.java
@@ -213,8 +213,7 @@ public class MetadataManagerTest {
assert bravo.getEnumeratedValues().size() == 4;
assert bravo.getEnumeratedValues().get(0).getName().equals("First Option Name");
assert bravo.getEnumeratedValues().get(0).getValue().equals("FirstOptionValue");
- assert bravo.getEnumeratedValues().get(0).isDefault();
- assert !bravo.getEnumeratedValues().get(1).isDefault();
+ assert bravo.getEnumeratedValues().get(0).getValue().equals(def.getDefaultTemplate().getConfiguration().getSimpleValue("bravo", null));
assert def.getPropertyDefinitionSimple("charlie").getType() == PropertySimpleType.BOOLEAN;
assert def.getPropertyDefinitionSimple("delta").getType() == PropertySimpleType.INTEGER;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 310f59f..3f01cde 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@@ -73,6 +74,9 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.validator.CustomValidator;
import com.smartgwt.client.widgets.form.validator.FloatRangeValidator;
import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator;
+import com.smartgwt.client.widgets.form.validator.IsBooleanValidator;
+import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
+import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
import com.smartgwt.client.widgets.form.validator.LengthRangeValidator;
import com.smartgwt.client.widgets.form.validator.RegExpValidator;
import com.smartgwt.client.widgets.form.validator.Validator;
@@ -668,8 +672,7 @@ public class ConfigurationEditor extends LocatableVLayout {
PropertyDefinition propertyDefinition,
boolean isValid) {
boolean wasValidBefore = this.invalidPropertyNames.isEmpty();
- Property topLevelProperty = getTopLevelProperty(property);
- validate();
+ Property topLevelProperty = getTopLevelProperty(property);
if (isValid) {
this.invalidPropertyNames.remove(topLevelProperty.getName());
} else {
@@ -1243,45 +1246,37 @@ public class ConfigurationEditor extends LocatableVLayout {
}
} else {
switch (propertyDefinitionSimple.getType()) {
-
- case STRING:
- case FILE:
- case DIRECTORY:
- valueItem = new TextItem();
- valueItem.setValue(propertySimple == null ? "" : propertySimple.getStringValue());
- break;
- case LONG_STRING:
- valueItem = new TextAreaItem();
- valueItem.setValue(propertySimple == null ? "" : propertySimple.getStringValue());
- break;
- case PASSWORD:
- valueItem = new PasswordItem();
- valueItem.setValue(propertySimple == null ? "" : propertySimple.getStringValue());
- break;
- case BOOLEAN:
- valueItem = new RadioGroupItem();
- LinkedHashMap<String, String> valMap = new LinkedHashMap<String, String>();
- valMap.put("true", "Yes");
- valMap.put("false", "No");
- valueItem.setValueMap(valMap);
- valueItem.setValue(propertySimple == null || propertySimple.getStringValue() == null ? false : propertySimple
- .getBooleanValue());
- break;
- case INTEGER:
- case LONG:
- valueItem = new IntegerItem();
- if (propertySimple != null && propertySimple.getStringValue() != null)
- valueItem.setValue(propertySimple.getLongValue());
- break;
- case FLOAT:
- case DOUBLE:
- valueItem = new FloatItem();
- valueItem.setValue(propertySimple == null || propertySimple.getStringValue() == null ? 0 : propertySimple
- .getDoubleValue());
- break;
+ case STRING:
+ case FILE:
+ case DIRECTORY:
+ valueItem = new TextItem();
+ break;
+ case LONG_STRING:
+ valueItem = new TextAreaItem();
+ break;
+ case PASSWORD:
+ valueItem = new PasswordItem();
+ break;
+ case BOOLEAN:
+ valueItem = new RadioGroupItem();
+ LinkedHashMap<String, String> valMap = new LinkedHashMap<String, String>();
+ valMap.put("true", "Yes");
+ valMap.put("false", "No");
+ valueItem.setValueMap(valMap);
+ break;
+ case INTEGER:
+ case LONG:
+ valueItem = new IntegerItem();
+ break;
+ case FLOAT:
+ case DOUBLE:
+ valueItem = new FloatItem();
+ break;
}
}
+ valueItem.setDefaultValue((String)null);
+ valueItem.setValue(propertySimple.getStringValue());
valueItem.setRequired(propertyDefinitionSimple.isRequired());
List<Validator> validators = buildValidators(propertyDefinitionSimple, propertySimple);
@@ -1339,7 +1334,7 @@ public class ConfigurationEditor extends LocatableVLayout {
public void onChange(ChangeEvent changeEvent) {
Boolean isUnset = (Boolean) changeEvent.getValue();
if (isUnset) {
- valueItem.getForm().setValue(valueItem.getName(), (String)null);
+ setValue(valueItem, null);
valueItem.setDisabled(true);
} else {
valueItem.setDisabled(false);
@@ -1350,12 +1345,14 @@ public class ConfigurationEditor extends LocatableVLayout {
}
});
+/*
valueItem.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent changeEvent) {
- String value = (String)changeEvent.getValue();
+ Object value = changeEvent.getValue();
unsetItem.setDisabled(value == null);
}
});
+*/
item = unsetItem;
} else {
@@ -1385,19 +1382,34 @@ public class ConfigurationEditor extends LocatableVLayout {
return !isInvalidRequiredProperty && (propertyDefinition.isReadOnly() || this.readOnly);
}
- private List<Validator> buildValidators(PropertyDefinitionSimple propertyDefinition, Property property) {
+ protected List<Validator> buildValidators(PropertyDefinitionSimple propertyDefinition, Property property) {
List<Validator> validators = new ArrayList<Validator>();
+ Validator typeValidator = null;
switch (propertyDefinition.getType()) {
case STRING:
case LONG_STRING:
case FILE:
case DIRECTORY:
- LengthRangeValidator validator = new LengthRangeValidator();
- validator.setMax(PropertySimple.MAX_VALUE_LENGTH);
- validators.add(validator);
+ LengthRangeValidator lengthRangeValidator = new LengthRangeValidator();
+ lengthRangeValidator.setMax(PropertySimple.MAX_VALUE_LENGTH);
+ typeValidator = lengthRangeValidator;
+ break;
+ case BOOLEAN:
+ typeValidator = new IsBooleanValidator();
+ break;
+ case INTEGER:
+ case LONG:
+ typeValidator = new IsIntegerValidator();
+ break;
+ case FLOAT:
+ case DOUBLE:
+ typeValidator = new IsFloatValidator();
break;
}
+ if (typeValidator != null) {
+ validators.add(typeValidator);
+ }
Set<Constraint> constraints = propertyDefinition.getConstraints();
if (constraints != null) {
@@ -1527,12 +1539,31 @@ public class ConfigurationEditor extends LocatableVLayout {
popup.show();
}
+ protected static void setValue(FormItem item, Object value) {
+ if (value instanceof String) {
+ item.setValue((String)value);
+ } else if (value instanceof Boolean) {
+ item.setValue((Boolean)value);
+ } else if (value instanceof Integer) {
+ item.setValue((Integer)value);
+ } else if (value instanceof Float) {
+ item.setValue((Float)value);
+ } else if (value instanceof Double) {
+ item.setValue((Double)value);
+ } else if (value instanceof Date) {
+ item.setValue((Date)value);
+ } else {
+ String stringValue = (value != null) ? value.toString() : null;
+ item.setValue(stringValue);
+ }
+ }
+
private static class PropertyDefinitionComparator implements Comparator<PropertyDefinition> {
public int compare(PropertyDefinition o1, PropertyDefinition o2) {
return new Integer(o1.getOrder()).compareTo(o2.getOrder());
}
}
-
+
private class PluginReportedErrorValidator extends CustomValidator {
private Property property;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index 463ee42..b25b625 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -35,6 +35,8 @@ import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -57,6 +59,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class GroupConfigurationEditor extends ConfigurationEditor {
private List<GroupMemberConfiguration> memberConfigurations;
+ private Map<String, FormItem> valueItemNameToUnsetItemMap = new HashMap<String, FormItem>();
public GroupConfigurationEditor(String locatorId, ConfigurationDefinition configurationDefinition,
List<GroupMemberConfiguration> memberConfigurations) {
@@ -78,47 +81,62 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
@Override
protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple propertySimple) {
- final FormItem item;
- boolean isAggregate = isAggregateProperty(propertySimple);
- if (!isAggregate || isHomogeneous(propertySimple)) {
- item = super.buildSimpleField(propertyDefinitionSimple, propertySimple);
- } else {
- item = new StaticTextItem();
- item.setDefaultValue("<span style='color: red'><i>Member Values Differ</i></span>");
- item.setShowTitle(false);
- }
+ final FormItem item = super.buildSimpleField(propertyDefinitionSimple, propertySimple);
+ boolean isAggregate = isAggregateProperty(propertySimple);
if (isAggregate) {
// Add the icon that user can click to edit the member values.
FormItemIcon icon = new FormItemIcon();
icon.setSrc("[SKIN]/actions/edit.png");
icon.setName("Edit Member Values");
+ icon.setNeverDisable(true);
icon.addFormItemClickHandler(new FormItemClickHandler() {
- public void onFormItemClick(FormItemIconClickEvent event) {
- // TODO: Pass the actual index, rather than null, if the prop is inside a list.
- displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"), propertyDefinitionSimple, item,
- propertySimple, null);
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ // TODO: Pass the actual index, rather than null, if the prop is inside a list.
+ displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"), propertyDefinitionSimple,
+ propertySimple, null, item);
+ }
+ });
+ // TODO: Figure out a way to add a tooltip to the icon.
+ item.setIcons(icon);
+
+ if (!isHomogeneous(propertySimple)) {
+ updateHeterogeneousValueItem(item);
+ }
+
+ item.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent changedEvent) {
+ Object value = changedEvent.getValue();
+ for (GroupMemberConfiguration memberConfiguration : memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ PropertySimple memberPropertySimple =
+ getPropertySimple(configuration, propertyDefinitionSimple, propertySimple, null);
+ memberPropertySimple.setValue(value);
+ }
}
});
- // TODO: Figure out a way to add a tooltip to the icon.
- item.setIcons(icon);
}
return item;
}
- private boolean isAggregateProperty(PropertySimple propertySimple) {
- return (propertySimple.getConfiguration() == getConfiguration());
- }
-
- private static Boolean isHomogeneous(PropertySimple propertySimple) {
- Boolean override = propertySimple.getOverride();
- return (override != null && override);
+ @Override
+ protected FormItem buildUnsetItem(final PropertyDefinitionSimple propertyDefinitionSimple, final PropertySimple propertySimple,
+ final FormItem valueItem) {
+ final FormItem unsetItem = super.buildUnsetItem(propertyDefinitionSimple, propertySimple, valueItem);
+ if (!isHomogeneous(propertySimple) && isAggregateProperty(propertySimple)) {
+ // non-homogeneous aggregate property (i.e. members have mixed values)
+ unsetItem.setValue(false);
+ unsetItem.setDisabled(true);
+ }
+ this.valueItemNameToUnsetItemMap.put(valueItem.getName(), unsetItem);
+ return unsetItem;
}
- private void displayMemberValuesEditor(String locatorId, PropertyDefinitionSimple propertyDefinitionSimple,
- final FormItem aggregateValueItem,
- final PropertySimple aggregatePropertySimple, Integer index) {
+ private void displayMemberValuesEditor(String locatorId, final PropertyDefinitionSimple propertyDefinitionSimple,
+ final PropertySimple aggregatePropertySimple,
+ Integer index, final FormItem aggregateValueItem
+ ) {
LocatableVLayout layout = new LocatableVLayout(locatorId);
layout.setHeight100();
@@ -151,14 +169,13 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
final List<FormItem> valueItems = new ArrayList<FormItem>(this.memberConfigurations.size());
final List<FormItem> unsetItems = new ArrayList<FormItem>(this.memberConfigurations.size());
for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
- // TODO: Format the disambiguated member name.
String memberName = memberConfiguration.getLabel();
StaticTextItem memberItem = new StaticTextItem();
memberItem.setShowTitle(false);
memberItem.setDefaultValue(memberName);
items.add(memberItem);
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple = getPropertySimple(configuration, propertyDefinitionSimple, index);
+ PropertySimple memberPropertySimple = getPropertySimple(configuration, propertyDefinitionSimple, aggregatePropertySimple, index);
memberProperties.put(memberName, memberPropertySimple);
FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple);
valueItem.setAttribute("rhq:property", memberPropertySimple);
@@ -170,7 +187,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
valueItem.setEndRow(true);
}
form.setItems(items.toArray(new FormItem[items.size()]));
-
+
final Window popup = new Window();
popup.setTitle("Member Values for Property '" + propertyDefinitionSimple.getName());
popup.setWidth(800);
@@ -185,28 +202,43 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
boolean valuesHomogeneous = true;
- String firstValue = (String)valueItems.get(0).getValue();
+ Object firstValue = valueItems.get(0).getValue();
for (FormItem valueItem : valueItems) {
- String value = (String)valueItem.getValue();
+ Object value = valueItem.getValue();
if ((value != null && !value.equals(firstValue)) || (value == null && firstValue != null)) {
valuesHomogeneous = false;
}
PropertySimple memberPropertySimple =
(PropertySimple)valueItem.getAttributeAsObject("rhq:property");
- memberPropertySimple.setStringValue(value);
+ memberPropertySimple.setValue(value);
memberPropertySimple.setErrorMessage(null);
}
+
+ FormItem aggregateUnsetItem = valueItemNameToUnsetItemMap.get(aggregateValueItem.getName());
+ aggregateUnsetItem.setDisabled(!valuesHomogeneous);
if (valuesHomogeneous) {
- // Values are all the same, so update the value of the aggregate property and set its override flag to true.
- aggregateValueItem.getForm().setValue(aggregateValueItem.getName(), firstValue);
- // TODO: Will this cause a value changed event to fire for the aggregate form item?
- aggregatePropertySimple.setStringValue(firstValue);
+ // Update the value of the aggregate property and set its override flag to true.
+ aggregatePropertySimple.setValue(firstValue);
aggregatePropertySimple.setOverride(true);
+
+ // Set the aggregate value item's value to the homogeneous value, enable it, and make sure it has
+ // validators set.
+ aggregateValueItem.setDisabled(false);
+ setValue(aggregateValueItem, firstValue);
+ aggregateValueItem.setTooltip(null);
+ aggregateValueItem.setValidateOnChange(true);
+ aggregateValueItem.setValidateOnExit(true);
+
+ aggregateUnsetItem.setValue(firstValue == null);
} else {
- aggregatePropertySimple.setStringValue(null);
+ aggregatePropertySimple.setValue(null);
aggregatePropertySimple.setOverride(false);
+
+ updateHeterogeneousValueItem(aggregateValueItem);
+
+ aggregateUnsetItem.setValue((String)null);
}
- // TODO: Figure out a way to update the aggregate Unset checkbox.
+
popup.destroy();
}
});
@@ -237,8 +269,17 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
popup.show();
}
+ private void updateHeterogeneousValueItem(FormItem item) {
+ item.setDisabled(true);
+ item.setValidateOnChange(false);
+ item.setValidateOnExit(false);
+ item.setValue("MEMBER VALUES DIFFER");
+ item.setTooltip("Member values differ - click icon to edit them.");
+ }
+
private PropertySimple getPropertySimple(Configuration configuration,
- PropertyDefinitionSimple propertyDefinitionSimple, Integer index) {
+ PropertyDefinitionSimple propertyDefinitionSimple,
+ PropertySimple aggregatePropertySimple, Integer index) {
LinkedList<PropertyDefinition> propertyDefinitionHierarchy = new LinkedList<PropertyDefinition>();
PropertyDefinition currentPropertyDefinition = propertyDefinitionSimple;
do {
@@ -266,7 +307,21 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
}
- return (PropertySimple)property;
+ PropertySimple propertySimple = (PropertySimple)property;
+ if (isHomogeneous(aggregatePropertySimple)) {
+ // If the aggregate property has its override bit set, make sure the member property has the same value.
+ propertySimple.setStringValue(aggregatePropertySimple.getStringValue());
+ }
+ return propertySimple;
+ }
+
+ private boolean isAggregateProperty(PropertySimple propertySimple) {
+ return (getConfiguration(propertySimple) == getConfiguration());
+ }
+
+ private static Boolean isHomogeneous(PropertySimple propertySimple) {
+ Boolean override = propertySimple.getOverride();
+ return (override != null && override);
}
private static Configuration getConfiguration(Property property) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index e0be6ef..f96d603 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -2,10 +2,8 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import java.util.List;
-import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@@ -13,14 +11,15 @@ import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.configuration.ConfigurationUpdateStillInProgressException;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+/**
+ *
+ */
@RemoteServiceRelativePath("ConfigurationGWTService")
public interface ConfigurationGWTService extends RemoteService {
-
Configuration getPluginConfiguration(int resourceId);
ConfigurationDefinition getPluginConfigurationDefinition(int resourceTypeId);
@@ -40,6 +39,11 @@ public interface ConfigurationGWTService extends RemoteService {
List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroup(int groupId);
- RawConfiguration dummy(RawConfiguration config);
+ List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroup(int groupId);
+
+ void updateResourceConfigurationsForGroup(int groupId, List<ResourceConfigurationComposite> resourceConfigurations);
+
+ void updatePluginConfigurationsForGroup(int groupId, List<ResourceConfigurationComposite> pluginConfigurations);
+ //RawConfiguration dummy(RawConfiguration config);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index 03cfc83..cef496a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -26,7 +26,6 @@ import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -92,6 +91,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
toolStrip.addMember(new LayoutSpacer());
this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), "Save");
+ this.saveButton.setTooltip("Update the configurations of all group members.");
this.saveButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
save();
@@ -176,26 +176,34 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
});
}
- private void save() {
- // TODO
-
- SC.say("Boo!");
-/*
- GWTServiceLookup.getConfigurationService().updateResourceConfiguration(resource.getId(), updatedConfiguration,
- new AsyncCallback<ResourceConfigurationUpdate>() {
+ private void save() {
+ List<ResourceConfigurationComposite> resourceConfigurations = convertToCompositeList();
+ GWTServiceLookup.getConfigurationService().updateResourceConfigurationsForGroup(this.group.getId(),
+ resourceConfigurations, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update configuration.", caught);
+ CoreGUI.getErrorHandler().handleError("Configuration update failed for "
+ + group.getResourceType().getName() + " compatible group '" + group.getName() + "'.", caught);
}
- public void onSuccess(ResourceConfigurationUpdate result) {
+ public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
- new Message("Configuration updated.",
- "Configuration updated for Resource [" + resource.getName() + "].",
+ new Message("Configuration update initiated.",
+ "Configuration update initiated for " + group.getResourceType().getName()
+ + " compatible group '" + group.getName() + "'.",
Message.Severity.Info));
reloadConfiguration();
}
});
-*/
+ }
+
+ private List<ResourceConfigurationComposite> convertToCompositeList() {
+ List<ResourceConfigurationComposite> resourceConfigurations =
+ new ArrayList<ResourceConfigurationComposite>(this.memberConfigurations.size());
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ resourceConfigurations.add(new ResourceConfigurationComposite(memberConfiguration.getId(),
+ memberConfiguration.getConfiguration()));
+ }
+ return resourceConfigurations;
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index 63fa33f..e20bd50 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -1,14 +1,12 @@
package org.rhq.enterprise.gui.coregui.server.gwt;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.allen_sauer.gwt.log.client.Log;
-
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@@ -34,6 +32,13 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
private static final long serialVersionUID = 1L;
+ private static final IntExtractor<ResourceConfigurationComposite> RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR =
+ new IntExtractor<ResourceConfigurationComposite>() {
+ public int extract(ResourceConfigurationComposite configurationComposite) {
+ return configurationComposite.getResourceId();
+ }
+ };
+
private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
private ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
@@ -125,14 +130,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
ResourceGroup group = this.groupManager.getResourceGroup(getSessionSubject(), groupId);
Map<Integer,Configuration> configurations =
this.configurationManager.getResourceConfigurationMapForCompatibleGroup(group);
- List<ResourceConfigurationComposite> configurationComposites =
- new ArrayList<ResourceConfigurationComposite>(configurations.size());
- for (Integer resourceId : configurations.keySet()) {
- Configuration configuration = configurations.get(resourceId);
- ResourceConfigurationComposite configurationComposite =
- new ResourceConfigurationComposite(resourceId, configuration);
- configurationComposites.add(configurationComposite);
- }
+ List<ResourceConfigurationComposite> configurationComposites = convertToCompositesList(configurations);
// Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
List<DisambiguationReport<ResourceConfigurationComposite>> disambiguatedConfigurationComposites = resourceManager
@@ -146,24 +144,70 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
- public RawConfiguration dummy(RawConfiguration config) {
- Log.info(config.getPath());
- return new RawConfiguration();
- // Dummy method for gwt compiler
+ public List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroup(
+ int groupId) {
+ try {
+ Map<Integer,Configuration> configurations =
+ this.configurationManager.getPluginConfigurationsForCompatibleGroup(getSessionSubject(), groupId);
+ List<ResourceConfigurationComposite> configurationComposites = convertToCompositesList(configurations);
+
+ // Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
+ List<DisambiguationReport<ResourceConfigurationComposite>> disambiguatedConfigurationComposites = resourceManager
+ .disambiguate(configurationComposites, RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR,
+ DefaultDisambiguationUpdateStrategies.getDefault());
+
+ return SerialUtility.prepare(disambiguatedConfigurationComposites,
+ "ConfigurationService.findPluginConfigurationsForGroup");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public void updateResourceConfigurationsForGroup(int groupId,
+ List<ResourceConfigurationComposite> resourceConfigurations) {
+ try {
+ Map<Integer, Configuration> configurations = convertToMap(resourceConfigurations);
+ this.configurationManager.scheduleGroupResourceConfigurationUpdate(getSessionSubject(), groupId, configurations);
+ } catch (RuntimeException e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public void updatePluginConfigurationsForGroup(int groupId,
+ List<ResourceConfigurationComposite> pluginConfigurations) {
+ try {
+ Map<Integer, Configuration> configurations = convertToMap(pluginConfigurations);
+ this.configurationManager.scheduleGroupPluginConfigurationUpdate(getSessionSubject(), groupId, configurations);
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
/*
- public ResourceConfigurationComposite dummy(ResourceConfigurationComposite resourceConfigurationComposite) {
- return new ResourceConfigurationComposite();
- // Dummy method for gwt compiler
+ // Dummy method for gwt compiler
+ public RawConfiguration dummy(RawConfiguration config) {
+ Log.info(config.getPath());
+ return new RawConfiguration();
}
*/
- private static final IntExtractor<ResourceConfigurationComposite> RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR =
- new IntExtractor<ResourceConfigurationComposite>() {
- public int extract(ResourceConfigurationComposite configurationComposite) {
- return configurationComposite.getResourceId();
+ private List<ResourceConfigurationComposite> convertToCompositesList(Map<Integer, Configuration> configurations) {
+ List<ResourceConfigurationComposite> configurationComposites =
+ new ArrayList<ResourceConfigurationComposite>(configurations.size());
+ for (Integer resourceId : configurations.keySet()) {
+ Configuration configuration = configurations.get(resourceId);
+ ResourceConfigurationComposite configurationComposite =
+ new ResourceConfigurationComposite(resourceId, configuration);
+ configurationComposites.add(configurationComposite);
}
- };
+ return configurationComposites;
+ }
+ private Map<Integer, Configuration> convertToMap(List<ResourceConfigurationComposite> resourceConfigurations) {
+ Map<Integer, Configuration> configurations = new HashMap<Integer, Configuration>(resourceConfigurations.size());
+ for (ResourceConfigurationComposite resourceConfiguration : resourceConfigurations) {
+ configurations.put(resourceConfiguration.getResourceId(), resourceConfiguration.getConfiguration());
+ }
+ return configurations;
+ }
}
13 years, 8 months
[rhq] modules/core modules/enterprise
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 41 ++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 80 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 10 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 18 +-
6 files changed, 113 insertions(+), 43 deletions(-)
New commits:
commit 915e740bb29e3ac21eaa1674a8a51779c1494991
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 7 22:17:23 2010 -0400
add Resource name to Disambiguation report; more work on group config editor
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
index e00e29d..cbff0b9 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
@@ -35,8 +35,8 @@ public class ResourceConfigurationComposite implements Serializable{
*/
private Configuration configuration;
- // No-arg constructor required by GWT
- protected ResourceConfigurationComposite() {
+ // Default constructor required by GWT
+ public ResourceConfigurationComposite() {
}
public ResourceConfigurationComposite(int resourceId, Configuration configuration) {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
index f54354b..717721b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
@@ -165,6 +165,7 @@ public class DisambiguationReport<T> implements Serializable {
}
public String toString() {
- return "DisambiguationReport(type=" + resourceType + ", parents=" + parents + ", original=" + original + ")";
+ return "DisambiguationReport(type=" + resourceType + ", parents=" + parents + ", original=" + original
+ + ", name=" + name + ")";
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 8a4d9fa..310f59f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -569,18 +569,23 @@ public class ConfigurationEditor extends LocatableVLayout {
final FormItem valueItem;
if (propertyDefinition instanceof PropertyDefinitionSimple) {
final PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple)propertyDefinition;
- final PropertySimple propertySimple = (PropertySimple)property;
+ PropertySimple propertySimple = (PropertySimple)property;
+
+ if (propertySimple == null) {
+ propertySimple = new PropertySimple(propertyDefinitionSimple.getName(), null);
+ }
+ final PropertySimple finalPropertySimple = propertySimple;
valueItem = buildSimpleField(propertyDefinitionSimple, propertySimple);
valueItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent changedEvent) {
- propertySimple.setErrorMessage(null);
+ finalPropertySimple.setErrorMessage(null);
boolean isValid = changedEvent.getItem().validate();
if (isValid) {
- propertySimple.setValue(changedEvent.getValue());
+ finalPropertySimple.setValue(changedEvent.getValue());
}
if (firePropertyChangedEvents) {
- firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, isValid);
+ firePropertyChangedEvent(finalPropertySimple, propertyDefinitionSimple, isValid);
}
}
});
@@ -602,6 +607,9 @@ public class ConfigurationEditor extends LocatableVLayout {
PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList)propertyDefinition;
PropertyDefinition memberDefinition = propertyDefinitionList.getMemberDefinition();
PropertyList propertyList = (PropertyList)property;
+ if (propertyList == null) {
+ propertyList = new PropertyList(propertyDefinitionList.getName());
+ }
if (memberDefinition instanceof PropertyDefinitionMap) {
// List of Maps is a specially supported case with summary fields as columns in a table
// Note: This field spans 3 columns.
@@ -638,9 +646,15 @@ public class ConfigurationEditor extends LocatableVLayout {
fields.add(canvasItem);
}
} else if (propertyDefinition instanceof PropertyDefinitionMap) {
+ PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)propertyDefinition;
+ PropertyMap propertyMap = (PropertyMap)property;
+ if (propertyMap == null) {
+ propertyMap = new PropertyMap(propertyDefinitionMap.getName());
+ }
+
// Note: This field spans 3 columns.
FormItem mapField =
- buildMapField(locatorId, (PropertyDefinitionMap)propertyDefinition, (PropertyMap)property);
+ buildMapField(locatorId, propertyDefinitionMap, propertyMap);
fields.add(mapField);
}
@@ -1293,7 +1307,7 @@ public class ConfigurationEditor extends LocatableVLayout {
return valueItem;
}
- private static Property getTopLevelProperty(Property property) {
+ protected static Property getTopLevelProperty(Property property) {
Property currentProperty = property;
while (currentProperty.getConfiguration() == null) {
if (currentProperty.getParentList() != null) {
@@ -1307,12 +1321,12 @@ public class ConfigurationEditor extends LocatableVLayout {
}
return currentProperty;
}
-
+
protected FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final PropertySimple property,
final FormItem valueItem) {
FormItem item;
if (!propertyDefinition.isRequired()) {
- CheckboxItem unsetItem = new CheckboxItem();
+ final CheckboxItem unsetItem = new CheckboxItem();
boolean unset = isUnset(propertyDefinition, property);
unsetItem.setValue(unset);
unsetItem.setDisabled(isReadOnly(propertyDefinition, property));
@@ -1325,15 +1339,24 @@ public class ConfigurationEditor extends LocatableVLayout {
public void onChange(ChangeEvent changeEvent) {
Boolean isUnset = (Boolean) changeEvent.getValue();
if (isUnset) {
+ valueItem.getForm().setValue(valueItem.getName(), (String)null);
valueItem.setDisabled(true);
- valueItem.setValue((String) null);
} else {
valueItem.setDisabled(false);
valueItem.focusInItem();
}
+ valueItem.redraw();
property.setValue(valueItem.getValue());
}
});
+
+ valueItem.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent changeEvent) {
+ String value = (String)changeEvent.getValue();
+ unsetItem.setDisabled(value == null);
+ }
+ });
+
item = unsetItem;
} else {
item = new SpacerItem();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index 4bdb9e6..463ee42 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -79,30 +79,43 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple propertySimple) {
final FormItem item;
- if (propertySimple.getOverride()) {
+ boolean isAggregate = isAggregateProperty(propertySimple);
+ if (!isAggregate || isHomogeneous(propertySimple)) {
item = super.buildSimpleField(propertyDefinitionSimple, propertySimple);
} else {
item = new StaticTextItem();
- item.setTitle("<i>Member Values Differ</i>");
- item.setIcons();
+ item.setDefaultValue("<span style='color: red'><i>Member Values Differ</i></span>");
+ item.setShowTitle(false);
}
- // Add the icon that user can click to edit the member values.
- FormItemIcon icon = new FormItemIcon();
- icon.setSrc("[SKIN]/actions/edit.png");
- icon.setName("Edit Member Values");
- icon.addFormItemClickHandler(new FormItemClickHandler() {
- public void onFormItemClick(FormItemIconClickEvent event) {
- // TODO: Pass the actual index, rather than null, if the prop is inside a list.
- displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"), propertyDefinitionSimple, item,
- propertySimple, null);
- }
- });
- item.setIcons(icon);
+ if (isAggregate) {
+ // Add the icon that user can click to edit the member values.
+ FormItemIcon icon = new FormItemIcon();
+ icon.setSrc("[SKIN]/actions/edit.png");
+ icon.setName("Edit Member Values");
+ icon.addFormItemClickHandler(new FormItemClickHandler() {
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ // TODO: Pass the actual index, rather than null, if the prop is inside a list.
+ displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"), propertyDefinitionSimple, item,
+ propertySimple, null);
+ }
+ });
+ // TODO: Figure out a way to add a tooltip to the icon.
+ item.setIcons(icon);
+ }
return item;
}
+ private boolean isAggregateProperty(PropertySimple propertySimple) {
+ return (propertySimple.getConfiguration() == getConfiguration());
+ }
+
+ private static Boolean isHomogeneous(PropertySimple propertySimple) {
+ Boolean override = propertySimple.getOverride();
+ return (override != null && override);
+ }
+
private void displayMemberValuesEditor(String locatorId, PropertyDefinitionSimple propertyDefinitionSimple,
final FormItem aggregateValueItem,
final PropertySimple aggregatePropertySimple, Integer index) {
@@ -113,26 +126,36 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
final DynamicForm form = new DynamicForm();
form.setHeight100();
- form.setColWidths("55%", "5%", "40%");
+ form.setNumCols(3);
+ form.setColWidths("60%", "8%", "32%");
layout.addMember(form);
// Add header row.
List<FormItem> items = new ArrayList<FormItem>();
- StaticTextItem memberHeader = new StaticTextItem("memberHeader", "Member");
+ StaticTextItem memberHeader = new StaticTextItem();
+ memberHeader.setShowTitle(false);
+ memberHeader.setDefaultValue("<h4>Member</h4>");
items.add(memberHeader);
- StaticTextItem unsetHeader = new StaticTextItem("unsetHeader", "Unset");
+ StaticTextItem unsetHeader = new StaticTextItem();
+ unsetHeader.setShowTitle(false);
+ unsetHeader.setDefaultValue("<h4>Unset</h4>");
items.add(unsetHeader);
- StaticTextItem valueHeader = new StaticTextItem("valueHeader", "Value");
+ StaticTextItem valueHeader = new StaticTextItem();
+ valueHeader.setShowTitle(false);
+ valueHeader.setDefaultValue("<h4>Value</h4>");
valueHeader.setEndRow(true);
items.add(valueHeader);
// Add data rows.
final Map<String, PropertySimple> memberProperties = new HashMap<String, PropertySimple>(this.memberConfigurations.size());
final List<FormItem> valueItems = new ArrayList<FormItem>(this.memberConfigurations.size());
+ final List<FormItem> unsetItems = new ArrayList<FormItem>(this.memberConfigurations.size());
for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
// TODO: Format the disambiguated member name.
String memberName = memberConfiguration.getLabel();
- StaticTextItem memberItem = new StaticTextItem("member", memberName);
+ StaticTextItem memberItem = new StaticTextItem();
+ memberItem.setShowTitle(false);
+ memberItem.setDefaultValue(memberName);
items.add(memberItem);
Configuration configuration = memberConfiguration.getConfiguration();
PropertySimple memberPropertySimple = getPropertySimple(configuration, propertyDefinitionSimple, index);
@@ -142,6 +165,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
valueItems.add(valueItem);
FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple, memberPropertySimple, valueItem);
items.add(unsetItem);
+ unsetItems.add(unsetItem);
items.add(valueItem);
valueItem.setEndRow(true);
}
@@ -164,7 +188,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
String firstValue = (String)valueItems.get(0).getValue();
for (FormItem valueItem : valueItems) {
String value = (String)valueItem.getValue();
- if ((value != null && !value.equals(firstValue)) || firstValue != null) {
+ if ((value != null && !value.equals(firstValue)) || (value == null && firstValue != null)) {
valuesHomogeneous = false;
}
PropertySimple memberPropertySimple =
@@ -174,12 +198,15 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
if (valuesHomogeneous) {
// Values are all the same, so update the value of the aggregate property and set its override flag to true.
- aggregateValueItem.setValue(firstValue);
+ aggregateValueItem.getForm().setValue(aggregateValueItem.getName(), firstValue);
// TODO: Will this cause a value changed event to fire for the aggregate form item?
aggregatePropertySimple.setStringValue(firstValue);
- aggregatePropertySimple.setErrorMessage(null);
aggregatePropertySimple.setOverride(true);
+ } else {
+ aggregatePropertySimple.setStringValue(null);
+ aggregatePropertySimple.setOverride(false);
}
+ // TODO: Figure out a way to update the aggregate Unset checkbox.
popup.destroy();
}
});
@@ -189,7 +216,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
public void onItemChanged(ItemChangedEvent itemChangedEvent) {
okButton.setDisabled(!form.validate());
}
- });
+ });
final IButton cancelButton = new IButton("Cancel");
cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@@ -241,4 +268,9 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
return (PropertySimple)property;
}
+
+ private static Configuration getConfiguration(Property property) {
+ Property topLevelProperty = getTopLevelProperty(property);
+ return topLevelProperty.getConfiguration();
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index ee2297c..03cfc83 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -67,7 +67,6 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
private ResourceGroup group;
private ResourcePermission resourcePermission;
private ConfigurationDefinition configurationDefinition;
- private Configuration aggregateConfiguration;
private List<GroupMemberConfiguration> memberConfigurations;
private ConfigurationEditor editor;
@@ -122,7 +121,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
}
private void initEditor() {
- if (this.configurationDefinition != null && this.aggregateConfiguration != null) {
+ if (this.configurationDefinition != null && this.memberConfigurations != null) {
this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
this.memberConfigurations);
this.editor.setOverflow(Overflow.AUTO);
@@ -150,7 +149,6 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
}
private void loadConfigurations() {
- this.aggregateConfiguration = null;
this.memberConfigurations = null;
this.configurationService.findResourceConfigurationsForGroup(group.getId(), new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
public void onFailure(Throwable caught) {
@@ -165,8 +163,12 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
String resourceHtml = ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
result.getResourceType(), result.getName(), resourceId);
String label = parentsHtml + ReportDecorator.DEFAULT_SEPARATOR + resourceHtml;
+ Configuration configuration = result.getOriginal().getConfiguration();
GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
- result.getOriginal().getConfiguration());
+ configuration);
+ if (configuration == null || configuration.getProperties().isEmpty()) {
+ throw new RuntimeException("One or more null or empty member Resource configuration was returned by the Server.");
+ }
memberConfigurations.add(memberConfiguration);
}
initEditor();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index abd6592..63fa33f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import com.allen_sauer.gwt.log.client.Log;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.RawConfiguration;
@@ -11,7 +13,6 @@ import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
@@ -26,6 +27,9 @@ import org.rhq.enterprise.server.resource.disambiguation.DefaultDisambiguationUp
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+/**
+ *
+ */
public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implements ConfigurationGWTService {
private static final long serialVersionUID = 1L;
@@ -135,18 +139,26 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
.disambiguate(configurationComposites, RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR,
DefaultDisambiguationUpdateStrategies.getDefault());
- return disambiguatedConfigurationComposites;
+ return SerialUtility.prepare(disambiguatedConfigurationComposites,
+ "ConfigurationService.findResourceConfigurationsForGroup");
} catch (RuntimeException e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
}
public RawConfiguration dummy(RawConfiguration config) {
- com.allen_sauer.gwt.log.client.Log.info(config.getPath());
+ Log.info(config.getPath());
return new RawConfiguration();
// Dummy method for gwt compiler
}
+/*
+ public ResourceConfigurationComposite dummy(ResourceConfigurationComposite resourceConfigurationComposite) {
+ return new ResourceConfigurationComposite();
+ // Dummy method for gwt compiler
+ }
+*/
+
private static final IntExtractor<ResourceConfigurationComposite> RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR =
new IntExtractor<ResourceConfigurationComposite>() {
public int extract(ResourceConfigurationComposite configurationComposite) {
13 years, 8 months