[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit 59417ed3ac11e6eeca8df4ecaa46968bdd134e3d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 28 12:51:20 2012 +0200
Trigger discovery
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
index d9afd1a..6b90fd8 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
@@ -22,6 +22,7 @@ package org.rhq.modules.plugins.jbossas7.itest.standalone;
import java.util.Iterator;
import org.jetbrains.annotations.NotNull;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.rhq.core.clientapi.agent.PluginContainerException;
@@ -37,6 +38,7 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+import org.rhq.test.arquillian.RunDiscovery;
/**
* Test stuff around socket bindings.
@@ -49,6 +51,11 @@ public class SocketBindingTest extends AbstractJBossAS7PluginTest {
public static final ResourceType RESOURCE_TYPE = new ResourceType("SocketBindingGroup", PLUGIN_NAME, ResourceCategory.SERVICE, null);
private static final String RESOURCE_KEY = "socket-binding-group=standard-sockets";
+ @BeforeClass
+ @RunDiscovery(discoverServices = true)
+ public void doSomeDiscovery() throws Exception {
+ }
+
public void loadBindings() throws Exception {
loadConfig();
12 years, 2 months
[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java | 3
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 10
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java | 210 ++++++++++
3 files changed, 218 insertions(+), 5 deletions(-)
New commits:
commit 51ace66460aa4ae35cf4d65ecfab0f1c1c320a28
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 28 10:57:11 2012 +0200
BZ 802794 - SocketBindingGroups must not be removed/re-added on change. Also add integration tests.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 8644b71..68e407c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -394,6 +394,9 @@ public class BaseServerComponent extends BaseComponent implements MeasurementFac
report.addData(data);
}
}
+ else {
+ log.debug("getSKMRequests failed: " + res.getFailureDescription());
+ }
}
super.getValues(report, leftovers);
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 0d2bfe0..1d85bff 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -2218,21 +2218,21 @@ working area for individual server instances</li></ul>"/>
<operation name="list-proxies" description="Read the list of httpd connected to the node.">
<results>
- <!-- List of proxies the node is connected to. Format (hostname:port) separated with comas.-->
+ <!-- List of proxies the node is connected to. Format (hostname:port) separated with comas.-->
<c:simple-property name="proxy-list" description="List of proxies the node is connected to. Format (hostname:port) separated with comas"/>
</results>
</operation>
<operation name="read-proxies-configuration" description="Send a DUMP to httpd and display the result.">
<results>
- <!-- Result of the DUMP command.-->
+ <!-- Result of the DUMP command.-->
<c:simple-property name="current-proxy-config" description="Result of the DUMP command. Snapshot of httpd/modcluster configuration."/>
</results>
</operation>
<operation name="read-proxies-info" description="Send a INFO to httpd and display the result.">
<results>
- <!-- Result of the INFO command.-->
+ <!-- Result of the INFO command.-->
<c:simple-property name="current-proxy-info" description="Result of the INFO command. Snapshot of httpd/modcluster proxy information."/>
</results>
</operation>
@@ -2309,7 +2309,7 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="ttl" required="false" type="integer" readOnly="false" defaultValue="60" description="Time to live (in seconds) for idle connections above smax"/>
<c:simple-property name="node-timeout" required="false" type="integer" readOnly="false" defaultValue="-1" description="Timeout (in seconds) for proxy connections to a node."/>
<c:simple-property name="balancer" required="false" type="string" readOnly="false" defaultValue="mycluster" description="The balancer name."/>
- <c:simple-property name="domain" required="false" type="string" readOnly="false" description="loadBalancingGroup name."/>
+ <c:simple-property name="domain" required="false" type="string" readOnly="false" description="loadBalancingGroup name."/>
</resource-configuration>
</server>
@@ -2448,7 +2448,7 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="port-offset" readOnly="false" displayName="Port Offset"
description="Offset from standard ports for this group. This is only available in standalone mode"
required="false"/>
- <c:group name="children:socket-binding:name+-" displayName="Individual socket bindings">
+ <c:group name="children:socket-binding:name+" displayName="Individual socket bindings">
<c:list-property name="*" displayName="Bindings">
<c:map-property name="binding">
<c:simple-property name="name" description="The name of the socket. Services which need to access the socket configuration information will find it using this name." readOnly="true"/>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
new file mode 100644
index 0000000..d9afd1a
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
@@ -0,0 +1,210 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.modules.plugins.jbossas7.itest.standalone;
+
+import java.util.Iterator;
+
+import org.jetbrains.annotations.NotNull;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
+import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+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.pc.inventory.InventoryManager;
+import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+
+/**
+ * Test stuff around socket bindings.
+ * This could actually also run for domain mode
+ * @author Heiko W. Rupp
+ */
+@Test(groups = {"integration", "pc", "standalone"}, singleThreaded = true)
+public class SocketBindingTest extends AbstractJBossAS7PluginTest {
+
+ public static final ResourceType RESOURCE_TYPE = new ResourceType("SocketBindingGroup", PLUGIN_NAME, ResourceCategory.SERVICE, null);
+ private static final String RESOURCE_KEY = "socket-binding-group=standard-sockets";
+
+ public void loadBindings() throws Exception {
+
+ loadConfig();
+ }
+
+ public void addBinding() throws Exception {
+
+ Configuration configuration = loadConfig();
+ PropertyMap map = new PropertyMap("socket-binding=bla");
+ PropertySimple ps = new PropertySimple("name","bla");
+ map.put(ps);
+ ps = new PropertySimple("port",12345);
+ map.put(ps);
+ ps = new PropertySimple("fixed-port",false);
+ map.put(ps);
+ ps = new PropertySimple("multicast-port","${foo.bar.baz:12346}");
+ map.put(ps);
+ PropertyList pl = (PropertyList) configuration.get("*");
+ int count = pl.getList().size();
+ pl.add(map);
+
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1,configuration,getResource().getId());
+ ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Config add resulted in this error: " + response.getErrorMessage();
+
+ configuration = loadConfig();
+ pl = (PropertyList) configuration.get("*");
+ assert pl.getList().size() == count+1;
+ }
+
+ public void addModifyBinding() throws Exception {
+
+ Configuration configuration = loadConfig();
+ PropertyMap map = new PropertyMap("bla2");
+ PropertySimple ps = new PropertySimple("name","bla2");
+ map.put(ps);
+ ps = new PropertySimple("port",12355);
+ map.put(ps);
+ ps = new PropertySimple("fixed-port",false);
+ map.put(ps);
+ ps = new PropertySimple("multicast-port","${foo.bar.baz:12356}");
+ map.put(ps);
+ PropertyList pl = (PropertyList) configuration.get("*");
+ pl.add(map);
+
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1,configuration,getResource().getId());
+ ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Config add resulted in this error: " + response.getErrorMessage();
+
+ configuration = loadConfig();
+ map=null;
+ pl = (PropertyList) configuration.get("*");
+ for (Property prop: pl.getList()) {
+ if (!prop.getName().equals("bla2"))
+ continue;
+
+ map = (PropertyMap) prop;
+ }
+ assert map != null : "Did not find 'bla2' in the returned config";
+ map.put(new PropertySimple("port",22355));
+ map.put(new PropertySimple("fixed-port",true));
+ request = new ConfigurationUpdateRequest(2,configuration,getResource().getId());
+ response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Config update resulted in this error: " + response.getErrorMessage();
+
+ }
+
+ public void addRemoveBinding() throws Exception {
+
+ Configuration configuration = loadConfig();
+ PropertyMap map = new PropertyMap("bla3");
+ PropertySimple ps = new PropertySimple("name","bla3");
+ map.put(ps);
+ ps = new PropertySimple("port",12365);
+ map.put(ps);
+ ps = new PropertySimple("fixed-port",false);
+ map.put(ps);
+ ps = new PropertySimple("multicast-port","${foo.bar.baz:12366}");
+ map.put(ps);
+ PropertyList pl = (PropertyList) configuration.get("*");
+ int count = pl.getList().size();
+ pl.add(map);
+
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1,configuration,getResource().getId());
+ ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Config add resulted in this error: " + response.getErrorMessage();
+
+ configuration = loadConfig();
+ pl = (PropertyList) configuration.get("*");
+ assert pl.getList().size() == count+1;
+
+ Iterator<Property> iter = pl.getList().iterator();
+ while (iter.hasNext()) {
+ Property prop = iter.next();
+ if (prop.getName().equals("bla3")) {
+ iter.remove();
+ break;
+ }
+ }
+
+ request = new ConfigurationUpdateRequest(3,configuration,getResource().getId());
+ response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Property removal resulted in this error: " + response.getErrorMessage();
+ }
+
+ /** THIS ONE WILL NOT WORK IN DOMAIN MODE */
+ public void changePortOffset() throws Exception {
+
+ Configuration configuration = loadConfig();
+ PropertySimple ps = configuration.getSimple("port-offset");
+ String original = ps.getStringValue();
+
+ configuration.put(new PropertySimple("port-offset",0));
+
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1,configuration,getResource().getId());
+ ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Changing the port-offset resulted in this error: " + response.getErrorMessage();
+
+ configuration = loadConfig();
+ ps = configuration.getSimple("port-offset");
+ assert ps != null;
+ assert ps.getIntegerValue()!=null;
+ assert ps.getIntegerValue()==0;
+
+ configuration.put(new PropertySimple("port-offset",original));
+
+ request = new ConfigurationUpdateRequest(2,configuration,getResource().getId());
+ response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
+ assert response!=null;
+ assert response.getErrorMessage()==null: "Changing the port-offset back resulted in this error: " + response.getErrorMessage();
+
+ }
+
+
+
+ @NotNull
+ private Configuration loadConfig() throws PluginContainerException {
+ Configuration config = pluginContainer.getConfigurationManager().loadResourceConfiguration(getResource().getId());
+ assert config != null;
+ assert !config.getProperties().isEmpty();
+ return config;
+ }
+
+ private Resource getResource() {
+
+ InventoryManager im = pluginContainer.getInventoryManager();
+ Resource platform = im.getPlatform();
+ Resource server = getResourceByTypeAndKey(platform,StandaloneServerComponentTest.RESOURCE_TYPE,StandaloneServerComponentTest.RESOURCE_KEY);
+ Resource bindings = getResourceByTypeAndKey(server,RESOURCE_TYPE,RESOURCE_KEY);
+ return bindings;
+ }
+
+}
12 years, 2 months
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java | 33 ++++++++--
1 file changed, 29 insertions(+), 4 deletions(-)
New commits:
commit f1a4266c4b627f7dd193341535a145ca4b759ccf
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Mar 27 22:37:10 2012 -0400
[BZ 802544] Adding initial support for selecting/deselecting all details
I spent a good bit of time investigating a good way to do this in the
column header, and unfortunately do not see one. You can easily add a
checkbox column that toggles on/off selection of all rows, but that is
not quite the behavior we want. Furthermore, I don't see an easy way to
add a label to that column. An easier option for the column header would
be to add another item to the export details column header. I'm not sure
how intuitive that would be. Adding the checkbox to the filters section
has the benefits of being easy to implement and being consistent with
where we place our other filter controls.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
index 8897845..6a513fc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
@@ -39,6 +39,9 @@ import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
@@ -103,8 +106,6 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
@Override
protected void onInit() {
super.onInit();
-
- //addMember(new TitleBar(this, VIEW_ID.getTitle(),VIEW_ID.getIconPath()));
addMember(new ResourceInstallReportTable(extendLocatorId("table")));
}
@@ -158,7 +159,7 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
ListGridField fieldCategory = new ListGridField(DataSource.Field.CATEGORY, MSG.common_title_category());
ListGridField fieldVersion = new ListGridField(DataSource.Field.VERSION, MSG.common_title_version());
ListGridField fieldCount = new ListGridField(DataSource.Field.COUNT, MSG.common_title_count());
- ListGridField fieldExport = new ListGridField("export", "Export");
+ ListGridField fieldExport = new ListGridField("exportDetails", "Export Details");
exportChangeHandler = new ExportChangeHandler(getListGrid(), DataSource.Field.TYPEID,
DataSource.Field.EXPORT);
@@ -251,6 +252,30 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
});
}
+ @Override
+ protected void configureTableFilters() {
+ CheckboxItem exportAllDetails = new CheckboxItem("exportAllDetails", "Export All Details");
+ exportAllDetails.setLabelAsTitle(true);
+
+ setShowFilterForm(true);
+ setFilterFormItems(exportAllDetails);
+
+ exportAllDetails.addChangedHandler(new ChangedHandler() {
+
+ boolean exportAll;
+
+ @Override
+ public void onChanged(ChangedEvent event) {
+ exportAll = !exportAll;
+ ListGrid table = getListGrid();
+ int row = 0;
+ for (ListGridRecord record : table.getRecords()) {
+ record.setAttribute(DataSource.Field.EXPORT, exportAll);
+ table.refreshCell(row++, 5);
+ }
+ }
+ });
+ }
private String getResourceTypeTableUrl(ListGridRecord selected) {
String url = null;
@@ -276,7 +301,7 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
public static final String TYPEID = "typeId"; // int
public static final String VERSION = "version"; // String
public static final String OBJECT = "object";
- public static final String EXPORT = "export";
+ public static final String EXPORT = "exportDetails";
}
public DataSource() {
12 years, 2 months
[rhq] Branch 'feature/export-reports' - 2 commits - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/MeasurementConverter.java | 252 ++++++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java | 106 ----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java | 2
4 files changed, 272 insertions(+), 90 deletions(-)
New commits:
commit 14bb993e58caeb8f80e156759f43de7837d99e8f
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Mar 27 21:21:21 2012 -0400
[BZ 802544] Fixing query params to match enum values
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java
index 2fc17bb..c968d0c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertLocal.java
@@ -12,7 +12,7 @@ public interface RecentAlertLocal {
@Path("/")
@Produces({"text/csv", "application/xml"})
StreamingOutput recentAlerts(
- @QueryParam("alertPriority") @DefaultValue("High,Med,Low") String alertPriority,
+ @QueryParam("alertPriority") @DefaultValue("high,medium,low") String alertPriority,
@Context UriInfo uriInfo,
@Context Request request,
@Context HttpHeaders headers);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java
index 814a2b6..d654773 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentOperationsLocal.java
@@ -12,7 +12,7 @@ public interface RecentOperationsLocal {
@Path("/")
@Produces({"text/csv", "application/xml"})
StreamingOutput recentOperations(
- @QueryParam("operationRequestStatus") @DefaultValue("InProgress,Success,Failure,Cancelled") String operationRequestStatus,
+ @QueryParam("operationRequestStatus") @DefaultValue("inprogress,success,failure,cancelled") String operationRequestStatus,
@Context UriInfo uriInfo,
@Context Request request,
@Context HttpHeaders headers);
commit c1093e1a986f8582e5ac3bc45b8b28734d28bf99
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Mar 27 21:05:36 2012 -0400
[BZ 802544] Adding support for converting measurement values for display
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/MeasurementConverter.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/MeasurementConverter.java
new file mode 100644
index 0000000..b8d950e
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/MeasurementConverter.java
@@ -0,0 +1,252 @@
+/*
+ *
+ * * RHQ Management Platform
+ * * Copyright (C) 2005-2012 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.server.rest.reporting;
+
+import java.text.DecimalFormat;
+
+import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.domain.measurement.util.MeasurementConversionException;
+
+/**
+ * @author jsanda
+ */
+public class MeasurementConverter {
+
+ private static final int MAX_PRECISION_DIGITS = 4;
+ private static final String NULL_OR_NAN_FORMATTED_VALUE = "--no data available--";
+
+ public static String format(Double value, MeasurementUnits targetUnits, boolean bestFit) {
+ return format(value, targetUnits, bestFit, null, null);
+ }
+
+ public static String format(Double value, MeasurementUnits targetUnits, boolean bestFit,
+ Integer minimumFractionDigits, Integer maximumFractionDigits) {
+ if (value == null || Double.isNaN(value)) {
+ return NULL_OR_NAN_FORMATTED_VALUE;
+ }
+ if (bestFit) {
+ MeasurementNumericValueAndUnits valueAndUnits = fit(value, targetUnits);
+
+ value = valueAndUnits.getValue();
+ targetUnits = valueAndUnits.getUnits();
+ }
+
+ // apply relative scale at presentation time
+ if (targetUnits != null && MeasurementUnits.Family.RELATIVE == targetUnits.getFamily()) {
+ value = MeasurementUnits.scaleUp(value, targetUnits);
+ }
+
+ DecimalFormat numberFormat = new DecimalFormat(getFormat(
+ minimumFractionDigits != null ? minimumFractionDigits : 1,
+ maximumFractionDigits != null ? maximumFractionDigits : 1));
+
+ String formatted = numberFormat.format(value);
+
+ return format(formatted, targetUnits);
+ }
+
+ public static String format(String value, MeasurementUnits targetUnits) {
+ if (targetUnits == null) {
+ return value;
+ } else {
+ return value + getMeasurementUnitAbbreviation(targetUnits);
+ }
+ }
+
+ public static MeasurementNumericValueAndUnits fit(Double origin, MeasurementUnits units) {
+ return fit(origin, units, null, null);
+ }
+
+ public static MeasurementNumericValueAndUnits fit(Double origin, MeasurementUnits units, MeasurementUnits lowUnits,
+ MeasurementUnits highUnits) {
+
+ // work-around for the various Chart descendants not properly setting their units field;
+ if (null == units) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ // by definition, absolutely specified units don't scale to anything
+ if ((MeasurementUnits.Family.ABSOLUTE == units.getFamily())
+ || (MeasurementUnits.Family.DURATION == units.getFamily())) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ // by definition relative-valued units are self-scaled (converted at formatting)
+ if (MeasurementUnits.Family.RELATIVE == units.getFamily()) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ if (MeasurementUnits.Family.TEMPERATURE == units.getFamily()) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ // if the magnitude is zero, the best-fit also will spin around forever since it won't change
+ if (Math.abs(origin) < 1e-9) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ boolean wasNegative = false;
+
+ if (origin < 0) {
+ wasNegative = true;
+ origin = -origin;
+ }
+
+ MeasurementNumericValueAndUnits currentValueAndUnits;
+ MeasurementNumericValueAndUnits nextValueAndUnits = new MeasurementNumericValueAndUnits(origin, units);
+
+ // first, make the value smaller if it's too big
+ int maxOrdinal = (highUnits != null) ? (highUnits.ordinal() + 1) : MeasurementUnits.values().length;
+
+ do {
+ currentValueAndUnits = nextValueAndUnits;
+
+ int nextOrdinal = currentValueAndUnits.getUnits().ordinal() + 1;
+ if (nextOrdinal == maxOrdinal) {
+ // we could theoretically get bigger, but we don't have any units to represent that
+ break;
+ }
+
+ MeasurementUnits biggerUnits = MeasurementUnits.values()[nextOrdinal];
+ if (biggerUnits.getFamily() != currentValueAndUnits.getUnits().getFamily()) {
+ // we're as big as we can get, break out of the loop so we can return
+ break;
+ }
+
+ Double smallerValue = scale(currentValueAndUnits, biggerUnits);
+
+ nextValueAndUnits = new MeasurementNumericValueAndUnits(smallerValue, biggerUnits);
+ } while (nextValueAndUnits.getValue() > 1.0);
+
+ // next, make the value bigger if it's too small
+ int minOrdinal = (lowUnits != null) ? (lowUnits.ordinal() - 1) : -1;
+
+ while (currentValueAndUnits.getValue() < 1.0) {
+ int nextOrdinal = currentValueAndUnits.getUnits().ordinal() - 1;
+ if (nextOrdinal == minOrdinal) {
+ // we could theoretically get smaller, but we don't have any units to represent that
+ break;
+ }
+
+ MeasurementUnits smallerUnits = MeasurementUnits.values()[nextOrdinal];
+ if (smallerUnits.getFamily() != currentValueAndUnits.getUnits().getFamily()) {
+ // we're as small as we can get, break out of the loop so we can return
+ break;
+ }
+
+ Double biggerValue = scale(currentValueAndUnits, smallerUnits);
+
+ nextValueAndUnits = new MeasurementNumericValueAndUnits(biggerValue, smallerUnits);
+
+ currentValueAndUnits = nextValueAndUnits;
+ }
+
+ if (wasNegative) {
+ return new MeasurementNumericValueAndUnits(-currentValueAndUnits.getValue(),
+ currentValueAndUnits.getUnits());
+ }
+
+ return currentValueAndUnits;
+ }
+
+ public static Double scale(MeasurementNumericValueAndUnits origin, MeasurementUnits targetUnits)
+ throws MeasurementConversionException {
+ MeasurementUnits originUnits = origin.getUnits();
+ Double originValue = origin.getValue();
+
+ return originValue * MeasurementUnits.calculateOffset(originUnits, targetUnits);
+ }
+
+ public static String getMeasurementUnitAbbreviation(MeasurementUnits units) {
+ switch (units) {
+ case NONE:
+ return "";
+ case PERCENTAGE:
+ return "%";
+ case BYTES:
+ return "B";
+ case KILOBYTES:
+ return "KB";
+ case MEGABYTES:
+ return "MB";
+ case GIGABYTES:
+ return "GB";
+ case TERABYTES:
+ return "TB";
+ case PETABYTES:
+ return "PB";
+ case BITS:
+ return "b";
+ case KILOBITS:
+ return "kb";
+ case MEGABITS:
+ return "Mb";
+ case GIGABITS:
+ return "Gb";
+ case TERABITS:
+ return "Tb";
+ case PETABITS:
+ return "Pb";
+ case EPOCH_MILLISECONDS:
+ return ""; // absolute time - no display
+ case EPOCH_SECONDS:
+ return ""; // absolute time - no display
+ case JIFFYS:
+ return "j";
+ case NANOSECONDS:
+ return "ns";
+ case MICROSECONDS:
+ return "us";
+ case MILLISECONDS:
+ return "ms";
+ case SECONDS:
+ return "s";
+ case MINUTES:
+ return "m";
+ case HOURS:
+ return "h";
+ case DAYS:
+ return "d";
+ case CELSIUS:
+ return "C";
+ case KELVIN:
+ return "K";
+ case FAHRENHEIGHT:
+ return "F";
+ default:
+ return units.toString();
+ }
+ }
+
+ public static String getFormat(int minDigits, int maxDigits) {
+ StringBuilder buf = new StringBuilder("0.");
+ for (int i = 0; i < minDigits; i++) {
+ buf.append("0");
+ }
+ for (int i = 0; i < (maxDigits - minDigits); i++) {
+ buf.append("#");
+ }
+ return buf.toString();
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
index 8c1d2c6..01c9054 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
@@ -114,9 +114,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
conditionValue = conditionLog.getValue();
if (condition.getMeasurementDefinition() != null) {
try {
-// conditionValue = MeasurementConverterClient.format(Double.valueOf(conditionLog.getValue()),
-// condition.getMeasurementDefinition().getUnits(), true);
- conditionValue = format(conditionLog.getValue(),
+ conditionValue = MeasurementConverter.format(conditionLog.getValue(),
condition.getMeasurementDefinition().getUnits());
} catch (Exception e) {
// the condition log value was probably not a number (most likely a trait). Ignore this exception.
@@ -135,7 +133,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
StringBuilder builder = new StringBuilder();
AlertConditionCategory category = condition.getCategory();
AlertConditionOperator operator;
- double threshold;
+ String formattedThreshold;
switch (category) {
case AVAILABILITY:
@@ -178,14 +176,13 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
builder.append(" For ");
String value = String.valueOf(Integer.valueOf(condition.getOption()) / 60);
- String formatted = format(value, MeasurementUnits.MINUTES);
+ String formatted = MeasurementConverter.format(value, MeasurementUnits.MINUTES);
builder.append(formatted).append("]");
break;
case THRESHOLD:
- threshold = condition.getThreshold();
MeasurementUnits units = condition.getMeasurementDefinition().getUnits();
- //String formatted = format(threshold, units, true);
+ formattedThreshold = MeasurementConverter.format(condition.getThreshold(), units, true);
if (condition.getOption() == null) {
builder.append("Metric Value Threshold [")
@@ -193,7 +190,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
.append(" ")
.append(condition.getComparator())
.append(" ")
- .append(threshold)
+ .append(formattedThreshold)
.append("]");
} else {
// this is a calltime threshold condition
@@ -205,7 +202,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
.append(" ")
.append(condition.getComparator()) // <, >, =
.append(" ")
- .append(threshold)
+ .append(formattedThreshold)
.append("]");
if (condition.getName() != null && condition.getName().length() > 0) {
builder.append(" with call destination matching '")
@@ -215,13 +212,14 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
}
break;
case BASELINE:
- threshold = condition.getThreshold();
+ formattedThreshold = MeasurementConverter.format(condition.getThreshold(),
+ MeasurementUnits.PERCENTAGE, true);
builder.append("Metric Value Baseline [")
.append(condition.getName())
.append(" ")
.append(condition.getComparator())
.append(" ")
- .append(threshold)
+ .append(formattedThreshold)
.append(" of ")
.append(condition.getOption())
.append("]");
@@ -234,7 +232,8 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
.append("]");
} else {
// this is a calltime change condition
- threshold = condition.getThreshold();
+ formattedThreshold = MeasurementConverter.format(condition.getThreshold(),
+ MeasurementUnits.PERCENTAGE, true);
builder.append("Call Time Value Changes [");
if (condition.getMeasurementDefinition() != null) {
builder.append(condition.getMeasurementDefinition().getDisplayName()).append(" ");
@@ -243,7 +242,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
.append(" ")
.append(getCalltimeChangeComparator(condition.getComparator()))
.append(" by at least ")
- .append(threshold)
+ .append(formattedThreshold)
.append("]");
if (condition.getName() != null && condition.getName().length() > 0) {
builder.append(" with call destination matching '")
@@ -310,11 +309,11 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
String metricName = condition.getName();
MeasurementUnits metricUnits = condition.getMeasurementDefinition().getUnits();
double loValue = condition.getThreshold();
- //String formattedLoValue = MeasurementConverterClient.format(loValue, units, true);
+ String formattedLoValue = MeasurementConverter.format(loValue, metricUnits, true);
String formattedHiValue = condition.getOption();
try {
double hiValue = Double.parseDouble(formattedHiValue);
- //formattedHiValue = MeasurementConverterClient.format(hiValue, units, true);
+ formattedHiValue = MeasurementConverter.format(hiValue, metricUnits, true);
} catch (Exception e) {
formattedHiValue = "?[" + formattedHiValue + "]?"; // signify something is wrong with the value
}
@@ -327,7 +326,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
builder.append("Metric Value Range: [")
.append(metricName)
.append("] between ")
- .append(loValue)
+ .append(formattedLoValue)
.append("] and [")
.append(formattedHiValue)
.append("], exclusive");
@@ -336,7 +335,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
builder.append("Metric Value Range: [")
.append(metricName)
.append("] outside [")
- .append(loValue)
+ .append(formattedLoValue)
.append("] and [")
.append(formattedHiValue)
.append("], exclusive");
@@ -345,7 +344,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
builder.append("Metric Value Range: [")
.append(metricName)
.append("] between [")
- .append(loValue)
+ .append(formattedLoValue)
.append("] and [")
.append(formattedHiValue)
.append("], inclusive");
@@ -354,7 +353,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
builder.append("Metric Value Range: [")
.append(metricName)
.append("] outside [")
- .append(loValue)
+ .append(formattedLoValue)
.append("] and [")
.append(formattedHiValue)
.append("], inclusive");
@@ -370,75 +369,6 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
return builder.toString();
}
- private String format(String value, MeasurementUnits targetUnits) {
- if (targetUnits == null) {
- return value;
- } else {
- return value + getMeasurementUnitAbbreviation(targetUnits);
- }
- }
-
- private String getMeasurementUnitAbbreviation(MeasurementUnits units) {
- switch (units) {
- case NONE:
- return "";
- case PERCENTAGE:
- return "%";
- case BYTES:
- return "B";
- case KILOBYTES:
- return "KB";
- case MEGABYTES:
- return "MB";
- case GIGABYTES:
- return "GB";
- case TERABYTES:
- return "TB";
- case PETABYTES:
- return "PB";
- case BITS:
- return "b";
- case KILOBITS:
- return "kb";
- case MEGABITS:
- return "Mb";
- case GIGABITS:
- return "Gb";
- case TERABITS:
- return "Tb";
- case PETABITS:
- return "Pb";
- case EPOCH_MILLISECONDS:
- return ""; // absolute time - no display
- case EPOCH_SECONDS:
- return ""; // absolute time - no display
- case JIFFYS:
- return "j";
- case NANOSECONDS:
- return "ns";
- case MICROSECONDS:
- return "us";
- case MILLISECONDS:
- return "ms";
- case SECONDS:
- return "s";
- case MINUTES:
- return "m";
- case HOURS:
- return "h";
- case DAYS:
- return "d";
- case CELSIUS:
- return "C";
- case KELVIN:
- return "K";
- case FAHRENHEIGHT:
- return "F";
- default:
- return units.toString();
- }
- }
-
private String getCalltimeChangeComparator(String comparator) {
if ("HI".equals(comparator)) {
return "Grows";
12 years, 2 months
[rhq] modules/plugins
by ips
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java | 83 +++++++---
1 file changed, 59 insertions(+), 24 deletions(-)
New commits:
commit 969ed45338179bfc4251ba4387ddf6916214206e
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Mar 27 19:51:54 2012 -0400
update logic for determining product type - first try to use JBOSS_HOME/bin/product.conf, and if that fails, fall back to looking for substrings in the JBOSS_HOME directory name
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
index 6002dac..93ce54e 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
@@ -19,7 +19,9 @@
package org.rhq.modules.plugins.jbossas7;
import java.io.File;
-import java.util.Arrays;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
/**
* A product based on JBoss 7.x.
@@ -28,19 +30,17 @@ import java.util.Arrays;
*/
public enum JBossProductType {
- AS("AS7", "JBoss AS 7", "JBoss Application Server 7"),
- EAP("EAP6", "JBoss EAP 6", "JBoss Enterprise Application Platform 6"),
- EDG("EDG6", "JBoss EDG 6", "JBoss Enterprise Data Grid 6"),
- EPP("EPP6", "JBoss EAP 6", "JBoss Enterprise Portal Platform 6"),
-// EWP("EWP6", "JBoss EWP 6", "JBoss Enterprise Web Platform 6"),
- SOA("SOA-P6", "JBoss SOA-P 6", "JBoss Enterprise SOA Platform (ESB)");
+ AS("AS", "JBoss AS 7", "JBoss Application Server 7"),
+ EAP("EAP", "JBoss EAP 6", "JBoss Enterprise Application Platform 6"),
+ EDG("EDG", "JBoss EDG 6", "JBoss Enterprise Data Grid 6"),
+ EPP("EPP", "JBoss EAP 6", "JBoss Enterprise Portal Platform 6"),
+// EWP("EWP", "JBoss EWP 6", "JBoss Enterprise Web Platform 6"),
+ SOA("SOA-P", "JBoss SOA-P 6", "JBoss Enterprise SOA Platform (ESB)");
public final String SHORT_NAME;
public final String NAME;
public final String FULL_NAME;
- private static final String EAP_IMPLEMENTATION_TITLE = "JBoss Enterprise Application Platform";
-
JBossProductType(String shortName, String name, String fullName) {
this.SHORT_NAME = shortName;
this.NAME = name;
@@ -55,27 +55,42 @@ public enum JBossProductType {
* @return the product type
*/
public static JBossProductType determineJBossProductType(File homeDir) {
- JBossProductType productType;
- File productDir = new File(homeDir, "modules/org/jboss/as/product");
- if (productDir.exists()) {
+ try {
+ return determineJBossProductTypeViaProductConfFile(homeDir);
+ } catch (Exception e) {
+ // TODO: Log an error.
+ return determineJBossProductTypeViaHomeDirName(homeDir);
+ }
+ }
+
+ private static JBossProductType determineJBossProductTypeViaProductConfFile(File homeDir) throws Exception {
+ JBossProductType productType;
+ File productConfFile = new File(homeDir, "bin/product.conf");
+ if (productConfFile.exists()) {
// It's some product (i.e. not community AS).
- File[] files = productDir.listFiles();
- if (files.length == 0) {
- throw new RuntimeException("Unable to determine product type - [" + productDir
- + "] exists but is empty.");
+ Properties productConfProps = new Properties();
+ FileInputStream inputStream = new FileInputStream(productConfFile);
+ try {
+ productConfProps.load(inputStream);
+ } catch (IOException e) {
+ throw new Exception("Failed to parse " + productConfFile + ".", e);
+ } finally {
+ inputStream.close();
}
- if (files.length > 1) {
- throw new RuntimeException("Unable to determine product type - [" + productDir
- + "] contains multiple product subdirectories: " + Arrays.toString(files));
+ String slot = productConfProps.getProperty("slot", "").trim();
+ if (slot.isEmpty()) {
+ throw new Exception("'slot' property not found in " + productConfFile + ".");
}
- File productTypeDir = files[0];
- String productName = productTypeDir.getName();
- if (productName.equals("eap")) {
+ if (slot.equals("eap")) {
productType = JBossProductType.EAP;
- } else if (productName.equals("edg")) {
+ } else if (slot.equals("edg")) {
productType = JBossProductType.EDG;
+ } else if (slot.equals("epp")) {
+ productType = JBossProductType.EPP;
+ } else if (slot.equals("soa-p")) {
+ productType = JBossProductType.SOA;
} else {
- throw new RuntimeException("Unknown product type: " + productName);
+ throw new RuntimeException("Unknown product type: " + slot);
}
} else {
productType = JBossProductType.AS;
@@ -84,6 +99,26 @@ public enum JBossProductType {
return productType;
}
+ private static JBossProductType determineJBossProductTypeViaHomeDirName(File homeDir) {
+ JBossProductType productType;
+ String homeDirName = homeDir.getName();
+ if (homeDirName.contains("-as-")) {
+ productType = JBossProductType.AS;
+ } else if (homeDirName.contains("-eap-")) {
+ productType = JBossProductType.EAP;
+ } else if (homeDirName.contains("-edg-")) {
+ productType = JBossProductType.EDG;
+ } else if (homeDirName.contains("-epp-")) {
+ productType = JBossProductType.EPP;
+ } else if (homeDirName.contains("soa-p-")) {
+ productType = JBossProductType.SOA;
+ } else {
+ throw new RuntimeException("Failed to determine product type for JBoss product installed at [" + homeDir + "].");
+ }
+
+ return productType;
+ }
+
@Override
public String toString() {
return this.NAME;
12 years, 2 months
[rhq] Branch 'feature/export-reports' - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java | 49 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java | 21 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/SubsystemResourceDriftView.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java | 56 +++++++---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java | 4
5 files changed, 105 insertions(+), 27 deletions(-)
New commits:
commit 967a46e529f727471fdeda91ea006d1ffc32bf95
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Mar 27 15:47:24 2012 -0700
[BZ 800453] Export Csv Reports. Add filtering to Recent Drift.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
index f176120..91f44e3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ExportModalWindow.java
@@ -63,7 +63,7 @@ public class ExportModalWindow {
private String reportUrl;
- PopupWindow exportWindow;
+ private PopupWindow exportWindow;
private boolean showDetail;
@@ -79,6 +79,12 @@ public class ExportModalWindow {
String[] operationRequestStatuses;
Set<Integer> resourceTypeIdsForExport;
+
+ // for Recent Drift Report
+ String driftDefinition;
+ String driftSnapshot;
+ String[] driftCategories;
+ String driftPath;
private ExportModalWindow(String reportUrl) {
@@ -97,8 +103,13 @@ public class ExportModalWindow {
return newExportDialog;
}
- public static ExportModalWindow createExportWindowForRecentDrift(String reportUrl) {
+ public static ExportModalWindow createExportWindowForRecentDrift(String reportUrl, String definition,
+ String snapshot, String[] driftCategories, String path) {
ExportModalWindow newExportDialog = new ExportModalWindow(reportUrl);
+ newExportDialog.setDriftCategories(driftCategories);
+ newExportDialog.setDriftDefinition(definition);
+ newExportDialog.setDriftPath(path);
+ newExportDialog.setDriftSnapshot(snapshot);
return newExportDialog;
}
@@ -221,6 +232,24 @@ public class ExportModalWindow {
queryString.append("alertPriority=").append(alertsPriorityBuffer.toString());
}
+ // Drift Related
+ if(driftCategories != null){
+ StringBuilder driftCategoriesBuffer = new StringBuilder();
+ for (String category : driftCategories) {
+ driftCategoriesBuffer.append(category).append(",");
+ }
+ queryString.append("categories=").append(driftCategoriesBuffer.toString());
+ }
+ if (driftDefinition != null) {
+ queryString.append("definition=").append(driftDefinition);
+ }
+ if (driftPath != null) {
+ queryString.append("path=").append(driftDefinition);
+ }
+ if (driftSnapshot != null) {
+ queryString.append("snapshot=").append(driftSnapshot);
+ }
+
return URL.encode(BASE_URL + reportUrl + "." + format + "?"+queryString);
}
@@ -233,6 +262,22 @@ public class ExportModalWindow {
this.showDetail = showDetail;
}
+ public void setDriftDefinition(String driftDefinition) {
+ this.driftDefinition = driftDefinition;
+ }
+
+ public void setDriftSnapshot(String driftSnapshot) {
+ this.driftSnapshot = driftSnapshot;
+ }
+
+ public void setDriftCategories(String[] driftCategories) {
+ this.driftCategories = driftCategories;
+ }
+
+ public void setDriftPath(String driftPath) {
+ this.driftPath = driftPath;
+ }
+
public void show() {
exportWindow.show();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
index e1c54e0..2bf5a5e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
@@ -19,9 +19,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.drift;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.SortDirection;
@@ -31,7 +28,6 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.drift.DriftCategory;
import org.rhq.enterprise.gui.coregui.client.IconEnum;
@@ -44,6 +40,9 @@ import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
/**
* A view that displays a paginated table of {@link org.rhq.core.domain.drift.JPADrift}s, along with the
* ability to filter those drifts, sort those drifts, double-click a row to view full details a drift, and perform
@@ -63,6 +62,12 @@ public class DriftHistoryView extends StringIDTableSection<DriftDataSource> {
public static final Criteria INITIAL_CRITERIA = new Criteria();
+ protected SelectItem categoryFilter;
+ protected TextItem definitionFilter;
+ protected TextItem changeSetFilter;
+ protected TextItem pathFilter;
+
+
private EntityContext context;
private boolean hasWriteAccess;
@@ -126,12 +131,12 @@ public class DriftHistoryView extends StringIDTableSection<DriftDataSource> {
.getDriftCategoryIcon(DriftCategory.FILE_CHANGED));
categoryIcons.put(DriftCategory.FILE_REMOVED.name(), ImageManager
.getDriftCategoryIcon(DriftCategory.FILE_REMOVED));
- SelectItem categoryFilter = new EnumSelectItem(DriftDataSource.FILTER_CATEGORIES, MSG.common_title_category(),
+ categoryFilter = new EnumSelectItem(DriftDataSource.FILTER_CATEGORIES, MSG.common_title_category(),
DriftCategory.class, categories, categoryIcons);
- TextItem definitionFilter = new TextItem(DriftDataSource.FILTER_DEFINITION, MSG.common_title_definition());
- TextItem changeSetFilter = new TextItem(DriftDataSource.FILTER_SNAPSHOT, MSG.view_drift_table_snapshot());
- TextItem pathFilter = new TextItem(DriftDataSource.FILTER_PATH, MSG.common_title_path());
+ definitionFilter = new TextItem(DriftDataSource.FILTER_DEFINITION, MSG.common_title_definition());
+ changeSetFilter = new TextItem(DriftDataSource.FILTER_SNAPSHOT, MSG.view_drift_table_snapshot());
+ pathFilter = new TextItem(DriftDataSource.FILTER_PATH, MSG.common_title_path());
if (isShowFilterForm()) {
setFilterFormItems(definitionFilter, changeSetFilter, categoryFilter, pathFilter);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/SubsystemResourceDriftView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/SubsystemResourceDriftView.java
index d76a7ff..73bed2b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/SubsystemResourceDriftView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/SubsystemResourceDriftView.java
@@ -47,7 +47,7 @@ public class SubsystemResourceDriftView extends DriftHistoryView {
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ExportModalWindow exportModalWindow = ExportModalWindow.createExportWindowForRecentDrift("recentDrift");
+ ExportModalWindow exportModalWindow = ExportModalWindow.createExportWindowForRecentDrift("recentDrift",definitionFilter.getValueAsString(),changeSetFilter.getValueAsString(),categoryFilter.getValues(),pathFilter.getValueAsString());
exportModalWindow.show();
refreshTableInfo();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java
index 5e3d71d..abc1db4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftHandler.java
@@ -1,21 +1,10 @@
package org.rhq.enterprise.server.rest.reporting;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.interceptor.Interceptors;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.StreamingOutput;
-import javax.ws.rs.core.UriInfo;
-
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.criteria.DriftCriteria;
import org.rhq.core.domain.criteria.GenericDriftCriteria;
+import org.rhq.core.domain.drift.DriftCategory;
import org.rhq.core.domain.drift.DriftComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -25,6 +14,19 @@ import org.rhq.enterprise.server.rest.SetCallerInterceptor;
import org.rhq.enterprise.server.util.CriteriaQuery;
import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
import static org.rhq.enterprise.server.rest.reporting.ReportHelper.cleanForCSV;
import static org.rhq.enterprise.server.rest.reporting.ReportHelper.formatDateTime;
@@ -32,6 +34,7 @@ import static org.rhq.enterprise.server.rest.reporting.ReportHelper.formatDateTi
@Stateless
public class RecentDriftHandler extends AbstractRestBean implements RecentDriftLocal {
+ private final Log log = LogFactory.getLog(RecentDriftHandler.class);
@EJB
private DriftManagerLocal driftManager;
@@ -40,7 +43,7 @@ public class RecentDriftHandler extends AbstractRestBean implements RecentDriftL
private SubjectManagerLocal subjectMgr;
@Override
- public StreamingOutput recentDrift(@QueryParam("categoryId") final Integer categoryId, @QueryParam("snapshot") final Integer snapshot, @QueryParam("path") final String path, @QueryParam("definition") final String definition, @Context UriInfo uriInfo, @Context Request request, @Context HttpHeaders headers) {
+ public StreamingOutput recentDrift(final String categories, final Integer snapshot, final String path, final String definition, final Long startTime, final Long endTime, final UriInfo uriInfo, Request request, final HttpHeaders headers) {
return new StreamingOutput() {
@Override
@@ -48,6 +51,29 @@ public class RecentDriftHandler extends AbstractRestBean implements RecentDriftL
GenericDriftCriteria criteria = new GenericDriftCriteria();
criteria.addFilterChangeSetStartVersion(1);// always start at 1 for this report
+ if(snapshot != null){
+ log.info("Drift Snapshot version Filter set for: " + snapshot);
+ criteria.addFilterChangeSetEndVersion(snapshot);
+ }
+ if(definition != null){
+ //@todo: drift definition search
+ }
+
+ List<DriftCategory> driftCategoryList = new ArrayList<DriftCategory>(10);
+ String categoryArray[] = categories.split(",");
+ for (String category : categoryArray) {
+ log.info("DriftCategories Filter set for: " + category);
+ driftCategoryList.add(DriftCategory.valueOf(category.toUpperCase()));
+ }
+ criteria.addFilterCategories(driftCategoryList.toArray(new DriftCategory[driftCategoryList.size()]));
+
+ if(startTime != null){
+ criteria.addFilterStartTime(startTime);
+ }
+ if(endTime != null){
+ criteria.addFilterEndTime(endTime);
+ }
+
CriteriaQueryExecutor<DriftComposite, DriftCriteria> queryExecutor =
new CriteriaQueryExecutor<DriftComposite, DriftCriteria>() {
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java
index efe5a89..7f5cad8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentDriftLocal.java
@@ -15,10 +15,12 @@ public interface RecentDriftLocal {
@Path("/")
@Produces({"text/csv", "application/xml"})
StreamingOutput recentDrift(
- @QueryParam("categoryId") Integer categoryId,
+ @QueryParam("categories") String categories,
@QueryParam("snapshot") Integer snapshot,
@QueryParam("path") String path,
@QueryParam("definition") String definition,
+ @QueryParam("startTime") Long startTime,
+ @QueryParam("endTime") Long endTime,
@Context UriInfo uriInfo,
@Context Request request,
@Context HttpHeaders headers);
12 years, 2 months
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 7a617211a41605718d4104d4a45b516a92103363
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Mar 27 17:25:20 2012 -0400
[BZ 802544] Set the condition text for when there are multiple conditions
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
index 917645c..8c1d2c6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
@@ -106,7 +106,7 @@ public class RecentAlertHandler extends AbstractRestBean implements RecentAlertL
String conditionValue;
if (conditionLogs.size() > 1) {
-
+ conditionText = "Multiple Conditions";
} else if (conditionLogs.size() == 1) {
AlertConditionLog conditionLog = conditionLogs.iterator().next();
AlertCondition condition = conditionLog.getCondition();
12 years, 2 months
[rhq] modules/core modules/plugins
by ips
modules/core/native-system/src/main/java/org/rhq/core/system/NativeSystemInfo.java | 35 +++++-----
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/WindowsPlatformComponent.java | 21 ------
2 files changed, 20 insertions(+), 36 deletions(-)
New commits:
commit 891804dc7546780190e63c20b0a73353e4ea1cd9
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Mar 27 17:09:01 2012 -0400
[BZ 804705] NativeSystemInfo.getOperatingSystemName() now returns "Windows", rather than "Win32" for Windows systems, since "Win32" did not seem like an appropriate value in the case of 64-bit Windows systems (https://bugzilla.redhat.com/show_bug.cgi?id=804705)
diff --git a/modules/core/native-system/src/main/java/org/rhq/core/system/NativeSystemInfo.java b/modules/core/native-system/src/main/java/org/rhq/core/system/NativeSystemInfo.java
index 3c08b51..e7e5f1f 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/NativeSystemInfo.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/NativeSystemInfo.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -51,12 +51,13 @@ import org.rhq.core.system.pquery.ProcessInfoQuery;
* there are additional platform-specific methods that need to be exposed. Most functionality, however, can be exposed
* via this native superclass implementation.
*
- * <p>This implementation uses SIGAR. To enable debug logging in SIGAR, set the system property "sigar.nativeLogging" or
- * call {@link Sigar#enableLogging(boolean)}.</p>
+ * <p>This implementation uses SIGAR. To enable debug logging in SIGAR, set the system property
+ * <code>sigar.nativeLogging</code> or call {@link Sigar#enableLogging(boolean)}.</p>
*
* @author John Mazzitelli
*/
public class NativeSystemInfo implements SystemInfo {
+
private final Log log = LogFactory.getLog(NativeSystemInfo.class);
private SigarProxy sigar;
@@ -104,7 +105,11 @@ public class NativeSystemInfo implements SystemInfo {
}
public String getOperatingSystemName() {
- return OperatingSystem.getInstance().getName();
+ OperatingSystem os = OperatingSystem.getInstance();
+ // SIGAR returns "Win32" as the OS name for all Windows systems, even 64-bit ones. Work around this by instead
+ // returning "Windows" for all Windows systems, which is more consistent with the UNIX operating systems anyway.
+ // (https://jira.hyperic.com/browse/SIGAR-238)
+ return (OperatingSystem.NAME_WIN32.equals(os.getName()) ? "Windows" : os.getName());
}
public String getOperatingSystemVersion() {
@@ -115,10 +120,10 @@ public class NativeSystemInfo implements SystemInfo {
try {
return sigar.getNetInfo().getHostName();
} catch (Exception e) {
- // For some reason, the native layer failed to get the hostname
- // Let's fallback and ask Java for help. But if that fails, too,
- // let's wrap the native layer's exception since we'll want to
- // see its cause since it'll probably have a more descriptive error message
+ // For some reason, the native layer failed to get the hostname.
+ // Let's fallback and ask Java for help. But if that fails too,
+ // let's wrap the native layer's exception, since we'll want to
+ // see its cause, which will probably have a more descriptive error message.
try {
return InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException uhe) {
@@ -128,7 +133,7 @@ public class NativeSystemInfo implements SystemInfo {
}
public List<NetworkAdapterInfo> getAllNetworkAdapters() throws SystemInfoException {
- ArrayList<NetworkAdapterInfo> adapters = new ArrayList<NetworkAdapterInfo>();
+ List<NetworkAdapterInfo> adapters = new ArrayList<NetworkAdapterInfo>();
try {
String[] interfaceNames = sigar.getNetInterfaceList();
@@ -200,13 +205,12 @@ public class NativeSystemInfo implements SystemInfo {
}
public List<ServiceInfo> getAllServices() throws SystemInfoException {
- throw new UnsupportedOperationException("Cannot get services for this plaform");
+ throw new UnsupportedOperationException("Cannot get services for this platform");
}
public List<ProcessInfo> getAllProcesses() {
ArrayList<ProcessInfo> processes = new ArrayList<ProcessInfo>();
long[] pids = null;
- final int timeout = 2 * 60 * 1000; // 2 minutes
log.debug("Retrieving PIDs of all running processes...");
long startTime = System.currentTimeMillis();
@@ -238,10 +242,7 @@ public class NativeSystemInfo implements SystemInfo {
}
public ProcessInfo getThisProcess() {
- long self;
-
- self = sigar.getPid();
-
+ long self = sigar.getPid();
ProcessInfo info = new ProcessInfo(self);
return info;
}
@@ -269,7 +270,6 @@ public class NativeSystemInfo implements SystemInfo {
}
public Swap getSwapInfo() {
-
try {
// Removed this check since http://jira.hyperic.com/browse/SIGAR-112 is fixed.
/*
@@ -341,7 +341,7 @@ public class NativeSystemInfo implements SystemInfo {
}
public String getSystemArchitecture() {
- OperatingSystem op = OperatingSystem.getInstance();
+ OperatingSystem op = OperatingSystem.getInstance();
return op.getArch();
}
@@ -352,4 +352,5 @@ public class NativeSystemInfo implements SystemInfo {
public NativeSystemInfo() {
this.sigar = SigarAccess.getSigar();
}
+
}
\ No newline at end of file
diff --git a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/WindowsPlatformComponent.java b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/WindowsPlatformComponent.java
index aa8d2e8..f1229c3 100644
--- a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/WindowsPlatformComponent.java
+++ b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/WindowsPlatformComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -37,8 +37,6 @@ import org.rhq.core.domain.content.transfer.DeployPackageStep;
import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.content.ContentFacet;
import org.rhq.core.pluginapi.content.ContentServices;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -50,8 +48,6 @@ import org.rhq.plugins.platform.win.WindowsSoftwareDelegate;
*/
public class WindowsPlatformComponent extends PlatformComponent implements ContentFacet {
- private static final String OS_NAME_WIN32 = "Win32";
- private static final String OS_NAME_WIN64 = "Win64";
private final Log log = LogFactory.getLog(WindowsPlatformComponent.class);
private Win32EventLogDelegate eventLogDelegate;
@@ -70,7 +66,7 @@ public class WindowsPlatformComponent extends PlatformComponent implements Conte
if (eventLogDelegate != null) {
try {
eventLogDelegate.close();
- } catch (Throwable t2) {
+ } catch (Throwable ignore) {
} finally {
eventLogDelegate = null;
}
@@ -119,17 +115,4 @@ public class WindowsPlatformComponent extends PlatformComponent implements Conte
return null;
}
- @Override
- protected MeasurementDataTrait getMeasurementDataTrait(MeasurementScheduleRequest request) {
- MeasurementDataTrait trait = super.getMeasurementDataTrait(request);
- // SIGAR returns "Win32" as the OS name for all Windows systems, even 64-bit ones, so add some special code
- // to instead return "Win64" for 64-bit systems.
- if (trait.getName().equals(TRAIT_OSNAME) && trait.getValue().equals(OS_NAME_WIN32)) {
- if ("x64".equals(getSysinfo().getSystemArchitecture())) {
- trait.setValue(OS_NAME_WIN64);
- }
- }
- return trait;
- }
-
}
12 years, 2 months
[rhq] modules/core
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit d4e2534409a75f4a715eec487a3a4eef90b42b94
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 27 16:53:53 2012 -0400
[BZ 801432][BZ 807465] this is just test code to see if we can catch the concurrent mod exception. we must remove this code before release
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 1310141..bfbf346 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
@@ -1220,6 +1220,12 @@ public class InventoryManager extends AgentService implements ContainerService,
// recursively, but we need to do this now to ensure everything is stopped prior to removing them from inventory
deactivateResource(resource);
+ // TODO REMOVE THIS IF STATEMENT - IT IS JUST FOR TESTING
+ if (!resource.getChildResources().getClass().getName().contains("Collections$SetFromMap")) {
+ new Exception("BAD CHILD SET:" + resource.getChildResources().getClass().getName() + ":"
+ + resource.getId() + ":" + resource.getName()).printStackTrace();
+ }
+
for (Resource child : resource.getChildResources()) {
scanIsNeeded |= removeResourceAndIndicateIfScanIsNeeded(child);
}
12 years, 2 months
[rhq] Branch 'feature/export-reports' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java | 15 ++++++++--
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit fc9869c6c225f417e79e10d67c3c8bab5b0cf8b8
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Mar 27 16:40:55 2012 -0400
[BZ 802544] fixing import errors from merge conflict
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
index 3e851f0..917645c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/reporting/RecentAlertHandler.java
@@ -2,21 +2,30 @@ package org.rhq.enterprise.server.rest.reporting;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertCondition;
+import org.rhq.core.domain.alert.AlertConditionCategory;
+import org.rhq.core.domain.alert.AlertConditionLog;
+import org.rhq.core.domain.alert.AlertConditionOperator;
+import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
12 years, 2 months