[rhq] modules/enterprise modules/integration-tests
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java | 61 ++++++++--
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java | 46 ++++++-
2 files changed, 92 insertions(+), 15 deletions(-)
New commits:
commit 399d0589927cedc689a6475a6f9ecd6092c7064c
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Sep 3 12:28:24 2013 +0200
BZ 973101 - Check passed MeasurementDefinitionId for validity
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
index 56ae66b..f608251 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
@@ -77,7 +77,9 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.resource.Resource;
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.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -222,6 +224,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@ApiErrors({
@ApiError(code = 406, reason = "There was not exactly one of 'resourceId','groupId' or 'resourceTypeId' given"),
@ApiError(code = 406, reason = "The passed condition failed validation"),
+ @ApiError(code = 406, reason = "The passed group was a mixed group, that can not have alert definitions"),
@ApiError(code = 404, reason = "A non existing alert notification sender was requested."),
@ApiError(code = 404, reason = "A referenced alert to recover does not exist")
})
@@ -250,18 +253,29 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
alertDefinition.setConditionExpression(BooleanExpression.valueOf(adr.getConditionMode().toUpperCase()));
alertDefinition.setRecoveryId(adr.getRecoveryId());
+ Resource resource = null;
+ if (resourceId!= null) {
+ resource = fetchResource(resourceId);
+ }
+
+ ResourceType resourceType=null;
if (groupId!=null) {
ResourceGroup group = resourceGroupMgr.getResourceGroup(caller,groupId);
alertDefinition.setGroup(group);
+ if (group.getGroupCategory()== GroupCategory.MIXED) {
+ throw new BadArgumentException("Group with id " + +groupId + " is a mixed group");
+ }
+ resourceType = group.getResourceType(); // TODO this may be null -> check 1st resource
}
+
if (resourceTypeId!=null) {
- ResourceType type = resourceTypeMgr.getResourceTypeById(caller,resourceTypeId);
- alertDefinition.setResourceType(type);
+ resourceType = resourceTypeMgr.getResourceTypeById(caller,resourceTypeId);
+ alertDefinition.setResourceType(resourceType);
}
Set<AlertCondition> conditions = new HashSet<AlertCondition>(adr.getConditions().size());
for (AlertConditionRest acr : adr.getConditions()) {
- AlertCondition condition = conditionRestToCondition(acr);
+ AlertCondition condition = conditionRestToCondition(acr, resource, resourceType);
conditions.add(condition);
}
alertDefinition.setConditions(conditions);
@@ -514,7 +528,9 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
if (definition==null)
throw new StuffNotFoundException("AlertDefinition with id " + definitionId);
- AlertCondition condition = conditionRestToCondition(conditionRest);
+ Resource resource = definition.getResource();
+ ResourceType resourceType = definition.getResourceType();
+ AlertCondition condition = conditionRestToCondition(conditionRest, resource, resourceType);
definition.addCondition(condition);
@@ -573,8 +589,9 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
}
}
-
- AlertCondition restCondition = conditionRestToCondition(conditionRest);
+ Resource resource = definition.getResource();
+ ResourceType resourceType = definition.getResourceType();
+ AlertCondition restCondition = conditionRestToCondition(conditionRest, resource, resourceType);
condition.setOption(conditionRest.getOption());
condition.setComparator(conditionRest.getComparator());
@@ -612,11 +629,16 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
/**
* Convert a passed condition from the REST side into the internal domain
* representation. The largest part of this method is validation of the input
+ *
+ *
* @param conditionRest Object to convert
+ * @param resource Optional {@link org.rhq.core.domain.resource.Resource} to check against if not null
+ * @param resourceType Optional {@link ResourceType} to validate against if not null
* @return Converted domain object
* @throws BadArgumentException If validation fails
*/
- private AlertCondition conditionRestToCondition(AlertConditionRest conditionRest) {
+ private AlertCondition conditionRestToCondition(AlertConditionRest conditionRest, Resource resource,
+ ResourceType resourceType) {
AlertCondition condition = new AlertCondition();
try {
@@ -629,6 +651,31 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
int measurementDefinition = conditionRest.getMeasurementDefinition();
MeasurementDefinition md;
+ if (measurementDefinition!=0) {
+ md = entityManager.find(MeasurementDefinition.class, measurementDefinition);
+ if (md==null) {
+ throw new StuffNotFoundException("measurementDefinition with id " + measurementDefinition);
+ }
+
+ // Validate that the definition belongs to the resource, if passed
+ if (resource!=null) {
+ ResourceType type = resource.getResourceType();
+ Set<MeasurementDefinition> definitions = type.getMetricDefinitions();
+ if (!definitions.contains(md)) {
+ throw new BadArgumentException("MeasurementDefinition does not apply to resource");
+ }
+ }
+
+ // Validate that the definition belongs to the passed resource type
+ if (resourceType!=null) {
+ Set<MeasurementDefinition> definitions = resourceType.getMetricDefinitions();
+ if (!definitions.contains(md)) {
+ throw new BadArgumentException("MeasurementDefinition does not apply to resource type");
+ }
+ }
+ }
+
+
String optionValue = conditionRest.getOption();
String conditionName = conditionRest.getName();
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
index b659145..cc48a09 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
@@ -24,6 +24,7 @@ import java.util.List;
import com.jayway.restassured.config.RedirectConfig;
import com.jayway.restassured.config.RestAssuredConfig;
import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.path.xml.XmlPath;
import com.jayway.restassured.response.Response;
@@ -666,7 +667,7 @@ public class AlertTest extends AbstractBase {
int definitionId = createEmptyAlertDefinition(false);
- int metricDefinitionId = findAMetricDefinition(_platformTypeId, "metric");
+ int metricDefinitionId = findAMetricDefinitionForResourceId(_platformId, "metric");
// Now add a condition
try {
@@ -706,7 +707,7 @@ public class AlertTest extends AbstractBase {
int definitionId = createEmptyAlertDefinition(false);
- int metricDefinitionId = findAMetricDefinition(_platformTypeId, "metric");
+ int metricDefinitionId = findAMetricDefinitionForResourceId(_platformId, "metric");
// Now add a condition
try {
@@ -769,7 +770,7 @@ public class AlertTest extends AbstractBase {
}
}
- private int findAMetricDefinition(int resourceId, String type) {
+ private int findAMetricDefinitionForResourceId(int resourceId, String type) {
Response response =
given()
.pathParam("id",resourceId)
@@ -781,9 +782,10 @@ public class AlertTest extends AbstractBase {
.when()
.get("/resource/{id}/schedules");
- int scheduleId = response.jsonPath().getInt("[0].definitionId");
+ JsonPath jsonPath = response.jsonPath();
+ int definitionId = jsonPath.getInt("[0].definitionId");
- return scheduleId;
+ return definitionId;
}
@Test
@@ -1122,9 +1124,37 @@ public class AlertTest extends AbstractBase {
}
@Test
+ public void testCreateUpdateConditionWithBadMetricDefinition() throws Exception {
+
+ int definitionId = createEmptyAlertDefinition(false);
+
+ try {
+ AlertCondition condition = new AlertCondition("THRESHOLD", "LESS_THAN");
+ condition.setOption("12345");
+ condition.setComparator(">");
+ condition.setMeasurementDefinition(10173);
+
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(condition)
+ .pathParam("defId", definitionId)
+ .expect()
+ .statusCode(406)
+ .log().ifError()
+ .when()
+ .post("/alert/definition/{defId}/conditions");
+ } finally {
+ cleanupDefinition(definitionId);
+ }
+ }
+
+ @Test
public void testCRUDCondition() throws Exception {
int definitionId = createEmptyAlertDefinition(false);
+ int metricDefinitionId = findAMetricDefinitionForResourceId(_platformId, "metric");
+
// Now add a condition
try {
@@ -1132,7 +1162,7 @@ public class AlertTest extends AbstractBase {
AlertCondition condition = new AlertCondition("THRESHOLD", "LESS_THAN");
condition.setOption("12345");
condition.setComparator(">");
- condition.setMeasurementDefinition(10173);
+ condition.setMeasurementDefinition(metricDefinitionId);
Integer cid =
given()
@@ -2236,7 +2266,7 @@ public class AlertTest extends AbstractBase {
alertCondition.setOption(".*JBAS123.*");
addConditionToDefinition(definitionId, alertCondition);
- int metricDef = findAMetricDefinition(_platformId,"metric");
+ int metricDef = findAMetricDefinitionForResourceId(_platformId, "metric");
assert metricDef != 0;
alertCondition = new AlertCondition("THRESHOLD");
alertCondition.setComparator("<");
@@ -2259,7 +2289,7 @@ public class AlertTest extends AbstractBase {
alertCondition.setMeasurementDefinition(metricDef);
addConditionToDefinition(definitionId, alertCondition);
- int traitDef = findAMetricDefinition(_platformId,"trait");
+ int traitDef = findAMetricDefinitionForResourceId(_platformId, "trait");
assert traitDef!=0;
alertCondition = new AlertCondition("TRAIT");
alertCondition.setOption("10.*");
10 years, 8 months
[rhq] Changes to 'jsanda/consistency-level'
by John Sanda
New branch 'jsanda/consistency-level' available with the following commits:
commit f0182c6901e9b3108c27565e85c216c7938d40c2
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Sep 2 21:21:44 2013 -0400
adding support for strongly consistent reads
This commit puts in place a strategy for the consistency level of reads and
writes such that it provides strong consistency on user-facing queries. If
the consistency level requirements cannot be satisfied, due to a down replica
for instance, the consistency level will be downgraded to provide greater
availability at the risk of possible loss of consistency.
We need to do some performance testing with this to see what tweaks need to
be made. It might also be good to make the strong consistency configurable
because some users might be fine with weaker consistency and increased
availability as well as performance on reads and writes.
10 years, 8 months
[rhq] 3 commits - modules/enterprise modules/plugins
by Heiko W. Rupp
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 57 +++++-----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java | 37 +++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java | 11 +
modules/plugins/pom.xml | 1
5 files changed, 72 insertions(+), 36 deletions(-)
New commits:
commit 5ecac795126938e113e9cd3ad4ca67a803d456ca
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Sep 2 17:49:11 2013 +0200
BZ 1001499 Provide a link to resource/group/type of the definition
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
index 7f0eea3..3d3fdf6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
@@ -292,10 +292,7 @@ public class AbstractRestBean {
Link link = new Link("operationDefinitions", uri.toString());
rwt.addLink(link);
- uriBuilder = uriInfo.getBaseUriBuilder();
- uriBuilder.path("/resource/{id}");
- uri = uriBuilder.build(res.getId());
- link = new Link("self", uri.toString());
+ link = getLinkToResource(res, uriInfo, "self");
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/schedules");
@@ -329,6 +326,37 @@ public class AbstractRestBean {
return rwt;
}
+ protected Link getLinkToResource(Resource res, UriInfo uriInfo, String rel) {
+ UriBuilder uriBuilder;URI uri;
+ Link link;
+ uriBuilder = uriInfo.getBaseUriBuilder();
+ uriBuilder.path("/resource/{id}");
+ uri = uriBuilder.build(res.getId());
+ link = new Link(rel, uri.toString());
+ return link;
+ }
+
+ protected Link getLinkToResourceType(ResourceType type, UriInfo uriInfo, String rel) {
+ UriBuilder uriBuilder;URI uri;
+ Link link;
+ uriBuilder = uriInfo.getBaseUriBuilder();
+ uriBuilder.path("/resource/type/{id}");
+ uri = uriBuilder.build(type.getId());
+ link = new Link(rel, uri.toString());
+ return link;
+ }
+
+ protected Link getLinkToGroup(ResourceGroup group, UriInfo uriInfo, String rel) {
+ UriBuilder uriBuilder;
+ URI uri;
+ Link link;
+ uriBuilder = uriInfo.getBaseUriBuilder();
+ uriBuilder.path("/group/{id}");
+ uri = uriBuilder.build(group.getId());
+ link = new Link(rel, uri.toString());
+ return link;
+ }
+
protected Resource fetchResource(int resourceId) {
Resource res;
res = resMgr.getResource(caller, resourceId);
@@ -479,6 +507,7 @@ public class AbstractRestBean {
URI uri = uriBuilder.build(group.getId());
Link link = new Link("edit",uri.toASCIIString());
gr.getLinks().add(link);
+ gr.getLinks().add(getLinkToGroup(group,uriInfo, "self"));
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/group/{id}/metricDefinitions");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
index 71638ec..56ae66b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
@@ -1100,13 +1100,18 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
adr.setDampeningUnit(dampening.getPeriodUnits().name());
}
+ List<Link> links = adr.getLinks();
if (def.getResource()!=null) {
- adr.getLinks().add(createUILink(uriInfo,UILinkTemplate.RESOURCE_ALERT_DEF,def.getResource().getId(),adr.getId()));
+ links.add(createUILink(uriInfo, UILinkTemplate.RESOURCE_ALERT_DEF, def.getResource().getId(), adr.getId()));
+ links.add(getLinkToResource(def.getResource(), uriInfo, "resource"));
} else if (def.getGroup() != null) {
- adr.getLinks().add(
+ links.add(
createUILink(uriInfo, UILinkTemplate.GROUP_ALERT_DEF, def.getGroup().getId(), adr.getId()));
+ links.add(getLinkToGroup(def.getGroup(), uriInfo, "group"));
} else {
- adr.getLinks().add(createUILink(uriInfo,UILinkTemplate.TEMPLATE_ALERT_DEF,def.getResourceType().getId(),adr.getId()));
+ links.add(
+ createUILink(uriInfo, UILinkTemplate.TEMPLATE_ALERT_DEF, def.getResourceType().getId(), adr.getId()));
+ links.add(getLinkToResourceType(def.getResourceType(),uriInfo,"resourceType"));
}
return adr;
commit 985dabb27d93acb9651528e1b9f5874174c90322
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Sep 2 15:38:39 2013 +0200
Add sonarqube plugin to the build
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index d35fdaa..d4061b2 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -211,6 +211,7 @@
<module>perftest</module>
<module>script2</module>
<module>snmptrapd</module>
+ <module>sonarqube</module>
<module>twitter</module>
<module>virt</module>
<module>kickstart</module>
commit 72a88385af8ea5524b68ccd7342f3a40eb851a7a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Sep 2 15:29:57 2013 +0200
Add a few more translations.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 45db241..e94b453 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -280,7 +280,7 @@ common_title_sort_order_tooltip = Sets sort order for results.
common_title_start = Start
common_title_status = Status
common_title_stop = Stop
-common_title_suggest = Suggest
+common_title_suggest = Suggestion
common_title_summary = Summary
common_title_tag_cloud = Tag Cloud
common_title_the = The
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 4513d89..0ac2a40 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -23,13 +23,13 @@ chart_hover_period_label = Zeitraum
chart_hover_start_label = Start
chart_hover_time_format = %H:%M:%S
chart_ie_not_supported = Charting ist bei diesem Browser nicht unterstützt
-##chart_metrics = Metrics
+chart_metrics = Metriken
##chart_metrics_add_to_dashboard_label = Dashboards
##chart_metrics_collapse_tooltip = Click here to see additional tabular availability data.
##chart_metrics_expand_tooltip = Click here to collapse additional availability detail.
##chart_metrics_sparkline_header = Chart
chart_no_data_label = Keine Daten vorhanden
-##chart_single_value_label = Value
+chart_single_value_label = Wert
chart_slider_button_bar_day = Tag
chart_slider_button_bar_hour = Stunde
chart_slider_button_bar_minute = Minute
@@ -145,7 +145,7 @@ common_severity_error = Fehler
common_severity_fatal = Fatal
common_severity_info = Information
common_severity_warn = Warnung
-##common_status_attention = Erfolg
+common_status_attention = Achtung
common_status_canceled = Abgebrochen
common_status_deferred = Verzögert
common_status_failed = Fehlgeschlagen
@@ -167,7 +167,7 @@ common_title_available_resources = Verfügbare Ressourcen
common_title_average_metrics = Durchsch. Anzahl Metriken pro Minute
common_title_background = Hintergrund
common_title_bundle = Bundle
-##common_title_bundleGroups = Bundle Groups
+common_title_bundleGroups = Bundle-Gruppen
common_title_bundles = Bundles
common_title_category = Kategorie
common_title_change_refresh_time = Aktualisierungsintervall
@@ -201,7 +201,7 @@ common_title_group = Gruppe
common_title_group_def_total = Anzahl Gruppen-Definitionen
common_title_group_member_health = Zustand der Gruppenmitglieder
common_title_groups = Gruppen
-##common_title_groupsFound = Gruppen
+common_title_groupsFound = Gruppen gefunden
common_title_help = Hilfe
common_title_host = Rechner
common_title_id = ID
@@ -214,7 +214,7 @@ common_title_kind = Art
common_title_lastUpdated = Zuletzt aktualisiert
common_title_lastUpdatedBy = Zuletzt aktualisiert durch
common_title_ldapGroups = LDAP-Gruppen
-##common_title_ldapGroupsAvailable = LDAP-Gruppen
+common_title_ldapGroupsAvailable = LDAP-Gruppen
##common_title_mashup = Mashup
common_title_members_reporting = Anzahl berichtender Mitglieder
common_title_message = Nachricht
@@ -239,8 +239,8 @@ common_title_platform_total = Anzahl Platformen
common_title_plugin = Plugin
common_title_port = Port
common_title_providers = Anbieter
-##common_title_queryPagesParsed = LDAP-Gruppen
-##common_title_queryProgress = LDAP-Gruppen
+##common_title_queryPagesParsed = Query Pages Parsed
+##common_title_queryProgress = Query Progress
common_title_recent_alerts = Kürzlich ausgelöste Alarme
common_title_recent_bundle_deployments = Kürzliche Bundle-Deployments
common_title_recent_configuration_updates = Frische Konfigurationsaktualisierungen
@@ -280,7 +280,7 @@ common_title_sort_order_tooltip = Legt die Sortierreihenfolge für Ergebnisse fe
common_title_start = Start
common_title_status = Status
common_title_stop = Stop
-##common_title_suggest = Zusammenfassung
+common_title_suggest = Vorschlag
common_title_summary = Zusammenfassung
common_title_tag_cloud = Tag-Wolke
common_title_the = Die
@@ -426,7 +426,7 @@ dataSource_schedules_loadFailedContext = Konnte die Zeitpläne für Metriken fü
dataSource_schedules_loadFailedCriteria = Konnte die Zeitpläne für Metriken für die Kriterien [{0}] nicht laden
##dataSource_schedules_updateFailure_group = Failed to set the collection interval of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]. The collection interval was to be [{3}] seconds.
##dataSource_schedules_updateFailure_resource = Failed to set the collection interval of [{0}] metrics for resource with ID [{1}]. The metrics were: [{2}]. The collection interval was to be [{3}] seconds.
-##dataSource_schedules_updateSuccessful_concise = A new collection interval of [{0}] seconds has been set on [{1}] measurements
+dataSource_schedules_updateSuccessful_concise = Das Intervall für das Sammeln von Metriken wurde für [{1}] Metriken auf [{0}] Sekunden gesetzt.
##dataSource_schedules_updateSuccessful_full_group = A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource group with ID [{2}]. The updated measurements are: [{3}]
##dataSource_schedules_updateSuccessful_full_resource = A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource with ID [{2}]. The updated measurements are: [{3}]
dataSource_traits_failFetch = Konnte die Traits für das Kiriterium [{0}] nicht ermitteln.
@@ -466,10 +466,10 @@ filter_from_date = Von
filter_to_date = Bis
group_tree_groupOfResourceType = Gruppe von [{0}]
group_tree_partialClusterTooltip = {0} der {1} Gruppenmitglieder haben eine ''{2}'' Ressource
-##pie_chart_availability_summary_disabled = Disabled
-##pie_chart_availability_summary_down = Down
-##pie_chart_availability_summary_label = Availability
-##pie_chart_availability_summary_up = Up
+pie_chart_availability_summary_disabled = Inaktiv
+pie_chart_availability_summary_down = Unverfügbar
+pie_chart_availability_summary_label = Verfügbarkeit
+pie_chart_availability_summary_up = Verfügbar
util_disambiguationReportDecorator_pluginSuffix = ({0} Plugin)
util_errorHandler_nullException = Exception war null
##util_monitoringRequestCallback_error_checkServerStatusFailure = Unable to determine login status - check Server status.
@@ -581,33 +581,33 @@ view_adminRoles_permissions_permWriteDesc_manageContent = Abonnieren von Content
view_adminRoles_permissions_permWriteDesc_manageDrift = Anlegen, Bearbeiten und Löschen von Drift-Definitionen und Management von Drift-Instanzen
view_adminRoles_permissions_permWriteDesc_manageEvents = Ereignisse löschen
view_adminRoles_permissions_permWriteDesc_manageMeasurements = Zeitplan für das Monitoring bearbeiten
-##view_adminRoles_permissions_perm_assignBundlesToGroup = Assign Bundles To Group
+view_adminRoles_permissions_perm_assignBundlesToGroup = Bundles zu Gruppen zuweisen
view_adminRoles_permissions_perm_configure = Konfiguration
view_adminRoles_permissions_perm_control = Operationen
-##view_adminRoles_permissions_perm_createBundles = Create Bundles
+view_adminRoles_permissions_perm_createBundles = Bundles anlegen
##view_adminRoles_permissions_perm_createBundlesInGroup = Create Bundles In Group
view_adminRoles_permissions_perm_createChildResources = Kind-Ressourcen erzeugen
-##view_adminRoles_permissions_perm_deleteBundles = Delete Bundles
+view_adminRoles_permissions_perm_deleteBundles = Bundles löschen
##view_adminRoles_permissions_perm_deleteBundlesFromGroup = Delete Bundles From Group
view_adminRoles_permissions_perm_deleteChildResources = Löschen von Kind-Ressourcen
-##view_adminRoles_permissions_perm_deployBundles = Deploy Bundles
+view_adminRoles_permissions_perm_deployBundles = Bundles deployen
##view_adminRoles_permissions_perm_deployBundlesToGroup = Deploy Bundles To Group
view_adminRoles_permissions_perm_inventory = Inventar
view_adminRoles_permissions_perm_manageAlerts = Alarme verwalten
-##view_adminRoles_permissions_perm_manageBundleGroups = Manage Bundle Groups
+view_adminRoles_permissions_perm_manageBundleGroups = Bundle-Gruppen verwalten
view_adminRoles_permissions_perm_manageBundles = Bundles verwalten
view_adminRoles_permissions_perm_manageContent = Content verwalten
view_adminRoles_permissions_perm_manageDrift = Drift verwalten
view_adminRoles_permissions_perm_manageEvents = Ereignisse verwalten
view_adminRoles_permissions_perm_manageInventory = Inventar verwalten
view_adminRoles_permissions_perm_manageMeasurements = Monitoring verwalten
-##view_adminRoles_permissions_perm_manageRepositories = Manage Repositories
+view_adminRoles_permissions_perm_manageRepositories = Repositories verwalten
view_adminRoles_permissions_perm_manageSecurity = Sicherheitseinstellungen verwalten
view_adminRoles_permissions_perm_manageSettings = Einstellungen verwalten
view_adminRoles_permissions_perm_unassignBundlesFromGroup = Unassign Bundles From Group
-##view_adminRoles_permissions_perm_viewBundles = View Bundles
-##view_adminRoles_permissions_perm_viewBundlesInGroup = View Bundles In Group
-##view_adminRoles_permissions_perm_viewUsers = View Users
+view_adminRoles_permissions_perm_viewBundles = Bundles ansehen
+view_adminRoles_permissions_perm_viewBundlesInGroup = Bundles in der Gruppe ansehen
+view_adminRoles_permissions_perm_viewUsers = Nutzer ansehen
view_adminRoles_permissions_read = Lesen
view_adminRoles_permissions_readAccessImplied = Lesezugriff für das Recht {0} ist implizit und kann nicht abgeschaltet werden.
view_adminRoles_permissions_resourcePermissions = Rechte für Ressourcen
@@ -911,9 +911,9 @@ view_alert_definition_condition_editor_avilability_option_up = Wird verfügbar
view_alert_definition_condition_editor_avilability_tooltip = Geben Sie die Änderung der Verfügbarkeit an, die die Bedingung auslösen soll.
view_alert_definition_condition_editor_avilability_value = Verfügbarkeit
view_alert_definition_condition_editor_common_avg = Durchschnitt
-##view_alert_definition_condition_editor_common_baseUnits = Base Units
-##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
-##view_alert_definition_condition_editor_common_baseUnits_none = None
+view_alert_definition_condition_editor_common_baseUnits = Basiseinheit
+view_alert_definition_condition_editor_common_baseUnits_availableUnits = Verfügbare Einheiten:
+view_alert_definition_condition_editor_common_baseUnits_none = Keine
view_alert_definition_condition_editor_common_max = Maximum
view_alert_definition_condition_editor_common_min = Minimum
view_alert_definition_condition_editor_common_regex = Regulärer Ausdruck
@@ -1070,7 +1070,7 @@ view_alerts_ack_failure = Bestätigen der Alarme mit den IDs {0} fehlgeschlagen
view_alerts_ack_failure_all = Bestätigung aller Alarme deiser Quelle fehlgeschlagen
view_alerts_ack_success = Erfolgreich {0} Alarme bestätigt
view_alerts_delete_confirm = Die ausgewählten Alarme löschen?
-view_alerts_delete_confirm_all = Alle Alarme aus dieser Quele löschen?
+view_alerts_delete_confirm_all = Alle Alarme aus dieser Quelle löschen?
view_alerts_delete_failure = Konnte die Alarme mit den IDs {0} nicht löschen
view_alerts_delete_failure_all = Löschen aller Alarme dieser Quelle fehlgeschlagen
view_alerts_delete_success = Erfolgreich {0} Alarme gelöscht
@@ -1895,6 +1895,7 @@ view_reports_driftCompliance = Drift-Übereinstimmung
view_reports_inventorySummary_failFetch = Konnte die Inventar-Zusammenfassung nicht laden
view_reports_platforms = Cpu- und Speicherauslastung
view_reports_subsystems = Subsysteme
+view_resource_inventory_childhistory_filterTitle = Letzte N Tage
##view_resourceResourceGroupList_error_fetchFailure = Failed to fetch Resource''s groups.
##view_resourceResourceGroupList_error_updateFailure = Failed to update assigned Resource groups.
##view_resourceResourceGroupList_message_updateSuccess = Group membership updated for [{0}].
@@ -2148,7 +2149,7 @@ widget_resourceFactoryWizard_execute1 = Konnte keine neue Ressource anlegen - es
##widget_resourceFactoryWizard_failedToGetType = Failed to get backing package type for new resource
widget_resourceFactoryWizard_importFailure = Das manuelle importieren der Ressource ist fehlgeschlagen
#widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
-widget_resourceFactoryWizard_importSubmitted = Ein Auftrag, eine neue Ressource vom Typ [{0}] wurde abgeschickt
+widget_resourceFactoryWizard_importSubmitted = Ein Auftrag, eine neue Ressource vom Typ [{0}] zu importieren wurde abgeschickt
widget_resourceFactoryWizard_importWizardTitle = Importieren von Ressourcen des Typs [{0}]
widget_resourceFactoryWizard_importWizardWindowTitle = Wizard zum Import von Ressourcen
widget_resourceFactoryWizard_infoStepName = Information über die Ressource
10 years, 8 months
[rhq] modules/core modules/enterprise
by lkrejci
modules/core/domain/src/main/java/org/rhq/core/domain/util/PageControl.java | 65 +++
modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java | 83 +++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 37 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java | 84 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaUtil.java | 173 ++++++++++
5 files changed, 381 insertions(+), 61 deletions(-)
New commits:
commit dc6a1fedea3bfa9efdfde446d1712d353a591778
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Aug 29 18:34:45 2013 +0200
[BZ 855674] - Get rid of the dreaded "PageList was passed an empty collection but 'totalSize' was X" exception.
The main part of the fix is just the realization that the "error"
condition for which the exception was thrown is actually no error but can
be triggered by the mere fact that we use READ_COMMITTED isolation level.
The fact that a user can go past the last page of a result is actually also
not an error and can be triggered by for example a massive change in the
available data between the user asking for first and second page.
I think it is better to stop treating all such conditions as errors and
instead provide the user with means of detecting such states.
For that a new method on pagelist was introduced:
PageList.isConsistent(), which calls out to PageControl.isConsistentWith()
that check if the data and total size of the page list are consistent with
the page control.
This in turn is used by the CriteriaQueryRunner to re-attempt the queries
if it finds the inconsistency (which is most possibly caused by the phantom
read due to our transaction isolation level).
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageControl.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageControl.java
index 888c821..da881e0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageControl.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PageControl.java
@@ -23,6 +23,7 @@
package org.rhq.core.domain.util;
import java.io.Serializable;
+import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -306,6 +307,70 @@ public class PageControl implements Serializable, Cloneable {
return getPageNumber() == 0 && getPageSize() == SIZE_UNLIMITED;
}
+ /**
+ * Checks whether this page control object is consistent with the supplied collection and totalSize values.
+ * The results (collection and totalSize) are consistent iff:
+ * <ul>
+ * <li>This page control "points" past the totalSize and the collection is empty,</li>
+ * <li>or if this is an unlimited page control, the collection size is equal to
+ * <code>totalSize - {@link #getStartRow()}</code>,</li>
+ * <li>or if this control object points to the last page of the results then the size of the collection is equal
+ * to the remainder of <code>totalSize / {@link #getPageSize()}</code>,</li>
+ * <li>otherwise the collection size is equal to the {@link #getPageSize() page size}</li>
+ * </ul>
+ * <p/>
+ * The primary reason why a page control would be inconsistent with the found results is the phenomenon called
+ * "phantom read" which can happen if there was a database change between performing a query to get the collection
+ * (which represents the paged subset limited by this page control object) and performing the count query
+ * to get the total number of results (without paging applied). This is an unfortunate consequence of using the
+ * {@code READ_COMMITTED} transaction isolation level for our database connection, which is needed for it being
+ * reasonably performant.
+ *
+ * @param collection the collection of results
+ * @param totalSize the total size of results
+ * @return true if this page control object is consistent with the results or not
+ */
+ public boolean isConsistentWith(Collection<?> collection, int totalSize) {
+ int minTotalSize = getStartRow();
+ int pageSize = isUnlimited() ? Integer.MAX_VALUE : getPageSize();
+
+ if (totalSize < minTotalSize) {
+ // user reading past the available number of results. this is "normal" condition caused either
+ // by carelessness of the user or by a drastically changed number of rows since the request for the
+ // "previous" page.
+ return collection.isEmpty();
+ }
+
+ int sizeDiff = totalSize - minTotalSize;
+
+ // there can be 2 cases here:
+ // 1) the total number of rows is large enough to fill the current page.
+ // 2) we're showing the last page of the results and thus the number of results should be equal to the
+ // number of results expected on that last page.
+ int expectedCollectionSize = Math.min(sizeDiff, pageSize);
+
+ return collection.size() == expectedCollectionSize;
+ }
+
+ /**
+ * If you can a {@link PageList} that is inconsistent with this page control object, it is recommended you try
+ * calling the method you obtained the page list from again. Maybe the database have "settled down" from the
+ * activity that caused that inconsistency.
+ * <p/>
+ * This is a convenience function that is equivalent to calling:
+ * <p>
+ * <code>isConsistentWith(pageList, pageList.getTotalSize())</code>
+ * </p>
+ *
+ * @see #isConsistentWith(java.util.Collection, int)
+ *
+ * @param pageList the page list to check the consistency with this page control
+ * @return true if the page list is consistent, false otherwise.
+ */
+ public boolean isConsistentWith(PageList<?> pageList) {
+ return isConsistentWith(pageList, pageList.getTotalSize());
+ }
+
// TODO (ips, 10/12/11): Incorporate firstRecord field into equals() and hashCode().
@Override
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 f521248..d66783a 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
@@ -47,6 +47,17 @@ public class PageList<E> extends ArrayList<E> implements Serializable {
public PageList() {
}
+ /**
+ * Using this constructor one obtains a {@code PageList} instance that contains no data but it has an associated
+ * page control.
+ * <p/>
+ * Such constructor can be used if you don't know or care about the total number of results in the list and
+ * want to add the members of the list at some later point in time.
+ * <p/>
+ * <b>Note:</b> This constructor sets up the {@code PageList} to be {@link #isUnbounded() unbounded}.
+ *
+ * @param pageControl the page control to associate with the {@code PageList}
+ */
public PageList(PageControl pageControl) {
super();
this.isUnbounded = true;
@@ -54,8 +65,15 @@ public class PageList<E> extends ArrayList<E> implements Serializable {
}
/**
- * Used to represent the cardinality of a result set without when the data is not needed
- *
+ * Used to represent the cardinality of a result set when the data is not needed.
+ * <p/>
+ * In another words you can use this constructor to setup the {@code PageList} such that it correctly declares
+ * the {@link #getTotalSize() total size}, is NOT {@link #isUnbounded() unbounded} and has an associated page
+ * control, but actually contains no data (the data can be added later on of course).
+ *
+ * @param totalSize the total number of records of which this instance contains a subset of
+ * @param pageControl defines what subset of data is contained in this instance
+ *
* @see Criteria.Restriction#COUNT_ONLY
*/
public PageList(int totalSize, PageControl pageControl) {
@@ -65,8 +83,15 @@ public class PageList<E> extends ArrayList<E> implements Serializable {
}
/**
- * Used to represent a result set when the cardinality of the data is not needed
- *
+ * Used to represent a result set when the cardinality of the data is not needed.
+ * <p/>
+ * In another words you can use this constructor to setup a {@code PageList} which IS {@link #isUnbounded()
+ * unbounded} and has an associated page control.
+ *
+ * @param collection the data contained in this instance - a shallow copy of the collection will be inserted into
+ * this instance
+ * @param pageControl defines what subset of the total number of items is present in this instance
+ *
* @see Criteria.Restriction#COLLECTION_ONLY
*/
public PageList(Collection<? extends E> collection, PageControl pageControl) {
@@ -75,18 +100,28 @@ public class PageList<E> extends ArrayList<E> implements Serializable {
this.pageControl = pageControl;
}
+ /**
+ * This constructor creates a fully configured {@code PageList} that contains the page control, the subset of the
+ * records that conforms to that page control, as well as the information about the total number of records.
+ * <p/>
+ * Note that it is perfectly legal for the collection to be empty, even though the {@code totalSize} is > 0.
+ * This can be caused by a couple of things:
+ * <ul>
+ * <li>the page control used to obtain this page list points "past" the total size,</li>
+ * <li>there has been a drastic change in the database between obtaining the previous "page" and the next
+ * page using the same page control resulting essentially in the previous case,</li>
+ * <li>there has been a concurrent DB activity while obtaining the data and totalSize of the list, resulting
+ * in the two being based on different DB state. There is an attempt to mitigate this condition in the while
+ * performing the criteria queries but due to the nature of the READ_COMMITTED transaction isolation level,
+ * this cannot be completely prevented.</li>
+ * </ul>
+ * @param collection the subset of the records as described by the {@code pageControl}
+ * @param totalSize the total number of records, the {@code collection} is subset of
+ * @param pageControl the page control object describing the subset
+ */
public PageList(Collection<? extends E> collection, int totalSize, PageControl pageControl) {
super(collection);
this.totalSize = totalSize;
- if (collection.size() == 0 && totalSize > 0) {
- /*
- * 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;
}
@@ -110,8 +145,8 @@ public class PageList<E> extends ArrayList<E> implements Serializable {
/**
* Returns the total size of the "master list" that this page is a subset of.
- *
- * @return Value of property listSize.
+ * <p/>
+ * <b>Note:</b> This method merely returns the size of this list if it is {@link #isUnbounded() unbounded}.
*/
public int getTotalSize() {
return Math.max(this.size(), this.totalSize);
@@ -127,16 +162,32 @@ public class PageList<E> extends ArrayList<E> implements Serializable {
this.totalSize = totalSize;
}
+ /**
+ * @return whether the total size of the list is known or not
+ */
public boolean isUnbounded() {
return this.isUnbounded;
}
public void setUnbounded(boolean isUnbounded) {
this.isUnbounded = isUnbounded;
+ if (isUnbounded) {
+ //reset this to 0, so that #getTotalSize() behaves consistently
+ totalSize = 0;
+ }
+ }
+
+ /**
+ * @see {@link PageControl#isConsistentWith(PageList)}
+ *
+ * @return true if this page list is consistent with its page control
+ */
+ public boolean isConsistent() {
+ return pageControl == null || pageControl.isConsistentWith(this);
}
@Override
public String toString() {
return "PageList" + super.toString();
}
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 48176d1..a1f3122 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -660,7 +660,7 @@ public final class CriteriaQueryGenerator {
public List<String> getFetchFields(Criteria criteria) {
List<String> results = new ArrayList<String>();
- for (Field fetchField : getFields(criteria, Criteria.Type.FETCH)) {
+ for (Field fetchField : CriteriaUtil.getFields(criteria, Criteria.Type.FETCH)) {
Object fetchFieldValue;
try {
fetchField.setAccessible(true);
@@ -681,35 +681,6 @@ public final class CriteriaQueryGenerator {
return results;
}
- private static List<Field> getFields(Criteria criteria, Criteria.Type fieldType) {
- String prefix = fieldType.name().toLowerCase();
- List<Field> results = new ArrayList<Field>();
-
- Class<?> currentLevelClass = criteria.getClass();
- List<String> globalFields = fieldType.getGlobalFields();
- boolean isCriteriaClass = false;
-
- do {
- isCriteriaClass = currentLevelClass.equals(Criteria.class);
-
- for (Field field : currentLevelClass.getDeclaredFields()) {
- field.setAccessible(true);
- if (isCriteriaClass) {
- if (globalFields.contains(field.getName()))
- results.add(field);
-
- } else if (field.getName().startsWith(prefix)) {
- results.add(field);
- }
- }
-
- currentLevelClass = currentLevelClass.getSuperclass();
-
- } while (!isCriteriaClass);
-
- return results;
- }
-
public static String getCleansedFieldName(Field field, int leadingCharsToStrip) {
String fieldNameFragment = field.getName().substring(leadingCharsToStrip);
String fieldName = Character.toLowerCase(fieldNameFragment.charAt(0)) + fieldNameFragment.substring(1);
@@ -718,9 +689,10 @@ public final class CriteriaQueryGenerator {
public Map<String, Object> getFilterFields(Criteria criteria) {
Map<String, Object> results = new HashMap<String, Object>();
- for (Field filterField : getFields(criteria, Criteria.Type.FILTER)) {
+ for (Field filterField : CriteriaUtil.getFields(criteria, Criteria.Type.FILTER)) {
Object filterFieldValue;
try {
+ filterField.setAccessible(true);
filterFieldValue = filterField.get(criteria);
} catch (IllegalAccessException iae) {
throw new RuntimeException(iae);
@@ -1056,12 +1028,13 @@ public final class CriteriaQueryGenerator {
}
for (String fieldName : criteria.getOrderingFieldNames()) {
- for (Field sortField : getFields(criteria, Criteria.Type.SORT)) {
+ for (Field sortField : CriteriaUtil.getFields(criteria, Criteria.Type.SORT)) {
if (sortField.getName().equals(fieldName) == false) {
continue;
}
Object sortFieldValue;
try {
+ sortField.setAccessible(true);
sortFieldValue = sortField.get(criteria);
} catch (IllegalAccessException iae) {
throw new RuntimeException(iae);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
index 1031738..175d237 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
@@ -61,29 +61,87 @@ public class CriteriaQueryRunner<T> {
this.automaticFetching = automaticFetching;
}
+ private static final int MAX_ATTEMPTS = 10;
+ private static final float START_WAIT_TIME = 100;
+ private static final float MAX_WAIT_TIME = 1000;
+
+ //we increase the wait time in a geometric progression from START_WAIT_TIME to MAX_WAIT_TIME...
+ private static final float INCREASE_COEFF = (float) Math
+ .pow(MAX_WAIT_TIME / START_WAIT_TIME, 1d / (MAX_ATTEMPTS - 1));
+
+ private class CollectionAndCountFetch {
+ Collection<? extends T> collection;
+ int count;
+
+ void fetch(PageControl pageControl) {
+ collection = getCollection();
+ count = getCount();
+ int cnt = 0;
+ float waitTime = 100;
+
+ long time = System.currentTimeMillis();
+
+ while (!pageControl.isConsistentWith(collection, count) &&
+ ++cnt < MAX_ATTEMPTS) { //++cnt - we already made 1 attempt out of the loop
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Possible phantom read detected while running a criteria query. The collection size = " +
+ collection.size() + ", count = " + count + ", pageControl = " + pageControl +
+ ". Attempt number " + cnt + ". Will wait for " + ((int) waitTime) + "ms.", new Exception());
+ }
+
+ try {
+ Thread.sleep((int) waitTime);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+
+ collection = getCollection();
+ count = getCount();
+
+ waitTime *= INCREASE_COEFF;
+ }
+
+ if (cnt == MAX_ATTEMPTS) {
+ time = System.currentTimeMillis() - time;
+ LOG.warn(
+ "Could not get consistent results of the paged data and a total count for " +
+ CriteriaUtil.toString(criteria) + ". After " + MAX_ATTEMPTS + " attempts, the collection size" +
+ " is " + collection.size() + ", while the count query reports " + count + " for " +
+ pageControl + ". The discrepancy has not cleared up in " + time + "ms so we're giving up, " +
+ "returning inconsistent results. Note that is most possibly NOT an error. It is likely " +
+ "caused by concurrent database activity that changes the contents of the database that the " +
+ "criteria query is querying.", new Exception());
+ }
+ }
+ }
+
public PageList<T> execute() {
PageList<T> results;
PageControl pageControl = CriteriaQueryGenerator.getPageControl(criteria);
Restriction criteriaRestriction = criteria.getRestriction();
if (criteriaRestriction == null) {
- results = new PageList<T>(getCollection(), getCount(), pageControl);
- if (LOG.isDebugEnabled()) {
- LOG.debug("restriction=" + criteriaRestriction + ", resultSize=" + results.size() + ", resultCount="
- + results.getTotalSize());
- }
+ CollectionAndCountFetch fetch = new CollectionAndCountFetch();
+ fetch.fetch(pageControl);
+ results = new PageList<T>(fetch.collection, fetch.count, pageControl);
+// if (LOG.isDebugEnabled()) {
+// LOG.debug("restriction=" + criteriaRestriction + ", resultSize=" + results.size() + ", resultCount="
+// + results.getTotalSize());
+// }
} else if (criteriaRestriction == Restriction.COUNT_ONLY) {
results = new PageList<T>(getCount(), pageControl);
- if (LOG.isDebugEnabled()) {
- LOG.debug("restriction=" + criteriaRestriction + ", resultCount=" + results.getTotalSize());
- }
+// if (LOG.isDebugEnabled()) {
+// LOG.debug("restriction=" + criteriaRestriction + ", resultCount=" + results.getTotalSize());
+// }
} else if (criteriaRestriction == Restriction.COLLECTION_ONLY) {
results = new PageList<T>(getCollection(), pageControl);
- if (LOG.isDebugEnabled()) {
- LOG.debug("restriction=" + criteriaRestriction + ", resultSize=" + results.size());
- }
+// if (LOG.isDebugEnabled()) {
+// LOG.debug("restriction=" + criteriaRestriction + ", resultSize=" + results.size());
+// }
} else {
throw new IllegalArgumentException(this.getClass().getSimpleName()
@@ -153,8 +211,8 @@ public class CriteriaQueryRunner<T> {
Hibernate.initialize(instance);
if (instance instanceof Iterable) {
- Iterator<?> it = ((Iterable<?>)instance).iterator();
- while(it.hasNext()) it.next();
+ Iterator<?> it = ((Iterable<?>) instance).iterator();
+ while (it.hasNext()) it.next();
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaUtil.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaUtil.java
new file mode 100644
index 0000000..9f74959
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaUtil.java
@@ -0,0 +1,173 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2013 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.util;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.rhq.core.domain.criteria.Criteria;
+
+/**
+ * @author Lukas Krejci
+ * @since 4.9
+ */
+public class CriteriaUtil {
+
+ private CriteriaUtil() {
+
+ }
+
+ public static List<Field> getFields(Criteria criteria, Criteria.Type type) {
+ String prefix = type.name().toLowerCase();
+ List<Field> results = new ArrayList<Field>();
+
+ Class<?> currentLevelClass = criteria.getClass();
+ List<String> globalFields = type.getGlobalFields();
+ boolean isCriteriaClass = false;
+
+ do {
+ isCriteriaClass = currentLevelClass.equals(Criteria.class);
+
+ for (Field field : currentLevelClass.getDeclaredFields()) {
+ if (isCriteriaClass) {
+ if (globalFields.contains(field.getName()))
+ results.add(field);
+
+ } else if (field.getName().startsWith(prefix)) {
+ results.add(field);
+ }
+ }
+
+ currentLevelClass = currentLevelClass.getSuperclass();
+
+ } while (!isCriteriaClass);
+
+ return results;
+ }
+
+ /**
+ * This method is <b>VERY EXPENSIVE</b>. Do not use it "casually" but rather only in very concrete and exceptional
+ * cases like severe error reporting.
+ *
+ * @return a human readable representation of the criteria object
+ */
+ public static String toString(Criteria criteria) {
+ StringBuilder bld = new StringBuilder();
+
+ bld.append(criteria.getClass().getSimpleName()).append("[");
+
+ for(Criteria.Type type : Criteria.Type.values()) {
+ switch (type) {
+ case FETCH:
+ bld.append("fetche");
+ break;
+ default:
+ bld.append(type.name().toLowerCase());
+ }
+ bld.append("s: [");
+
+ List<Field> fields = getFields(criteria, type);
+
+ Collections.sort(fields, new Comparator<Field>() {
+ @Override
+ public int compare(Field o1, Field o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ boolean hasValues = false;
+ for (Field f : fields) {
+ boolean hasValue = false;
+ try {
+ f.setAccessible(true);
+ Object value = f.get(criteria);
+
+ //don't show fetch fields that are not applied
+ if (type == Criteria.Type.FETCH && value instanceof Boolean && !(Boolean)value) {
+ value = null;
+ }
+
+ if (value != null) {
+ bld.append(f.getName()).append("=");
+ appendToString(value, bld);
+ hasValue = true;
+ hasValues = true;
+ }
+ } catch (IllegalAccessException e) {
+ bld.append("<value-inaccessible>");
+ hasValue = true;
+ hasValues = true;
+ }
+
+ if (hasValue) {
+ bld.append(", ");
+ }
+ }
+
+ if (hasValues) {
+ bld.replace(bld.length() - 2, bld.length(), "");
+ }
+
+ bld.append("], ");
+ }
+
+ bld.replace(bld.length() - 2, bld.length(), "").append("]");
+ return bld.toString();
+ }
+
+ private static void appendToString(Object object, StringBuilder bld) {
+ if (object == null) {
+ bld.append("null");
+ } else if (object.getClass().isArray()) {
+ Class<?> componentType = object.getClass().getComponentType();
+ String str;
+ if (componentType == boolean.class) {
+ str = Arrays.toString((boolean[]) object);
+ } else if (componentType == byte.class) {
+ str = Arrays.toString((byte[]) object);
+ } else if (componentType == char.class) {
+ str = Arrays.toString((char[]) object);
+ } else if (componentType == double.class) {
+ str = Arrays.toString((double[]) object);
+ } else if (componentType == float.class) {
+ str = Arrays.toString((float[]) object);
+ } else if (componentType == int.class) {
+ str = Arrays.toString((int[]) object);
+ } else if (componentType == long.class) {
+ str = Arrays.toString((long[]) object);
+ } else if (componentType == short.class) {
+ str = Arrays.toString((short[]) object);
+ } else {
+ str = Arrays.deepToString((Object[]) object);
+ }
+
+ bld.append(str);
+ } else if (object instanceof CharSequence) {
+ bld.append("\"").append(object).append("\"");
+ } else {
+ bld.append(object.toString());
+ }
+ }
+
+}
10 years, 8 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java | 57 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 29 ++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 4
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 1
10 files changed, 72 insertions(+), 25 deletions(-)
New commits:
commit 56e34b687112afad9b6e972dab37ed774736adb3
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Mon Sep 2 12:59:51 2013 +0200
[BZ 1002174] - uninventory storage node for stopped agent destabilizes system and leads to Administration-> Topology -> Storage Nodes page dysfunction - Adding yet another confirmation box when uninventorying the platform or storage node.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java
index cab8d5b..f61c2ee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java
@@ -27,6 +27,8 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
@@ -150,30 +152,37 @@ public class AgentTableView extends TableSection<AgentDatasource> implements Has
if (selections == null || selections.length == 0) {
return; // do nothing since nothing is selected (we really shouldn't get here)
}
-
- final ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
- final Agent[] agents = new Agent[selections.length];
- int i = 0;
- for (ListGridRecord selection : selections) {
- final int agentId = selection.getAttributeAsInt(FIELD_ID);
- final String agentName = selection.getAttribute(FIELD_NAME);
- final Agent agent = new Agent();
- agent.setId(agentId);
- agent.setName(agentName);
- agents[i++] = agent;
- }
-
- resourceManager.uninventoryAllResourcesByAgent(agents, new AsyncCallback<Void>() {
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_adminTopology_agent_delete_submitted(Integer
- .toString(agents.length))));
- refresh();
- }
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_agent_delete_error(), caught);
- refresh();
+ // ask again it may contain a storage node
+ SC.confirm(MSG.view_inventory_resources_uninventoryStorageConfirm(), new BooleanCallback() {
+ public void execute(Boolean test) {
+ if (test) {
+ final ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
+ final Agent[] agents = new Agent[selections.length];
+ int i = 0;
+ for (ListGridRecord selection : selections) {
+ final int agentId = selection.getAttributeAsInt(FIELD_ID);
+ final String agentName = selection.getAttribute(FIELD_NAME);
+ final Agent agent = new Agent();
+ agent.setId(agentId);
+ agent.setName(agentName);
+ agents[i++] = agent;
+ }
+
+ resourceManager.uninventoryAllResourcesByAgent(agents, new AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_adminTopology_agent_delete_submitted(Integer
+ .toString(agents.length))));
+ refresh();
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_adminTopology_agent_delete_error(), caught);
+ refresh();
+ }
+ });
+ }
}
});
}
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 e55aed7..43b5a1f 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
@@ -43,6 +43,8 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
@@ -183,7 +185,21 @@ public class ResourceSearchView extends Table {
}
}) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ public void executeAction(final ListGridRecord[] selection, Object actionValue) {
+ if (containsStorageNodeOrItsResource(selection)) {
+ // ask again if we are going to remove platform, storage node or its child
+ SC.confirm(MSG.view_inventory_resources_uninventoryStorageConfirm(),
+ new BooleanCallback() {
+ public void execute(Boolean test) {
+ if (test) uninventoryItems(selection);
+ }
+ });
+ } else {
+ uninventoryItems(selection);
+ }
+ }
+
+ private void uninventoryItems(ListGridRecord[] selection) {
int[] resourceIds = TableUtility.getIds(selection);
ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
@@ -201,6 +217,17 @@ public class ResourceSearchView extends Table {
}
});
}
+
+ private boolean containsStorageNodeOrItsResource(ListGridRecord[] selection) {
+ for (ListGridRecord record : selection) {
+ if (record.getAttribute(AncestryUtil.RESOURCE_ANCESTRY) == null
+ || "RHQStorage".equals(record.getAttribute(PLUGIN.propertyName()))) {
+ // is a platform, storage node or child resource of storage node
+ return true;
+ }
+ }
+ return false;
+ }
});
addTableAction(MSG.common_button_disable(), MSG.view_inventory_resources_disableConfirm(),
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index b6ed982..45db241 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1821,6 +1821,7 @@ view_inventory_resources_unignoreConfirm = Are you sure you want the selected re
view_inventory_resources_unignoreFailed = Failed to unignore resources
view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
view_inventory_resources_uninventoryConfirm = Are you sure you want to uninventory the selected resources? Note that if a selected resource still exists, then it will get rediscovered during its agent''s next discovery scan.
+view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
view_inventory_resources_uninventoryFailed = Failed to uninventory the selected resources
view_inventory_resources_uninventorySuccessful = You have successfully uninventoried the selected resources
view_inventory_sectionHelp = From this section, newly discovered Resources, inventoried Resources, and Groups can be viewed and managed.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index a790810..1d9fd27 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -1832,6 +1832,7 @@ view_inventory_resources_members = Členské zdroje
##view_inventory_resources_unignoreFailed = Failed to unignore resources
##view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
view_inventory_resources_uninventoryConfirm = Chcete opravdu odstranit vybrané zdroje z inventáře? Pozn. pokud odstraněný zdroj stále existuje, bude znovuobjeven v příští fázi skenování agentem.
+view_inventory_resources_uninventoryStorageConfirm = Chystáte se odstranit alespoň jeden zdroj, který může používat úložiště. Abyste zabránili možným chybám v budoucnu, je vhodné nejprve spustit operaci Undeploy na daném uzlu. Opravdu si přejete na vlastní riziko pokračovat?
view_inventory_resources_uninventoryFailed = Nepodařilo se odstranit vybraný zdroj z inventáře
view_inventory_resources_uninventorySuccessful = Úspěšně jste odstranili z inventáře vybraný zdroj
view_inventory_sectionHelp = Z této sekce mohou být zobrazeny a spravovány nově objevené nebo inventorizovane zdroje a skupiny
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 543b45c..4513d89 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1636,6 +1636,10 @@ view_inventory_resources_ignoreSuccessful = Sie haben die ausgewählten Ressourc
##view_inventory_resources_unignoreConfirm = Are you sure you want the selected resources to be unignored? This will bring them back into inventory and you will see them again.
##view_inventory_resources_unignoreFailed = Failed to unignore resources
##view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
+##view_inventory_resources_uninventoryConfirm = Are you sure you want to uninventory the selected resources? Note that if a selected resource still exists, then it will get rediscovered during its agent''s next discovery scan.
+##view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
+##view_inventory_resources_uninventoryFailed = Failed to uninventory the selected resources
+##view_inventory_resources_uninventorySuccessful = You have successfully uninventoried the selected resources
view_inventory_sectionHelp = In diesem Abschnitt können neu gefundene Ressourcen, sowie Ressourcen und Gruppen im Inventar angesehen und verwaltet werden.
view_inventory_servers = Server
view_inventory_serversTop = Server auf Plattform-Ebene
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 4e14dd0..ef538a0 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1802,6 +1802,7 @@ view_inventory_resources_members = メンバーリソース
##view_inventory_resources_unignoreFailed = Failed to unignore resources
##view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
view_inventory_resources_uninventoryConfirm = 選択したリソースをアンインベントリしてもよろしいですか? もし選択したリソースがまだ存在しているなら、そのエージェントの次回のディスカバリスキャンの間にそれは再発見されます。
+##view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
view_inventory_resources_uninventoryFailed = 選択されたリソースのアンインベントリに失敗しました
view_inventory_resources_uninventorySuccessful = 選択されたリソースのアンインベントリに成功しました
view_inventory_sectionHelp = このセクションにおいて、新規に発見されたリソース、インベントリに登録されたリソース、グループを対象とした表示と管理がおこなわれます。
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index 9cfec15..4f6b144 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -1552,6 +1552,7 @@ view_inventory_resources_members = 멤버 리소스
##view_inventory_resources_unignoreFailed = Failed to unignore resources
##view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
view_inventory_resources_uninventoryConfirm = 선택한 리소스를 인벤토리에서 제거하시겠습니까? 만약 선택한 리소스가 존재하고 있다면, 그 에이전트의 다음 디스커버리 스캔 사이에 그것은 재발견됩니다.
+##view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
view_inventory_resources_uninventoryFailed = 선택된 리소스 인벤토리 제거에 실패했습니다
view_inventory_resources_uninventorySuccessful = 선택된 리소스의 인벤토리 제거에 성공했습니다
view_inventory_servers = 서버
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index d69d7dc..b39be65 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1829,6 +1829,7 @@ view_inventory_resources_ignoreSuccessful = Os recursos selecionados foram ignor
##view_inventory_resources_unignoreFailed = Failed to unignore resources
##view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
##view_inventory_resources_uninventoryConfirm = Are you sure you want to uninventory the selected resources? Note that if a selected resource still exists, then it will get rediscovered during its agent''s next discovery scan.
+##view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
##view_inventory_resources_uninventoryFailed = Failed to uninventory the selected resources
##view_inventory_resources_uninventorySuccessful = You have successfully uninventoried the selected resources
view_inventory_sectionHelp = From this section, newly discovered Resources, inventoried Resources, and Groups can be viewed and managed.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index fa3f59c..4b5d99a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -1690,6 +1690,7 @@
#view_inventory_resources_loadFailed = Failed to load resource composite data
#view_inventory_resources_members = Member Resources
#view_inventory_resources_uninventoryConfirm = Are you sure you want to uninventory the selected resources? Note that if a selected resource still exists, then it will get rediscovered during its agent''s next discovery scan.
+##view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
#view_inventory_resources_uninventoryFailed = Failed to uninventory the selected resources
#view_inventory_resources_uninventorySuccessful = You have successfully uninventoried the selected resources
#view_inventory_sectionHelp = From this section, newly discovered Resources, inventoried Resources, and Groups can be viewed and managed.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index ad25cfe..e37f80e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1805,6 +1805,7 @@ view_inventory_resources_members = \u6210\u5458\u8d44\u6e90
##view_inventory_resources_unignoreFailed = Failed to unignore resources
##view_inventory_resources_unignoreSuccessful = You have successfully unignored the selected resources.
view_inventory_resources_uninventoryConfirm = \u786e\u5b9a\u628a\u9009\u4e2d\u7684\u8d44\u6e90\u4ece\u6e05\u5355\u4e2d\u5220\u9664? \u6ce8\u610f\uff1a\u5982\u679c\u67d0\u4e2a\u9009\u4e2d\u7684\u8d44\u6e90\u4f9d\u7136\u5b58\u5728, \u5219\u7cfb\u7edf\u4f1a\u5728\u6b64\u8d44\u6e90\u7684\u5ba2\u6237\u7aef\u7a0b\u5e8f\u4e0b\u6b21\u63a2\u7d22\u626b\u63cf\u65f6\u91cd\u65b0\u52a0\u8f7d\u6b64\u8d44\u6e90.
+##view_inventory_resources_uninventoryStorageConfirm = You are going to uninventory at least one resource that may be used by the storage cluster. To avoid any errors in the future, you should run undeploy the node prior to the this step. Do you really want to continue on your own risk?
view_inventory_resources_uninventoryFailed = \u4ece\u6e05\u5355\u4e2d\u5220\u9664\u9009\u4e2d\u7684\u8d44\u6e90\u5931\u8d25
view_inventory_resources_uninventorySuccessful = \u6210\u529f\u4ece\u6e05\u5355\u4e2d\u5220\u9664\u9009\u4e2d\u7684\u8d44\u6e90
view_inventory_sectionHelp = \u6b64\u6a21\u5757\u53ef\u4ee5\u67e5\u770b\u548c\u7ba1\u7406\u65b0\u53d1\u73b0\u7684\u8d44\u6e90,\u5206\u7c7b\u7684\u8d44\u6e90\u548c\u7ec4.
10 years, 8 months
[rhq] Branch 'refs/tags/RHQ_4_7_0_JONCI' - modules/plugins
by rhqci
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 100 +++-------
1 file changed, 37 insertions(+), 63 deletions(-)
New commits:
commit 5a53d21763f107353f38506090f073ca2e1235d9
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Sat Aug 31 02:38:31 2013 -0400
[BZ 998058] Adding blocking-bounded-queue-thread-pool and blocking-queueless-thread-pool to list of supported templates.
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 24b5519..7956207 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
@@ -852,6 +852,37 @@
<c:simple-property name="queue-length:expr" required="false" type="integer" readOnly="false" displayName="Queue Length" description="The queue length. Required only for Bounded and Blocking Bounded Thread Pools."/>
'>
+ <!ENTITY threadPoolTemplateResourceConfig '
+ <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool" displayName="Thread Pool Type" description="Thread pool type">
+ <c:property-options>
+ <c:option value="blocking-bounded-queue-thread-pool"/>
+ <c:option value="blocking-queueless-thread-pool"/>
+ <c:option value="bounded-queue-thread-pool"/>
+ <c:option value="queueless-thread-pool"/>
+ <c:option value="unbounded-queue-thread-pool"/>
+ <c:option value="scheduled-thread-pool"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Blocking Queueless Thread Pool" description="Blocking Queueless Thread Pool">
+ <c:simple-property name="__type" readOnly="true" default="blocking-queueless-thread-pool"/>
+ </c:template>
+ <c:template name="Blocking Bounded Queue Thread Pool" description="Blocking Bounded Queue Thread Pool">
+ <c:simple-property name="__type" readOnly="true" default="blocking-bounded-queue-thread-pool"/>
+ </c:template>
+ <c:template name="Bounded Queue Thread Pool" description="Bounded Queue Thread Pool">
+ <c:simple-property name="__type" readOnly="true" default="bounded-queue-thread-pool"/>
+ </c:template>
+ <c:template name="Queueless Thread Pool" description="Queueless Thread Pool">
+ <c:simple-property name="__type" readOnly="true" default="queueless-thread-pool"/>
+ </c:template>
+ <c:template name="Scheduled Thread Pool" description="Scheduled Thread Pool">
+ <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool"/>
+ </c:template>
+ <c:template name="Unbounded Queue Thread Pool" description="Unbounded Queue Thread Pool">
+ <c:simple-property name="__type" readOnly="true" default="unbounded-queue-thread-pool"/>
+ </c:template>
+'>
+
<!ENTITY flagModuleResourceConfig '
<resource-configuration>
<c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
@@ -3158,7 +3189,7 @@
createDeletePolicy="neither">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="bounded-queue-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
+ <c:simple-property name="path" readOnly="true" default="bounded-queue-thread-pool|blocking-bounded-queue-thread-pool|blocking-queueless-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
</plugin-configuration>
<metric property="active-count" description="The approximate number of threads that are actively executing tasks."/>
@@ -3178,26 +3209,7 @@
&queueLengthResourceConfig;
<c:simple-property name="thread-factory" required="false" type="string" readOnly="false" description="Specifies the name of a specific thread factory to use to create worker threads. If not defined an appropriate default thread factory will be used."/>
- <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool" displayName="Thread Pool Type" description="Thread pool type">
- <c:property-options>
- <c:option value="bounded-queue-thread-pool"/>
- <c:option value="queueless-thread-pool"/>
- <c:option value="unbounded-queue-thread-pool"/>
- <c:option value="scheduled-thread-pool"/>
- </c:property-options>
- </c:simple-property>
- <c:template name="Bounded Queue Thread Pool" description="Bounded Queue Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="bounded-queue-thread-pool"/>
- </c:template>
- <c:template name="Queueless Thread Pool" description="Queueless Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="queueless-thread-pool"/>
- </c:template>
- <c:template name="Scheduled Thread Pool" description="Scheduled Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool"/>
- </c:template>
- <c:template name="Unbounded Queue Thread Pool" description="Unbounded Queue Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="unbounded-queue-thread-pool"/>
- </c:template>
+ &threadPoolTemplateResourceConfig;
</resource-configuration>
</service>
</service>
@@ -6011,7 +6023,7 @@
createDeletePolicy="both">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="bounded-queue-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
+ <c:simple-property name="path" readOnly="true" default="bounded-queue-thread-pool|blocking-bounded-queue-thread-pool|blocking-queueless-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
</plugin-configuration>
<resource-configuration>
@@ -6024,26 +6036,7 @@
&queueLengthResourceConfig;
<c:simple-property name="thread-factory" required="false" type="string" readOnly="false" description="Specifies the name of a specific thread factory to use to create worker threads. If not defined an appropriate default thread factory will be used."/>
- <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool" displayName="Thread Pool Type" description="Thread pool type">
- <c:property-options>
- <c:option value="bounded-queue-thread-pool"/>
- <c:option value="queueless-thread-pool"/>
- <c:option value="unbounded-queue-thread-pool"/>
- <c:option value="scheduled-thread-pool"/>
- </c:property-options>
- </c:simple-property>
- <c:template name="Bounded Queue Thread Pool" description="Bounded Queue Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="bounded-queue-thread-pool"/>
- </c:template>
- <c:template name="Queueless Thread Pool" description="Queueless Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="queueless-thread-pool"/>
- </c:template>
- <c:template name="Scheduled Thread Pool" description="Scheduled Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool"/>
- </c:template>
- <c:template name="Unbounded Queue Thread Pool" description="Unbounded Queue Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="unbounded-queue-thread-pool"/>
- </c:template>
+ &threadPoolTemplateResourceConfig;
</resource-configuration>
</service>
</service>
@@ -10955,7 +10948,7 @@
createDeletePolicy="both">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="bounded-queue-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
+ <c:simple-property name="path" readOnly="true" default="bounded-queue-thread-pool|blocking-bounded-queue-thread-pool|blocking-queueless-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
</plugin-configuration>
<metric property="active-count" description="The approximate number of threads that are actively executing tasks."/>
@@ -10975,26 +10968,7 @@
&queueLengthResourceConfig;
<c:simple-property name="thread-factory" required="false" type="string" readOnly="false" description="Specifies the name of a specific thread factory to use to create worker threads. If not defined an appropriate default thread factory will be used."/>
- <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool" displayName="Thread Pool Type" description="Thread pool type">
- <c:property-options>
- <c:option value="bounded-queue-thread-pool"/>
- <c:option value="queueless-thread-pool"/>
- <c:option value="unbounded-queue-thread-pool"/>
- <c:option value="scheduled-thread-pool"/>
- </c:property-options>
- </c:simple-property>
- <c:template name="Bounded Queue Thread Pool" description="Bounded Queue Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="bounded-queue-thread-pool"/>
- </c:template>
- <c:template name="Queueless Thread Pool" description="Queueless Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="queueless-thread-pool"/>
- </c:template>
- <c:template name="Scheduled Thread Pool" description="Scheduled Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="scheduled-thread-pool"/>
- </c:template>
- <c:template name="Unbounded Queue Thread Pool" description="Unbounded Queue Thread Pool">
- <c:simple-property name="__type" readOnly="true" default="unbounded-queue-thread-pool"/>
- </c:template>
+ &threadPoolTemplateResourceConfig;
</resource-configuration>
</service>
10 years, 8 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java | 9 +++++++++
modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit a9245fd319ec0ff1f52bd35bcb8f910bf4530555
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 31 22:25:48 2013 -0400
fixing server itest failures
need to set the cql and gossip ports for itests. In dbsetup/dbupgrade they are
set to empty strings because the server installer sets them, but we do not run
the installer for itests.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
index 258cbb8..2db60d8 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
@@ -126,9 +126,18 @@ public class StrippedDownStartupBeanPreparation {
System.setProperty("rhq.storage.password", props.getProperty("rhq.storage.password"));
System.setProperty("rhq.storage.nodes", props.getProperty("rhq.storage.nodes"));
System.setProperty("rhq.storage.cql-port", props.getProperty("rhq.storage.cql-port"));
+ System.setProperty("rhq.storage.gossip-port", props.getProperty("rhq.storage.gossip-port"));
} catch (IOException e) {
throw new RuntimeException(("Failed to load cassandra-test.properties"));
}
+
+ String cqlPort = System.getProperty("rhq.storage.cql-port");
+ String gossipPort = System.getProperty("rhq.storage.gossip-port");
+
+ entityManager.createNativeQuery("update rhq_system_config set property_value = '" + cqlPort +
+ "', default_property_value = '" + cqlPort + "' where property_key = 'STORAGE_CQL_PORT'").executeUpdate();
+ entityManager.createNativeQuery("update rhq_system_config set property_value = '" + gossipPort +
+ "', default_property_value = '" + gossipPort + "' where property_key = 'STORAGE_GOSSIP_PORT'").executeUpdate();
}
@Timeout
diff --git a/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties b/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
index d4185d0..b702a37 100644
--- a/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
+++ b/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
@@ -1,4 +1,5 @@
rhq.storage.username=${rhq.storage.username}
rhq.storage.password =${rhq.storage.password}
rhq.storage.nodes=${rhq.storage.nodes}
-rhq.storage.cql-port=${rhq.storage.cql-port}
\ No newline at end of file
+rhq.storage.cql-port=${rhq.storage.cql-port}
+rhq.storage.gossip-port=7100
\ No newline at end of file
10 years, 8 months