modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
| 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
| 118 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
| 138 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
| 108 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
| 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
| 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
| 108 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
| 4
modules/enterprise/gui/coregui/src/main/webapp/images/availBar/disabled.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16_Disabled.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_24.png
|binary
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/availability/data.xhtml
| 143 +++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
| 75 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
| 59 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
| 41 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
| 6
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
| 108 ++---
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/NetworkAdapterComponent.java
| 202 +++++-----
27 files changed, 632 insertions(+), 540 deletions(-)
New commits:
commit 62e335192131ef460963716c39c0226a0eb71914
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 21 11:04:05 2012 -0500
Work the new DISABLED and UNKNOWN avail types into the code
- add new icon support
!!! NOTE - icons in this checking are placeholders and need to be replaced !!!
- work into availability "christmas tree" support
- for range edges, set down if any down avail, then disabled, then up, then
unknown.
basically set pessimistically given the partial data
- disabled periods are now shown in yellow on the timeline
- !!! NOTE: current christmas tree light color is yellow, this will
change when the final icons are incorportated.
- work new options into group definitions
- revise group avail strategy
group avail was determined by taking an average of the avail ordinals for
the group members. DOWN=0 and UP=1, so the result was 0..1, a percentage
of UP members. 0 if all members were down, 1 if all members were up,
and somewhere in between otherwise. The average of ordinals is no longer
useful as we now have UNKNOWN=2 and DISABLED=3. The new strategy is
basically the same, but with a slight semantic change. The generated
percentage is still the percentage of UP members, but compared with NOT
UP members, as opposed to DOWN members.
- begin fixing and enhancing unit tests
- NOTE: Network Adapter now sets avail to DISABLED as opposed to DOWN in
most situations. This keeps them out of the Down+Alerted dash
portlet, which is currently an annoying behavior.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 156253c..dcc3740 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -72,7 +72,7 @@ import org.rhq.core.domain.tagging.Tag;
* @author Joseph Marques
*/
@Entity
-@NamedQueries( {
+@NamedQueries({
@NamedQuery(name = ResourceGroup.QUERY_FIND_ALL_FILTERED_COUNT, query = "SELECT
count(DISTINCT g) "
+ "FROM ResourceGroup g JOIN g.roles r JOIN r.subjects s " //
+ "LEFT JOIN g.resourceType type " //
@@ -118,11 +118,8 @@ import org.rhq.core.domain.tagging.Tag;
+ " GROUP BY rg.groupCategory "),
@NamedQuery(name = ResourceGroup.QUERY_FIND_BY_NAME, query = "SELECT rg FROM
ResourceGroup AS rg WHERE LOWER(rg.name) = LOWER(:name)"),
- @NamedQuery(name = ResourceGroup.QUERY_FIND_BY_NAME_VISIBLE_GROUP, query =
- "SELECT rg FROM ResourceGroup AS rg " +
- " WHERE LOWER(rg.name) = LOWER(:name)" +
- " AND rg.visible = true"
- ),
+ @NamedQuery(name = ResourceGroup.QUERY_FIND_BY_NAME_VISIBLE_GROUP, query =
"SELECT rg FROM ResourceGroup AS rg "
+ + " WHERE LOWER(rg.name) = LOWER(:name)" + " AND rg.visible =
true"),
@NamedQuery(name = ResourceGroup.QUERY_FIND_BY_CLUSTER_KEY, query = "SELECT rg
FROM ResourceGroup AS rg WHERE rg.clusterKey = :clusterKey"),
@NamedQuery(name = ResourceGroup.QUERY_GET_AVAILABLE_RESOURCE_GROUPS_FOR_ROLE, query
= "SELECT DISTINCT rg "
@@ -241,7 +238,7 @@ public class ResourceGroup extends Group {
public static final String QUERY_NATIVE_FIND_FILTERED_MEMBER = "" //
+ " SELECT "
- + " ( SELECT COUNT(eresAvail.ID) "
+ + " ( SELECT COUNT(eresAvail.ID) " // the count of all
explicit members
+ " FROM rhq_resource_avail eresAvail "
+ " INNER JOIN rhq_resource eres "
+ " ON eresAvail.resource_id = eres.id "
@@ -250,16 +247,17 @@ public class ResourceGroup extends Group {
+ " WHERE expMap.resource_group_id = rg.id "
+ " ) as explicitCount, "
+ "" //
- + " ( SELECT AVG(eresAvail.availability_type) "
+ + " ( SELECT COUNT(eresAvail.ID) " // the count of UP
explicit members
+ " FROM rhq_resource_avail eresAvail "
+ " INNER JOIN rhq_resource eres "
+ " ON eresAvail.resource_id = eres.id "
+ " INNER JOIN rhq_resource_group_res_exp_map expMap "
+ " ON eres.id = expMap.resource_id "
+ " WHERE expMap.resource_group_id = rg.id "
+ + " AND eresAvail.availability_type = 1 "
+ " ) as explicitAvail, "
+ "" //
- + " ( SELECT COUNT(iresAvail.ID) "
+ + " ( SELECT COUNT(iresAvail.ID) " // the count of all
implicit members
+ " FROM rhq_resource_avail iresAvail "
+ " INNER JOIN rhq_resource ires "
+ " ON iresAvail.resource_id = ires.id "
@@ -268,13 +266,14 @@ public class ResourceGroup extends Group {
+ " WHERE impMap.resource_group_id = rg.id "
+ " ) as implicitCount, "
+ "" //
- + " ( SELECT AVG(iresAvail.availability_type) "
+ + " ( SELECT COUNT(iresAvail.ID) " // the count of UP
implicit members
+ " FROM rhq_resource_avail iresAvail "
+ " INNER JOIN rhq_resource ires "
+ " ON iresAvail.resource_id = ires.id "
+ " INNER JOIN rhq_resource_group_res_imp_map impMap "
+ " ON ires.id = impMap.resource_id "
+ " WHERE impMap.resource_group_id = rg.id "
+ + " AND iresAvail.availability_type = 1 "
+ " ) as implicitAvail, "
+ "" //
+ " rg.id as groupId, "
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index 3d95849..bae889c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -198,18 +198,7 @@ public class ImageManager {
}
ResourceAvailability resourceAvail = resource.getCurrentAvailability();
- Boolean avail;
- if (resourceAvail != null) {
- AvailabilityType availType = resourceAvail.getAvailabilityType();
- if (availType != null) {
- avail = Boolean.valueOf(availType == AvailabilityType.UP);
- } else {
- avail = null;
- }
- } else {
- avail = null;
- }
- return getResourceIcon(category, avail, size);
+ return getResourceIcon(category, resourceAvail.getAvailabilityType(), size);
}
public static String getClusteredResourceIcon(ResourceCategory category) {
@@ -234,40 +223,46 @@ public class ImageManager {
}
public static String getResourceIcon(ResourceCategory category) {
- return getResourceIcon(category, Boolean.TRUE);
+ return getResourceIcon(category, AvailabilityType.UP);
}
public static String getResourceLargeIcon(ResourceCategory category) {
- return getResourceLargeIcon(category, Boolean.TRUE);
+ return getResourceLargeIcon(category, AvailabilityType.UP);
}
- public static String getResourceIcon(ResourceCategory category, Boolean avail) {
+ public static String getResourceIcon(ResourceCategory category, AvailabilityType
avail) {
return getResourceIcon(category, avail, "16");
}
- public static String getResourceLargeIcon(ResourceCategory category, Boolean avail)
{
+ public static String getResourceLargeIcon(ResourceCategory category, AvailabilityType
avail) {
return getResourceIcon(category, avail, "24");
}
- private static String getResourceIcon(ResourceCategory category, Boolean avail,
String size) {
+ private static String getResourceIcon(ResourceCategory category, AvailabilityType
avail, String size) {
String categoryName = null;
String availName = null;
+ if (null == avail) {
+ avail = AvailabilityType.UNKNOWN;
+ }
+
switch (category) {
case PLATFORM: {
categoryName = "Platform";
- availName = (avail != null && avail.booleanValue()) ? "up"
: "down";
+ // platform can only be up or down
+ availName = (AvailabilityType.UP == avail) ? "up" :
"down";
break;
}
case SERVER: {
categoryName = "Server";
- // only server icons have an explicit "unknown" icon, the others
will be assumed down when null
- availName = (avail != null) ? (avail.booleanValue() ? "up" :
"down") : "unknown";
- break;
+ // no break
}
case SERVICE: {
- categoryName = "Service";
- availName = (avail != null && avail.booleanValue()) ? "up"
: "down";
+ if (null == categoryName) {
+ categoryName = "Service";
+ }
+
+ availName = avail.name().toLowerCase();
break;
}
}
@@ -325,29 +320,51 @@ public class ImageManager {
}
public static String getAvailabilityIconFromAvailType(AvailabilityType availType) {
- return getAvailabilityIcon((availType != null) ? Boolean.valueOf(availType ==
AvailabilityType.UP) : null);
+ return getAvailabilityIconFromAvailTypeAndSize(availType, false);
}
public static String getAvailabilityLargeIconFromAvailType(AvailabilityType
availType) {
- return getAvailabilityLargeIcon((availType != null) ? Boolean.valueOf(availType
== AvailabilityType.UP) : null);
+ return getAvailabilityIconFromAvailTypeAndSize(availType, true);
}
- /**
- * Given a Boolean to indicate if something is to be considered available or
unavailable, the appropriate
- * availability icon is returned. If the given Boolean is null, the availability will
be considered unknown
- * and thus the unknown/question icon is returned.
- *
- * @param avail
- * @return the avail icon
- */
- public static String getAvailabilityIcon(Boolean avail) {
- return "subsystems/availability/availability_" + ((avail == null) ?
"grey" : (avail ? "green" : "red"))
- + "_16.png";
+ private static String getAvailabilityIconFromAvailTypeAndSize(AvailabilityType
availType, boolean isLarge) {
+ if (null == availType) {
+ availType = AvailabilityType.UNKNOWN;
+ }
+
+ String color = null;
+ switch (availType) {
+ case UP:
+ color = "green";
+ break;
+ case DOWN:
+ color = "red";
+ break;
+ case DISABLED:
+ color = "yellow";
+ break;
+ case UNKNOWN:
+ color = "grey";
+ break;
+ }
+
+ return "subsystems/availability/availability_" + color + "_"
+ (isLarge ? "24" : "16") + ".png";
}
- public static String getAvailabilityLargeIcon(Boolean avail) {
- return "subsystems/availability/availability_" + ((avail == null) ?
"grey" : (avail ? "green" : "red"))
- + "_24.png";
+ // TODO: Fix this overloading of avail icons, status should have their own icons
+ public static String getAvailabilityIcon(Boolean status) {
+ AvailabilityType availType = (null == status) ? AvailabilityType.UNKNOWN
+ : (Boolean.TRUE == status) ? AvailabilityType.UP : AvailabilityType.DOWN;
+
+ return getAvailabilityIconFromAvailTypeAndSize(availType, false);
+ }
+
+ // TODO: Fix this overloading of avail icons, status should have their own icons
+ public static String getAvailabilityLargeIcon(Boolean status) {
+ AvailabilityType availType = (null == status) ? AvailabilityType.UNKNOWN
+ : (Boolean.TRUE == status) ? AvailabilityType.UP : AvailabilityType.DOWN;
+
+ return getAvailabilityIconFromAvailTypeAndSize(availType, true);
}
/**
@@ -385,6 +402,24 @@ public class ImageManager {
return "subsystems/availability/availability_yellow_24.png";
}
+ public static String getAvailBarImagePath(AvailabilityType availType) {
+
+ switch (availType) {
+ case UP:
+ return "availBar/up.png";
+
+ case DOWN:
+ return "availBar/down.png";
+
+ case DISABLED:
+ return "availBar/disabled.png";
+
+ case UNKNOWN:
+ default:
+ return "availBar/unknown.png";
+ }
+ }
+
public static String getAlertIcon(AlertPriority priority) {
return "subsystems/alert/Alert_" + priority.name() +
"_16.png";
}
@@ -478,11 +513,12 @@ public class ImageManager {
if (status == null) {
status = ResultState.UNKNOWN;
}
+
switch (status) {
case SUCCESS:
- return ImageManager.getAvailabilityIcon(Boolean.TRUE);
+ return ImageManager.getAvailabilityIcon(true);
case FAILURE:
- return ImageManager.getAvailabilityIcon(Boolean.FALSE);
+ return ImageManager.getAvailabilityIcon(false);
case PARTIAL:
return ImageManager.getAvailabilityYellowIcon();
case DEFERRED:
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index bbc4175..0421694 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -347,8 +347,12 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
ResourceCategory resourceCategory =
deployment.getDestination().getGroup().getResourceType().getCategory();
ListGridField resourceIcon = new
ListGridField("resourceAvailability");
HashMap<String, String> icons = new HashMap<String, String>();
- icons.put(AvailabilityType.UP.name(),
ImageManager.getResourceIcon(resourceCategory, Boolean.TRUE));
- icons.put(AvailabilityType.DOWN.name(),
ImageManager.getResourceIcon(resourceCategory, Boolean.FALSE));
+ icons.put(AvailabilityType.UP.name(),
ImageManager.getResourceIcon(resourceCategory, AvailabilityType.UP));
+ icons.put(AvailabilityType.DOWN.name(),
ImageManager.getResourceIcon(resourceCategory, AvailabilityType.DOWN));
+ icons.put(AvailabilityType.DISABLED.name(),
+ ImageManager.getResourceIcon(resourceCategory, AvailabilityType.DISABLED));
+ icons.put(AvailabilityType.UNKNOWN.name(),
+ ImageManager.getResourceIcon(resourceCategory, AvailabilityType.UNKNOWN));
resourceIcon.setValueIcons(icons);
resourceIcon.setValueIconSize(16);
resourceIcon.setType(ListGridFieldType.ICON);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
index 4c1a348..75f6ed9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
@@ -61,26 +61,26 @@ public class InventoryView extends AbstractSectionedLeftNavigationView
{
// view IDs for Resources section
private static final ViewName RESOURCES_SECTION_VIEW_ID = new
ViewName("Resources", MSG.common_title_resources());
- private static final ViewName PAGE_AUTODISCOVERY_QUEUE = new
ViewName("AutodiscoveryQueue", MSG
- .view_inventory_adq());
+ private static final ViewName PAGE_AUTODISCOVERY_QUEUE = new
ViewName("AutodiscoveryQueue",
+ MSG.view_inventory_adq());
private static final ViewName PAGE_ALL_RESOURCES = new
ViewName("AllResources", MSG.view_inventory_allResources());
private static final ViewName PAGE_PLATFORMS = new ViewName("Platforms",
MSG.view_inventory_platforms());
private static final ViewName PAGE_SERVERS = new ViewName("Servers",
MSG.view_inventory_servers());
private static final ViewName PAGE_SERVICES = new ViewName("Services",
MSG.view_inventory_services());
- private static final ViewName PAGE_UNAVAIL_SERVERS = new
ViewName("UnavailableServers", MSG
- .view_inventory_unavailableServers());
+ private static final ViewName PAGE_UNAVAIL_SERVERS = new
ViewName("UnavailableServers",
+ MSG.view_inventory_unavailableServers());
// view IDs for Groups section
private static final ViewName GROUPS_SECTION_VIEW_ID = new
ViewName("Groups", MSG.view_inventory_groups());
- private static final ViewName PAGE_DYNAGROUP_DEFINITIONS = new
ViewName("DynagroupDefinitions", MSG
- .view_inventory_dynagroupDefs());
+ private static final ViewName PAGE_DYNAGROUP_DEFINITIONS = new
ViewName("DynagroupDefinitions",
+ MSG.view_inventory_dynagroupDefs());
private static final ViewName PAGE_ALL_GROUPS = new ViewName("AllGroups",
MSG.view_inventory_allGroups());
- private static final ViewName PAGE_COMPATIBLE_GROUPS = new
ViewName("CompatibleGroups", MSG
- .common_title_compatibleGroups());
+ private static final ViewName PAGE_COMPATIBLE_GROUPS = new
ViewName("CompatibleGroups",
+ MSG.common_title_compatibleGroups());
private static final ViewName PAGE_MIXED_GROUPS = new
ViewName("MixedGroups", MSG.common_title_mixedGroups());
- private static final ViewName PAGE_PROBLEM_GROUPS = new
ViewName("ProblemGroups", MSG
- .view_inventory_problemGroups());
+ private static final ViewName PAGE_PROBLEM_GROUPS = new
ViewName("ProblemGroups",
+ MSG.view_inventory_problemGroups());
private Set<Permission> globalPermissions;
@@ -137,63 +137,66 @@ public class InventoryView extends
AbstractSectionedLeftNavigationView {
}, this.globalPermissions.contains(Permission.MANAGE_INVENTORY));
autodiscoveryQueueItem.setRefreshRequired(true);
- NavigationItem allResourcesItem = new NavigationItem(PAGE_ALL_RESOURCES,
"resources/all_resources.png", new ViewFactory() {
- public Canvas createView() {
- return new
ResourceSearchView(extendLocatorId(PAGE_ALL_RESOURCES.getName()), null,
PAGE_ALL_RESOURCES
- .getTitle(),
ImageManager.getResourceLargeIcon(ResourceCategory.PLATFORM, Boolean.TRUE),
- ImageManager.getResourceLargeIcon(ResourceCategory.SERVER,
Boolean.TRUE), ImageManager
- .getResourceLargeIcon(ResourceCategory.SERVICE, Boolean.TRUE));
- }
- });
+ NavigationItem allResourcesItem = new NavigationItem(PAGE_ALL_RESOURCES,
"resources/all_resources.png",
+ new ViewFactory() {
+ public Canvas createView() {
+ return new
ResourceSearchView(extendLocatorId(PAGE_ALL_RESOURCES.getName()), null,
+ PAGE_ALL_RESOURCES.getTitle(),
ImageManager.getResourceLargeIcon(ResourceCategory.PLATFORM,
+ AvailabilityType.UP),
ImageManager.getResourceLargeIcon(ResourceCategory.SERVER,
+ AvailabilityType.UP),
ImageManager.getResourceLargeIcon(ResourceCategory.SERVICE,
+ AvailabilityType.UP));
+ }
+ });
NavigationItem platformsItem = new NavigationItem(PAGE_PLATFORMS,
ImageManager.getResourceIcon(
- ResourceCategory.PLATFORM, Boolean.TRUE), new ViewFactory() {
+ ResourceCategory.PLATFORM, AvailabilityType.UP), new ViewFactory() {
public Canvas createView() {
- Criteria initialCriteria = new Criteria(
- ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.PLATFORM.name());
+ Criteria initialCriteria = new
Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.PLATFORM.name());
ResourceSearchView view = new
ResourceSearchView(extendLocatorId(PAGE_PLATFORMS.getName()),
- initialCriteria, PAGE_PLATFORMS.getTitle(),
ImageManager.getResourceLargeIcon(ResourceCategory.PLATFORM,
- Boolean.TRUE));
+ initialCriteria, PAGE_PLATFORMS.getTitle(),
ImageManager.getResourceLargeIcon(
+ ResourceCategory.PLATFORM, AvailabilityType.UP));
//view.setInitialSearchBarSearchText("category=" +
ResourceCategory.PLATFORM.name().toLowerCase());
return view;
}
});
NavigationItem serversItem = new NavigationItem(PAGE_SERVERS,
ImageManager.getResourceIcon(
- ResourceCategory.SERVER, Boolean.TRUE), new ViewFactory() {
+ ResourceCategory.SERVER, AvailabilityType.UP), new ViewFactory() {
public Canvas createView() {
- Criteria initialCriteria = new Criteria(
- ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.SERVER.name());
+ Criteria initialCriteria = new
Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.SERVER.name());
ResourceSearchView view = new
ResourceSearchView(extendLocatorId(PAGE_SERVERS.getName()),
- initialCriteria, PAGE_SERVERS.getTitle(),
ImageManager.getResourceLargeIcon(ResourceCategory.SERVER,
- Boolean.TRUE));
+ initialCriteria, PAGE_SERVERS.getTitle(),
ImageManager.getResourceLargeIcon(
+ ResourceCategory.SERVER, AvailabilityType.UP));
//view.setInitialSearchBarSearchText("category=" +
ResourceCategory.SERVER.name().toLowerCase());
return view;
}
});
NavigationItem servicesItem = new NavigationItem(PAGE_SERVICES,
ImageManager.getResourceIcon(
- ResourceCategory.SERVICE, Boolean.TRUE), new ViewFactory() {
+ ResourceCategory.SERVICE, AvailabilityType.UP), new ViewFactory() {
public Canvas createView() {
- Criteria initialCriteria = new Criteria(
- ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.SERVICE.name());
+ Criteria initialCriteria = new
Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.SERVICE.name());
ResourceSearchView view = new
ResourceSearchView(extendLocatorId(PAGE_SERVICES.getName()),
- initialCriteria, PAGE_SERVICES.getTitle(),
ImageManager.getResourceLargeIcon(ResourceCategory.SERVICE,
- Boolean.TRUE));
+ initialCriteria, PAGE_SERVICES.getTitle(),
ImageManager.getResourceLargeIcon(
+ ResourceCategory.SERVICE, AvailabilityType.UP));
//view.setInitialSearchBarSearchText("category=" +
ResourceCategory.SERVICE.name().toLowerCase());
return view;
}
});
NavigationItem downServersItem = new NavigationItem(PAGE_UNAVAIL_SERVERS,
ImageManager.getResourceIcon(
- ResourceCategory.SERVER, Boolean.FALSE), new ViewFactory() {
+ ResourceCategory.SERVER, AvailabilityType.DOWN), new ViewFactory() {
public Canvas createView() {
Criteria initialCriteria = new
Criteria(ResourceDataSourceField.AVAILABILITY.propertyName(),
AvailabilityType.DOWN.name());
-
initialCriteria.addCriteria(ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.SERVER.name());
+
initialCriteria.addCriteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.SERVER.name());
ResourceSearchView view = new
ResourceSearchView(extendLocatorId(PAGE_UNAVAIL_SERVERS.getName()),
initialCriteria, MSG.view_inventory_unavailableServers(),
ImageManager.getResourceLargeIcon(
- ResourceCategory.SERVER, Boolean.FALSE));
+ ResourceCategory.SERVER, AvailabilityType.DOWN));
//view.setInitialSearchBarSearchText("category=" +
ResourceCategory.SERVER.name().toLowerCase()
// + " availability=" +
AvailabilityType.DOWN.name().toLowerCase());
return view;
@@ -213,44 +216,45 @@ public class InventoryView extends
AbstractSectionedLeftNavigationView {
}
}, this.globalPermissions.contains(Permission.MANAGE_INVENTORY));
- NavigationItem allGroupsItem = new NavigationItem(PAGE_ALL_GROUPS, ImageManager
- .getGroupIcon(GroupCategory.MIXED), new ViewFactory() {
- public Canvas createView() {
- return new
ResourceGroupListView(extendLocatorId(PAGE_ALL_GROUPS.getName()), null, PAGE_ALL_GROUPS
- .getTitle(),
ImageManager.getGroupLargeIcon(GroupCategory.COMPATIBLE), ImageManager
- .getGroupLargeIcon(GroupCategory.MIXED));
- }
- });
+ NavigationItem allGroupsItem = new NavigationItem(PAGE_ALL_GROUPS,
+ ImageManager.getGroupIcon(GroupCategory.MIXED), new ViewFactory() {
+ public Canvas createView() {
+ return new
ResourceGroupListView(extendLocatorId(PAGE_ALL_GROUPS.getName()), null,
+ PAGE_ALL_GROUPS.getTitle(),
ImageManager.getGroupLargeIcon(GroupCategory.COMPATIBLE),
+ ImageManager.getGroupLargeIcon(GroupCategory.MIXED));
+ }
+ });
- NavigationItem compatibleGroupsItem = new NavigationItem(PAGE_COMPATIBLE_GROUPS,
ImageManager
- .getGroupIcon(GroupCategory.COMPATIBLE), new ViewFactory() {
- public Canvas createView() {
- ResourceGroupListView view = new ResourceGroupListView(
- extendLocatorId(PAGE_COMPATIBLE_GROUPS.getName()), new Criteria(
- ResourceGroupDataSourceField.CATEGORY.propertyName(),
GroupCategory.COMPATIBLE.name()),
- PAGE_COMPATIBLE_GROUPS.getTitle(),
ImageManager.getGroupLargeIcon(GroupCategory.COMPATIBLE));
-
//view.setInitialSearchBarSearchText("groupCategory=compatible");
- return view;
- }
- });
+ NavigationItem compatibleGroupsItem = new NavigationItem(PAGE_COMPATIBLE_GROUPS,
+ ImageManager.getGroupIcon(GroupCategory.COMPATIBLE), new ViewFactory() {
+ public Canvas createView() {
+ ResourceGroupListView view = new ResourceGroupListView(
+ extendLocatorId(PAGE_COMPATIBLE_GROUPS.getName()), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(),
GroupCategory.COMPATIBLE.name()),
+ PAGE_COMPATIBLE_GROUPS.getTitle(),
ImageManager.getGroupLargeIcon(GroupCategory.COMPATIBLE));
+
//view.setInitialSearchBarSearchText("groupCategory=compatible");
+ return view;
+ }
+ });
- NavigationItem mixedGroupsItem = new NavigationItem(PAGE_MIXED_GROUPS,
ImageManager
- .getGroupIcon(GroupCategory.MIXED), new ViewFactory() {
- public Canvas createView() {
- ResourceGroupListView view = new
ResourceGroupListView(extendLocatorId(PAGE_MIXED_GROUPS.getName()),
- new Criteria(ResourceGroupDataSourceField.CATEGORY.propertyName(),
GroupCategory.MIXED.name()),
- PAGE_MIXED_GROUPS.getTitle(),
ImageManager.getGroupLargeIcon(GroupCategory.MIXED));
- //view.setInitialSearchBarSearchText("groupCategory=mixed");
- return view;
- }
- });
+ NavigationItem mixedGroupsItem = new NavigationItem(PAGE_MIXED_GROUPS,
+ ImageManager.getGroupIcon(GroupCategory.MIXED), new ViewFactory() {
+ public Canvas createView() {
+ ResourceGroupListView view = new ResourceGroupListView(
+ extendLocatorId(PAGE_MIXED_GROUPS.getName()), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(),
GroupCategory.MIXED.name()),
+ PAGE_MIXED_GROUPS.getTitle(),
ImageManager.getGroupLargeIcon(GroupCategory.MIXED));
+
//view.setInitialSearchBarSearchText("groupCategory=mixed");
+ return view;
+ }
+ });
NavigationItem problemGroupsItem = new NavigationItem(PAGE_PROBLEM_GROUPS,
ImageManager.getGroupIcon(
GroupCategory.MIXED, 0.0d), new ViewFactory() {
public Canvas createView() {
ResourceGroupListView view = new
ResourceGroupListView(extendLocatorId(PAGE_PROBLEM_GROUPS.getName()),
- new Criteria("downMemberCount", "1"),
PAGE_PROBLEM_GROUPS.getTitle(), ImageManager
- .getGroupLargeIcon(GroupCategory.MIXED, 0.0d));
+ new Criteria("downMemberCount", "1"),
PAGE_PROBLEM_GROUPS.getTitle(),
+ ImageManager.getGroupLargeIcon(GroupCategory.MIXED, 0.0d));
//view.setInitialSearchBarSearchText("availability=down"); I
don't think this matches exactly what the criteria returns
view.setShowNewButton(false);
return view;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index c7af478..be046d4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -23,7 +23,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Set;
-import java.util.logging.Logger;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
@@ -31,6 +30,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.ResourceCategory;
@@ -160,19 +160,19 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
protected List<TwoLevelTab> createTabs() {
List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
- summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"),
new ViewName("Summary", MSG
- .common_title_summary()),
ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
- summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"),
new ViewName("Activity", MSG
- .view_tabs_common_activity()), null);
- summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"),
new ViewName("Timeline", MSG
- .view_tabs_common_timeline()), null);
+ summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"),
new ViewName("Summary",
+ MSG.common_title_summary()),
ImageManager.getResourceIcon(ResourceCategory.SERVICE, AvailabilityType.UP));
+ summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"),
new ViewName("Activity",
+ MSG.view_tabs_common_activity()), null);
+ summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"),
new ViewName("Timeline",
+ MSG.view_tabs_common_timeline()), null);
summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
tabs.add(summaryTab);
- inventoryTab = new
TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new
ViewName("Inventory", MSG
- .view_tabs_common_inventory()),
"/images/icons/Inventory_grey_16.png");
- inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"),
new ViewName("Members", MSG
- .view_tabs_common_members()), null);
+ inventoryTab = new
TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new
ViewName("Inventory",
+ MSG.view_tabs_common_inventory()),
"/images/icons/Inventory_grey_16.png");
+ inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"),
new ViewName("Members",
+ MSG.view_tabs_common_members()), null);
inventoryConn = new
SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), new ViewName(
"ConnectionSettings", MSG.view_tabs_common_connectionSettings()),
null);
inventoryConnHistory = new
SubTab(inventoryTab.extendLocatorId("ConnectionSettingsHistory"), new ViewName(
@@ -180,53 +180,53 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
inventoryTab.registerSubTabs(this.inventoryMembers, this.inventoryConn,
this.inventoryConnHistory);
tabs.add(inventoryTab);
- alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new
ViewName("Alerts", MSG
- .common_title_alerts()), "/images/icons/Alert_grey_16.png");
- this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"),
new ViewName("History", MSG
- .view_tabs_common_history()), null);
- this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"),
new ViewName("Definitions", MSG
- .common_title_definitions()), null);
+ alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new
ViewName("Alerts",
+ MSG.common_title_alerts()), "/images/icons/Alert_grey_16.png");
+ this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"),
new ViewName("History",
+ MSG.view_tabs_common_history()), null);
+ this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"),
new ViewName("Definitions",
+ MSG.common_title_definitions()), null);
alertsTab.registerSubTabs(alertHistory, alertDef);
tabs.add(alertsTab);
- monitoringTab = new
TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new
ViewName("Monitoring", MSG
- .view_tabs_common_monitoring()),
"/images/icons/Monitor_grey_16.png");
- monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new
ViewName("Graphs", MSG
- .view_tabs_common_graphs()), null);
- monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new
ViewName("Tables", MSG
- .view_tabs_common_tables()), null);
- monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new
ViewName("Traits", MSG
- .view_tabs_common_traits()), null);
-
- monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"),
new ViewName("Schedules", MSG
- .view_tabs_common_schedules()), null);
- monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"),
new ViewName("CallTime", MSG
- .view_tabs_common_calltime()), null);
+ monitoringTab = new
TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new
ViewName("Monitoring",
+ MSG.view_tabs_common_monitoring()),
"/images/icons/Monitor_grey_16.png");
+ monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new
ViewName("Graphs",
+ MSG.view_tabs_common_graphs()), null);
+ monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new
ViewName("Tables",
+ MSG.view_tabs_common_tables()), null);
+ monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new
ViewName("Traits",
+ MSG.view_tabs_common_traits()), null);
+
+ monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"),
new ViewName("Schedules",
+ MSG.view_tabs_common_schedules()), null);
+ monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"),
new ViewName("CallTime",
+ MSG.view_tabs_common_calltime()), null);
monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorTraits,
monitorSched, monitorCallTime);
tabs.add(monitoringTab);
- eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new
ViewName("Events", MSG
- .view_tabs_common_events()), "/images/icons/Events_grey_16.png");
- this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"),
new ViewName("History", MSG
- .view_tabs_common_history()), null);
+ eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new
ViewName("Events",
+ MSG.view_tabs_common_events()),
"/images/icons/Events_grey_16.png");
+ this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"),
new ViewName("History",
+ MSG.view_tabs_common_history()), null);
eventsTab.registerSubTabs(eventHistory);
tabs.add(eventsTab);
- operationsTab = new
TwoLevelTab(getTabSet().extendLocatorId("Operations"), new
ViewName("Operations", MSG
- .common_title_operations()),
"/images/icons/Operation_grey_16.png");
- this.operationsSchedules = new
SubTab(operationsTab.extendLocatorId("Schedules"), new
ViewName("Schedules", MSG
- .view_tabs_common_schedules()), null);
- this.operationsHistory = new
SubTab(operationsTab.extendLocatorId("History"), new
ViewName("History", MSG
- .view_tabs_common_history()), null);
+ operationsTab = new
TwoLevelTab(getTabSet().extendLocatorId("Operations"), new
ViewName("Operations",
+ MSG.common_title_operations()),
"/images/icons/Operation_grey_16.png");
+ this.operationsSchedules = new
SubTab(operationsTab.extendLocatorId("Schedules"), new
ViewName("Schedules",
+ MSG.view_tabs_common_schedules()), null);
+ this.operationsHistory = new
SubTab(operationsTab.extendLocatorId("History"), new
ViewName("History",
+ MSG.view_tabs_common_history()), null);
operationsTab.registerSubTabs(this.operationsSchedules, this.operationsHistory);
tabs.add(operationsTab);
configurationTab = new
TwoLevelTab(getTabSet().extendLocatorId("Configuration"), new
ViewName("Configuration",
MSG.common_title_configuration()),
"/images/icons/Configure_grey_16.png");
- this.configCurrent = new
SubTab(configurationTab.extendLocatorId("Current"), new
ViewName("Current", MSG
- .view_tabs_common_current()), null);
- this.configHistory = new
SubTab(configurationTab.extendLocatorId("History"), new
ViewName("History", MSG
- .view_tabs_common_history()), null);
+ this.configCurrent = new
SubTab(configurationTab.extendLocatorId("Current"), new
ViewName("Current",
+ MSG.view_tabs_common_current()), null);
+ this.configHistory = new
SubTab(configurationTab.extendLocatorId("History"), new
ViewName("History",
+ MSG.view_tabs_common_history()), null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
tabs.add(configurationTab);
@@ -368,19 +368,19 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
return new
GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"),
groupComposite);
}
});
- updateSubTab(this.inventoryTab, this.inventoryConnHistory, facets
- .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true, new ViewFactory() {
- @Override
- public Canvas createView() {
- return new
HistoryGroupPluginConfigurationView(inventoryConnHistory.extendLocatorId("View"),
- groupComposite);
- }
- });
+ updateSubTab(this.inventoryTab, this.inventoryConnHistory,
+ facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true, new
ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new
HistoryGroupPluginConfigurationView(inventoryConnHistory.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
}
private void updateOperationsTab(GroupCategory groupCategory,
Set<ResourceTypeFacet> facets) {
- if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
- && facets.contains(ResourceTypeFacet.OPERATION), true)) {
+ if (updateTab(this.operationsTab,
+ groupCategory == GroupCategory.COMPATIBLE &&
facets.contains(ResourceTypeFacet.OPERATION), true)) {
updateSubTab(this.operationsTab, this.operationsSchedules, true, true, new
ViewFactory() {
@Override
public Canvas createView() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
index 4e3c90c..c2a0ea2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
@@ -22,7 +22,19 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.*;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.AVAILABILITY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CTIME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.DESCRIPTION;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.ITIME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.KEY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.LOCATION;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.MODIFIER;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.MTIME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.VERSION;
import java.util.ArrayList;
import java.util.HashSet;
@@ -203,9 +215,9 @@ public class ResourceCompositeDataSource extends
RPCDataSource<ResourceComposite
record.setAttribute(VERSION.propertyName(), res.getVersion());
record.setAttribute(CATEGORY.propertyName(),
res.getResourceType().getCategory().name());
record.setAttribute("icon",
ImageManager.getResourceIcon(res.getResourceType().getCategory(), res
- .getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP));
- record.setAttribute(AVAILABILITY.propertyName(),
ImageManager.getAvailabilityIconFromAvailType(res
.getCurrentAvailability().getAvailabilityType()));
+ record.setAttribute(AVAILABILITY.propertyName(),
+
ImageManager.getAvailabilityIconFromAvailType(res.getCurrentAvailability().getAvailabilityType()));
record.setAttribute(CTIME.propertyName(), res.getCtime());
record.setAttribute(ITIME.propertyName(), res.getItime());
record.setAttribute(MTIME.propertyName(), res.getMtime());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index d084446..82a04ba 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -113,8 +113,8 @@ public class ResourceDatasource extends RPCDataSource<Resource,
ResourceCriteria
keyDataField.setDetail(true);
fields.add(keyDataField);
- DataSourceTextField descriptionDataField = new
DataSourceTextField(DESCRIPTION.propertyName(), DESCRIPTION
- .title());
+ DataSourceTextField descriptionDataField = new
DataSourceTextField(DESCRIPTION.propertyName(),
+ DESCRIPTION.title());
descriptionDataField.setCanEdit(false);
fields.add(descriptionDataField);
@@ -138,8 +138,8 @@ public class ResourceDatasource extends RPCDataSource<Resource,
ResourceCriteria
categoryDataField.setDetail(true);
fields.add(categoryDataField);
- DataSourceImageField availabilityDataField = new
DataSourceImageField(AVAILABILITY.propertyName(), AVAILABILITY
- .title(), 20);
+ DataSourceImageField availabilityDataField = new
DataSourceImageField(AVAILABILITY.propertyName(),
+ AVAILABILITY.title(), 20);
availabilityDataField.setCanEdit(false);
fields.add(availabilityDataField);
@@ -274,9 +274,9 @@ public class ResourceDatasource extends RPCDataSource<Resource,
ResourceCriteria
record.setAttribute(VERSION.propertyName(), from.getVersion());
record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory().name());
record.setAttribute("icon",
ImageManager.getResourceIcon(from.getResourceType().getCategory(), from
- .getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP));
- record.setAttribute(AVAILABILITY.propertyName(),
ImageManager.getAvailabilityIconFromAvailType(from
.getCurrentAvailability().getAvailabilityType()));
+ record.setAttribute(AVAILABILITY.propertyName(),
+
ImageManager.getAvailabilityIconFromAvailType(from.getCurrentAvailability().getAvailabilityType()));
record.setAttribute(CTIME.propertyName(), from.getCtime());
record.setAttribute(ITIME.propertyName(), from.getItime());
record.setAttribute(MTIME.propertyName(), from.getMtime());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index 92b7d9e..034dd05 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -21,7 +21,6 @@ package
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.widgets.tree.TreeNode;
-import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.ResourceTreeNode;
@@ -50,8 +49,8 @@ public class CustomResourceTreeGrid extends LocatableTreeGrid {
return ImageManager.getLockedIcon();
} else {
Resource resource = ((ResourceTreeDatasource.ResourceTreeNode)
record).getResource();
- boolean up = resource.getCurrentAvailability().getAvailabilityType()
== AvailabilityType.UP;
- return
ImageManager.getResourceIcon(resource.getResourceType().getCategory(), up);
+ return
ImageManager.getResourceIcon(resource.getResourceType().getCategory(), resource
+ .getCurrentAvailability().getAvailabilityType());
}
} else if (record instanceof SubCategoryTreeNode) {
return "resources/folder_mixed_" + (open ? "opened" :
"closed") + ".png";
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index c78b8f2..aa81b4c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
@@ -161,69 +162,69 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
protected List<TwoLevelTab> createTabs() {
List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
- summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"),
new ViewName("Summary", MSG
- .common_title_summary()),
ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
- summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"),
new ViewName("Activity", MSG
- .view_tabs_common_activity()), null);
- summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"),
new ViewName("Timeline", MSG
- .view_tabs_common_timeline()), null);
+ summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"),
new ViewName("Summary",
+ MSG.common_title_summary()),
ImageManager.getResourceIcon(ResourceCategory.SERVICE, AvailabilityType.UP));
+ summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"),
new ViewName("Activity",
+ MSG.view_tabs_common_activity()), null);
+ summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"),
new ViewName("Timeline",
+ MSG.view_tabs_common_timeline()), null);
summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
tabs.add(summaryTab);
- inventoryTab = new
TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new
ViewName("Inventory", MSG
- .view_tabs_common_inventory()),
"subsystems/inventory/Inventory_grey_16.png");
- inventoryChildren = new
SubTab(inventoryTab.extendLocatorId("Children"), new
ViewName("Children", MSG
- .view_tabs_common_child_resources()), null);
- inventoryChildHistory = new
SubTab(inventoryTab.extendLocatorId("ChildHist"), new
ViewName("ChildHistory", MSG
- .view_tabs_common_child_history()), null);
+ inventoryTab = new
TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new
ViewName("Inventory",
+ MSG.view_tabs_common_inventory()),
"subsystems/inventory/Inventory_grey_16.png");
+ inventoryChildren = new
SubTab(inventoryTab.extendLocatorId("Children"), new
ViewName("Children",
+ MSG.view_tabs_common_child_resources()), null);
+ inventoryChildHistory = new
SubTab(inventoryTab.extendLocatorId("ChildHist"), new
ViewName("ChildHistory",
+ MSG.view_tabs_common_child_history()), null);
inventoryConn = new
SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), new ViewName(
"ConnectionSettings", MSG.view_tabs_common_connectionSettings()),
null);
inventoryConnHistory = new
SubTab(inventoryTab.extendLocatorId("ConnSetHist"),
PluginConfigurationHistoryListView.VIEW_ID, null);
- inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"),
new ViewName("Groups", MSG
- .view_tabs_common_groups()), null);
- inventoryAgent = new SubTab(inventoryTab.extendLocatorId("Agent"), new
ViewName("Agent", MSG
- .view_tabs_common_agent()), null);
+ inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"),
new ViewName("Groups",
+ MSG.view_tabs_common_groups()), null);
+ inventoryAgent = new SubTab(inventoryTab.extendLocatorId("Agent"), new
ViewName("Agent",
+ MSG.view_tabs_common_agent()), null);
inventoryTab.registerSubTabs(this.inventoryChildren, this.inventoryChildHistory,
this.inventoryConn,
this.inventoryConnHistory, this.inventoryGroups, this.inventoryAgent);
tabs.add(inventoryTab);
- alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new
ViewName("Alerts", MSG
- .common_title_alerts()), "subsystems/alert/Alerts_16.png");
- this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"),
new ViewName("History", MSG
- .view_tabs_common_history()), null);
- this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"),
new ViewName("Definitions", MSG
- .common_title_definitions()), null);
+ alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new
ViewName("Alerts",
+ MSG.common_title_alerts()), "subsystems/alert/Alerts_16.png");
+ this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"),
new ViewName("History",
+ MSG.view_tabs_common_history()), null);
+ this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"),
new ViewName("Definitions",
+ MSG.common_title_definitions()), null);
alertsTab.registerSubTabs(alertHistory, alertDef);
tabs.add(alertsTab);
- monitoringTab = new
TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new
ViewName("Monitoring", MSG
- .view_tabs_common_monitoring()),
"subsystems/monitor/Monitor_grey_16.png");
- monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new
ViewName("Graphs", MSG
- .view_tabs_common_graphs()), null);
- monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new
ViewName("Tables", MSG
- .view_tabs_common_tables()), null);
- monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new
ViewName("Traits", MSG
- .view_tabs_common_traits()), null);
- monitorAvail = new
SubTab(monitoringTab.extendLocatorId("Availability"), new
ViewName("Availability", MSG
- .view_tabs_common_availability()), null);
- monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"),
new ViewName("Schedules", MSG
- .view_tabs_common_schedules()), null);
- monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"),
new ViewName("CallTime", MSG
- .view_tabs_common_calltime()), null);
+ monitoringTab = new
TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new
ViewName("Monitoring",
+ MSG.view_tabs_common_monitoring()),
"subsystems/monitor/Monitor_grey_16.png");
+ monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new
ViewName("Graphs",
+ MSG.view_tabs_common_graphs()), null);
+ monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new
ViewName("Tables",
+ MSG.view_tabs_common_tables()), null);
+ monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new
ViewName("Traits",
+ MSG.view_tabs_common_traits()), null);
+ monitorAvail = new
SubTab(monitoringTab.extendLocatorId("Availability"), new
ViewName("Availability",
+ MSG.view_tabs_common_availability()), null);
+ monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"),
new ViewName("Schedules",
+ MSG.view_tabs_common_schedules()), null);
+ monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"),
new ViewName("CallTime",
+ MSG.view_tabs_common_calltime()), null);
monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorTraits,
monitorAvail, monitorSched,
monitorCallTime);
tabs.add(monitoringTab);
- eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new
ViewName("Events", MSG
- .view_tabs_common_events()),
"subsystems/event/Events_grey_16.png");
- this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"),
new ViewName("History", MSG
- .view_tabs_common_history()), null);
+ eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new
ViewName("Events",
+ MSG.view_tabs_common_events()),
"subsystems/event/Events_grey_16.png");
+ this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"),
new ViewName("History",
+ MSG.view_tabs_common_history()), null);
eventsTab.registerSubTabs(eventHistory);
tabs.add(eventsTab);
- operationsTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.OPERATIONS), new
ViewName(Tab.OPERATIONS, MSG
- .common_title_operations()),
"subsystems/control/Operation_grey_16.png");
+ operationsTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.OPERATIONS), new
ViewName(Tab.OPERATIONS,
+ MSG.common_title_operations()),
"subsystems/control/Operation_grey_16.png");
this.operationsSchedules = new
SubTab(operationsTab.extendLocatorId(OperationsSubTab.SCHEDULES), new ViewName(
OperationsSubTab.SCHEDULES, MSG.view_tabs_common_schedules()), null);
this.operationsHistory = new
SubTab(operationsTab.extendLocatorId(OperationsSubTab.HISTORY), new ViewName(
@@ -240,8 +241,8 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
tabs.add(configurationTab);
- driftTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.DRIFT), new
ViewName(Tab.DRIFT, MSG
- .view_tabs_common_drift()), "subsystems/drift/Drift_16.png");
+ driftTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.DRIFT), new
ViewName(Tab.DRIFT,
+ MSG.view_tabs_common_drift()), "subsystems/drift/Drift_16.png");
// TODO: Experimenting with not shoing a drift history tab and having all
resource level drift viewing
// go through the comprehensive drift carousel view. Leave it in, but commented,
in case we want it back.
//this.driftHistory = new SubTab(driftTab.extendLocatorId(DriftSubTab.HISTORY),
new ViewName(DriftSubTab.HISTORY,
@@ -252,16 +253,16 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
driftTab.registerSubTabs(driftDefinitions);
tabs.add(driftTab);
- contentTab = new TwoLevelTab(getTabSet().extendLocatorId("Content"),
new ViewName("Content", MSG
- .view_tabs_common_content()),
"subsystems/content/Content_grey_16.png");
- this.contentDeployed = new
SubTab(contentTab.extendLocatorId("Deployed"), new
ViewName("Deployed", MSG
- .view_tabs_common_deployed()), null);
+ contentTab = new TwoLevelTab(getTabSet().extendLocatorId("Content"),
new ViewName("Content",
+ MSG.view_tabs_common_content()),
"subsystems/content/Content_grey_16.png");
+ this.contentDeployed = new
SubTab(contentTab.extendLocatorId("Deployed"), new
ViewName("Deployed",
+ MSG.view_tabs_common_deployed()), null);
this.contentNew = new SubTab(contentTab.extendLocatorId("New"), new
ViewName("New", MSG.common_button_new()),
null);
this.contentSubscrip = new
SubTab(contentTab.extendLocatorId("Subscriptions"), new
ViewName("Subscriptions",
MSG.view_tabs_common_subscriptions()), null);
- this.contentHistory = new SubTab(contentTab.extendLocatorId("History"),
new ViewName("History", MSG
- .view_tabs_common_history()), null);
+ this.contentHistory = new SubTab(contentTab.extendLocatorId("History"),
new ViewName("History",
+ MSG.view_tabs_common_history()), null);
contentTab.registerSubTabs(contentDeployed, contentNew, contentSubscrip,
contentHistory);
tabs.add(contentTab);
@@ -499,8 +500,8 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
private void updateConfigurationTabContent(final ResourceComposite resourceComposite,
final Resource resource,
ResourcePermission resourcePermissions, Set<ResourceTypeFacet> facets) {
- if (updateTab(this.configurationTab,
facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions
- .isConfigureRead())) {
+ if (updateTab(this.configurationTab,
facets.contains(ResourceTypeFacet.CONFIGURATION),
+ resourcePermissions.isConfigureRead())) {
updateSubTab(this.configurationTab, this.configCurrent, true, true, new
ViewFactory() {
@Override
@@ -536,8 +537,7 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.driftTab, this.driftDefinitions, true, true, new
ViewFactory() {
@Override
public Canvas createView() {
- return ResourceDriftDefinitionsView
- .get(driftDefinitions.extendLocatorId("View"),
resourceComposite);
+ return
ResourceDriftDefinitionsView.get(driftDefinitions.extendLocatorId("View"),
resourceComposite);
}
});
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
index 4abfb0e..ba08d3c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
@@ -27,13 +27,13 @@ import com.smartgwt.client.widgets.events.MouseOverHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
@@ -94,7 +94,7 @@ public class AvailabilityBarView extends HLayout {
widthString = "2px";
}
- String imagePath = a.getAvailabilityType() == AvailabilityType.UP ?
"availBar/up.png" : "availBar/down.png";
+ String imagePath =
ImageManager.getAvailBarImagePath(a.getAvailabilityType());
final Img section = new Img(imagePath);
section.setHeight(28);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/availBar/disabled.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/availBar/disabled.png
new file mode 100644
index 0000000..603506e
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/availBar/disabled.png differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16.png
new file mode 100644
index 0000000..8182778
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16_Disabled.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16_Disabled.png
new file mode 100644
index 0000000..8e1ff7d
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_16_Disabled.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_24.png
new file mode 100644
index 0000000..a6c61e9
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_orange_24.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_16.png
new file mode 100644
index 0000000..73b5f6b
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_16.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_24.png
new file mode 100644
index 0000000..3a56b8d
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_disabled_24.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_16.png
new file mode 100644
index 0000000..a925aaf
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_16.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_24.png
new file mode 100644
index 0000000..fc8583f
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_disabled_24.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_16.png
new file mode 100644
index 0000000..a925aaf
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_16.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_24.png
new file mode 100644
index 0000000..6c37504
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_unknown_24.png
differ
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/availability/data.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/availability/data.xhtml
index 3e01210..b747654 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/availability/data.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/availability/data.xhtml
@@ -1,71 +1,74 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:c="http://java.sun.com/jstl/core"
-
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
-
xmlns:onc="http://jboss.org/on/component"
-
xmlns:onf="http://jboss.org/on/function">
-
-<ui:composition>
-
-<c:if test="#{not empty AvailabilityUIBean.data}">
-<table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td>
- <font class="BoldText">
- <h:outputFormat
value="#{msg['resource.common.monitor.visibility.availability.value']}">
- <f:param value="#{AvailabilityUIBean.percentage}" />
- </h:outputFormat>
- </font>
- <font class="FooterSmall">
- <h:outputFormat
value="#{msg['resource.common.monitor.visibility.availability.timeframeShown']}"
/>
- </font>
- </td>
- </tr>
- <tr>
- <td>
- <table cellpadding="0" cellspacing="0"
border="0">
- <tr>
- <td width="8">
- <img src="/images/timeline_ul.gif"
height="10"/>
- <div id="charttop"></div>
- </td>
- <c:forEach var="avail"
items="#{AvailabilityUIBean.data}" varStatus="status">
- <c:set var="count" value="#{status.index}"/>
- <ui:param name="formattedTimestamp"
value="#{onf:formatTimestamp(avail.timestamp)}"/>
- <td width="9">
- <div
onmouseover="overlay.moveOverlay(this);overlay.showTimePopup('#{count}','#{formattedTimestamp}')"
>
- <c:choose>
- <c:when test="#{avail.value == 1}">
- <img src="/images/timeline_green.gif"
height="10" width="9" border="0" title="UP"/>
- </c:when>
- <c:when test="#{avail.value == 0 and
avail.known}">
- <img src="/images/timeline_red.gif"
height="10" width="9" border="0"
title="DOWN"/>
- </c:when>
- <c:otherwise>
- <img src="/images/timeline_unknown.gif"
height="10" width="9" border="0"
title="UNKNOWN"/>
- </c:otherwise>
- </c:choose>
- </div>
- </td>
- </c:forEach>
- <td width="10" align="left">
- <img src="/images/timeline_ur.gif"
height="10"/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-</c:if>
-
-</ui:composition>
-
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:c="http://java.sun.com/jstl/core"
+
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+
xmlns:onc="http://jboss.org/on/component"
+
xmlns:onf="http://jboss.org/on/function">
+
+<ui:composition>
+
+<c:if test="#{not empty AvailabilityUIBean.data}">
+<table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td>
+ <font class="BoldText">
+ <h:outputFormat
value="#{msg['resource.common.monitor.visibility.availability.value']}">
+ <f:param value="#{AvailabilityUIBean.percentage}" />
+ </h:outputFormat>
+ </font>
+ <font class="FooterSmall">
+ <h:outputFormat
value="#{msg['resource.common.monitor.visibility.availability.timeframeShown']}"
/>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellpadding="0" cellspacing="0"
border="0">
+ <tr>
+ <td width="8">
+ <img src="/images/timeline_ul.gif"
height="10"/>
+ <div id="charttop"></div>
+ </td>
+ <c:forEach var="avail"
items="#{AvailabilityUIBean.data}" varStatus="status">
+ <c:set var="count" value="#{status.index}"/>
+ <ui:param name="formattedTimestamp"
value="#{onf:formatTimestamp(avail.timestamp)}"/>
+ <td width="9">
+ <div
onmouseover="overlay.moveOverlay(this);overlay.showTimePopup('#{count}','#{formattedTimestamp}')"
>
+ <c:choose>
+ <c:when test="#{avail.value == 1}">
+ <img src="/images/timeline_green.gif"
height="10" width="9" border="0" title="UP"/>
+ </c:when>
+ <c:when test="#{avail.value == 0 and
avail.known}">
+ <img src="/images/timeline_red.gif"
height="10" width="9" border="0"
title="DOWN"/>
+ </c:when>
+ <c:when test="#{avail.value == 3 and
avail.known}">
+ <img src="/images/timeline_yellow.gif"
height="10" width="9" border="0"
title="DISABLED"/>
+ </c:when>
+ <c:otherwise>
+ <img src="/images/timeline_unknown.gif"
height="10" width="9" border="0"
title="UNKNOWN"/>
+ </c:otherwise>
+ </c:choose>
+ </div>
+ </td>
+ </c:forEach>
+ <td width="10" align="left">
+ <img src="/images/timeline_ur.gif"
height="10"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</c:if>
+
+</ui:composition>
+
</html>
\ No newline at end of file
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index 8627824..f762c2c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -209,7 +209,7 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
long totalMillis = fullRangeEndTime - fullRangeBeginTime;
long perPointMillis = totalMillis / numberOfPoints;
for (int i = numberOfPoints; i >= 0; i--) {
- availabilityPoints.add(new AvailabilityPoint(i * perPointMillis));
+ availabilityPoints.add(new AvailabilityPoint(AvailabilityType.UNKNOWN, i
* perPointMillis));
}
Collections.reverse(availabilityPoints);
@@ -258,13 +258,16 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
long currentTime = fullRangeEndTime;
int currentAvailabilityIndex = availabilities.size() - 1;
long timeUpInDataPoint = 0;
+ long timeDisabledInDataPoint = 0;
boolean hasDownPeriods = false;
+ boolean hasDisabledPeriods = false;
+ boolean hasUnknownPeriods = false;
long dataPointStartBarrier = fullRangeEndTime - perPointMillis;
while (currentTime > fullRangeBeginTime) {
if (currentAvailabilityIndex <= -1) {
// no more availability data, the rest of the data points are unknown
- availabilityPoints.add(new AvailabilityPoint(currentTime));
+ availabilityPoints.add(new AvailabilityPoint(AvailabilityType.UNKNOWN,
currentTime));
currentTime -= perPointMillis;
continue;
}
@@ -272,36 +275,64 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
Availability currentAvailability =
availabilities.get(currentAvailabilityIndex);
long availabilityStartBarrier =
currentAvailability.getStartTime().getTime();
- if (dataPointStartBarrier >= availabilityStartBarrier) { // the start of
the data point comes first or at same time as availability record (remember, we are going
backwards in time)
+ // the start of the data point comes first or at same time as availability
record (remember, we are going
+ // backwards in time)
+ if (dataPointStartBarrier >= availabilityStartBarrier) {
// end the data point
if (currentAvailability.getAvailabilityType() == null) {
- // we are on the edge of the range, but know that at least one point
there was red, so
- // we'll be pessimistic and set our entire point down instead of
unknown
+ // we are on the edge of the range, the null avail type means we have
an unknown period for
+ // this data point. Be pessimistic, if we have had any down time,
set to down, then disabled,
+ // then up, and finally unknown.
if (hasDownPeriods) {
availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.DOWN, currentTime));
+
+ } else if (hasDisabledPeriods) {
+ availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.DISABLED, currentTime));
+
+ } else if (timeUpInDataPoint > 0) {
+ availabilityPoints.add(new AvailabilityPoint(AvailabilityType.UP,
currentTime));
+
} else {
- // we are on the edge of the range - if we have ANY data saying
we were UP, consider this UP
- if (timeUpInDataPoint > 0) {
- availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.UP, currentTime));
- } else {
- // happens when this timeslice only has surrogates or known
avails
- availabilityPoints.add(new AvailabilityPoint(currentTime));
// unknown
- }
+ availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.UNKNOWN, currentTime));
}
} else {
- // if the resource has been up in the current time frame, bump up the
counter
- if (currentAvailability.getAvailabilityType() == AvailabilityType.UP)
{
+ // bump up the proper counter or set the proper flag for the current
time frame
+ switch (currentAvailability.getAvailabilityType()) {
+ case UP:
timeUpInDataPoint += currentTime - dataPointStartBarrier;
+ break;
+ case DOWN:
+ hasDownPeriods = true;
+ break;
+ case DISABLED:
+ hasDisabledPeriods = true;
+ break;
+ case UNKNOWN:
+ hasUnknownPeriods = true;
+ break;
}
- AvailabilityType type = (timeUpInDataPoint != perPointMillis) ?
AvailabilityType.DOWN
- : AvailabilityType.UP;
- availabilityPoints.add(new AvailabilityPoint(type, currentTime));
+ // if the period has been all green then set it to UP, otherwise, be
pessimistic if there is any
+ // mix of avail types
+ if (timeUpInDataPoint == perPointMillis) {
+ availabilityPoints.add(new AvailabilityPoint(AvailabilityType.UP,
currentTime));
+
+ } else if (hasDownPeriods) {
+ availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.DOWN, currentTime));
+
+ } else if (hasDisabledPeriods) {
+ availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.DISABLED, currentTime));
+
+ } else {
+ availabilityPoints.add(new
AvailabilityPoint(AvailabilityType.UNKNOWN, currentTime));
+ }
}
timeUpInDataPoint = 0;
hasDownPeriods = false;
+ hasDisabledPeriods = false;
+ hasUnknownPeriods = false;
// if we reached the start of the current availability record, move to
the previous one (going back in time, remember)
if (dataPointStartBarrier == availabilityStartBarrier) {
@@ -311,6 +342,7 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
// move the current time pointer to the next data point and move back to
the next data point start time
currentTime = dataPointStartBarrier;
dataPointStartBarrier -= perPointMillis;
+
} else { // the end of the availability record comes first, in the middle of
a data point
// if the resource has been up in the current time frame, bump up the
counter
@@ -340,12 +372,14 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
AvailabilityType newFirstAvailabilityType =
oldFirstAvailabilityPoint.getAvailabilityType();
if (context.type == EntityContext.Type.Resource) {
newFirstAvailabilityType = getCurrentAvailabilityTypeForResource(subject,
context.resourceId);
+
} else if (context.type == EntityContext.Type.ResourceGroup) {
ResourceGroupComposite composite =
resourceGroupManager.getResourceGroupComposite(subject,
context.groupId);
Double firstAvailability = composite.getExplicitAvail();
newFirstAvailabilityType = firstAvailability == null ? null
: (firstAvailability == 1.0 ? AvailabilityType.UP :
AvailabilityType.DOWN);
+
} else {
// March 20, 2009: we only support the "summary area" for
resources and resourceGroups to date
// as a result, newFirstAvailabilityType will be a pass-through of the
type in oldFirstAvailabilityPoint
@@ -517,13 +551,12 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
// update the last known availability data for this resource
ResourceAvailability currentAvailability =
resourceAvailabilityManager.getLatestAvailability(reported
.getResource().getId());
- if (currentAvailability!=null &&
currentAvailability.getAvailabilityType() != reported.getAvailabilityType()) {
+ if (currentAvailability != null &&
currentAvailability.getAvailabilityType() != reported.getAvailabilityType()) {
// but only update the record if necessary (if the AvailabilityType changed)
currentAvailability.setAvailabilityType(reported.getAvailabilityType());
entityManager.merge(currentAvailability);
- }
- else if (currentAvailability==null) {
- currentAvailability = new
ResourceAvailability(reported.getResource(),reported.getAvailabilityType());
+ } else if (currentAvailability == null) {
+ currentAvailability = new ResourceAvailability(reported.getResource(),
reported.getAvailabilityType());
entityManager.persist(currentAvailability);
}
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
index df5d389..a7075c4 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.measurement;
import java.io.Serializable;
import java.util.Date;
+
import org.rhq.core.domain.measurement.AvailabilityType;
/**
@@ -34,50 +35,34 @@ import org.rhq.core.domain.measurement.AvailabilityType;
public class AvailabilityPoint implements Serializable {
private static final long serialVersionUID = 1L;
- private final int value;
+ private final AvailabilityType availabilityType;
private final long timestamp;
- private final boolean known;
- /**
- * Creates an availability point with an explicitly known value.
- *
- * @param value the availability status
- * @param timestamp the time when the resource was in the given availability status
- */
- public AvailabilityPoint(AvailabilityType value, long timestamp) {
- if (value != null) {
- this.value = value.ordinal();
- this.timestamp = timestamp;
- this.known = true;
- } else {
- this.value = AvailabilityType.DOWN.ordinal();
- this.timestamp = timestamp;
- this.known = false;
- }
- }
+ // for back compat with portal war
+ private final int value;
/**
- * Creates an availability point with an unknown value (whose {@link
#getAvailabilityType()} will return
- * {@link AvailabilityType#DOWN}.
+ * Creates an availability point with an explicitly known value.
*
+ * @param availabilityType the availability type. if null set to UNKNOWN
* @param timestamp the time when the resource was in the given availability status
*/
- public AvailabilityPoint(long timestamp) {
- this.value = AvailabilityType.DOWN.ordinal();
+ public AvailabilityPoint(AvailabilityType availabilityType, long timestamp) {
+ this.availabilityType = (null == availabilityType) ? AvailabilityType.UNKNOWN :
availabilityType;
this.timestamp = timestamp;
- this.known = false;
+
+ this.value = this.availabilityType.ordinal();
}
/**
- * Returns <code>true</code> if the availability data is explicitly
known. If <code>false</code>, there was no
- * explicit data in the database that indicated an availability, so the
resource's availability will be assumed to
- * be DOWN.
+ * Returns <code>true</code> if the availability type is explicitly
known. If <code>false</code>, there was no
+ * explicit data in the database that indicated an availability.
*
* @return <code>true</code> if {@link #getAvailabilityType()} returns a
status that is explicitly known about the
* resource
*/
public boolean isKnown() {
- return known;
+ return (AvailabilityType.UNKNOWN != availabilityType);
}
/**
@@ -90,27 +75,17 @@ public class AvailabilityPoint implements Serializable {
}
public AvailabilityType getAvailabilityType() {
- return AvailabilityType.values()[this.value];
+ return availabilityType;
}
- /**
- * Returns the ordinal value of the {@link #getAvailabilityType() availability
type}.
- *
- * @return availability type ordinal value
- *
- * @see #getAvailabilityType()
- */
+ // for back compat with portal war
public int getValue() {
- return this.value;
+ return value;
}
public String toString() {
StringBuilder str = new StringBuilder("AvailabilityPoint ");
- str.append("value=[" + this.value);
- if (!this.known) {
- str.append('?');
- }
-
+ str.append("value=[" + this.availabilityType.name());
str.append("], timestamp=[" + this.timestamp);
str.append("(" + new Date(this.timestamp) + ")]");
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index 82a91dc..eb493c3 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -210,7 +210,7 @@ public class ResourceGroupManagerBean implements
ResourceGroupManagerLocal, Reso
//owns the relationship. Let's make sure we don't change the assigned
roles here.
group.getRoles().clear();
group.getRoles().addAll(attachedGroup.getRoles());
-
+
if (changeType == null) {
changeType = RecursivityChangeType.None;
if (attachedGroup.isRecursive() == true && group.isRecursive() ==
false) {
@@ -1156,9 +1156,16 @@ public class ResourceGroupManagerBean implements
ResourceGroupManagerLocal, Reso
try {
while (rs.next()) {
long explicitCount = rs.getLong(1);
- double explicitAvail = rs.getDouble(2);
+ long explicitUpCount = rs.getLong(2);
+ //double explicitAvail = rs.getDouble(2);
long implicitCount = rs.getLong(3);
- double implicitAvail = rs.getDouble(4);
+ long implicitUpCount = rs.getLong(4);
+ //double implicitAvail = rs.getDouble(4);
+ // In the past we had only DOWN/0 and UP/1 avails/ordinal and and the
avails were just averages.
+ // Now we have DISABLED and UNKNOWN. So group avail is done
differently, instead of an indication
+ // of UP vs DOWN it is now UP vs NOT UP (not up is every other
avail).
+ double explicitAvail = (explicitCount > 0) ? (explicitUpCount /
explicitCount) : 0D;
+ double implicitAvail = (implicitCount > 0) ? (implicitUpCount /
implicitCount) : 0D;
int groupKey = rs.getInt(5);
Object[] next = new Object[] { explicitCount, explicitAvail,
implicitCount, implicitAvail, groupKey };
rawResults.add(next);
@@ -1358,12 +1365,14 @@ public class ResourceGroupManagerBean implements
ResourceGroupManagerLocal, Reso
String queryString = "SELECT \n" //
+ " (SELECT count(er) "
+ " FROM ResourceGroup g JOIN g.explicitResources er where g.id =
:groupId),\n"
- + " (SELECT avg(er.currentAvailability.availabilityType) "
- + " FROM ResourceGroup g JOIN g.explicitResources er where g.id =
:groupId) AS eavail,\n"
+ + " (SELECT count(er) "
+ + " FROM ResourceGroup g JOIN g.explicitResources er where g.id =
:groupId"
+ + " AND er.currentAvailability.availabilityType = 1 ),\n"
+ " (SELECT count(ir) "
+ " FROM ResourceGroup g JOIN g.implicitResources ir where g.id =
:groupId),\n"
- + " (SELECT avg(ir.currentAvailability.availabilityType) "
- + " FROM ResourceGroup g JOIN g.implicitResources ir where g.id =
:groupId), g \n"
+ + " (SELECT count(ir) "
+ + " FROM ResourceGroup g JOIN g.implicitResources ir where g.id =
:groupId"
+ + " AND ir.currentAvailability.availabilityType = 1 ), g
\n"
+ "FROM ResourceGroup g where g.id = :groupId";
Query query = entityManager.createQuery(queryString);
@@ -1389,12 +1398,18 @@ public class ResourceGroupManagerBean implements
ResourceGroupManagerLocal, Reso
ResourceGroupComposite composite = null;
if (((Number) data[2]).longValue() > 0) {
- composite = new ResourceGroupComposite( //
- ((Number) data[0]).longValue(), //
- data[1] == null ? 0.0 : ((Number) data[1]).doubleValue(), //
- ((Number) data[2]).longValue(), //
- data[3] == null ? 0.0 : ((Number) data[3]).doubleValue(), //
- group, facets);
+ long explicitCount = ((Number) data[0]).longValue();
+ long explicitUpCount = ((Number) data[1]).longValue();
+ long implicitCount = ((Number) data[2]).longValue();
+ long implicitUpCount = ((Number) data[3]).longValue();
+ // In the past we had only DOWN/0 and UP/1 avails/ordinal and and the avails
were just averages.
+ // Now we have DISABLED and UNKNOWN. So group avail is done differently,
instead of an indication
+ // of UP vs DOWN it is now UP vs NOT UP (not up is every other avail).
+ double explicitAvail = (explicitCount > 0) ? (explicitUpCount /
explicitCount) : 0D;
+ double implicitAvail = (implicitCount > 0) ? (implicitUpCount /
implicitCount) : 0D;
+
+ composite = new ResourceGroupComposite(explicitCount, explicitAvail,
implicitCount, implicitAvail, group,
+ facets);
} else {
composite = new ResourceGroupComposite(0L, 0.0, 0L, 0.0, group, facets);
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
index 2aacc14..480c97f 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
@@ -484,9 +484,13 @@ public class ExpressionEvaluator implements
Iterable<ExpressionEvaluator.Result>
type = AvailabilityType.UP;
} else if ("down".equalsIgnoreCase(value)) {
type = AvailabilityType.DOWN;
+ } else if ("disabled".equalsIgnoreCase(value)) {
+ type = AvailabilityType.DISABLED;
+ } else if ("unknown".equalsIgnoreCase(value)) {
+ type = AvailabilityType.UNKNOWN;
} else {
throw new InvalidExpressionException("Invalid
'resource.availability' comparision value, "
- + "only 'UP' and 'DOWN' are valid
values");
+ + "only
'UP''DOWN''DISABLED''UNKNOWN' are valid values");
}
}
addJoinCondition(JoinCondition.AVAILABILITY);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index 492a700..f816e20 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -60,6 +60,8 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
private static final AvailabilityType UP = AvailabilityType.UP;
private static final AvailabilityType DOWN = AvailabilityType.DOWN;
+ private static final AvailabilityType DISABLED = AvailabilityType.DISABLED;
+ private static final AvailabilityType UNKNOWN = AvailabilityType.UNKNOWN;
private AvailabilityManagerLocal availabilityManager;
private ResourceAvailabilityManagerLocal resourceAvailabilityManager;
@@ -276,9 +278,9 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(), 1,
System.currentTimeMillis(), 3, false);
assert availPoints.size() == 3 : "There is no avail data, but should
still get 3 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal(); // aka unknown
- assert availPoints.get(1).getValue() == DOWN.ordinal(); // aka unknown
- assert availPoints.get(2).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(0).getAvailabilityType() == UNKNOWN;
+ assert availPoints.get(1).getAvailabilityType() == UNKNOWN;
+ assert availPoints.get(2).getAvailabilityType() == UNKNOWN;
long startMillis = 60000;
Date startDate = new Date(startMillis);
@@ -290,58 +292,58 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(), startMillis,
startMillis + 10000, 3, false);
assert availPoints.size() == 3 : "There is 1 avail data, but should
still get 3 availability points";
- assert availPoints.get(0).getValue() == UP.ordinal();
- assert availPoints.get(1).getValue() == UP.ordinal();
- assert availPoints.get(2).getValue() == UP.ordinal();
+ assert availPoints.get(0).getAvailabilityType() == UP;
+ assert availPoints.get(1).getAvailabilityType() == UP;
+ assert availPoints.get(2).getAvailabilityType() == UP;
// our avail data point is right on the end edge
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(),
startMillis - 3, startMillis, 3, false);
assert availPoints.size() == 3 : "There is 1 avail data, but should
still get 3 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(0).getAvailabilityType() == DOWN; // aka unknown
assert !availPoints.get(0).isKnown() : availPoints;
- assert availPoints.get(1).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(1).getAvailabilityType() == DOWN; // aka unknown
assert !availPoints.get(1).isKnown() : availPoints;
- assert availPoints.get(2).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(2).getAvailabilityType() == DOWN; // aka unknown
assert !availPoints.get(2).isKnown() : availPoints;
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(),
startMillis - 20000, startMillis + 10000, 3, false);
assert availPoints.size() == 3 : "There is 1 avail data, but should
still get 3 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(0).getAvailabilityType() == UNKNOWN;
assert !availPoints.get(0).isKnown() : availPoints;
- assert availPoints.get(1).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(1).getAvailabilityType() == UNKNOWN;
assert !availPoints.get(1).isKnown() : availPoints;
- assert availPoints.get(2).getValue() == UP.ordinal();
+ assert availPoints.get(2).getAvailabilityType() == UP;
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(),
startMillis - 10000, startMillis + 20000, 3, false);
assert availPoints.size() == 3 : "There is 1 avail data, but should
still get 3 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal(); // aka unknown
+ assert availPoints.get(0).getAvailabilityType() == UNKNOWN;
assert !availPoints.get(0).isKnown() : availPoints;
- assert availPoints.get(1).getValue() == UP.ordinal();
+ assert availPoints.get(1).getAvailabilityType() == UP;
assert availPoints.get(1).isKnown() : availPoints;
- assert availPoints.get(2).getValue() == UP.ordinal();
+ assert availPoints.get(2).getAvailabilityType() == UP;
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(),
startMillis - 20000, startMillis + 20000, 10, false);
assert availPoints.size() == 10 : "There is 1 avail data, but should
still get 10 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal() : availPoints; // aka
unknown
+ assert availPoints.get(0).getAvailabilityType() == UNKNOWN : availPoints;
assert !availPoints.get(0).isKnown() : availPoints;
- assert availPoints.get(1).getValue() == DOWN.ordinal() : availPoints;
+ assert availPoints.get(1).getAvailabilityType() == DOWN : availPoints;
assert !availPoints.get(1).isKnown() : availPoints;
- assert availPoints.get(2).getValue() == DOWN.ordinal() : availPoints;
+ assert availPoints.get(2).getAvailabilityType() == DOWN : availPoints;
assert !availPoints.get(2).isKnown() : availPoints;
- assert availPoints.get(3).getValue() == DOWN.ordinal() : availPoints;
+ assert availPoints.get(3).getAvailabilityType() == DOWN : availPoints;
assert !availPoints.get(3).isKnown() : availPoints;
- assert availPoints.get(4).getValue() == DOWN.ordinal() : availPoints;
+ assert availPoints.get(4).getAvailabilityType() == DOWN : availPoints;
assert !availPoints.get(4).isKnown() : availPoints;
- assert availPoints.get(5).getValue() == UP.ordinal() : availPoints;
+ assert availPoints.get(5).getAvailabilityType() == UP : availPoints;
assert availPoints.get(5).isKnown() : availPoints;
- assert availPoints.get(6).getValue() == UP.ordinal() : availPoints;
- assert availPoints.get(7).getValue() == UP.ordinal() : availPoints;
- assert availPoints.get(8).getValue() == UP.ordinal() : availPoints;
- assert availPoints.get(9).getValue() == UP.ordinal() : availPoints;
+ assert availPoints.get(6).getAvailabilityType() == UP : availPoints;
+ assert availPoints.get(7).getAvailabilityType() == UP : availPoints;
+ assert availPoints.get(8).getAvailabilityType() == UP : availPoints;
+ assert availPoints.get(9).getAvailabilityType() == UP : availPoints;
report = new AvailabilityReport(false, theAgent.getName());
report.addAvailability(new Availability(theResource, new
Date(startDate.getTime() + 10000), DOWN));
@@ -358,31 +360,31 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(),
startMillis - 15000, startMillis + 35000, 5, false);
assert availPoints.size() == 5 : "There is 1 avail data, but should
still get 5 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal() : availPoints; //
45000-55000 == unknown=down
+ assert availPoints.get(0).getAvailabilityType() == UNKNOWN : availPoints; //
45000-55000 == unknown
assert !availPoints.get(0).isKnown() : availPoints;
// this next point is on the edge - part was unknown, part was up - because
its on the edge, and part of it
// was UP, we consider the data point UP
- assert availPoints.get(1).getValue() == UP.ordinal() : availPoints; //
55000-65000 == 55-60=unknown=down, 60-70=up
+ assert availPoints.get(1).getAvailabilityType() == UP : availPoints; //
55000-65000 == 55-60=unknown=down, 60-70=up
assert availPoints.get(1).isKnown() : availPoints;
- assert availPoints.get(2).getValue() == DOWN.ordinal() : availPoints; //
65000-75000 == 60-70=up, 70-80=down (0.5==down)
- assert availPoints.get(3).getValue() == DOWN.ordinal() : availPoints; //
75000-85000, 0.5 == down
- assert availPoints.get(4).getValue() == DOWN.ordinal() : availPoints; //
85000-95000, 0.5 == down
+ assert availPoints.get(2).getAvailabilityType() == DOWN : availPoints; //
65000-75000 == 60-70=up, 70-80=down (0.5==down)
+ assert availPoints.get(3).getAvailabilityType() == DOWN : availPoints; //
75000-85000, 0.5 == down
+ assert availPoints.get(4).getAvailabilityType() == DOWN : availPoints; //
85000-95000, 0.5 == down
availPoints = availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(),
startMillis - 30000, startMillis + 30000, 10, false);
assert availPoints.size() == 10 : "There is 1 avail data, but should
still get 10 availability points";
- assert availPoints.get(0).getValue() == DOWN.ordinal() : availPoints;
- assert availPoints.get(1).getValue() == DOWN.ordinal() : availPoints;
- assert availPoints.get(2).getValue() == DOWN.ordinal() : availPoints;
- assert availPoints.get(3).getValue() == DOWN.ordinal() : availPoints;
- assert availPoints.get(4).getValue() == DOWN.ordinal() : availPoints;
- assert availPoints.get(5).getValue() == UP.ordinal() : availPoints;
- assert availPoints.get(6).getValue() == DOWN.ordinal() : availPoints; // 0.5
- assert availPoints.get(7).getValue() == DOWN.ordinal() : availPoints;
- assert availPoints.get(8).getValue() == DOWN.ordinal() : availPoints; // 0.5
- assert availPoints.get(9).getValue() == UP.ordinal() : availPoints;
+ assert availPoints.get(0).getAvailabilityType() == DOWN : availPoints;
+ assert availPoints.get(1).getAvailabilityType() == DOWN : availPoints;
+ assert availPoints.get(2).getAvailabilityType() == DOWN : availPoints;
+ assert availPoints.get(3).getAvailabilityType() == DOWN : availPoints;
+ assert availPoints.get(4).getAvailabilityType() == DOWN : availPoints;
+ assert availPoints.get(5).getAvailabilityType() == UP : availPoints;
+ assert availPoints.get(6).getAvailabilityType() == DOWN : availPoints; //
0.5
+ assert availPoints.get(7).getAvailabilityType() == DOWN : availPoints;
+ assert availPoints.get(8).getAvailabilityType() == DOWN : availPoints; //
0.5
+ assert availPoints.get(9).getAvailabilityType() == UP : availPoints;
} catch (Exception e) {
e.printStackTrace();
throw e;
@@ -860,11 +862,11 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
List<AvailabilityPoint> points =
availabilityManager.findAvailabilitiesForResource(overlord,
theResource.getId(), date1.getTime(), date6.getTime(), 5, false);
assert points.size() == 5;
- assert points.get(0).getValue() == 1;
- assert points.get(1).getValue() == 0;
- assert points.get(2).getValue() == 1;
- assert points.get(3).getValue() == 0;
- assert points.get(4).getValue() == 1;
+ assert points.get(0).getAvailabilityType() == UP;
+ assert points.get(1).getAvailabilityType() == DOWN;
+ assert points.get(2).getAvailabilityType() == UP;
+ assert points.get(3).getAvailabilityType() == DOWN;
+ assert points.get(4).getAvailabilityType() == UP;
} catch (Exception e) {
e.printStackTrace();
throw e;
@@ -1075,17 +1077,19 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
time.getTime(), time.getTime() + 1, 1, false);
assert list != null;
assert list.size() == 1 : "Should have returned a single point";
- int typeOrdinal = list.get(0).getValue();
+ AvailabilityType type = list.get(0).getAvailabilityType();
- if (UP.ordinal() == typeOrdinal) {
- return UP;
- }
+ switch (type) {
+ case UP:
+ case DOWN:
+ case DISABLED:
+ case UNKNOWN:
+ return type;
- if (DOWN.ordinal() == typeOrdinal) {
- return DOWN;
+ default:
+ assert false : "AvailabilityType enum has some additional values not
known to this test: " + type;
}
- assert false : "AvailabilityType enum has some additional values not known
to this test: " + typeOrdinal;
return null;
}
diff --git
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/NetworkAdapterComponent.java
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/NetworkAdapterComponent.java
index fe9e282..ece65ac 100644
---
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/NetworkAdapterComponent.java
+++
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/NetworkAdapterComponent.java
@@ -1,100 +1,104 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.plugins.platform;
-
-import java.net.InetAddress;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.rhq.core.pluginapi.util.ObjectUtil;
-import org.rhq.core.system.NetworkAdapterInfo;
-import org.rhq.core.system.NetworkAdapterStats;
-
-public class NetworkAdapterComponent implements
ResourceComponent<PlatformComponent>, MeasurementFacet {
- private final Log log = LogFactory.getLog(NetworkAdapterComponent.class);
-
- private ResourceContext<PlatformComponent> context;
-
- public void start(ResourceContext<PlatformComponent> resourceContext) {
- this.context = resourceContext;
- }
-
- public void stop() {
- }
-
- public AvailabilityType getAvailability() {
- if (getInfo().getOperationalStatus() == NetworkAdapterInfo.OperationState.UP) {
- return AvailabilityType.UP;
- }
-
- return AvailabilityType.DOWN;
- }
-
- private NetworkAdapterInfo getInfo() {
- for (NetworkAdapterInfo info :
this.context.getSystemInformation().getAllNetworkAdapters()) {
- if (context.getResourceKey().equals(info.getName())) {
- return info;
- }
- }
-
- throw new RuntimeException("Could not find network adapter info [" +
context.getResourceKey() + "]");
- }
-
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
metrics) {
- NetworkAdapterInfo info = getInfo();
- NetworkAdapterStats stats =
this.context.getSystemInformation().getNetworkAdapterStats(info.getName());
-
- for (MeasurementScheduleRequest request : metrics) {
- String property = request.getName();
-
- if (property.startsWith("Trait.net4.address")) // TODO
- { // this trait is supported regardless of having native support or not
- List<InetAddress> addrs = info.getUnicastAddresses();
- String ifAddrs = (addrs.size() > 0) ? addrs.get(0).getHostAddress() :
"";
- for (int i = 1; i < addrs.size(); i++) {
- ifAddrs += "," + addrs.get(i).getHostAddress();
- }
-
- report.addData(new MeasurementDataTrait(request, ifAddrs));
- } else if (property.equals("Trait.interfaceFlags")) {
- report.addData(new MeasurementDataTrait(request, info.getAllFlags()));
- } else {
- Number number = ((Number) ObjectUtil.lookupAttributeProperty(stats,
request.getName()));
- if (number != null) {
- report.addData(new MeasurementDataNumeric(request,
number.doubleValue()));
- }
- }
- }
-
- return;
- }
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.plugins.platform;
+
+import java.net.InetAddress;
+import java.util.List;
+import java.util.Set;
+
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.util.ObjectUtil;
+import org.rhq.core.system.NetworkAdapterInfo;
+import org.rhq.core.system.NetworkAdapterStats;
+
+public class NetworkAdapterComponent implements
ResourceComponent<PlatformComponent>, MeasurementFacet {
+ //private final Log log = LogFactory.getLog(NetworkAdapterComponent.class);
+
+ private ResourceContext<PlatformComponent> context;
+
+ public void start(ResourceContext<PlatformComponent> resourceContext) {
+ this.context = resourceContext;
+ }
+
+ public void stop() {
+ }
+
+ public AvailabilityType getAvailability() {
+ switch (getInfo().getOperationalStatus()) {
+ case UP:
+ return AvailabilityType.UP;
+ case LOWERLAYERDOWN:
+ return AvailabilityType.DOWN;
+ case UNKNOWN:
+ return AvailabilityType.UNKNOWN;
+ default:
+ return AvailabilityType.DISABLED;
+ }
+ }
+
+ private NetworkAdapterInfo getInfo() {
+ for (NetworkAdapterInfo info :
this.context.getSystemInformation().getAllNetworkAdapters()) {
+ if (context.getResourceKey().equals(info.getName())) {
+ return info;
+ }
+ }
+
+ throw new RuntimeException("Could not find network adapter info [" +
context.getResourceKey() + "]");
+ }
+
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
metrics) {
+ NetworkAdapterInfo info = getInfo();
+ NetworkAdapterStats stats =
this.context.getSystemInformation().getNetworkAdapterStats(info.getName());
+
+ for (MeasurementScheduleRequest request : metrics) {
+ String property = request.getName();
+
+ if (property.startsWith("Trait.net4.address")) // TODO
+ { // this trait is supported regardless of having native support or not
+ List<InetAddress> addrs = info.getUnicastAddresses();
+ String ifAddrs = (addrs.size() > 0) ? addrs.get(0).getHostAddress() :
"";
+ for (int i = 1; i < addrs.size(); i++) {
+ ifAddrs += "," + addrs.get(i).getHostAddress();
+ }
+
+ report.addData(new MeasurementDataTrait(request, ifAddrs));
+ } else if (property.equals("Trait.interfaceFlags")) {
+ report.addData(new MeasurementDataTrait(request, info.getAllFlags()));
+ } else {
+ Number number = ((Number) ObjectUtil.lookupAttributeProperty(stats,
request.getName()));
+ if (number != null) {
+ report.addData(new MeasurementDataNumeric(request,
number.doubleValue()));
+ }
+ }
+ }
+
+ return;
+ }
}
\ No newline at end of file