[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 1 -
1 file changed, 1 deletion(-)
New commits:
commit 40218867d9e9cee5202462c1ac87ca3962fcf590
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 21 14:36:37 2012 -0500
remove erroneous import
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 9a41142..f0a4ac8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -131,7 +131,6 @@ import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QuartzUtil;
-import sun.management.resources.agent;
/**
* The manager responsible for working with Resource and plugin configurations.
12 years, 3 months
[rhq] Branch 'bug/747925' - 5 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java | 47 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 111 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java | 105 +++++++++
7 files changed, 263 insertions(+), 8 deletions(-)
New commits:
commit 1e1b14ece1d3763b2e92ec54d15bf70537068bcc
Merge: d1c93e1 4ad3670
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 21 14:28:40 2012 -0500
Merge remote-tracking branch 'origin/master' into bug/747925
commit 4ad367088998fcb67b0a058c4fb8bd5ed4133838
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Feb 21 13:46:19 2012 -0500
[BZ 781602] Adding logic to keep order of tabs consistent
The set of visible tabs can vary from one resource to another; however,
the order of tabs relative to one another is fixed. For example, the
Operations tab could appear as the 3rd or 4th tab, and it could be the
last tab. Note that it should always appear after the summary,
inventory, monitoring, and events tabs in that order. So if the
monitoring and events tabs are not visible, then the order should be
summary, inventory, operations, etc.
This commit adds an internal data structure to TwoLevelTabSet, similar
to a singly linked list a tab is a list node. Each node maintains two
pointers - one to the next visible tab and one to the next actual tab.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index fa62e45..79afade 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -23,11 +23,14 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/**
- * @author Greg Hinkle
+ * @author John Sanda
* @author Jay Shaughnessy
*/
public class TwoLevelTab extends NamedTab {
private SubTabLayout layout;
+
+ private TwoLevelTab actualNext;
+ private TwoLevelTab visibleNext;
public TwoLevelTab(String locatorId, ViewName viewName, String icon) {
super(locatorId, viewName, icon);
@@ -78,6 +81,48 @@ public class TwoLevelTab extends NamedTab {
return layout;
}
+ /**
+ * This is the successor or tab immediately to the right of this tab when all tabs
+ * are visible. The tab to which actualNext refers does not change whereas the tab to
+ * which {@link #getVisibleNext visibleNext} refers can change.
+ *
+ * @return The successor or tab immediately to the right of this tab when all tabs are
+ * visible.
+ */
+ public TwoLevelTab getActualNext() {
+ return actualNext;
+ }
+
+ /**
+ * @param actualNext The successor or tab immediately to the right of this tab when all
+ * tabs are visible. The tab to which actualNext refers does not change whereas the tab
+ * to which {@link #getVisibleNext visibleNext} refers can change.
+ */
+ public void setActualNext(TwoLevelTab actualNext) {
+ this.actualNext = actualNext;
+ }
+
+ /**
+ * The successor or tab immediately to the right of this tab among the set of visible
+ * tabs. The tab to which visibleNext refers can change whereas the tab to which
+ * {@link #getActualNext actualNext} refers will not change.
+ *
+ * @return The successor or tab immediately to the right of this tab among the set of
+ * visible tabs.
+ */
+ public TwoLevelTab getVisibleNext() {
+ return visibleNext;
+ }
+
+ /**
+ * @param visibleNext The successor or tab immediately to the right of this tab among
+ * the set of visible tabs. The tab to which visibleNext refers can change whereas the
+ * tab to which {@link #getActualNext actualNext} refers will not change.
+ */
+ public void setVisibleNext(TwoLevelTab visibleNext) {
+ this.visibleNext = visibleNext;
+ }
+
@Override
public String toString() {
return "TwoLevelTab[title=" + getTitle() + ", locatorId=" + getLocatorId() + "]";
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index 572f035..573c543 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -39,9 +39,19 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
private Map<String, TwoLevelTab> hiddenTabs = new LinkedHashMap<String, TwoLevelTab>();
private boolean ignoreSelectEvents = false;
+
+ private TwoLevelTab head;
+
+ /**
+ * This is the visible tail. Because the actual order of tabs is fixed we know that the
+ * actual tail will always be the content tab.
+ */
+ private TwoLevelTab tail;
public TwoLevelTabSet(String locatorId) {
super(locatorId);
+ // Need to set destroyPanes property to false so that we do not lose tab
+ // content when hiding a tab.
setDestroyPanes(false);
}
@@ -51,10 +61,29 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
tab.getLayout().addTwoLevelTabSelectedHandler(this);
updateTab(tab, tab.getPane());
}
-
+ buildTabList();
addTabSelectedHandler(this);
}
+ /**
+ * This method initializes the head and tail pointers. Then it initializes the
+ * {@link TwoLevelTab#getActualNext actualNext} and {@link TwoLevelTab#getVisibleNext visibleNext}
+ * properties of each tab. This list is built so that when hiding and showing tabs, the
+ * tab order remains consistent. The order of the list is the same as the order of the
+ * tabs passed to {@link #setTabs(TwoLevelTab...)}
+ */
+ private void buildTabList() {
+ TwoLevelTab[] tabs = getTabs();
+ head = tabs[0];
+ tail = tabs[tabs.length - 1];
+ TwoLevelTab current = head;
+ for (int i = 1; i < tabs.length; ++i) {
+ current.setActualNext(tabs[i]);
+ current.setVisibleNext(tabs[i]);
+ current = tabs[i];
+ }
+ }
+
public TwoLevelTab[] getTabs() {
Tab[] tabs = super.getTabs();
TwoLevelTab[] twoLevelTabs = new TwoLevelTab[tabs.length];
@@ -75,9 +104,29 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
if (hiddenTabs.containsKey(tab.getLocatorId())) {
return;
}
+
+ TwoLevelTab visiblePrevious = findClosestVisiblePredecessor(tab);
+ if (visiblePrevious == null) {
+ // if visiblePrevious is null then that means we are updating
+ // then head. Note that as of now (02/21/2012), the visible head,
+ // the summary tab, is fixed, so we don't really need to worry
+ // about updating the head; however, doing so will make it easier
+ // to support things like hiding arbitrary tabs or reordering tabs.
+ head = tab.getVisibleNext();
+
+ } else {
+ visiblePrevious.setVisibleNext(tab.getVisibleNext());
+ // check to see if the tail needs to be updated. If the
+ // following check is true, then that means visiblePrevious is
+ // now the tail.
+ if (visiblePrevious.getVisibleNext() == null) {
+ tail = visiblePrevious;
+ }
+ }
+ tab.setVisibleNext(null);
// Note that removing the tab does *not* destroy its content pane
// since we set the destroyPanes property to false in the
- removeTab(tab);
+ removeTab(tab);
hiddenTabs.put(tab.getLocatorId(), tab);
} else {
if (!hiddenTabs.containsKey(tab.getLocatorId())) {
@@ -85,10 +134,66 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
}
hiddenTabs.remove(tab.getLocatorId());
- addTab(tab);
+ TwoLevelTab successor = findClosestVisibleSuccessor(tab);
+ if (successor == null) {
+ // if successor is null then that means we are updating the tail
+ tail.setVisibleNext(tab);
+ tail = tab;
+ addTab(tab);
+ } else {
+ TwoLevelTab visiblePrevious = findClosestVisiblePredecessor(successor);
+ tab.setVisibleNext(visiblePrevious.getVisibleNext());
+ visiblePrevious.setVisibleNext(tab);
+ addTab(tab, (getTabNumber(visiblePrevious.getID()) + 1));
+ }
}
}
+ /**
+ * Walks the list of tabs to find the closest, visible predecessor.
+ *
+ * @param tab A {@link TwoLevelTab tab} that is currently visible
+ * @return The closest, visible predecessor or null if have the head
+ */
+ private TwoLevelTab findClosestVisiblePredecessor(TwoLevelTab tab) {
+ if (tab == head) {
+ return null;
+ }
+
+ TwoLevelTab current = head;
+ while (current != tab) {
+ // if we have reached the visible tail or the immediate predecessor
+ // of the tab, then return it.
+ if (current.getVisibleNext() == null || current.getVisibleNext() == tab) {
+ return current;
+ }
+ current = current.getVisibleNext();
+ }
+ // Not sure what we should do if we get here. return null for now
+ return null;
+ }
+
+ /**
+ * Walks the list to find the closest, visible successor.
+ *
+ * @param tab A {@link TwoLevelTab tab} that is currently hidden
+ * @return The closest, visisble successor or null if the insertion point
+ * is the tail.
+ */
+ private TwoLevelTab findClosestVisibleSuccessor(TwoLevelTab tab) {
+ TwoLevelTab current = tab;
+ while (current != null) {
+ // Walk the list of tabs until we reach a visible successor or the tail
+ if (current.getVisibleNext() == null && current != tail) {
+ current = current.getActualNext();
+ } else {
+ return current;
+ }
+ }
+ // if we reach this point then that means we will be inserting at the tail
+ return null;
+ }
+
public void destroyViews() {
for (TwoLevelTab tab : getTabs()) {
tab.getLayout().destroyViews();
commit 223f5fdfd7b7c3fbb5510b457a9892fc329fba1b
Merge: fd854c8 03737b1
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 09:40:41 2012 -0800
Merge branch 'BZ691544'
commit 03737b1598b62d8334e1c85391736d9cc66e6d1c
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 09:39:30 2012 -0800
[BZ691544 - Entering very large numbers in Dynagroups Recalculate Interval field causes stack trace] Forgot to comment out foreign resource bundle keys for translation.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index a42707d..c6e8b99 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1133,7 +1133,7 @@ view_dynagroup_permDenied = Sie haben nicht das Recht die Gruppen Definitionen a
##view_dynagroup_recalcSuccessful = You have successfully recalculated this group definition
##view_dynagroup_recalcSuccessfulSelection = You have successfully recalculated [{0}] group definitions
view_dynagroup_recalculate = Neu berechnen
-##view_dynagroup_recalculationInterval = Recalculation Interval
+##view_dynagroup_recalculationInterval = Recalculation Interval (min)
view_dynagroup_recursive = Rekursiv
view_dynagroup_saveAndRecalculate = Speichern & neu berechnen
##view_dynagroup_saveFailure = Failed to save the group definition named [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 41a33be..40d61a4a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1317,7 +1317,7 @@ view_dynagroup_recalcFailureSelection = 選択されたグループ定義を再
view_dynagroup_recalcSuccessful = このグループ定義の再計算が成功しました
view_dynagroup_recalcSuccessfulSelection = [{0}] グループ定義の再計算が成功しました
view_dynagroup_recalculate = 再計算
-view_dynagroup_recalculationInterval = 再計算間隔 (ms)
+#view_dynagroup_recalculationInterval = 再計算間隔 (min)
view_dynagroup_recursive = 再帰
view_dynagroup_saveAndRecalculate = 保存 & 再計算
view_dynagroup_saveFailure = グループ定義名 [{0}] の保存に失敗しました
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 3a60da7..95903f0 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1348,7 +1348,7 @@ view_dynagroup_recalcFailureSelection = Falha ao recalcular as defini��es de
view_dynagroup_recalcSuccessful = Recalculo da defini��o grupo realizado com sucesso!
view_dynagroup_recalcSuccessfulSelection = As defini��es dos grupos [{0}] foram recalculadas com com sucesso!
view_dynagroup_recalculate = Recalcular
-view_dynagroup_recalculationInterval = Intervalo para Recalculo
+#view_dynagroup_recalculationInterval = Intervalo para Recalculo
view_dynagroup_recursive = Recursivo
view_dynagroup_saveAndRecalculate = Salvar e Recalcular
view_dynagroup_saveFailure = Falha ao salvar a defini��o do grupo [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 7e4da98..0bb6308 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1328,7 +1328,7 @@ view_dynagroup_recalcFailureSelection = Failed to recalculated the selected grou
view_dynagroup_recalcSuccessful = \u7ec4\u5b9a\u4e49\u5df2\u7ecf\u91cd\u65b0\u8ba1\u7b97
view_dynagroup_recalcSuccessfulSelection = You have successfully recalculated [{0}] group definitions
view_dynagroup_recalculate = \u91cd\u7b97
-view_dynagroup_recalculationInterval = \u91cd\u7b97\u95f4\u9694 (ms)
+#view_dynagroup_recalculationInterval = \u91cd\u7b97\u95f4\u9694 (ms)
view_dynagroup_recursive = \u9012\u5f52
view_dynagroup_saveAndRecalculate = \u4fdd\u5b58&\u91cd\u7b97
view_dynagroup_saveFailure = \u4fdd\u5b58\u540d\u79f0\u4e3a[{0}]\u7684\u7ec4\u5b9a\u4e49\u5931\u8d25
commit fd854c837ed2e549c039a794c5f1cf739ad9fe2a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Feb 21 11:33:06 2012 -0500
[BZ 786159] add functional tests for the new VIEW_USERS global permission
(https://bugzilla.redhat.com/show_bug.cgi?id=786159)
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
index b9fe4df..8426843 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
@@ -20,7 +20,10 @@ package org.rhq.enterprise.server.auth.test;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.UUID;
import javax.security.auth.login.LoginException;
@@ -50,8 +53,10 @@ import org.rhq.enterprise.server.util.LookupUtil;
*/
@Test
public class SubjectManagerBeanTest extends AbstractEJB3Test {
+
private SubjectManagerLocal subjectManager;
private AuthorizationManagerLocal authorizationManager;
+ private RoleManagerLocal roleManager;
/**
* Prepares things for the entire test class.
@@ -60,6 +65,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
public void beforeClass() {
subjectManager = LookupUtil.getSubjectManager();
authorizationManager = LookupUtil.getAuthorizationManager();
+ roleManager = LookupUtil.getRoleManager();
}
/**
@@ -463,4 +469,103 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
}
}
+
+ public void testViewUsersPermission_subjectWithViewUsersRoleCanViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+ Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+
+ Role roleWithViewUsersPerm = new Role("role" + UUID.randomUUID());
+ roleWithViewUsersPerm.addPermission(Permission.VIEW_USERS);
+ roleWithViewUsersPerm = roleManager.createRole(overlord, roleWithViewUsersPerm);
+
+ Subject subjectWithViewUsersRole = new Subject("subject" + UUID.randomUUID(), true, false);
+ subjectWithViewUsersRole.addRole(roleWithViewUsersPerm);
+ subjectWithViewUsersRole = subjectManager.createSubject(overlord, subjectWithViewUsersRole, "password");
+ subjectWithViewUsersRole = subjectManager.loginUnauthenticated(subjectWithViewUsersRole.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(subjectWithViewUsersRole, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertTrue(subjectSet.contains(subjectWithViewUsersRole));
+ assertTrue(subjectSet.contains(anotherSubject));
+ assertTrue(subjectSet.contains(rhqadmin));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ public void testViewUsersPermission_rhqadminCanViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+
+ Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ rhqadmin = subjectManager.loginUnauthenticated(rhqadmin.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(rhqadmin, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertTrue(subjectSet.contains(anotherSubject));
+ assertTrue(subjectSet.contains(rhqadmin));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ public void testViewUsersPermission_subjectWithNonViewUsersRoleCannotViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+
+ Role roleWithoutViewUsersPerm = new Role("role" + UUID.randomUUID());
+ roleWithoutViewUsersPerm = roleManager.createRole(overlord, roleWithoutViewUsersPerm);
+
+ Subject subjectWithNonViewUsersRole = new Subject("subject" + UUID.randomUUID(), true, false);
+ subjectWithNonViewUsersRole.addRole(roleWithoutViewUsersPerm);
+ subjectWithNonViewUsersRole = subjectManager.createSubject(overlord, subjectWithNonViewUsersRole, "password");
+ subjectWithNonViewUsersRole = subjectManager.loginUnauthenticated(subjectWithNonViewUsersRole.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(subjectWithNonViewUsersRole, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertEquals(1, subjectSet.size());
+ assertTrue(subjectSet.contains(subjectWithNonViewUsersRole));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ public void testViewUsersPermission_subjectWithNoRolesCannotViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+
+ Subject subjectWithNoRoles = new Subject("subject" + UUID.randomUUID(), true, false);
+ subjectWithNoRoles = subjectManager.createSubject(overlord, subjectWithNoRoles, "password");
+ subjectWithNoRoles = subjectManager.loginUnauthenticated(subjectWithNoRoles.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(subjectWithNoRoles, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertEquals(1, subjectSet.size());
+ assertTrue(subjectSet.contains(subjectWithNoRoles));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
}
\ No newline at end of file
12 years, 3 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java | 47 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 111 +++++++++-
2 files changed, 154 insertions(+), 4 deletions(-)
New commits:
commit 4ad367088998fcb67b0a058c4fb8bd5ed4133838
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Feb 21 13:46:19 2012 -0500
[BZ 781602] Adding logic to keep order of tabs consistent
The set of visible tabs can vary from one resource to another; however,
the order of tabs relative to one another is fixed. For example, the
Operations tab could appear as the 3rd or 4th tab, and it could be the
last tab. Note that it should always appear after the summary,
inventory, monitoring, and events tabs in that order. So if the
monitoring and events tabs are not visible, then the order should be
summary, inventory, operations, etc.
This commit adds an internal data structure to TwoLevelTabSet, similar
to a singly linked list a tab is a list node. Each node maintains two
pointers - one to the next visible tab and one to the next actual tab.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index fa62e45..79afade 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -23,11 +23,14 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/**
- * @author Greg Hinkle
+ * @author John Sanda
* @author Jay Shaughnessy
*/
public class TwoLevelTab extends NamedTab {
private SubTabLayout layout;
+
+ private TwoLevelTab actualNext;
+ private TwoLevelTab visibleNext;
public TwoLevelTab(String locatorId, ViewName viewName, String icon) {
super(locatorId, viewName, icon);
@@ -78,6 +81,48 @@ public class TwoLevelTab extends NamedTab {
return layout;
}
+ /**
+ * This is the successor or tab immediately to the right of this tab when all tabs
+ * are visible. The tab to which actualNext refers does not change whereas the tab to
+ * which {@link #getVisibleNext visibleNext} refers can change.
+ *
+ * @return The successor or tab immediately to the right of this tab when all tabs are
+ * visible.
+ */
+ public TwoLevelTab getActualNext() {
+ return actualNext;
+ }
+
+ /**
+ * @param actualNext The successor or tab immediately to the right of this tab when all
+ * tabs are visible. The tab to which actualNext refers does not change whereas the tab
+ * to which {@link #getVisibleNext visibleNext} refers can change.
+ */
+ public void setActualNext(TwoLevelTab actualNext) {
+ this.actualNext = actualNext;
+ }
+
+ /**
+ * The successor or tab immediately to the right of this tab among the set of visible
+ * tabs. The tab to which visibleNext refers can change whereas the tab to which
+ * {@link #getActualNext actualNext} refers will not change.
+ *
+ * @return The successor or tab immediately to the right of this tab among the set of
+ * visible tabs.
+ */
+ public TwoLevelTab getVisibleNext() {
+ return visibleNext;
+ }
+
+ /**
+ * @param visibleNext The successor or tab immediately to the right of this tab among
+ * the set of visible tabs. The tab to which visibleNext refers can change whereas the
+ * tab to which {@link #getActualNext actualNext} refers will not change.
+ */
+ public void setVisibleNext(TwoLevelTab visibleNext) {
+ this.visibleNext = visibleNext;
+ }
+
@Override
public String toString() {
return "TwoLevelTab[title=" + getTitle() + ", locatorId=" + getLocatorId() + "]";
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index 572f035..573c543 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -39,9 +39,19 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
private Map<String, TwoLevelTab> hiddenTabs = new LinkedHashMap<String, TwoLevelTab>();
private boolean ignoreSelectEvents = false;
+
+ private TwoLevelTab head;
+
+ /**
+ * This is the visible tail. Because the actual order of tabs is fixed we know that the
+ * actual tail will always be the content tab.
+ */
+ private TwoLevelTab tail;
public TwoLevelTabSet(String locatorId) {
super(locatorId);
+ // Need to set destroyPanes property to false so that we do not lose tab
+ // content when hiding a tab.
setDestroyPanes(false);
}
@@ -51,10 +61,29 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
tab.getLayout().addTwoLevelTabSelectedHandler(this);
updateTab(tab, tab.getPane());
}
-
+ buildTabList();
addTabSelectedHandler(this);
}
+ /**
+ * This method initializes the head and tail pointers. Then it initializes the
+ * {@link TwoLevelTab#getActualNext actualNext} and {@link TwoLevelTab#getVisibleNext visibleNext}
+ * properties of each tab. This list is built so that when hiding and showing tabs, the
+ * tab order remains consistent. The order of the list is the same as the order of the
+ * tabs passed to {@link #setTabs(TwoLevelTab...)}
+ */
+ private void buildTabList() {
+ TwoLevelTab[] tabs = getTabs();
+ head = tabs[0];
+ tail = tabs[tabs.length - 1];
+ TwoLevelTab current = head;
+ for (int i = 1; i < tabs.length; ++i) {
+ current.setActualNext(tabs[i]);
+ current.setVisibleNext(tabs[i]);
+ current = tabs[i];
+ }
+ }
+
public TwoLevelTab[] getTabs() {
Tab[] tabs = super.getTabs();
TwoLevelTab[] twoLevelTabs = new TwoLevelTab[tabs.length];
@@ -75,9 +104,29 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
if (hiddenTabs.containsKey(tab.getLocatorId())) {
return;
}
+
+ TwoLevelTab visiblePrevious = findClosestVisiblePredecessor(tab);
+ if (visiblePrevious == null) {
+ // if visiblePrevious is null then that means we are updating
+ // then head. Note that as of now (02/21/2012), the visible head,
+ // the summary tab, is fixed, so we don't really need to worry
+ // about updating the head; however, doing so will make it easier
+ // to support things like hiding arbitrary tabs or reordering tabs.
+ head = tab.getVisibleNext();
+
+ } else {
+ visiblePrevious.setVisibleNext(tab.getVisibleNext());
+ // check to see if the tail needs to be updated. If the
+ // following check is true, then that means visiblePrevious is
+ // now the tail.
+ if (visiblePrevious.getVisibleNext() == null) {
+ tail = visiblePrevious;
+ }
+ }
+ tab.setVisibleNext(null);
// Note that removing the tab does *not* destroy its content pane
// since we set the destroyPanes property to false in the
- removeTab(tab);
+ removeTab(tab);
hiddenTabs.put(tab.getLocatorId(), tab);
} else {
if (!hiddenTabs.containsKey(tab.getLocatorId())) {
@@ -85,10 +134,66 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
}
hiddenTabs.remove(tab.getLocatorId());
- addTab(tab);
+ TwoLevelTab successor = findClosestVisibleSuccessor(tab);
+ if (successor == null) {
+ // if successor is null then that means we are updating the tail
+ tail.setVisibleNext(tab);
+ tail = tab;
+ addTab(tab);
+ } else {
+ TwoLevelTab visiblePrevious = findClosestVisiblePredecessor(successor);
+ tab.setVisibleNext(visiblePrevious.getVisibleNext());
+ visiblePrevious.setVisibleNext(tab);
+ addTab(tab, (getTabNumber(visiblePrevious.getID()) + 1));
+ }
}
}
+ /**
+ * Walks the list of tabs to find the closest, visible predecessor.
+ *
+ * @param tab A {@link TwoLevelTab tab} that is currently visible
+ * @return The closest, visible predecessor or null if have the head
+ */
+ private TwoLevelTab findClosestVisiblePredecessor(TwoLevelTab tab) {
+ if (tab == head) {
+ return null;
+ }
+
+ TwoLevelTab current = head;
+ while (current != tab) {
+ // if we have reached the visible tail or the immediate predecessor
+ // of the tab, then return it.
+ if (current.getVisibleNext() == null || current.getVisibleNext() == tab) {
+ return current;
+ }
+ current = current.getVisibleNext();
+ }
+ // Not sure what we should do if we get here. return null for now
+ return null;
+ }
+
+ /**
+ * Walks the list to find the closest, visible successor.
+ *
+ * @param tab A {@link TwoLevelTab tab} that is currently hidden
+ * @return The closest, visisble successor or null if the insertion point
+ * is the tail.
+ */
+ private TwoLevelTab findClosestVisibleSuccessor(TwoLevelTab tab) {
+ TwoLevelTab current = tab;
+ while (current != null) {
+ // Walk the list of tabs until we reach a visible successor or the tail
+ if (current.getVisibleNext() == null && current != tail) {
+ current = current.getActualNext();
+ } else {
+ return current;
+ }
+ }
+ // if we reach this point then that means we will be inserting at the tail
+ return null;
+ }
+
public void destroyViews() {
for (TwoLevelTab tab : getTabs()) {
tab.getLayout().destroyViews();
12 years, 3 months
[rhq] 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 2 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 2 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 2 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 223f5fdfd7b7c3fbb5510b457a9892fc329fba1b
Merge: fd854c8 03737b1
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 09:40:41 2012 -0800
Merge branch 'BZ691544'
commit 03737b1598b62d8334e1c85391736d9cc66e6d1c
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 09:39:30 2012 -0800
[BZ691544 - Entering very large numbers in Dynagroups Recalculate Interval field causes stack trace] Forgot to comment out foreign resource bundle keys for translation.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index a42707d..c6e8b99 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1133,7 +1133,7 @@ view_dynagroup_permDenied = Sie haben nicht das Recht die Gruppen Definitionen a
##view_dynagroup_recalcSuccessful = You have successfully recalculated this group definition
##view_dynagroup_recalcSuccessfulSelection = You have successfully recalculated [{0}] group definitions
view_dynagroup_recalculate = Neu berechnen
-##view_dynagroup_recalculationInterval = Recalculation Interval
+##view_dynagroup_recalculationInterval = Recalculation Interval (min)
view_dynagroup_recursive = Rekursiv
view_dynagroup_saveAndRecalculate = Speichern & neu berechnen
##view_dynagroup_saveFailure = Failed to save the group definition named [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 41a33be..40d61a4a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1317,7 +1317,7 @@ view_dynagroup_recalcFailureSelection = 選択されたグループ定義を再
view_dynagroup_recalcSuccessful = このグループ定義の再計算が成功しました
view_dynagroup_recalcSuccessfulSelection = [{0}] グループ定義の再計算が成功しました
view_dynagroup_recalculate = 再計算
-view_dynagroup_recalculationInterval = 再計算間隔 (ms)
+#view_dynagroup_recalculationInterval = 再計算間隔 (min)
view_dynagroup_recursive = 再帰
view_dynagroup_saveAndRecalculate = 保存 & 再計算
view_dynagroup_saveFailure = グループ定義名 [{0}] の保存に失敗しました
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 3a60da7..95903f0 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1348,7 +1348,7 @@ view_dynagroup_recalcFailureSelection = Falha ao recalcular as defini��es de
view_dynagroup_recalcSuccessful = Recalculo da defini��o grupo realizado com sucesso!
view_dynagroup_recalcSuccessfulSelection = As defini��es dos grupos [{0}] foram recalculadas com com sucesso!
view_dynagroup_recalculate = Recalcular
-view_dynagroup_recalculationInterval = Intervalo para Recalculo
+#view_dynagroup_recalculationInterval = Intervalo para Recalculo
view_dynagroup_recursive = Recursivo
view_dynagroup_saveAndRecalculate = Salvar e Recalcular
view_dynagroup_saveFailure = Falha ao salvar a defini��o do grupo [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 7e4da98..0bb6308 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1328,7 +1328,7 @@ view_dynagroup_recalcFailureSelection = Failed to recalculated the selected grou
view_dynagroup_recalcSuccessful = \u7ec4\u5b9a\u4e49\u5df2\u7ecf\u91cd\u65b0\u8ba1\u7b97
view_dynagroup_recalcSuccessfulSelection = You have successfully recalculated [{0}] group definitions
view_dynagroup_recalculate = \u91cd\u7b97
-view_dynagroup_recalculationInterval = \u91cd\u7b97\u95f4\u9694 (ms)
+#view_dynagroup_recalculationInterval = \u91cd\u7b97\u95f4\u9694 (ms)
view_dynagroup_recursive = \u9012\u5f52
view_dynagroup_saveAndRecalculate = \u4fdd\u5b58&\u91cd\u7b97
view_dynagroup_saveFailure = \u4fdd\u5b58\u540d\u79f0\u4e3a[{0}]\u7684\u7ec4\u5b9a\u4e49\u5931\u8d25
12 years, 3 months
[rhq] modules/enterprise
by ips
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java | 105 ++++++++++
1 file changed, 105 insertions(+)
New commits:
commit fd854c837ed2e549c039a794c5f1cf739ad9fe2a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Feb 21 11:33:06 2012 -0500
[BZ 786159] add functional tests for the new VIEW_USERS global permission
(https://bugzilla.redhat.com/show_bug.cgi?id=786159)
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
index b9fe4df..8426843 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
@@ -20,7 +20,10 @@ package org.rhq.enterprise.server.auth.test;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.UUID;
import javax.security.auth.login.LoginException;
@@ -50,8 +53,10 @@ import org.rhq.enterprise.server.util.LookupUtil;
*/
@Test
public class SubjectManagerBeanTest extends AbstractEJB3Test {
+
private SubjectManagerLocal subjectManager;
private AuthorizationManagerLocal authorizationManager;
+ private RoleManagerLocal roleManager;
/**
* Prepares things for the entire test class.
@@ -60,6 +65,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
public void beforeClass() {
subjectManager = LookupUtil.getSubjectManager();
authorizationManager = LookupUtil.getAuthorizationManager();
+ roleManager = LookupUtil.getRoleManager();
}
/**
@@ -463,4 +469,103 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
}
}
+
+ public void testViewUsersPermission_subjectWithViewUsersRoleCanViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+ Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+
+ Role roleWithViewUsersPerm = new Role("role" + UUID.randomUUID());
+ roleWithViewUsersPerm.addPermission(Permission.VIEW_USERS);
+ roleWithViewUsersPerm = roleManager.createRole(overlord, roleWithViewUsersPerm);
+
+ Subject subjectWithViewUsersRole = new Subject("subject" + UUID.randomUUID(), true, false);
+ subjectWithViewUsersRole.addRole(roleWithViewUsersPerm);
+ subjectWithViewUsersRole = subjectManager.createSubject(overlord, subjectWithViewUsersRole, "password");
+ subjectWithViewUsersRole = subjectManager.loginUnauthenticated(subjectWithViewUsersRole.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(subjectWithViewUsersRole, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertTrue(subjectSet.contains(subjectWithViewUsersRole));
+ assertTrue(subjectSet.contains(anotherSubject));
+ assertTrue(subjectSet.contains(rhqadmin));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ public void testViewUsersPermission_rhqadminCanViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+
+ Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ rhqadmin = subjectManager.loginUnauthenticated(rhqadmin.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(rhqadmin, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertTrue(subjectSet.contains(anotherSubject));
+ assertTrue(subjectSet.contains(rhqadmin));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ public void testViewUsersPermission_subjectWithNonViewUsersRoleCannotViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+
+ Role roleWithoutViewUsersPerm = new Role("role" + UUID.randomUUID());
+ roleWithoutViewUsersPerm = roleManager.createRole(overlord, roleWithoutViewUsersPerm);
+
+ Subject subjectWithNonViewUsersRole = new Subject("subject" + UUID.randomUUID(), true, false);
+ subjectWithNonViewUsersRole.addRole(roleWithoutViewUsersPerm);
+ subjectWithNonViewUsersRole = subjectManager.createSubject(overlord, subjectWithNonViewUsersRole, "password");
+ subjectWithNonViewUsersRole = subjectManager.loginUnauthenticated(subjectWithNonViewUsersRole.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(subjectWithNonViewUsersRole, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertEquals(1, subjectSet.size());
+ assertTrue(subjectSet.contains(subjectWithNonViewUsersRole));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ public void testViewUsersPermission_subjectWithNoRolesCannotViewOtherUsers() throws Exception {
+ getTransactionManager().begin();
+
+ try {
+ Subject overlord = subjectManager.getOverlord();
+
+ Subject subjectWithNoRoles = new Subject("subject" + UUID.randomUUID(), true, false);
+ subjectWithNoRoles = subjectManager.createSubject(overlord, subjectWithNoRoles, "password");
+ subjectWithNoRoles = subjectManager.loginUnauthenticated(subjectWithNoRoles.getName());
+
+ Subject anotherSubject = new Subject("subject" + UUID.randomUUID(), true, false);
+ anotherSubject = subjectManager.createSubject(overlord, anotherSubject, "password");
+
+ PageList<Subject> subjects = subjectManager.findSubjectsByCriteria(subjectWithNoRoles, new SubjectCriteria());
+ Set<Subject> subjectSet = new HashSet<Subject>(subjects);
+ assertEquals(1, subjectSet.size());
+ assertTrue(subjectSet.contains(subjectWithNoRoles));
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
}
\ No newline at end of file
12 years, 3 months
[rhq] Branch 'bug/747925' - 17 commits - modules/enterprise modules/integration-tests modules/plugins
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 3 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java | 3 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java | 23 ---------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java | 9 ++-
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheExecutionUtil.java | 24 +++++-----
modules/integration-tests/jboss-as-7-plugin-test/src/test/java/org/rhq/modules/integrationTests/jbossas7plugin/UploadAndDeployTest.java | 4 -
modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java | 4 -
modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java | 2
modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java | 16 +++---
modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java | 3 -
10 files changed, 35 insertions(+), 56 deletions(-)
New commits:
commit d1c93e1a4928d27438e416d54bc05b9dd76ca0b1
Merge: 3f4c912 ceaec5f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 21 11:12:58 2012 -0500
Merge remote-tracking branch 'origin/master' into bug/747925
commit ceaec5f0e9f1a3cd8087b8da5aaa15d80535cdaf
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 21 11:02:50 2012 -0500
[BZ 616395] the original fix for this BZ was to change the value in
rhq-server.properties. However, it forgot to address what would happen
if the user did not have that property set OR what would happen if the
value was not a valid number. It used to default to 5, but the fix for
this BZ was to reduce that to 1. This commit just makes sure we fallback
to 1 on error. Note that a comment was added in the code to remind people
that we really don't want this to be more than 1 now - although the code
will allow for a user to change this in the field if necessary. I doubt
this setting will ever want to be changed until we fully fix the metadata
registration to allow it to be done concurrently.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java
index 4ace359..9408228 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java
@@ -70,10 +70,15 @@ public class LatchedServiceController {
nextService.controller = this;
}
+ // When this latched service stuff was originally written, it was to help speed up
+ // plugin deployment by registering multiple plugins concurrently. However, it turns
+ // out that that causes problems today. Plugin registraton should not be done
+ // concurrently - each plugin must be registered one after the other serially.
+ // See BZ 616395
try {
- this.threadPoolSize = Integer.parseInt(System.getProperty("rhq.server.plugin-deployer-threads", "5"));
+ this.threadPoolSize = Integer.parseInt(System.getProperty("rhq.server.plugin-deployer-threads", "1"));
} catch (NumberFormatException e) {
- this.threadPoolSize = 5;
+ this.threadPoolSize = 1;
log.warn("Invalid number of threads specified, defaulting to [" + this.threadPoolSize + "]: " + e);
}
}
commit a1b5969b04c5316af6fc8555f75ebc65ff6ebf72
Merge: 48262b1 5dd802d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 08:04:27 2012 -0800
Merge branch 'BZ682255'
commit 5dd802d4f1b3a6e46e979f6ac6c35a30f316163e
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 08:03:30 2012 -0800
[BZ790621 IE6 Removal] Removal last residuals of IE6 BrowserUtil ie6 browserHack
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index a54324d..e886374 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -553,7 +553,6 @@ public class LoginView extends LocatableCanvas {
}
private void login(final String username, final String password) {
- BrowserUtility.forceIe6Hacks();
loginButton.setDisabled(true);
@@ -585,8 +584,6 @@ public class LoginView extends LocatableCanvas {
requestBuilder.send();
} catch (Exception e) {
handleError(0);
- } finally {
- BrowserUtility.unforceIe6Hacks();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
index fff462a..7e29fd1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
@@ -144,7 +144,6 @@ public class UserSessionManager {
}
public static void checkLoginStatus(final String user, final String password, final AsyncCallback<Subject> callback) {
- BrowserUtility.forceIe6Hacks();
//initiate request to portal.war(SessionAccessServlet) to retrieve existing session info if exists
//session has valid user then <subjectId>:<sessionId>:<lastAccess> else ""
final RequestBuilder b = new RequestBuilder(RequestBuilder.POST, "/sessionAccess");
@@ -379,8 +378,6 @@ public class UserSessionManager {
b.send();
} catch (RequestException e) {
callback.onFailure(e);
- } finally {
- BrowserUtility.unforceIe6Hacks();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java
index db53dfa..5f66507 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java
@@ -32,29 +32,6 @@ public class BrowserUtility {
// static access only
}
- /*
- * Adapted from http://code.google.com/p/google-web-toolkit/issues/detail?id=3608
- *
- * Should
- */
- public static native void forceIe6Hacks()
- /*-{
- if (typeof $doc.body.style.maxHeight == "undefined") {
- $wnd.XMLHttpRequestBackup = $wnd.XMLHttpRequest;
- $wnd.XMLHttpRequest = null;
- }
- }-*/;
-
- /*
- * Adapted from http://code.google.com/p/google-web-toolkit/issues/detail?id=3608
- */
- public static native void unforceIe6Hacks()
- /*-{
- if (typeof $doc.body.style.maxHeight == "undefined") {
- $wnd.XMLHttpRequest = $wnd.XMLHttpRequestBackup;
- $wnd.XMLHttpRequestBackup = null;
- }
- }-*/;
//This is a JSNI call out to the third party javascript lib to execute on the data inserted into the DOM.
public static native void graphSparkLines()
commit 48262b1ffcbfc2b4e1e2c80bd0858ca54942aae4
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 21 16:51:15 2012 +0100
[BZ 794489] - Fixing the unit tests to work with the changed signature of
ResourceContext constructor.
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheExecutionUtil.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheExecutionUtil.java
index ee03318..752b421 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheExecutionUtil.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheExecutionUtil.java
@@ -46,14 +46,14 @@ import org.rhq.plugins.apache.parser.ApacheDirectiveTree;
import org.rhq.plugins.platform.PlatformComponent;
/**
- *
+ *
*
* @author Lukas Krejci
*/
public class ApacheExecutionUtil {
private static final Log LOG = LogFactory.getLog(ApacheExecutionUtil.class);
-
+
private ResourceType apacheServerResourceType;
private ApacheServerComponent serverComponent;
private ResourceContext<PlatformComponent> resourceContext;
@@ -67,7 +67,7 @@ public class ApacheExecutionUtil {
public enum ExpectedApacheState {
RUNNING, STOPPED
};
-
+
public ApacheExecutionUtil(ResourceType apacheServerResourceType, String serverRootPath, String exePath,
String httpdConfPath, String pingUrl, String snmpHost, int snmpPort) {
@@ -103,7 +103,7 @@ public class ApacheExecutionUtil {
Resource resource = new Resource(result.getResourceKey(), null, apacheServerResourceType);
resource.setPluginConfiguration(config);
- resourceContext = new ResourceContext<PlatformComponent>(resource, null,
+ resourceContext = new ResourceContext<PlatformComponent>(resource, null, null,
discoveryComponent, systemInfo, null, null, null, null, null, null, null, null);
serverComponent.start(resourceContext);
@@ -113,13 +113,13 @@ public class ApacheExecutionUtil {
int i = 0;
while (i < 10) {
serverComponent.invokeOperation(operation, new Configuration());
-
- //wait for max 30s for the operation to "express" itself
+
+ //wait for max 30s for the operation to "express" itself
int w = 0;
ProcessInfo pi;
while (w < 30) {
pi = getResourceContext().getNativeProcess();
-
+
switch (desiredState) {
case RUNNING:
if (pi != null && pi.isRunning()) {
@@ -131,16 +131,16 @@ public class ApacheExecutionUtil {
return;
}
}
-
+
Thread.sleep(1000);
++w;
}
-
+
++i;
-
+
LOG.warn("Could not detect the httpd process after invoking the start operation but the operation didn't throw any exception. I will retry at most ten times and then fail loudly. This has been attempt no. " + i);
}
-
+
throw new IllegalStateException("Failed to start the httpd process even after 10 retries without the apache component complaining. This is super strange.");
}
@@ -155,7 +155,7 @@ public class ApacheExecutionUtil {
public ApacheServerComponent getServerComponent() {
return serverComponent;
}
-
+
private List<ProcessScanResult> scanProcesses(SystemInfo systemInfo) {
List<ProcessScanResult> scanResults = new ArrayList<ProcessScanResult>();
Set<ProcessScan> processScans = apacheServerResourceType.getProcessScans();
diff --git a/modules/integration-tests/jboss-as-7-plugin-test/src/test/java/org/rhq/modules/integrationTests/jbossas7plugin/UploadAndDeployTest.java b/modules/integration-tests/jboss-as-7-plugin-test/src/test/java/org/rhq/modules/integrationTests/jbossas7plugin/UploadAndDeployTest.java
index cc55f1c..dc745a3 100644
--- a/modules/integration-tests/jboss-as-7-plugin-test/src/test/java/org/rhq/modules/integrationTests/jbossas7plugin/UploadAndDeployTest.java
+++ b/modules/integration-tests/jboss-as-7-plugin-test/src/test/java/org/rhq/modules/integrationTests/jbossas7plugin/UploadAndDeployTest.java
@@ -368,7 +368,7 @@ public class UploadAndDeployTest extends AbstractIntegrationTest {
ResourceType rt = new ResourceType();
rt.setName("Deployment");
Resource resource = new Resource("deployment="+TEST_WAR,TEST_WAR,rt); // TODO resource key?
- ResourceContext context = new ResourceContext(resource,null,null,null,null,null,null,null,null,null,null,null);
+ ResourceContext context = new ResourceContext(resource,null,null,null,null,null,null,null,null,null,null,null,null);
bc.start(context);
String bytes_value = uploadToAs(TEST_WAR);
@@ -403,7 +403,7 @@ public class UploadAndDeployTest extends AbstractIntegrationTest {
ResourceType rt = new ResourceType();
rt.setName("Deployment");
Resource resource = new Resource("server-group=main-server-group",TEST_WAR,rt);
- ResourceContext context = new ResourceContext(resource,null,null,null,null,null,null,null,null,null,null,null);
+ ResourceContext context = new ResourceContext(resource,null,null,null,null,null,null,null,null,null,null,null,null);
bc.start(context);
String bytes_value = uploadToAs(TEST_WAR);
diff --git a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
index 96a8bd5..66d577c 100644
--- a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
+++ b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
@@ -98,7 +98,7 @@ public class AntBundlePluginComponentTest {
ResourceType type = new ResourceType("antBundleTestType", "antBundleTestPlugin", ResourceCategory.SERVER, null);
Resource resource = new Resource("antBundleTestKey", "antBundleTestName", type);
@SuppressWarnings({ "rawtypes", "unchecked" })
- ResourceContext<?> context = new ResourceContext(resource, null, null,
+ ResourceContext<?> context = new ResourceContext(resource, null, null, null,
SystemInfoFactory.createJavaSystemInfo(), tmpDir, null, "antBundleTestPC", null, null, null, null, null);
this.plugin.start(context);
}
@@ -212,7 +212,7 @@ public class AntBundlePluginComponentTest {
DeploymentProperties currentProps = metadata.getCurrentDeploymentProperties();
assert deploymentProps.equals(currentProps);
- // check the backup directory - note, clean flag is irrelevent when determining what should be backed up
+ // check the backup directory - note, clean flag is irrelevent when determining what should be backed up
File backupDir = metadata.getDeploymentBackupDirectory(deployment.getId());
File ignoredBackupFile = new File(backupDir, "ignore/ignore-file.txt");
assert ignoredBackupFile.isFile() : "old recipe didn't ignore these, should be backed up";
diff --git a/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java b/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java
index 533c250..ec7bb9f 100644
--- a/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java
+++ b/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java
@@ -115,7 +115,7 @@ public class SmartDiskComponent implements ResourceComponent, MeasurementFacet {
public static void main(String[] args) throws Exception {
SmartDiskComponent sdc = new SmartDiskComponent();
- sdc.start(new ResourceContext(new Resource("/dev/sda", "foo", new ResourceType()), null, null, null, null,
+ sdc.start(new ResourceContext(new Resource("/dev/sda", "foo", new ResourceType()), null, null, null, null, null,
null, null, null, null, null, null, PluginContainerDeployment.AGENT));
sdc.getValues(null, null);
diff --git a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java
index 8eeed0c..bd293f5 100644
--- a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java
+++ b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java
@@ -124,14 +124,16 @@ public abstract class ComponentTest {
resource.setResourceType(resourceType);
resource.setPluginConfiguration(configuration);
resource.setName(resourceType.getName());
+
ResourceComponent parentResourceComponent = null;
+ ResourceContext<?> parentResourceContext = null;
components.put(component, resource);
resource.setParentResource(pluginContainer.getInventoryManager().getPlatform());
ResourceDiscoveryComponent resourceDiscoveryComponent = new NothingDiscoveringDiscoveryComponent();
EventContext eventContext = new EventContextImpl(resource);
- ResourceContext context = new ResourceContext(resource, parentResourceComponent,
+ ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory,
pluginContainerName, eventContext, operationContext, contentContext,
availCollectorThreadPool, pluginContainerDeployment);
@@ -141,7 +143,7 @@ public abstract class ComponentTest {
Collections.emptyList(), Collections.emptyList(), pluginContainerName, pluginContainerDeployment);
for (ResourceType rt : resourceType.getChildResourceTypes()) {
- processChild(rt, component, resource);
+ processChild(rt, component, context, resource);
}
}
@@ -154,7 +156,7 @@ public abstract class ComponentTest {
* @param resource parent resource
* @param resourceType child resource type
*/
- private void processChild(ResourceType resourceType, ResourceComponent component, Resource resource) throws Exception {
+ private void processChild(ResourceType resourceType, ResourceComponent component, ResourceContext<?> parentContext, Resource resource) throws Exception {
Configuration configuration = resourceType.getPluginConfigurationDefinition().getDefaultTemplate().createConfiguration();
setConfiguration(configuration, resourceType);
log.info("childResource " + resourceType + " properties " + configuration.getProperties());
@@ -164,7 +166,7 @@ public abstract class ComponentTest {
log.debug("rdc=" + rdc);
EventContext eventContext = new EventContextImpl(resource);
- ResourceContext context = new ResourceContext(resource, component,
+ ResourceContext context = new ResourceContext(resource, component, parentContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory,
pluginContainerName, eventContext, operationContext, contentContext,
availCollectorThreadPool, pluginContainerDeployment);
@@ -174,7 +176,7 @@ public abstract class ComponentTest {
Set<DiscoveredResourceDetails> d = rdc.discoverResources(resourceDiscoveryContext);
for (DiscoveredResourceDetails drd : d) {
log.debug("discovered " + drd);
- createChild(drd, resource, configuration, component);
+ createChild(drd, resource, configuration, component, context);
}
}
@@ -182,7 +184,7 @@ public abstract class ComponentTest {
private void createChild(DiscoveredResourceDetails drd,
Resource resource,
Configuration configuration,
- ResourceComponent parentComponent) throws Exception
+ ResourceComponent parentComponent, ResourceContext<?> parentContext) throws Exception
{
ResourceType type = pmm.getType(drd.getResourceType());
@@ -197,7 +199,7 @@ public abstract class ComponentTest {
ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance();
EventContext eventContext = new EventContextImpl(resource);
- ResourceContext context = new ResourceContext(cresource, parentComponent,
+ ResourceContext context = new ResourceContext(cresource, parentComponent, parentContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory,
pluginContainerName, eventContext, operationContext, contentContext,
availCollectorThreadPool, pluginContainerDeployment);
diff --git a/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java b/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java
index 944b0c1..2323ed3 100644
--- a/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java
+++ b/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java
@@ -82,6 +82,7 @@ public abstract class ComponentTest {
resource.setPluginConfiguration(configuration);
ResourceComponent parentResourceComponent = null;
+ ResourceContext<?> parentResourceContext = null;
ResourceDiscoveryComponent resourceDiscoveryComponent = new NothingDiscoveringDiscoveryComponent();
SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
File temporaryDirectory = temp;
@@ -92,7 +93,7 @@ public abstract class ComponentTest {
ContentContext contentContext = new ContentContextImpl(0);
Executor availCollectorThreadPool = Executors.newCachedThreadPool();
PluginContainerDeployment pluginContainerDeployment = null;
- ResourceContext context = new ResourceContext(resource, parentResourceComponent,
+ ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory,
pluginContainerName, eventContext, operationContext, contentContext,
availCollectorThreadPool, pluginContainerDeployment);
commit f74b81038db9416583f5f244bb693521c090f88c
Merge: 4ba4e10 4487140
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 06:28:01 2012 -0800
Merge branch 'gwtAutoLocale'
commit 448714093806aae663483b5f048870139cd6b2f6
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 06:26:45 2012 -0800
Trivial remove duplicate servlet mapping from web.xml
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index 7d94de8..a6d19fc 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -291,10 +291,7 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ContentGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/ContentGWTService</url-pattern>
</servlet-mapping>
- <servlet-mapping>
- <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI SearchGWTService</servlet-name>
- <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/SearchGWTService</url-pattern>
- </servlet-mapping>
+
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI DashboardGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/DashboardGWTService</url-pattern>
commit 4ba4e10053595f0cea71d4c3ab82f5e464b1bcee
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Feb 20 16:59:17 2012 -0500
Rename NetworkInterface to 'Network Interface' as that name shows up in UI and should have spaces for readability like other tree nodes.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 44e1149..1e4d55a 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -2095,7 +2095,7 @@ working area for individual server instances</li></ul>"/>
</server>
- <service name="NetworkInterface"
+ <service name="Network Interface"
discovery="SubsystemDiscovery"
class="BaseComponent"
description="A named network interface, along with required criteria for determining the IP address to associate with that interface">
@@ -2126,9 +2126,9 @@ working area for individual server instances</li></ul>"/>
<resource-configuration>
<c:simple-property name="default-interface" readOnly="true" displayName="Default Interface"
- description="Default Interface for these bindings. See NetworkInterfaces for its definition"
+ description="Default Interface for these bindings. See Network Interfaces for its definition"
required="true">
- <c:option-source target="resource" expression="type=NetworkInterface plugin=jboss-as-7"/>
+ <c:option-source target="resource" expression="type=Network Interface plugin=jboss-as-7"/>
</c:simple-property>
<!-- note: at domain level there is no port-offset -->
<c:simple-property name="port-offset" readOnly="false" displayName="Port Offset"
@@ -2140,7 +2140,7 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="name" description="The name of the socket. Services which need to access the socket configuration information will find it using this name." readOnly="true"/>
<c:simple-property name="interface" description="Name of the interface to which the socket should be bound, or, for multicast sockets, the interface on which it should listen. This should be one of the declared interfaces."
required="false">
- <c:option-source target="resource" expression="type=NetworkInterface plugin=jboss-as-7"/>
+ <c:option-source target="resource" expression="type=Network Interface plugin=jboss-as-7"/>
</c:simple-property>
<c:simple-property name="port" description="Number of the port to which the socket should be bound." type="integer"/>
<c:simple-property name="fixed-port" description="Whether the port value should remain fixed even if numeric offsets are applied to the other sockets in the socket group."
@@ -2168,9 +2168,9 @@ working area for individual server instances</li></ul>"/>
<resource-configuration>
<c:simple-property name="default-interface" readOnly="true" displayName="Default Interface"
- description="Default Interface for these bindings. See NetworkInterfaces for its definition"
+ description="Default Interface for these bindings. See Network Interfaces for its definition"
required="true">
- <c:option-source target="resource" expression="type=NetworkInterface plugin=jboss-as-7"/>
+ <c:option-source target="resource" expression="type=Network Interface plugin=jboss-as-7"/>
</c:simple-property>
<c:list-property name="includes" required="false" readOnly="true"> <!-- read-only until AS7-1467 is fixed -->
<c:simple-property name="includes" displayName="Included bindings" description="Other bindings that are included in this one (only needed in Domain Mode)"/>
@@ -2181,7 +2181,7 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="name" description="The name of the socket. Services which need to access the socket configuration information will find it using this name." readOnly="true"/>
<c:simple-property name="interface" description="Name of the interface to which the socket should be bound, or, for multicast sockets, the interface on which it should listen. This should be one of the declared interfaces."
required="false">
- <c:option-source target="resource" expression="type=NetworkInterface plugin=jboss-as-7"/>
+ <c:option-source target="resource" expression="type=Network Interface plugin=jboss-as-7"/>
</c:simple-property>
<c:simple-property name="port" description="Number of the port to which the socket should be bound." type="integer"/>
diff --git a/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml b/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml
index 913bcb2..5b87ef3 100644
--- a/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/test/resources/test-plugin.xml
@@ -178,7 +178,7 @@
</resource-configuration>
</server>
-
+ <!-- This socket binding plugin setup is for Standalone AS instances -->
<server name="SocketBindingGroupStandalone"
discovery="SubsystemDiscovery"
class="BaseComponent"
@@ -186,9 +186,9 @@
<resource-configuration>
<c:simple-property name="default-interface" readOnly="true" displayName="Default Interface"
- description="Default Interface for these bindings. See NetworkInterfaces for its definition"
+ description="Default Interface for these bindings. See Network Interfaces for its definition"
required="true">
- <c:option-source target="resource" expression="type=NetworkInterface plugin=jboss-as-7"/>
+ <c:option-source target="resource" expression="type=Network Interface plugin=jboss-as-7"/>
</c:simple-property>
<!-- note: at domain level there is no port-offset -->
<c:simple-property name="port-offset" readOnly="false" displayName="Port Offset"
@@ -200,7 +200,7 @@
<c:simple-property name="name" readOnly="true"/>
<c:simple-property name="interface"
required="false">
- <c:option-source target="resource" expression="type=NetworkInterface plugin=jboss-as-7"/>
+ <c:option-source target="resource" expression="type=Network Interface plugin=jboss-as-7"/>
</c:simple-property>
<c:simple-property name="port" type="integer"/>
<c:simple-property name="fixed-port"
commit 576aa1f47683f6369b747ac570b9971001614728
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Feb 20 11:12:33 2012 -0500
fix a few hard coded file separators.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
index 51870a8..a0faeaa 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
@@ -94,13 +94,12 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
String logFile = bootLogFile;
if (homeDir.contains("eap")) {
- isEAP=true;
+ isEAP = true;
}
if (homeDir.contains("edg")) {
- isEDG=true;
+ isEDG = true;
}
-
if (psName.equals("HostController")) {
readStandaloneOrHostXml(psr.getProcessInfo(), true);
@@ -112,8 +111,7 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
description = "Domain controller for a " + JBOSS_EAP_6 + " domain";
else
description = "Domain controller for an " + AS7 + " domain";
- }
- else {
+ } else {
serverName = "HostController"; // TODO make more unique
serverNameFull = "HostController";
if (isEAP)
@@ -133,8 +131,8 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
// provide running config
String domainConfig = getServerConfigFromCommandLine(commandLine, AS7Mode.DOMAIN);
String hostConfig = getServerConfigFromCommandLine(commandLine, AS7Mode.HOST);
- config.put(new PropertySimple("domainConfig",domainConfig));
- config.put(new PropertySimple("hostConfig",hostConfig));
+ config.put(new PropertySimple("domainConfig", domainConfig));
+ config.put(new PropertySimple("hostConfig", hostConfig));
} else { // Standalone server
serverNameFull = homeDir;
@@ -147,15 +145,15 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
description = "Standalone " + AS7 + " server";
readStandaloneOrHostXml(psr.getProcessInfo(), false);
- if ( serverNameFull.isEmpty()) {
+ if (serverNameFull.isEmpty()) {
// Try to obtain the server name
// -Dorg.jboss.boot.log.file=domain/servers/server-one/log/boot.log
// This is a hack until I know a better way to do so.
//XXX hardcoded separators?
String tmp = getLogFileFromCommandLine(commandLine);
- int i = tmp.indexOf("servers/");
+ int i = tmp.indexOf("servers" + File.separator);
tmp = tmp.substring(i + 8);
- tmp = tmp.substring(0, tmp.indexOf("/"));
+ tmp = tmp.substring(0, tmp.indexOf(File.separator));
serverNameFull = tmp;
}
@@ -168,42 +166,41 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
if (serverName.isEmpty())
serverName = serverNameFull;
-
String serverConfig = getServerConfigFromCommandLine(commandLine, AS7Mode.STANDALONE);
- config.put(new PropertySimple("config",serverConfig));
- config.put(new PropertySimple("startScript",AS7Mode.STANDALONE.getStartScript()));
+ config.put(new PropertySimple("config", serverConfig));
+ config.put(new PropertySimple("startScript", AS7Mode.STANDALONE.getStartScript()));
fillUserPassFromFile(config, AS7Mode.STANDALONE, serverNameFull);
//preload server.log file for event log monitoring
- logFile = bootLogFile.substring(0, bootLogFile.lastIndexOf(File.separator)) + File.separator + "server.log";
+ logFile = bootLogFile.substring(0, bootLogFile.lastIndexOf(File.separator)) + File.separator
+ + "server.log";
}
if (isEAP) {
serverName = "EAP " + serverName;
- version="EAP " + version;
- }
- else if (isEDG) {
+ version = "EAP " + version;
+ } else if (isEDG) {
serverName = "EDG " + serverName;
- version="EDG " + version;
+ version = "EDG " + version;
}
-
initLogEventSourcesConfigProp(logFile, config);
HostPort managmentPort = getManagementPortFromHostXml(commandLine);
config.put(new PropertySimple("hostname", managmentPort.host));
config.put(new PropertySimple("port", managmentPort.port));
- config.put(new PropertySimple("realm",getManagementSecurtiyRealmFromHostXml()));
+ config.put(new PropertySimple("realm", getManagementSecurtiyRealmFromHostXml()));
- ProductInfo productInfo = new ProductInfo(managmentPort.host,config.getSimpleValue("user",null),config.getSimpleValue("password",null),managmentPort.port);
+ ProductInfo productInfo = new ProductInfo(managmentPort.host, config.getSimpleValue("user", null),
+ config.getSimpleValue("password", null), managmentPort.port);
productInfo = productInfo.getFromRemote();
if (productInfo.fromRemote) {
version = productInfo.productName + " " + productInfo.productVersion;
- serverName = productInfo.productName + " " + productInfo.serverName;
+ serverName = productInfo.productName + " " + productInfo.serverName;
String tmp = getServerDescr(productInfo.getProductName());
- description = "Standalone " + tmp +" server";
+ description = "Standalone " + tmp + " server";
}
// String javaClazz = psr.getProcessInfo().getName();
@@ -224,15 +221,15 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(discoveryContext.getResourceType(), // ResourceType
serverNameFull, // key TODO distinguish per domain?
serverName, // Name
- version,
- description, // Description
+ version, description, // Description
config, psr.getProcessInfo());
// Add to return values
discoveredResources.add(detail);
log.info("Discovered new ... " + discoveryContext.getResourceType() + ", " + serverNameFull);
} catch (Exception e) {
- log.warn("Discovery for a " + discoveryContext.getResourceType() + " failed for process " + psr + " :" + e.getMessage());
+ log.warn("Discovery for a " + discoveryContext.getResourceType() + " failed for process " + psr + " :"
+ + e.getMessage());
}
}
@@ -262,14 +259,14 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
*/
@Override
public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
- ResourceDiscoveryContext context) throws InvalidPluginConfigurationException {
+ ResourceDiscoveryContext context) throws InvalidPluginConfigurationException {
- String hostname = pluginConfiguration.getSimpleValue("hostname",null);
- String portS = pluginConfiguration.getSimpleValue("port",null);
- String user = pluginConfiguration.getSimpleValue("user",null);
- String pass = pluginConfiguration.getSimpleValue("password",null);
+ String hostname = pluginConfiguration.getSimpleValue("hostname", null);
+ String portS = pluginConfiguration.getSimpleValue("port", null);
+ String user = pluginConfiguration.getSimpleValue("user", null);
+ String pass = pluginConfiguration.getSimpleValue("password", null);
- if (hostname==null || portS==null) {
+ if (hostname == null || portS == null) {
throw new InvalidPluginConfigurationException("Host and port must not be null");
}
int port = Integer.valueOf(portS);
@@ -284,40 +281,32 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
description = "Standalone JBoss Enterprise Application Platform server";
} else if (productName.contains("EDG")) {
description = "Standalone JBoss Enterprise DataGrid server";
- }
- else
+ } else
description = context.getResourceType().getDescription();
- pluginConfiguration.put(new PropertySimple("manuallyAdded",true));
+ pluginConfiguration.put(new PropertySimple("manuallyAdded", true));
- DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
- context.getResourceType(),
- resourceKey,
- productName + " @ " + hostname + ":" + port,
- productVersion,
- description,
- pluginConfiguration,
- null
- );
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), resourceKey,
+ productName + " @ " + hostname + ":" + port, productVersion, description, pluginConfiguration, null);
return detail;
}
private String getServerAttribute(ASConnection connection, String attributeName) {
- Operation op = new ReadAttribute(null,attributeName);
+ Operation op = new ReadAttribute(null, attributeName);
Result res = connection.execute(op);
if (!res.isSuccess()) {
- throw new InvalidPluginConfigurationException("Could not connect to remote server [" + res.getFailureDescription() + "]. Did you enable management?");
+ throw new InvalidPluginConfigurationException("Could not connect to remote server ["
+ + res.getFailureDescription() + "]. Did you enable management?");
}
return (String) res.getResult();
}
private void fillUserPassFromFile(Configuration config, AS7Mode mode, String baseDir) {
-// String configDir = baseDir + File.separator + mode + File.separator + "configuration";
+ // String configDir = baseDir + File.separator + mode + File.separator + "configuration";
String realm = getManagementSecurtiyRealmFromHostXml();
- String fileName = getSecurityPropertyFileFromHostXml(baseDir,mode, realm);
-
+ String fileName = getSecurityPropertyFileFromHostXml(baseDir, mode, realm);
File file = new File(fileName);
if (!file.exists() || !file.canRead()) {
@@ -342,7 +331,7 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
String user = line.substring(0, line.indexOf("="));
String pass = line.substring(line.indexOf("=") + 1);
config.put(new PropertySimple("user", user));
-// config.put(new PropertySimple("password", pass)); // this is now hashed, so no point in supplying it
+ // config.put(new PropertySimple("password", pass)); // this is now hashed, so no point in supplying it
}
} catch (IOException e) {
@@ -387,9 +376,9 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
*/
String getServerConfigFromCommandLine(String[] commandLine, AS7Mode mode) {
String configArg = mode.getConfigArg();
- for (String line: commandLine) {
+ for (String line : commandLine) {
if (line.startsWith(configArg))
- return line.substring(configArg.length()+1);
+ return line.substring(configArg.length() + 1);
}
return mode.getDefaultXmlFile();
}
@@ -458,33 +447,28 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou
try {
productVersion = getServerAttribute(connection, "product-version");
productName = getServerAttribute(connection, "product-name");
- releaseVersion = getServerAttribute(connection,"release-version");
- releaseCodeName = getServerAttribute(connection,"release-codename");
- serverName = getServerAttribute(connection,"name");
+ releaseVersion = getServerAttribute(connection, "release-version");
+ releaseCodeName = getServerAttribute(connection, "release-codename");
+ serverName = getServerAttribute(connection, "name");
if (productVersion == null)
productVersion = releaseVersion;
- if (productName ==null)
+ if (productName == null)
productName = "AS7";
fromRemote = true;
- }
- catch (InvalidPluginConfigurationException e) {
- log.debug("Could not get the product info from [" + hostname + ":" + port +"] - probably a connection failure");
+ } catch (InvalidPluginConfigurationException e) {
+ log.debug("Could not get the product info from [" + hostname + ":" + port
+ + "] - probably a connection failure");
}
return this;
}
@Override
public String toString() {
- return "ProductInfo{" +
- "hostname='" + hostname + '\'' +
- ", port=" + port +
- ", productVersion='" + productVersion + '\'' +
- ", productName='" + productName + '\'' +
- ", releaseVersion='" + releaseVersion + '\'' +
- ", releaseCodeName='" + releaseCodeName + '\'' +
- ", fromRemote=" + fromRemote +
- '}';
+ return "ProductInfo{" + "hostname='" + hostname + '\'' + ", port=" + port + ", productVersion='"
+ + productVersion + '\'' + ", productName='" + productName + '\'' + ", releaseVersion='"
+ + releaseVersion + '\'' + ", releaseCodeName='" + releaseCodeName + '\'' + ", fromRemote=" + fromRemote
+ + '}';
}
}
}
commit 8ce9b2349fe1a3b436853fa153b9262bdaaa8acd
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Feb 20 10:09:43 2012 -0500
i)Modifying as7 plugin to generate plugin config exceptions when credentials are not set correctly.
ii)Modified Resource Plugin config error screen to remind user that they need to delete errors in ui to clear icon from resource.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index 49fb719..23c549c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -200,6 +201,13 @@ public class ResourceTitleBar extends LocatableVLayout {
winModal.centerInPage();
winModal.setTitle(MSG.common_title_component_errors());
+ Label disposalReminder = new Label();
+ disposalReminder.setHeight(12);
+ disposalReminder.setPadding(4);
+ disposalReminder.setAlign(Alignment.CENTER);
+ disposalReminder.setValign(VerticalAlignment.CENTER);
+ disposalReminder.setContents(MSG.view_resource_title_component_errors_cleanup());
+
LocatableVLayout form = new LocatableVLayout(extendLocatorId("_Modal_Form"));
form.setAlign(VerticalAlignment.CENTER);
form.setLayoutMargin(10);
@@ -215,7 +223,9 @@ public class ResourceTitleBar extends LocatableVLayout {
errorsGrid.setDataSource(errors);
form.addMember(errorsGrid);
+ winModal.addItem(disposalReminder);
winModal.addItem(form);
+ winModal.setPadding(2);
winModal.show();
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 0bf7dad..0955a23 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1725,6 +1725,7 @@ view_resource_monitor_table_avg = Average
view_resource_monitor_table_last = Last
view_resource_monitor_table_max = Maximum
view_resource_monitor_table_min = Minimum
+view_resource_title_component_errors_cleanup = After addressing the issue, you will need to delete the message below to clear the 'managed component error' icon from the previous screen.
view_resource_title_component_errors_tooltip = Shows managed component errors. Click for details
view_resource_title_tagUpdateFailed = Failed to update resource tags
view_searchBar_defaultPattern = name your pattern
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index a42707d..24b8e94 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1491,6 +1491,7 @@ view_resource_monitor_table_avg = Durchschnitt
view_resource_monitor_table_last = Letzter
view_resource_monitor_table_max = Maximum
view_resource_monitor_table_min = Minimum
+##view_resource_title_component_errors_cleanup = After addressing the issue, you will need to delete the message below to clear the 'managed component error' icon from the previous screen.
view_resource_title_component_errors_tooltip = Zeigt Fehler der gemanagten Ressource. Klicken für Details
view_resource_title_tagUpdateFailed = Fehler beim Aktualisieren der Ressourcen-Tags
##view_searchBar_defaultPattern = name your pattern
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 41a33be..086793e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1708,6 +1708,7 @@ view_resource_monitor_table_avg = 平均
view_resource_monitor_table_last = 最新
view_resource_monitor_table_max = 最大
view_resource_monitor_table_min = 最小
+##view_resource_title_component_errors_cleanup = After addressing the issue, you will need to delete the message below to clear the 'managed component error' icon from the previous screen.
view_resource_title_component_errors_tooltip = 管理コンポーネントエラーの表示。詳細はクリックしてください
view_resource_title_tagUpdateFailed = リソースタグの更新に失敗しました
view_searchBar_defaultPattern = パターンを名前を付けてください
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 25c4ee4..c262cfe 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1829,6 +1829,7 @@ view_resource_monitor_table_avg = Average
view_resource_monitor_table_last = Last
view_resource_monitor_table_max = Maximum
view_resource_monitor_table_min = Minimum
+##view_resource_title_component_errors_cleanup = After addressing the issue, you will need to delete the message below to clear the 'managed component error' icon from the previous screen.
view_resource_title_component_errors_tooltip = Shows managed component errors. Click for details
view_resource_title_tagUpdateFailed = Failed to update resource tags
view_searchBar_defaultPattern = definir nome para o padr\u00E3o
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 7e4da98..83c0634 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1721,6 +1721,7 @@ view_resource_monitor_table_avg = \u5e73\u5747
view_resource_monitor_table_last = Last
view_resource_monitor_table_max = \u6700\u5927
view_resource_monitor_table_min = \u6700\u5c0f
+##view_resource_title_component_errors_cleanup = After addressing the issue, you will need to delete the message below to clear the 'managed component error' icon from the previous screen.
view_resource_title_component_errors_tooltip = \u663e\u793a\u88ab\u7ba1\u7ec4\u4ef6\u9519\u8bef.\u5355\u51fb\u67e5\u770b\u8be6\u60c5
view_resource_title_tagUpdateFailed = \u66f4\u65b0\u8d44\u6e90\u6807\u7b7e\u5931\u8d25
view_searchBar_defaultPattern = \u5b9a\u4e49\u81ea\u5df1\u7684\u6837\u5f0f
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 382a145..6a7523f 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -35,6 +35,7 @@ import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
import org.rhq.modules.plugins.jbossas7.json.Operation;
import org.rhq.modules.plugins.jbossas7.json.Result;
@@ -51,7 +52,7 @@ public class ASConnection {
String urlString;
private ObjectMapper mapper;
public static boolean verbose = false; // This is a variable on purpose, so devs can switch it on in the debugger or in the agent
- Authenticator passwordAuthenticator ;
+ Authenticator passwordAuthenticator;
private String host;
private int port;
@@ -75,7 +76,7 @@ public class ASConnection {
throw new IllegalArgumentException(e.getMessage());
}
- passwordAuthenticator = new AS7Authenticator(user,password);
+ passwordAuthenticator = new AS7Authenticator(user, password);
Authenticator.setDefault(passwordAuthenticator);
// read system property "as7plugin.verbose"
@@ -101,18 +102,18 @@ public class ASConnection {
InputStream inputStream = null;
BufferedReader br = null;
InputStream es = null;
- HttpURLConnection conn=null;
+ HttpURLConnection conn = null;
long t1 = System.currentTimeMillis();
try {
conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.addRequestProperty("Content-Type", "application/json");
- conn.addRequestProperty("Accept","application/json");
+ conn.addRequestProperty("Accept", "application/json");
conn.setConnectTimeout(10 * 1000); // 10s
conn.setReadTimeout(10 * 1000); // 10s
- if (conn.getReadTimeout()!=10*1000)
+ if (conn.getReadTimeout() != 10 * 1000)
log.warn("JRE uses a broken timeout mechanism - nothing we can do");
OutputStream out = conn.getOutputStream();
@@ -163,6 +164,11 @@ public class ASConnection {
return operationResult;
} else {
log.error("IS was null and code was " + responseCode);
+ //if not properly authorized sends plugin exception for visual indicator in the ui.
+ if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
+ throw new InvalidPluginConfigurationException(
+ "Credentials for plugin to communicate with are invalid. Update Connection Settings with valid credentials.");
+ }
}
} catch (IllegalArgumentException iae) {
log.error("Illegal argument " + iae);
@@ -262,7 +268,7 @@ public class ASConnection {
public Result execute(Operation op, boolean isComplex) {
JsonNode node = executeRaw(op);
- if (node==null) {
+ if (node == null) {
log.warn("Operation [" + op + "] returned null");
Result failure = new Result();
failure.setFailureDescription("Operation [" + op + "] returned null");
commit 7533cbccc0d91f2307b6ab858d119a335d42d1ed
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 21 13:43:19 2012 +0100
[BZ 794489] - Minimize the number of executed discoveries by sharing
the discovery results among sibling resources during getNativeProcess()
call.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
index a5d3d75..bcb16a1 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
@@ -25,10 +25,13 @@ package org.rhq.core.pluginapi.inventory;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
+import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.configuration.Configuration;
@@ -40,6 +43,7 @@ import org.rhq.core.pluginapi.availability.AvailabilityFacet;
import org.rhq.core.pluginapi.content.ContentContext;
import org.rhq.core.pluginapi.event.EventContext;
import org.rhq.core.pluginapi.operation.OperationContext;
+import org.rhq.core.pluginapi.upgrade.ResourceUpgradeContext;
import org.rhq.core.system.ProcessInfo;
import org.rhq.core.system.SystemInfo;
import org.rhq.core.system.SystemInfoFactory;
@@ -60,6 +64,8 @@ import org.rhq.core.system.pquery.ProcessInfoQuery;
@SuppressWarnings("unchecked")
public class ResourceContext<T extends ResourceComponent<?>> {
+ private static final Log LOG = LogFactory.getLog(ResourceContext.class);
+
private final String resourceKey;
private final ResourceType resourceType;
private final String version;
@@ -76,9 +82,42 @@ public class ResourceContext<T extends ResourceComponent<?>> {
private final ContentContext contentContext;
private final Executor availCollectionThreadPool;
private final PluginContainerDeployment pluginContainerDeployment;
+ private final ResourceTypeProcesses trackedProcesses;
+
+ private static class Children {
+ public ResourceType resourceType;
+ public String parentResourceUuid;
+
+ public Children(String parentResourceUuid, ResourceType resourceType) {
+ this.parentResourceUuid = parentResourceUuid;
+ this.resourceType = resourceType;
+ }
+
+ @Override
+ public int hashCode() {
+ int uuidHashCode = parentResourceUuid == null ? 1 : parentResourceUuid.hashCode();
+ return 31 * uuidHashCode * resourceType.getId();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
- private ProcessInfo processInfo;
+ if (!(other instanceof Children)) {
+ return false;
+ }
+ Children o = (Children) other;
+
+ return (parentResourceUuid == null ? o.parentResourceUuid == null : parentResourceUuid
+ .equals(o.parentResourceUuid)) && resourceType.equals(o.resourceType);
+ }
+ }
+
+ private static Map<Children, ResourceTypeProcesses> PROCESSES_PER_PARENT_PER_RESOURCE_TYPE = new HashMap<Children, ResourceTypeProcesses>();
+
/**
* Creates a new {@link ResourceContext} object. The plugin container is responsible for instantiating these
* objects; plugin writers should never have to actually create context objects.
@@ -135,6 +174,12 @@ public class ResourceContext<T extends ResourceComponent<?>> {
this.operationContext = operationContext;
this.contentContext = contentContext;
this.availCollectionThreadPool = availCollectorThreadPool;
+
+ String parentResourceUuid = "";
+ if (resource.getParentResource() != null) {
+ parentResourceUuid = resource.getParentResource().getUuid();
+ }
+ this.trackedProcesses = getTrackedProcesses(parentResourceUuid, resourceType);
}
/**
@@ -219,46 +264,74 @@ public class ResourceContext<T extends ResourceComponent<?>> {
* @return information on the resource's process
*/
public ProcessInfo getNativeProcess() {
- boolean rediscover = this.processInfo == null;
-
- if (!rediscover) {
- //if the process info thinks the process is running,
- //refresh it to check its facts again
- if (this.processInfo.isRunning()) {
- this.processInfo.refresh();
- }
- rediscover = !this.processInfo.isRunning();
+ ProcessInfo processInfo = trackedProcesses.getProcessInfo(resourceKey);
+
+ if (!isRediscoveryRequired(processInfo)) {
+ return processInfo;
}
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("getNativeProcess(): rediscovery required on resource " + resourceType + " with key " + resourceKey + ", syncing on " + trackedProcesses);
+ }
+
+ synchronized (trackedProcesses) {
+ //right, we've entered the critical section...
+ //we might have waited for another thread to actually fill in the tracked processes
+ //so let's check again if we really need to run the discovery
+ processInfo = trackedProcesses.getProcessInfo(resourceKey);
+
+ if (isRediscoveryRequired(processInfo)) {
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("getNativeProcess(): recheck for rediscovery confirmed the need for it");
+ }
- if (rediscover) {
- //This method is documented to return null if the process can no longer be found.
- //Let's make sure that's the case and null it out now. The discovery might or might not
- //reassign it.
- this.processInfo = null;
- if (this.resourceDiscoveryComponent != null) {
try {
- Set<DiscoveredResourceDetails> details;
- ResourceDiscoveryContext<T> context;
+ Set<DiscoveredResourceDetails> details = Collections.emptySet();
- context = new ResourceDiscoveryContext<T>(this.resourceType, this.parentResourceComponent, this.parentResourceContext,
- this.systemInformation, getNativeProcessesForType(), Collections.EMPTY_LIST,
- getPluginContainerName(), getPluginContainerDeployment());
+ List<ProcessScanResult> processes = getNativeProcessesForType();
+ if (!processes.isEmpty()) {
+ ResourceDiscoveryContext<T> context;
- details = this.resourceDiscoveryComponent.discoverResources(context);
+ context =
+ new ResourceDiscoveryContext<T>(this.resourceType, this.parentResourceComponent,
+ this.parentResourceContext, this.systemInformation, processes, Collections.EMPTY_LIST,
+ getPluginContainerName(), getPluginContainerDeployment());
- for (DiscoveredResourceDetails detail : details) {
- if (detail.getResourceKey().equals(this.resourceKey)) {
- this.processInfo = detail.getProcessInfo();
- }
+ details = this.resourceDiscoveryComponent.discoverResources(context);
+
+ trackedProcesses.update(details);
+ processInfo = trackedProcesses.getProcessInfo(resourceKey);
}
} catch (Exception e) {
- LogFactory.getLog(getClass()).warn(
- "Cannot get native process for resource [" + this.resourceKey + "] - discovery failed", e);
+ LOG.warn("Cannot get native process for resource [" + this.resourceKey + "] - discovery failed", e);
}
}
}
- return this.processInfo;
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("getNativeProcess(): rediscovery done");
+ }
+
+ return processInfo;
+ }
+
+ /**
+ * @param processInfo
+ * @return
+ */
+ private boolean isRediscoveryRequired(ProcessInfo processInfo) {
+ boolean rediscover = processInfo == null;
+
+ if (!rediscover) {
+ //if the process info thinks the process is running,
+ //refresh it to check its facts again
+ if (processInfo.isRunning()) {
+ processInfo.refresh();
+ }
+ rediscover = !processInfo.isRunning();
+ }
+ return rediscover;
}
/**
@@ -402,4 +475,27 @@ public class ResourceContext<T extends ResourceComponent<?>> {
return new AvailabilityCollectorRunnable(availChecker, interval,
Thread.currentThread().getContextClassLoader(), this.availCollectionThreadPool);
}
+
+ /**
+ * Returns a shared object representing the processes detected for given resource type under given parent.
+ * Note that this comes from a static field so it is shared by any resource contexts representing a
+ * resource of the same type under a single parent. This is to reduce the number of needed discoveries
+ * to a minimum.
+ *
+ * @param parentResourceUuid
+ * @param resourceType
+ * @return
+ */
+ private static ResourceTypeProcesses getTrackedProcesses(String parentResourceUuid, ResourceType resourceType) {
+ synchronized(PROCESSES_PER_PARENT_PER_RESOURCE_TYPE) {
+ Children key = new Children(parentResourceUuid, resourceType);
+ ResourceTypeProcesses ret = PROCESSES_PER_PARENT_PER_RESOURCE_TYPE.get(key);
+ if (ret == null) {
+ ret = new ResourceTypeProcesses();
+ PROCESSES_PER_PARENT_PER_RESOURCE_TYPE.put(key, ret);
+ }
+
+ return ret;
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceTypeProcesses.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceTypeProcesses.java
new file mode 100644
index 0000000..8e509da
--- /dev/null
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceTypeProcesses.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.pluginapi.inventory;
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.rhq.core.system.ProcessInfo;
+
+/**
+ * A helper class to {@link ResourceContext} to store the process infos of individual
+ * resources of a resource type.
+ *
+ * @author Lukas Krejci
+ */
+class ResourceTypeProcesses {
+
+ private HashMap<String, ProcessInfo> processes = new HashMap<String, ProcessInfo>();
+
+ //why do we synchronize on something different than "this"? because if the callers
+ //synchronize on "this" and try to call some of the below methods outside of that
+ //synchronized block, they won't deadlock, which they would if the below methods were
+ //syncing on "this" (i.e. if the methods below were synchronized).
+ private final Object lock = new Object();
+
+ public ProcessInfo getProcessInfo(String resourceKey) {
+ synchronized(lock) {
+ return processes.get(resourceKey);
+ }
+ }
+
+ public void update(Set<DiscoveredResourceDetails> discoveryResults) {
+ synchronized(lock) {
+ processes.clear();
+ for (DiscoveredResourceDetails details : discoveryResults) {
+ processes.put(details.getResourceKey(), details.getProcessInfo());
+ }
+ }
+ }
+}
commit 21ce96ac0da01f32f3c57acec608523176db2ceb
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 21 13:23:47 2012 +0100
[BZ 794489] - make sure to use the parent resource context when creating
the discovery context that should rediscover the same resource as
the resource context represents.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
index 853345d..a5d3d75 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
@@ -59,10 +59,12 @@ import org.rhq.core.system.pquery.ProcessInfoQuery;
*/
@SuppressWarnings("unchecked")
public class ResourceContext<T extends ResourceComponent<?>> {
+
private final String resourceKey;
private final ResourceType resourceType;
private final String version;
private final T parentResourceComponent;
+ private final ResourceContext<?> parentResourceContext;
private final Configuration pluginConfiguration;
private final SystemInfo systemInformation;
private final ResourceDiscoveryComponent<T> resourceDiscoveryComponent;
@@ -83,7 +85,8 @@ public class ResourceContext<T extends ResourceComponent<?>> {
*
* @param resource the resource whose {@link org.rhq.core.pluginapi.inventory.ResourceComponent}
* will be given this context object of the plugin
- * @param parentResourceComponent the parent component of the context's associated resource component
+ * @param parentResourceComponent the parent component of the context's associated resource component (or null if parent resource is null)
+ * @param parentResourceContext the resource context of the parent resource (or null if parent resource is null)
* @param resourceDiscoveryComponent the discovery component that can be used to detect other resources of the same
* type as this resource (may be <code>null</code>)
* @param systemInfo information about the system on which the plugin and its plugin container are
@@ -104,7 +107,7 @@ public class ResourceContext<T extends ResourceComponent<?>> {
* {@link AvailabilityCollectorRunnable} for more information on this.
* @param pluginContainerDeployment indicates where the plugin container is running
*/
- public ResourceContext(Resource resource, T parentResourceComponent,
+ public ResourceContext(Resource resource, T parentResourceComponent, ResourceContext<?> parentResourceContext,
ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo, File temporaryDirectory,
File dataDirectory, String pluginContainerName, EventContext eventContext, OperationContext operationContext,
ContentContext contentContext, Executor availCollectorThreadPool,
@@ -114,6 +117,7 @@ public class ResourceContext<T extends ResourceComponent<?>> {
this.resourceType = resource.getResourceType();
this.version = resource.getVersion();
this.parentResourceComponent = parentResourceComponent;
+ this.parentResourceContext = parentResourceContext;
this.resourceDiscoveryComponent = resourceDiscoveryComponent;
this.systemInformation = systemInfo;
this.pluginConfiguration = resource.getPluginConfiguration();
@@ -172,6 +176,19 @@ public class ResourceContext<T extends ResourceComponent<?>> {
}
/**
+ * Returns the resource context of the parent resource or null if there is no parent resource.
+ * <p>
+ * (This method is protected to be able to share that information with the {@link ResourceUpgradeContext}
+ * but at the same time to not pollute the ResourceContext public API with data that doesn't belong
+ * to it).
+ *
+ * @return
+ */
+ protected ResourceContext<?> getParentResourceContext() {
+ return this.parentResourceContext;
+ }
+
+ /**
* Returns a {@link SystemInfo} object that contains information about the platform/operating system that the
* resource is running on. With this object, you can natively obtain things such as the operating system name, its
* hostname,and other things. Please refer to the javadoc on {@link SystemInfo} for more details on the types of
@@ -223,7 +240,7 @@ public class ResourceContext<T extends ResourceComponent<?>> {
Set<DiscoveredResourceDetails> details;
ResourceDiscoveryContext<T> context;
- context = new ResourceDiscoveryContext<T>(this.resourceType, this.parentResourceComponent, this,
+ context = new ResourceDiscoveryContext<T>(this.resourceType, this.parentResourceComponent, this.parentResourceContext,
this.systemInformation, getNativeProcessesForType(), Collections.EMPTY_LIST,
getPluginContainerName(), getPluginContainerDeployment());
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
index b4c6192..702a768 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
@@ -49,7 +49,6 @@ public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends Reso
private final Configuration resourceConfiguration;
private final String name;
private final String description;
- private ResourceContext<?> parentResourceContext;
/**
* @see ResourceContext#ResourceContext(Resource, ResourceComponent, ResourceDiscoveryComponent, SystemInfo, File, File, String, EventContext, OperationContext, ContentContext, Executor, PluginContainerDeployment)
@@ -60,18 +59,18 @@ public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends Reso
OperationContext operationContext, ContentContext contentContext, Executor availCollectorThreadPool,
PluginContainerDeployment pluginContainerDeployment) {
- super(resource, parentResourceComponent, resourceDiscoveryComponent, systemInfo, temporaryDirectory,
+ super(resource, parentResourceComponent, parentResourceContext, resourceDiscoveryComponent, systemInfo, temporaryDirectory,
dataDirectory, pluginContainerName, eventContext, operationContext, contentContext,
availCollectorThreadPool, pluginContainerDeployment);
- this.parentResourceContext = parentResourceContext;
this.resourceConfiguration = resource.getResourceConfiguration();
this.name = resource.getName();
this.description = resource.getDescription();
}
+ @Override
public ResourceContext<?> getParentResourceContext() {
- return parentResourceContext;
+ return super.getParentResourceContext();
}
public Configuration getResourceConfiguration() {
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index ab42feb..fad45b9 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1551,11 +1551,15 @@ public class InventoryManager extends AgentService implements ContainerService,
type.getPluginConfigurationDefinition());
ResourceComponent<?> parentComponent = null;
+ ResourceContext<?> parentResourceContext = null;
if (resource.getParentResource() != null) {
- parentComponent = getResourceComponent(resource.getParentResource());
+ ResourceContainer rc = getResourceContainer(resource.getParentResource());
+
+ parentComponent = rc.getResourceComponent();
+ parentResourceContext = rc.getResourceContext();
}
- ResourceContext context = createResourceContext(resource, parentComponent, discoveryComponent);
+ ResourceContext context = createResourceContext(resource, parentComponent, parentResourceContext, discoveryComponent);
container.setResourceContext(context);
return true;
@@ -1645,11 +1649,12 @@ public class InventoryManager extends AgentService implements ContainerService,
}
private <T extends ResourceComponent<?>> ResourceContext<T> createResourceContext(Resource resource,
- T parentComponent, ResourceDiscoveryComponent<T> discoveryComponent) {
+ T parentComponent, ResourceContext<?> parentResourceContext, ResourceDiscoveryComponent<T> discoveryComponent) {
File pluginDataDir = new File(this.configuration.getDataDirectory(), resource.getResourceType().getPlugin());
return new ResourceContext<T>(resource, // the resource itself
parentComponent, // its parent component
+ parentResourceContext, //the resource context of the parent
discoveryComponent, // the discovery component (this is actually the proxy to it)
SystemInfoFactory.createSystemInfo(), // for native access
this.configuration.getTemporaryDirectory(), // location for plugin to write temp files
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java
index c69331c..c8e9f10 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java
@@ -477,7 +477,7 @@ public class BundleManagerTest {
@SuppressWarnings("unchecked")
private class MockResourceContext extends ResourceContext {
public MockResourceContext(Resource resource) {
- super(resource, null, null, null, null, null, null, null, null, null, null, null);
+ super(resource, null, null, null, null, null, null, null, null, null, null, null, null);
}
}
}
\ No newline at end of file
commit e2bbfdf06987dd1de0dcedac98f69116f21a24ae
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Feb 20 18:13:42 2012 -0500
[BZ 786159] add a new VIEW_USERS global permission that is required in order to view other users (https://bugzilla.redhat.com/show_bug.cgi?id=786159)
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index d434713..c2b8a1f 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -15,7 +15,7 @@
<description>Database schema setup, upgrade and other utilities</description>
<properties>
- <db.schema.version>2.118</db.schema.version>
+ <db.schema.version>2.119</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
<rhq.ds.connection-url>${rhq.test.ds.connection-url}</rhq.ds.connection-url>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/authz-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/authz-data.xml
index d17e907..681bd66 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/authz-data.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/authz-data.xml
@@ -49,6 +49,7 @@
<data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS -->
<data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE -->
<data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES -->
+ <data ROLE_ID="1" OPERATION="17"/> <!-- Permission.VIEW_USERS -->
<!-- resource permissions start here-->
<data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE -->
<data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE -->
@@ -67,6 +68,7 @@
(explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) -->
<data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY -->
<data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE -->
+ <data ROLE_ID="2" OPERATION="17"/> <!-- Permission.VIEW_USERS -->
<!-- resource permissions start here-->
<data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE -->
<data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE -->
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 7b1f9a2..74b278a 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3944,7 +3944,7 @@
<!-- Remove an obsolete drift table that may be hanging around -->
<schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
- <!-- Remove an unwanted null consraint -->
+ <!-- Remove an unwanted null constraint -->
<schema-alterColumn table="RHQ_DRIFT_CHANGE_SET" column="DRIFT_DEFINITION_ID" nullable="TRUE" />
</schemaSpec>
@@ -3956,7 +3956,16 @@
</statement>
</schema-directSQL>
</schemaSpec>
-
+
+ <schemaSpec version="2.119">
+ <schema-directSQL>
+ <statement desc="Adding VIEW_USERS global permission to all existing roles">
+ INSERT INTO RHQ_PERMISSION (ROLE_ID, OPERATION)
+ SELECT r.ID, 17 FROM RHQ_ROLE r WHERE r.ID > 2
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Permission.java b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Permission.java
index 16f60dc..c7abea6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Permission.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Permission.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -130,7 +130,13 @@ public enum Permission {
/**
* Can C/U/D drift related entities
*/
- MANAGE_DRIFT(Target.RESOURCE) // 16
+ MANAGE_DRIFT(Target.RESOURCE), // 16
+
+ /**
+ * Can view other RHQ users, except for their assigned roles
+ */
+ // NOTE: This is a GLOBAL permission but defined here to maintain the ordinal indexes
+ VIEW_USERS(Target.GLOBAL) // 17
;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
index 859a8ff..6c5d820 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
-import java.util.logging.Logger;
import com.google.gwt.core.client.JavaScriptObject;
import com.smartgwt.client.core.RefDataClass;
import com.smartgwt.client.data.Record;
@@ -34,7 +33,6 @@ import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.util.JSOHelper;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -168,14 +166,17 @@ public class PermissionsEditor extends LocatableVStack {
ListGridRecord record = createGlobalPermissionRecord(MSG.view_adminRoles_permissions_perm_manageSecurity(),
"global/Locked", Permission.MANAGE_SECURITY, MSG.view_adminRoles_permissions_permDesc_manageSecurity());
records.add(record);
+
record = createGlobalPermissionRecord(MSG.view_adminRoles_permissions_perm_manageInventory(),
"subsystems/inventory/Inventory", Permission.MANAGE_INVENTORY,
MSG.view_adminRoles_permissions_permDesc_manageInventory());
records.add(record);
+
record = createGlobalPermissionRecord(MSG.view_adminRoles_permissions_perm_manageSettings(),
"subsystems/configure/Configure", Permission.MANAGE_SETTINGS,
MSG.view_adminRoles_permissions_permDesc_manageSettings(productInfo.getShortName()));
records.add(record);
+
record = createGlobalPermissionRecord(MSG.view_adminRoles_permissions_perm_manageBundles(),
"subsystems/bundle/Bundle", Permission.MANAGE_BUNDLE,
MSG.view_adminRoles_permissions_permDesc_manageBundles());
@@ -186,6 +187,11 @@ public class PermissionsEditor extends LocatableVStack {
MSG.view_adminRoles_permissions_permDesc_manageRepositories());
records.add(record);
+ record = createGlobalPermissionRecord(MSG.view_adminRoles_permissions_perm_viewUsers(),
+ "global/User", Permission.VIEW_USERS,
+ MSG.view_adminRoles_permissions_permDesc_viewUsers());
+ records.add(record);
+
grid.setData(records.toArray(new ListGridRecord[records.size()]));
return grid;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index af39085..2751ba5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -211,6 +211,7 @@ public class RoleEditView extends AbstractRecordEditor<RolesDataSource> implemen
@Override
protected Record createNewRecord() {
Role role = new Role();
+ role.addPermission(Permission.VIEW_USERS);
Record roleRecord = RolesDataSource.getInstance().copyValues(role);
return roleRecord;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
index 8e90f8a..7001a56 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
@@ -299,7 +299,7 @@ public abstract class AbstractRecordEditor<DS extends RPCDataSource> extends Loc
}
message = new Message(conciseMessage, detailedMessage);
- CoreGUI.goToView(getListViewPath(), message);
+ CoreGUI.goToView(getListViewPath(), message, true);
} else if (response.getStatus() == RPCResponse.STATUS_VALIDATION_ERROR) {
Message message = new Message(MSG.widget_recordEditor_error_operationInvalidValues(),
Message.Severity.Error);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index d568efb..0bf7dad 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -423,8 +423,9 @@ view_adminRoles_permissions_isWrite = Write?
view_adminRoles_permissions_permDesc_manageBundles = can create, update, or delete provisioning bundles (viewing is implied for everyone)
view_adminRoles_permissions_permDesc_manageInventory = has all Resource permissions, as described below, for all Resources; can create, update, and delete groups; and can import auto-discovered or manually discovered Resources
view_adminRoles_permissions_permDesc_manageRepositories = can create, update, or delete repositories of any user (everyone can create their own repositories), can associate content sources to repositories.
-view_adminRoles_permissions_permDesc_manageSecurity = can create, update, or delete users and roles (viewing is implied for everyone)
+view_adminRoles_permissions_permDesc_manageSecurity = can create, update, or delete users and roles - implies all other permissions
view_adminRoles_permissions_permDesc_manageSettings = can modify the {0} Server configuration and perform any Server-related functionality
+view_adminRoles_permissions_permDesc_viewUsers = can view other users, with the exception of their assigned roles
view_adminRoles_permissions_permReadDesc_configure = view Resource configuration and Resource configuration revision history
view_adminRoles_permissions_permReadDesc_control = (IMPLIED) view available operations and operation execution history
view_adminRoles_permissions_permReadDesc_createChildResources = (IMPLIED) view child Resource creation history
@@ -460,6 +461,7 @@ view_adminRoles_permissions_perm_manageMeasurements = Manage Measurements
view_adminRoles_permissions_perm_manageRepositories = Manage Repositories
view_adminRoles_permissions_perm_manageSecurity = Manage Security
view_adminRoles_permissions_perm_manageSettings = Manage Settings
+view_adminRoles_permissions_perm_viewUsers = View Users
view_adminRoles_permissions_read = Read:
view_adminRoles_permissions_readAccessImplied = Read access for the {0} permission is implied and cannot be disabled.
view_adminRoles_permissions_resourcePermissions = Resource Permissions
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index 5880c66..1265aa7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -774,9 +774,15 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
public PageList<Subject> findSubjectsByCriteria(Subject subject, SubjectCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
-
CriteriaQueryRunner<Subject> queryRunner = new CriteriaQueryRunner<Subject>(criteria, generator, entityManager);
- return queryRunner.execute();
+ PageList<Subject> subjects = queryRunner.execute();
+ if (!authorizationManager.hasGlobalPermission(subject, Permission.VIEW_USERS)) {
+ subjects.clear();
+ Subject attachedSubject = entityManager.find(Subject.class, subject.getId());
+ subjects.add(attachedSubject);
+ subjects.setTotalSize(1);
+ }
+ return subjects;
}
private boolean isLdapAuthenticationEnabled() {
commit f54f4ed03d76d21ab73d9075dc21a81e9fdf21bc
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Feb 20 14:25:12 2012 -0500
[BZ 772259] Use the destroyPanes property to save content panes
Not sure if the destroyPanes property is new since SmartGWT 2.4, but
setting it to false causes a tab's content pane not be destroyed when
the owning tab is removed from a TabSet. This simplifies the logic for
hiding a tab, and also fixes the regression mentioned in
https://bugzilla.redhat.com/show_bug.cgi?id=781602#c1.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index b7eeac2..572f035 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.History;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
@@ -37,23 +36,13 @@ import java.util.Map;
*/
public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
- private static class TabPanePair {
- public TwoLevelTab tab;
- public Canvas pane;
-
- public TabPanePair(TwoLevelTab tab, Canvas pane) {
- this.tab= tab;
- this.pane = pane;
- }
- }
-
- /** maps Tab locator IDs to Tabs and their associated panes. */
- private Map<String, TabPanePair> hiddenTabs = new LinkedHashMap<String, TabPanePair>();
-
+ private Map<String, TwoLevelTab> hiddenTabs = new LinkedHashMap<String, TwoLevelTab>();
+
private boolean ignoreSelectEvents = false;
public TwoLevelTabSet(String locatorId) {
super(locatorId);
+ setDestroyPanes(false);
}
public void setTabs(TwoLevelTab... tabs) {
@@ -86,27 +75,16 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
if (hiddenTabs.containsKey(tab.getLocatorId())) {
return;
}
-
- // don't let the removeTab() destroy the pane
- Canvas contentPane = tab.getPane();
- updateTab(tab, null);
+ // Note that removing the tab does *not* destroy its content pane
+ // since we set the destroyPanes property to false in the
removeTab(tab);
-
- // Previously we called tab.setPane(contentPane) here to reset the
- // pane. With the upgrade to SmartGWT 3.0 however, resetting the
- // pane prevents the tab from being hidden. This issue was logged
- // under https://bugzilla.redhat.com/show_bug.cgi?id=772259. Note
- // that we need to hold onto both the tab and its pane so that the
- // tab content can be displayed when the tab is made visible again.
- // We hold onto the tab and its pane in a TabPanePair.
- hiddenTabs.put(tab.getLocatorId(), new TabPanePair(tab, contentPane));
+ hiddenTabs.put(tab.getLocatorId(), tab);
} else {
if (!hiddenTabs.containsKey(tab.getLocatorId())) {
return;
}
- TabPanePair pair = hiddenTabs.remove(tab.getLocatorId());
- tab.setPane(pair.pane);
+ hiddenTabs.remove(tab.getLocatorId());
addTab(tab);
}
}
@@ -115,9 +93,6 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
for (TwoLevelTab tab : getTabs()) {
tab.getLayout().destroyViews();
}
- for (TabPanePair pair : hiddenTabs.values()) {
- pair.tab.getLayout().destroyViews();
- }
}
// ------- Event support -------
@@ -205,9 +180,7 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
public void destroy() {
// add the hidden tabs back under the TabSet. This will get them destroyed by smartgwt when the tabset
// goes away. There is no explicit Tab.destroy().
- for (TabPanePair pair : hiddenTabs.values()) {
- Tab tab = pair.tab;
- tab.setPane(pair.pane);
+ for (TwoLevelTab tab : hiddenTabs.values()) {
addTab(tab);
}
for (TwoLevelTab tab : getTabs()) {
commit 6f7913acb3583d89f8e1c5dd61f220cef1e05b9b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Feb 20 13:04:16 2012 -0500
[BZ 794790] within the plugin container, always use a ConcurrentHashMap-based Set for Resource.childResources field to allow it to be concurrently accessed safely (i.e. to avoid ConcurrentModificationExceptions) (https://bugzilla.redhat.com/show_bug.cgi?id=794790)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index a403cd4..e920c51 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2009 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -976,7 +976,7 @@ public class Resource implements Comparable<Resource>, Serializable {
@OneToMany(mappedBy = "parentResource", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
@OrderBy
// primary key
- private Set<Resource> childResources = new LinkedHashSet<Resource>();
+ private Set<Resource> childResources = new HashSet<Resource>();
// LAZY fetch otherwise this will recursively call all parents until null is found
@JoinColumn(name = "PARENT_RESOURCE_ID", nullable = true)
@@ -1181,7 +1181,7 @@ public class Resource implements Comparable<Resource>, Serializable {
* Using the current settings for resource field set the encoded ancestry string. This method
* is called automatically from {@link #setParentResource(Resource)} because the parent defines the ancestry.
* The parent should be an attached entity to ensure access to all necessary information. If the parent is
- * not a persisted entity, or if it lacks the required information, the update will be skipped.<br/><br.>
+ * not a persisted entity, or if it lacks the required information, the update will be skipped.
* It can also be called at any time the ancestry has changed, for example, if a resource name has
* been updated.
*
@@ -1362,6 +1362,7 @@ public class Resource implements Comparable<Resource>, Serializable {
this.location = location;
}
+ @NotNull
public Set<Resource> getChildResources() {
return this.childResources;
}
@@ -1376,10 +1377,9 @@ public class Resource implements Comparable<Resource>, Serializable {
}
public void setChildResources(Set<Resource> children) {
- if (children == null) {
- children = new LinkedHashSet<Resource>();
- }
- this.childResources = children;
+ // Never allow this.childResources to become null, so we can guarantee getChildResources() will always return a
+ // non-null value.
+ this.childResources = (children != null) ? children : new HashSet<Resource>();
}
@Nullable
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
index 6e02e3d..6138dcf 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
@@ -129,9 +129,7 @@ public class ConfigurationCheckExecutor implements Runnable, Callable {
}
if (checkChildren) {
- // Avoid concurrent mod exceptions during potentially long duration issues
- Set<Resource> childSet = new HashSet<Resource>(resource.getChildResources());
- for (Resource child : childSet) {
+ for (Resource child : resource.getChildResources()) {
try {
checkConfigurations(child, true);
} catch (Exception e) {
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
index e623cb0..de0b0c1 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
@@ -232,9 +232,7 @@ public class AvailabilityExecutor implements Runnable, Callable<AvailabilityRepo
}
if (checkChildren) {
- // Wrap in a fresh HashSet to avoid ConcurrentModificationExceptions.
- Set<Resource> children = new HashSet<Resource>(resource.getChildResources());
- for (Resource child : children) {
+ for (Resource child : resource.getChildResources()) {
checkInventory(child, availabilityReport, reportChangesOnly, true, current == AvailabilityType.DOWN);
}
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryFile.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryFile.java
index 023a93e..fac1e6f 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryFile.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryFile.java
@@ -139,7 +139,7 @@ public class InventoryFile {
private void removeIgnoredResourcesFromChildren(Resource resource, Set<String> uuidsToIgnore) {
Set<Resource> children = resource.getChildResources();
- if (children != null && !children.isEmpty() && !uuidsToIgnore.isEmpty()) {
+ if (!children.isEmpty() && !uuidsToIgnore.isEmpty()) {
Iterator<Resource> iterator = children.iterator();
while (iterator.hasNext() && !uuidsToIgnore.isEmpty()) {
Resource child = iterator.next();
@@ -164,10 +164,8 @@ public class InventoryFile {
// now reconnect all its children's types
Set<Resource> children = resource.getChildResources();
- if (children != null) {
- for (Resource child : children) {
- connectTypes(child, uuidsToIgnore);
- }
+ for (Resource child : children) {
+ connectTypes(child, uuidsToIgnore);
}
} else {
log.info("Persisted resource [" + resource + "] has a disabled resource type - will not reconnect it");
@@ -185,10 +183,8 @@ public class InventoryFile {
private void addAllUUIDsToList(Resource resource, Set<String> list) {
list.add(resource.getUuid());
Set<Resource> children = resource.getChildResources();
- if (children != null) {
- for (Resource child : children) {
- addAllUUIDsToList(child, list);
- }
+ for (Resource child : children) {
+ addAllUUIDsToList(child, list);
}
return;
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index c39f6f2..ab42feb 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -38,6 +38,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -840,6 +841,7 @@ public class InventoryManager extends AgentService implements ContainerService,
static Resource createNewResource(DiscoveredResourceDetails details) {
Resource resource = new Resource();
+
resource.setUuid(UUID.randomUUID().toString());
resource.setResourceKey(details.getResourceKey());
resource.setName(details.getResourceName());
@@ -850,8 +852,12 @@ public class InventoryManager extends AgentService implements ContainerService,
Configuration pluginConfiguration = details.getPluginConfiguration();
ConfigurationUtility.normalizeConfiguration(details.getPluginConfiguration(), details.getResourceType()
.getPluginConfigurationDefinition());
-
resource.setPluginConfiguration(pluginConfiguration);
+
+ // Use a ConcurrentHashMap-based Set for childResources to allow the field to be concurrently accessed safely
+ // (i.e. to avoid ConcurrentModificationExceptions).
+ resource.setChildResources(Collections.newSetFromMap(new ConcurrentHashMap<Resource, Boolean>()));
+
return resource;
}
@@ -1167,9 +1173,7 @@ public class InventoryManager extends AgentService implements ContainerService,
// recursively, but we need to do this now to ensure everything is stopped prior to removing them from inventory
deactivateResource(resource);
- // put in new set to avoid concurrent mod exceptions
- Set<Resource> children = new HashSet<Resource>(resource.getChildResources());
- for (Resource child : children) {
+ for (Resource child : resource.getChildResources()) {
scanIsNeeded |= removeResourceAndIndicateIfScanIsNeeded(child);
}
@@ -1724,11 +1728,9 @@ public class InventoryManager extends AgentService implements ContainerService,
return this.platform;
}
} else {
- if (parent.getChildResources() != null) {
- for (Resource child : parent.getChildResources()) {
- if (child != null && matches(resource, child)) {
- return child;
- }
+ for (Resource child : parent.getChildResources()) {
+ if (child != null && matches(resource, child)) {
+ return child;
}
}
}
@@ -1861,10 +1863,7 @@ public class InventoryManager extends AgentService implements ContainerService,
try {
ResourceContainer container = getResourceContainer(resource);
if ((container != null) && (container.getResourceComponentState() == ResourceComponentState.STARTED)) {
- // Copy child Resources to an array and iterate that, rather than iterating the Set, which could cause
- // a ConcurrentModificationException if another thread tries to modify the Set while we're iterating it.
- Resource[] childResources = resource.getChildResources().toArray(new Resource[resource.getChildResources().size()]);
- for (Resource child : childResources) {
+ for (Resource child : resource.getChildResources()) {
deactivateResource(child);
}
@@ -2035,7 +2034,7 @@ public class InventoryManager extends AgentService implements ContainerService,
// performing syncing of the children schedules in one fell swoop
Set<Integer> childrenIds = new HashSet<Integer>();
- for (Resource child : new HashSet<Resource>(resource.getChildResources())) {
+ for (Resource child : resource.getChildResources()) {
childrenIds.add(child.getId());
}
scheduleRequests = configuration.getServerServices().getMeasurementServerService()
@@ -2702,9 +2701,7 @@ public class InventoryManager extends AgentService implements ContainerService,
refreshResourceComponentState(resourceContainer, pluginConfigUpdated);
- // Recurse... wrap in new HashSet to avoid CMEs
- Set<Resource> childResources = new HashSet<Resource>(passedResource.getChildResources());
- for (Resource childResource : childResources) {
+ for (Resource childResource : passedResource.getChildResources()) {
mergeResource(childResource);
}
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java
index e1b8d85..0f2257f 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java
@@ -148,7 +148,7 @@ public class RuntimeDiscoveryExecutor implements Runnable, Callable<InventoryRep
private void discoverForResourceRecursive(Resource parent, InventoryReport report) throws PluginContainerException {
Set<Resource> children = parent.getChildResources();
- if (children != null && !children.isEmpty()) {
+ if (!children.isEmpty()) {
Set<Resource> childrenCopy = new HashSet<Resource>(children); // prevent concurrent mod
for (Resource child : childrenCopy) {
// See if the child has new children itself. Then we check those children to see if there are grandchildren.
@@ -289,7 +289,7 @@ public class RuntimeDiscoveryExecutor implements Runnable, Callable<InventoryRep
// TODO: Move this to InventoryManager, so it can be used by AutoDiscoveryExecutor too.
private void removeStaleResources(Resource parent, ResourceType childResourceType,
Map<String, Resource> mergedResources) {
- Set<Resource> existingChildResources = new HashSet<Resource>(parent.getChildResources()); // wrap in new HashSet to avoid CMEs
+ Set<Resource> existingChildResources = parent.getChildResources();
for (Resource existingChildResource : existingChildResources) {
// NOTE: If inside Agent, only remove Resources w/ id == 0. Other Resources may still exist in the
// the Server's inventory.
@@ -300,7 +300,5 @@ public class RuntimeDiscoveryExecutor implements Runnable, Callable<InventoryRep
this.inventoryManager.removeResourceAndIndicateIfScanIsNeeded(existingChildResource);
}
}
- existingChildResources.clear(); // help GC
- existingChildResources = null;
}
}
\ No newline at end of file
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeFailureHandlingTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeFailureHandlingTest.java
index 0241f6d..c559553 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeFailureHandlingTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeFailureHandlingTest.java
@@ -36,14 +36,10 @@ import org.testng.annotations.Test;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.discovery.InvalidPluginConfigurationClientException;
-import org.rhq.core.clientapi.server.discovery.InvalidInventoryReportException;
-import org.rhq.core.clientapi.server.discovery.InventoryReport;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.PluginContainer;
-import org.rhq.core.pc.ServerServices;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.upgrade.plugins.multi.base.BaseResourceComponentInterface;
diff --git a/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java b/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
index d058626..0eae80c 100644
--- a/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
+++ b/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
@@ -112,13 +112,10 @@ public class HibernatePluginTest
{
found.add(resource);
}
- if (resource.getChildResources() != null)
- {
- for (Resource child : found)
- {
- found.addAll(findResource(child,typeName));
- }
- }
+ for (Resource child : found)
+ {
+ found.addAll(findResource(child,typeName));
+ }
}
return found;
}
diff --git a/modules/plugins/tomcat/src/test/java/org/jboss/on/plugins/tomcat/test/TomcatPluginTest.java b/modules/plugins/tomcat/src/test/java/org/jboss/on/plugins/tomcat/test/TomcatPluginTest.java
index ca5b6eb..3589dcb 100644
--- a/modules/plugins/tomcat/src/test/java/org/jboss/on/plugins/tomcat/test/TomcatPluginTest.java
+++ b/modules/plugins/tomcat/src/test/java/org/jboss/on/plugins/tomcat/test/TomcatPluginTest.java
@@ -103,10 +103,8 @@ public class TomcatPluginTest {
foundResources.add(currentResource);
}
- if (currentResource.getChildResources() != null) {
- for (Resource child : currentResource.getChildResources()) {
- discoveryQueue.add(child);
- }
+ for (Resource child : currentResource.getChildResources()) {
+ discoveryQueue.add(child);
}
}
commit 1e79412feb36d45db866abf9639948f7a5275f4f
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Feb 20 11:54:21 2012 -0500
use Hibernate.initialize(), rather than size() hack, to init lazy fields; remove an unused import
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 9888496..9a41142 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -131,6 +131,7 @@ import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QuartzUtil;
+import sun.management.resources.agent;
/**
* The manager responsible for working with Resource and plugin configurations.
@@ -1438,13 +1439,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
resource.addResourceConfigurationUpdates(newUpdateRequest);
- resource.getChildResources().size();
-
- // agent field is LAZY - force it to load because the caller will need it.
- Agent agent = resource.getAgent();
- if (agent != null) {
- agent.getName();
- }
+ // agent and childResources fields are LAZY - force them to load, because the caller will need them.
+ Hibernate.initialize(resource.getChildResources());
+ Hibernate.initialize(resource.getAgent());
return newUpdateRequest;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 7609492..f74b287 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -42,6 +42,7 @@ import javax.security.auth.login.LoginException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.Hibernate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.quartz.JobDataMap;
@@ -791,7 +792,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
}
if (existingResource != null) {
- existingResource.getChildResources().size(); // eager load child resources to avoid later failures in adding children
+ // eager load child resources to avoid later failures in adding children
+ Hibernate.initialize(existingResource.getChildResources());
}
return existingResource;
commit 0d967523e88c88260fccebb686f56974fb67eeb2
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Feb 17 15:23:38 2012 -0500
[BZ 742698] Adjust view path when operation is scheduled from context menu
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 192711f..55c7de4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -113,7 +113,14 @@ public abstract class AbstractOperationScheduleDetailsView extends
// to the history page so that he can view the status/result of the operation;
// otherwise, the user will stay on the schedules list view.
if (isImmediateExecution) {
- return viewPath.getPathToIndex(viewPath.getCurrentIndex() - 2) + "/History";
+ // If the operation is scheduled from the context menu, the view path will
+ // another entry appended to the end, the operation definition id.
+ if (viewPath.getCurrentIndex() == 6) {
+ return viewPath.getPathToIndex(viewPath.getCurrentIndex() - 3) + "/History";
+ } else {
+ return viewPath.getPathToIndex(viewPath.getCurrentIndex() - 2) + "/History";
+ }
+
}
return super.getListViewPath();
}
12 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
New commits:
commit ceaec5f0e9f1a3cd8087b8da5aaa15d80535cdaf
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 21 11:02:50 2012 -0500
[BZ 616395] the original fix for this BZ was to change the value in
rhq-server.properties. However, it forgot to address what would happen
if the user did not have that property set OR what would happen if the
value was not a valid number. It used to default to 5, but the fix for
this BZ was to reduce that to 1. This commit just makes sure we fallback
to 1 on error. Note that a comment was added in the code to remind people
that we really don't want this to be more than 1 now - although the code
will allow for a user to change this in the field if necessary. I doubt
this setting will ever want to be changed until we fully fix the metadata
registration to allow it to be done concurrently.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java
index 4ace359..9408228 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/concurrency/LatchedServiceController.java
@@ -70,10 +70,15 @@ public class LatchedServiceController {
nextService.controller = this;
}
+ // When this latched service stuff was originally written, it was to help speed up
+ // plugin deployment by registering multiple plugins concurrently. However, it turns
+ // out that that causes problems today. Plugin registraton should not be done
+ // concurrently - each plugin must be registered one after the other serially.
+ // See BZ 616395
try {
- this.threadPoolSize = Integer.parseInt(System.getProperty("rhq.server.plugin-deployer-threads", "5"));
+ this.threadPoolSize = Integer.parseInt(System.getProperty("rhq.server.plugin-deployer-threads", "1"));
} catch (NumberFormatException e) {
- this.threadPoolSize = 5;
+ this.threadPoolSize = 1;
log.warn("Invalid number of threads specified, defaulting to [" + this.threadPoolSize + "]: " + e);
}
}
12 years, 3 months
[rhq] 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 3 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java | 3 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java | 23 ----------
3 files changed, 29 deletions(-)
New commits:
commit a1b5969b04c5316af6fc8555f75ebc65ff6ebf72
Merge: 48262b1 5dd802d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 08:04:27 2012 -0800
Merge branch 'BZ682255'
commit 5dd802d4f1b3a6e46e979f6ac6c35a30f316163e
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 21 08:03:30 2012 -0800
[BZ790621 IE6 Removal] Removal last residuals of IE6 BrowserUtil ie6 browserHack
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index a54324d..e886374 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -553,7 +553,6 @@ public class LoginView extends LocatableCanvas {
}
private void login(final String username, final String password) {
- BrowserUtility.forceIe6Hacks();
loginButton.setDisabled(true);
@@ -585,8 +584,6 @@ public class LoginView extends LocatableCanvas {
requestBuilder.send();
} catch (Exception e) {
handleError(0);
- } finally {
- BrowserUtility.unforceIe6Hacks();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
index fff462a..7e29fd1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
@@ -144,7 +144,6 @@ public class UserSessionManager {
}
public static void checkLoginStatus(final String user, final String password, final AsyncCallback<Subject> callback) {
- BrowserUtility.forceIe6Hacks();
//initiate request to portal.war(SessionAccessServlet) to retrieve existing session info if exists
//session has valid user then <subjectId>:<sessionId>:<lastAccess> else ""
final RequestBuilder b = new RequestBuilder(RequestBuilder.POST, "/sessionAccess");
@@ -379,8 +378,6 @@ public class UserSessionManager {
b.send();
} catch (RequestException e) {
callback.onFailure(e);
- } finally {
- BrowserUtility.unforceIe6Hacks();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java
index db53dfa..5f66507 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/BrowserUtility.java
@@ -32,29 +32,6 @@ public class BrowserUtility {
// static access only
}
- /*
- * Adapted from http://code.google.com/p/google-web-toolkit/issues/detail?id=3608
- *
- * Should
- */
- public static native void forceIe6Hacks()
- /*-{
- if (typeof $doc.body.style.maxHeight == "undefined") {
- $wnd.XMLHttpRequestBackup = $wnd.XMLHttpRequest;
- $wnd.XMLHttpRequest = null;
- }
- }-*/;
-
- /*
- * Adapted from http://code.google.com/p/google-web-toolkit/issues/detail?id=3608
- */
- public static native void unforceIe6Hacks()
- /*-{
- if (typeof $doc.body.style.maxHeight == "undefined") {
- $wnd.XMLHttpRequest = $wnd.XMLHttpRequestBackup;
- $wnd.XMLHttpRequestBackup = null;
- }
- }-*/;
//This is a JSNI call out to the third party javascript lib to execute on the data inserted into the DOM.
public static native void graphSparkLines()
12 years, 3 months
[rhq] Branch 'jshaughn/avail' - modules/core modules/enterprise modules/plugins
by Jay Shaughnessy
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
12 years, 3 months