modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
| 16
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
| 1
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
| 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
| 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
| 36 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
| 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java
| 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
| 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java
| 237 -------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TopologyGWTService.java
| 237 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java
| 272 --------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TopologyGWTServiceImpl.java
| 272 ++++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ListServersUIBean.java
| 10
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewAgentUIBean.java
| 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewServerUIBean.java
| 8
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/test/AlertConditionTest.java
| 2
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/FailoverListManagerBeanTest.java
| 8
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
| 67 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
| 316 ----------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerException.java
| 43 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
| 102 ---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/FailoverListManagerBean.java
| 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerBean.java
| 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerLocal.java
| 39 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerBean.java
| 316 ++++++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerException.java
| 43 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerLocal.java
| 155 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
| 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
| 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java
| 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
| 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/CloudManagerJob.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
| 8
modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
| 4
modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
| 6
51 files changed, 1266 insertions(+), 1103 deletions(-)
New commits:
commit 2d5ccbf8e6756ccc444b540420938071c4842fa2
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Dec 20 20:28:24 2012 +0100
Refactoring: renaming "CloudManager" to "TopologyManager".
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
index f7c8083..3be1d58 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
@@ -94,7 +94,7 @@ public class AffinityGroupAgentsSelector extends
AbstractSelector<Agent, AgentCr
private void prepareMembers(final AffinityGroupAgentsSelector selector) {
AgentCriteria criteria = new AgentCriteria();
criteria.addFilterAffinityGroupId(affinityGroupId);
- GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new
AsyncCallback<PageList<Agent>>() {
+ GWTServiceLookup.getTopologyService().findAgentsByCriteria(criteria, new
AsyncCallback<PageList<Agent>>() {
public void onSuccess(PageList<Agent> result) {
ListGridRecord[] records = getDataSource().buildRecords(result);
originallyAssignedIds = getIdList(records);
@@ -179,7 +179,7 @@ public class AffinityGroupAgentsSelector extends
AbstractSelector<Agent, AgentCr
shouldBeClosed = true;
if (!originallySelected.isEmpty()) {
shouldBeClosed = false;
- GWTServiceLookup.getCloudService().removeAgentsFromGroup(
+ GWTServiceLookup.getTopologyService().removeAgentsFromGroup(
originallySelected.toArray(new
Integer[originallySelected.size()]), new AsyncCallback<Void>() {
public void onSuccess(Void result) {
closeAndRefresh(parrent, true);
@@ -194,7 +194,7 @@ public class AffinityGroupAgentsSelector extends
AbstractSelector<Agent, AgentCr
}
if (!actuallySelected.isEmpty()) {
shouldBeClosed = false;
-
GWTServiceLookup.getCloudService().addAgentsToGroup(selector.getAffinityGroupId(),
+
GWTServiceLookup.getTopologyService().addAgentsToGroup(selector.getAffinityGroupId(),
actuallySelected.toArray(new Integer[actuallySelected.size()]),
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
closeAndRefresh(parrent, true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java
index 669ea22..03711a4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java
@@ -79,7 +79,7 @@ public class AffinityGroupDetailView extends LocatableVLayout implements
Bookmar
@Override
protected void onInit() {
super.onInit();
- GWTServiceLookup.getCloudService().getAffinityGroupById(affinityGroupId, new
AsyncCallback<AffinityGroup>() {
+ GWTServiceLookup.getTopologyService().getAffinityGroupById(affinityGroupId, new
AsyncCallback<AffinityGroup>() {
public void onSuccess(final AffinityGroup affinityGroup) {
prepareDetailsSection(sectionStack, affinityGroup);
}
@@ -180,7 +180,7 @@ public class AffinityGroupDetailView extends LocatableVLayout
implements Bookmar
saveButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
affinityGroup.setName(nameItem.getValueAsString());
- GWTServiceLookup.getCloudService().updateAffinityGroup(affinityGroup, new
AsyncCallback<Void>() {
+ GWTServiceLookup.getTopologyService().updateAffinityGroup(affinityGroup,
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
Message msg = new
Message(MSG.view_adminTopology_message_agroupRenamed(
String.valueOf(affinityGroupId), affinityGroup.getName(),
nameItem.getValueAsString()),
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
index d1d97d4..0f64fd7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
@@ -98,7 +98,7 @@ public class AffinityGroupServersSelector extends
AbstractSelector<Server, Serve
private void prepareMembers(final AffinityGroupServersSelector selector) {
ServerCriteria criteria = new ServerCriteria();
criteria.addFilterAffinityGroupId(affinityGroupId);
- GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new
AsyncCallback<PageList<Server>>() {
+ GWTServiceLookup.getTopologyService().findServersByCriteria(criteria, new
AsyncCallback<PageList<Server>>() {
public void onSuccess(PageList<Server> result) {
ListGridRecord[] records = getDataSource().buildRecords(result);
originallyAssignedIds = getIdList(records);
@@ -184,7 +184,7 @@ public class AffinityGroupServersSelector extends
AbstractSelector<Server, Serve
shouldBeClosed = true;
if (!originallySelected.isEmpty()) {
shouldBeClosed = false;
- GWTServiceLookup.getCloudService().removeServersFromGroup(
+ GWTServiceLookup.getTopologyService().removeServersFromGroup(
originallySelected.toArray(new
Integer[originallySelected.size()]), new AsyncCallback<Void>() {
public void onSuccess(Void result) {
closeAndRefresh(parrent, true);
@@ -199,7 +199,7 @@ public class AffinityGroupServersSelector extends
AbstractSelector<Server, Serve
}
if (!actuallySelected.isEmpty()) {
shouldBeClosed = false;
-
GWTServiceLookup.getCloudService().addServersToGroup(selector.getAffinityGroupId(),
+
GWTServiceLookup.getTopologyService().addServersToGroup(selector.getAffinityGroupId(),
actuallySelected.toArray(new Integer[actuallySelected.size()]),
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
closeAndRefresh(parrent, true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java
index ef271dc..90b0dc3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java
@@ -110,7 +110,7 @@ public class AffinityGroupTableView extends
TableSection<AffinityGroupWithCounts
public void execute(Boolean confirmed) {
if (confirmed) {
int[] selectedIds = getSelectedIds(selections);
-
GWTServiceLookup.getCloudService().deleteAffinityGroups(selectedIds,
+
GWTServiceLookup.getTopologyService().deleteAffinityGroups(selectedIds,
new AsyncCallback<Integer>() {
public void onSuccess(Integer count) {
Message msg = new Message(MSG
@@ -232,7 +232,7 @@ public class AffinityGroupTableView extends
TableSection<AffinityGroupWithCounts
if (form.validate()) {
String name = form.getValueAsString(FIELD_NAME);
AffinityGroup affinityGroup = new AffinityGroup(name);
- GWTServiceLookup.getCloudService().createAffinityGroup(affinityGroup, new
AsyncCallback<Integer>() {
+ GWTServiceLookup.getTopologyService().createAffinityGroup(affinityGroup, new
AsyncCallback<Integer>() {
public void onSuccess(Integer affinityGroupId) {
modalWindow.destroy();
CoreGUI.goToView(VIEW_PATH + "/" + affinityGroupId);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java
index bd8b6b3..33a0e5f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java
@@ -116,7 +116,7 @@ public class AffinityGroupWithCountsDatasource extends
RPCDataSource<AffinityGro
protected void executeFetch(final DSRequest request, final DSResponse response,
Criteria criteria) {
final PageControl pc = getPageControl(request);
- GWTServiceLookup.getCloudService().getAffinityGroupCountComposites(pc,
+ GWTServiceLookup.getTopologyService().getAffinityGroupCountComposites(pc,
new AsyncCallback<PageList<AffinityGroupCountComposite>>() {
public void onSuccess(PageList<AffinityGroupCountComposite> result)
{
response.setData(buildRecords(result));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
index f35aaee..ac33e74 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
@@ -122,7 +122,7 @@ public class AgentDatasource extends RPCDataSource<Agent,
AgentCriteria> {
criteria.addFilterServerId(id);
}
- GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new
AsyncCallback<PageList<Agent>>() {
+ GWTServiceLookup.getTopologyService().findAgentsByCriteria(criteria, new
AsyncCallback<PageList<Agent>>() {
public void onSuccess(PageList<Agent> result) {
response.setData(buildRecords(result));
response.setTotalRows(result.size());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java
index 255a571..92ee011 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java
@@ -84,7 +84,7 @@ public class AgentDetailView extends LocatableVLayout {
super.onInit();
AgentCriteria criteria = new AgentCriteria();
criteria.addFilterId(agentId);
- GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new
AsyncCallback<PageList<Agent>>() {
+ GWTServiceLookup.getTopologyService().findAgentsByCriteria(criteria, new
AsyncCallback<PageList<Agent>>() {
public void onSuccess(final PageList<Agent> agents) {
if (agents == null || agents.isEmpty() || agents.size() != 1) {
CoreGUI.getErrorHandler().handleError(
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java
index c21d086..8146a42 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java
@@ -103,7 +103,7 @@ public class FailoverListItemDatasource extends
AbstractServerNodeDatasource<Fai
final PageControl pc = getPageControl(request);
// if agentId == null all FailoverListDetails are returned
- GWTServiceLookup.getCloudService().getFailoverListDetailsByAgentId(agentId, pc,
+ GWTServiceLookup.getTopologyService().getFailoverListDetailsByAgentId(agentId,
pc,
new AsyncCallback<List<FailoverListDetails>>() {
public void onSuccess(List<FailoverListDetails> result) {
response.setData(buildRecords(result));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
index 39bd457..9042b6b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
@@ -100,7 +100,7 @@ public class PartitionEventDatasource extends
RPCDataSource<PartitionEvent, Part
processResponse(request.getRequestId(), response);
return;
}
- GWTServiceLookup.getCloudService().findPartitionEventsByCriteria(criteria,
+ GWTServiceLookup.getTopologyService().findPartitionEventsByCriteria(criteria,
new AsyncCallback<PageList<PartitionEvent>>() {
public void onSuccess(PageList<PartitionEvent> result) {
response.setData(buildRecords(result));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java
index 43ac373..d9103eb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java
@@ -46,7 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
-import org.rhq.enterprise.gui.coregui.client.gwt.CloudGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.TopologyGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.Log;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
@@ -89,7 +89,7 @@ public class PartitionEventDetailView extends LocatableVLayout
implements Bookma
super.onInit();
PartitionEventCriteria criteria = new PartitionEventCriteria();
criteria.addFilterId(partitionEventId);
- final CloudGWTServiceAsync service = GWTServiceLookup.getCloudService();
+ final TopologyGWTServiceAsync service = GWTServiceLookup.getTopologyService();
service.findPartitionEventsByCriteria(criteria, new
AsyncCallback<PageList<PartitionEvent>>() {
public void onSuccess(final PageList<PartitionEvent> events) {
if (events == null || events.size() != 1) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java
index 3cbfdb1..dc7e545 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java
@@ -209,13 +209,13 @@ public class PartitionEventTableView extends
TableSection<PartitionEventDatasour
};
switch (action) {
case REMOVE_SELECTED:
-
GWTServiceLookup.getCloudService().deletePartitionEvents(selectedIds, callback);
+
GWTServiceLookup.getTopologyService().deletePartitionEvents(selectedIds, callback);
break;
case PURGE_ALL:
-
GWTServiceLookup.getCloudService().purgeAllEvents(callback);
+
GWTServiceLookup.getTopologyService().purgeAllEvents(callback);
break;
case FORCE_REPARTITION:
-
GWTServiceLookup.getCloudService().cloudPartitionEventRequest(callback);
+
GWTServiceLookup.getTopologyService().cloudPartitionEventRequest(callback);
}
} else {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
index 09ea8c3..76ba87c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
@@ -119,7 +119,7 @@ public class ServerDatasource extends
AbstractServerNodeDatasource<Server, Serve
if (affinityGroupId != null) {
criteria.addFilterAffinityGroupId(affinityGroupId);
}
- GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new
AsyncCallback<PageList<Server>>() {
+ GWTServiceLookup.getTopologyService().findServersByCriteria(criteria, new
AsyncCallback<PageList<Server>>() {
public void onSuccess(PageList<Server> result) {
response.setData(buildRecords(result));
response.setTotalRows(result.size());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java
index ccc11aa..1e15208 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java
@@ -97,7 +97,7 @@ public class ServerDetailView extends LocatableVLayout implements
BookmarkableVi
super.onInit();
ServerCriteria criteria = new ServerCriteria();
criteria.addFilterId(serverId);
- GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new
AsyncCallback<PageList<Server>>() {
+ GWTServiceLookup.getTopologyService().findServersByCriteria(criteria, new
AsyncCallback<PageList<Server>>() {
public void onSuccess(final PageList<Server> servers) {
if (servers == null || servers.isEmpty() || servers.size() != 1) {
CoreGUI.getErrorHandler().handleError(
@@ -229,7 +229,7 @@ public class ServerDetailView extends LocatableVLayout implements
BookmarkableVi
server.setPort(Integer.parseInt(portItem.getValueAsString()));
server.setSecurePort(Integer.parseInt(securePortItem.getValueAsString()));
server.setOperationMode(OperationMode.valueOf(operationModeItem.getValueAsString()));
- GWTServiceLookup.getCloudService().updateServer(server, new
AsyncCallback<Void>() {
+ GWTServiceLookup.getTopologyService().updateServer(server, new
AsyncCallback<Void>() {
public void onSuccess(Void result) {
Message msg = new
Message(MSG.view_adminTopology_message_serverUpdated(server.getName()),
Message.Severity.Info);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java
index 6cae592..1c6e6d5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java
@@ -157,7 +157,7 @@ public class ServerTableView extends
public void execute(Boolean confirmed) {
if (confirmed) {
int[] selectedIds = getSelectedIds(selections);
-
GWTServiceLookup.getCloudService().deleteServers(selectedIds,
+
GWTServiceLookup.getTopologyService().deleteServers(selectedIds,
new AsyncCallback<Void>() {
public void onSuccess(Void arg0) {
Message msg = new Message(MSG
@@ -192,7 +192,7 @@ public class ServerTableView extends
public void execute(Boolean confirmed) {
if (confirmed) {
int[] selectedIds = getSelectedIds(selections);
-
GWTServiceLookup.getCloudService().updateServerMode(selectedIds, mode,
+
GWTServiceLookup.getTopologyService().updateServerMode(selectedIds, mode,
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
Message msg = new
Message(MSG.view_adminTopology_message_setMode(
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java
index d686395..91f5f53 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java
@@ -78,7 +78,7 @@ public class ServerWithAgentCountDatasource extends
protected void executeFetch(final DSRequest request, final DSResponse response,
Criteria criteria) {
final PageControl pc = getPageControl(request);
- GWTServiceLookup.getCloudService().getServers(pc, new
AsyncCallback<List<ServerWithAgentCountComposite>>() {
+ GWTServiceLookup.getTopologyService().getServers(pc, new
AsyncCallback<List<ServerWithAgentCountComposite>>() {
public void onSuccess(List<ServerWithAgentCountComposite> result) {
response.setData(buildRecords(result));
response.setTotalRows(result.size());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java
deleted file mode 100644
index 4b92d6f..0000000
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.gwt;
-
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.RemoteService;
-
-import org.rhq.core.domain.cloud.AffinityGroup;
-import org.rhq.core.domain.cloud.FailoverListDetails;
-import org.rhq.core.domain.cloud.PartitionEvent;
-import org.rhq.core.domain.cloud.PartitionEventDetails;
-import org.rhq.core.domain.cloud.Server;
-import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite;
-import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
-import org.rhq.core.domain.criteria.AgentCriteria;
-import org.rhq.core.domain.criteria.PartitionEventCriteria;
-import org.rhq.core.domain.criteria.ServerCriteria;
-import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-
-/**
- * API for HAAC console, mostly CRUD operations for entities
<code>Server</code>, <code>Agent</code>,
- * <code>PartitionEvent</code> and <code>AffinityGroup</code>.
- *
- * @author Jiri Kremser
- */
-public interface CloudGWTService extends RemoteService {
-
- /**
- * Returns all the servers with agent count.
- *
- * @param pageControl the page control instance
- * @return a list of all available servers (the servers in
<code>MAINTENANCE</code> or <code>DOWN</code> mode are included as
well)
- * @throws RuntimeException
- */
- List<ServerWithAgentCountComposite> getServers(PageControl pageControl) throws
RuntimeException;
-
- /**
- * Deletes the servers with provided ids.
- *
- * @param serverIds array of server ids
- * @throws RuntimeException
- */
- void deleteServers(int[] serverIds) throws RuntimeException;
-
- /**
- * Updates the server mode to particular servers.
- *
- * @param serverIds the array of ids of the servers whose modes are object of update
- * @param mode the new operation mode
- * @throws RuntimeException
- */
- void updateServerMode(int[] serverIds, Server.OperationMode mode) throws
RuntimeException;
-
- /**
- * Updates the server.
- *
- * @param server instance of Server
- * @throws RuntimeException
- */
- void updateServer(Server server) throws RuntimeException;
-
- /**
- * Returns the list of <code>FailoverListDetails</code> for a particular
agent.
- *
- * @param agentId the id the agent
- * @param pageControl the page control instance
- * @return a list of <code>FailoverListDetails</code> instances
- * @throws RuntimeException
- */
- List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId,
PageControl pageControl) throws RuntimeException;;
-
- /**
- * Finder for <code>PartitionEvent</code> instances
- *
- * @param criteria the criteria for finding partition events
- * @return a list of <code>codePartitionEvent</code> instances
- * @throws RuntimeException
- */
- PageList<PartitionEvent> findPartitionEventsByCriteria(PartitionEventCriteria
criteria) throws RuntimeException;
-
- /**
- * Finder for <code>Server</code> instances
- *
- * @param criteria the criteria for finding servers
- * @return a list of <code>Server</code> instances
- * @throws RuntimeException
- */
- PageList<Server> findServersByCriteria(ServerCriteria criteria) throws
RuntimeException;
-
- /**
- * Finder for <code>Agent</code> instances
- *
- * @param criteria the criteria for finding agents
- * @return a list of <code>Agent</code> instances
- * @throws RuntimeException
- */
- PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws
RuntimeException;
-
- /**
- * Request forcing the repartition of the cluster. All agents should eventually
reconnects to its most preferred server
- * (The first one in their failover list.)
- *
- * @throws RuntimeException
- */
- void cloudPartitionEventRequest() throws RuntimeException;
-
- /**
- * Deletes all the partition events.
- *
- * @throws RuntimeException
- */
- void purgeAllEvents() throws RuntimeException;
-
- /**
- * Deletes some partition events.
- *
- * @param eventIds the list of ids of partition events to delete
- * @throws RuntimeException
- */
- void deletePartitionEvents(int[] eventIds) throws RuntimeException;
-
- /**
- * Returns the list of <code>PartitionEventDetails</code> instances.
- *
- * @param partitionEventId
- * @param pageControl the page control instance
- * @return list of <code>PartitionEventDetails</code> instances
- * @throws RuntimeException
- */
- PageList<PartitionEventDetails> getPartitionEventDetails(int partitionEventId,
PageControl pageControl)
- throws RuntimeException;
-
- /**
- * Returns the list with <code>AffinityGroupCountComposite</code>
instances, i.e. affinity groups with agent and server
- * counts.
- *
- * @param pageControl the page control instance
- * @return list with <code>AffinityGroupCountComposite</code> instances
- * @throws RuntimeException
- */
- PageList<AffinityGroupCountComposite>
getAffinityGroupCountComposites(PageControl pageControl)
- throws RuntimeException;
-
- /**
- * Deletes some affinity groups.
- *
- * @param affinityGroupIds array of ids of affinity group to delete
- * @return the number of deleted affinity groups
- * @throws RuntimeException
- */
- int deleteAffinityGroups(int[] affinityGroupIds) throws RuntimeException;
-
- /**
- * Creates new affinity group.
- *
- * @param affinityGroup instance of <code>AffinityGroup</code> to create
- * @return the new id of the affinity group
- * @throws RuntimeException
- */
- int createAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException;
-
- /**
- * Updates existing affinity group.
- *
- * @param affinityGroup instance of <code>AffinityGroup</code>
- * @throws RuntimeException
- */
- void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException;
-
- /**
- * Returns the affinity group based on the provided id.
- *
- * @param affinityGroupId the id of an affinity group
- * @return the instance of <code>AffinityGroup</code>
- * @throws RuntimeException
- */
- AffinityGroup getAffinityGroupById(int affinityGroupId) throws RuntimeException;
-
- /**
- * Add servers to an existing affinity group.
- *
- * @param affinityGroupId id of the affinity group into which the servers should be
added
- * @param serverIds array of ids of servers to be added
- * @throws RuntimeException
- */
- void addServersToGroup(int affinityGroupId, Integer[] serverIds) throws
RuntimeException;
-
- /**
- * Removes the servers from the affinity group. There is no need to provide the id of
affinity group,
- * because it is part of the server data.
- *
- * @param serverIds array of ids of servers to be removed
- * @throws RuntimeException
- */
- void removeServersFromGroup(Integer[] serverIds) throws RuntimeException;
-
- /**
- * Add agents to an existing affinity group.
- *
- * @param affinityGroupId id of the affinity group into which the agents should be
added
- * @param agentIds array of ids of agents to be added
- * @throws RuntimeException
- */
- void addAgentsToGroup(int affinityGroupId, Integer[] agentIds) throws
RuntimeException;
-
- /**
- * Removes the agents from the affinity group. There is no need to provide the id of
affinity group,
- * because it is part of the agent data.
- *
- * @param agentIds array of ids of agents to be removed
- * @throws RuntimeException
- */
- void removeAgentsFromGroup(Integer[] agentIds) throws RuntimeException;
-}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index d41b173..8e883af 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -202,8 +202,8 @@ public class GWTServiceLookup {
return secure(PlatformUtilizationGWTServiceAsync.Util.getInstance());
}
- public static CloudGWTServiceAsync getCloudService() {
- return secure(CloudGWTServiceAsync.Util.getInstance());
+ public static TopologyGWTServiceAsync getTopologyService() {
+ return secure(TopologyGWTServiceAsync.Util.getInstance());
}
@SuppressWarnings("unchecked")
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TopologyGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TopologyGWTService.java
new file mode 100644
index 0000000..666fb3e
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TopologyGWTService.java
@@ -0,0 +1,237 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.gwt;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.cloud.AffinityGroup;
+import org.rhq.core.domain.cloud.FailoverListDetails;
+import org.rhq.core.domain.cloud.PartitionEvent;
+import org.rhq.core.domain.cloud.PartitionEventDetails;
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite;
+import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
+import org.rhq.core.domain.criteria.AgentCriteria;
+import org.rhq.core.domain.criteria.PartitionEventCriteria;
+import org.rhq.core.domain.criteria.ServerCriteria;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+
+/**
+ * API for HAAC console, mostly CRUD operations for entities
<code>Server</code>, <code>Agent</code>,
+ * <code>PartitionEvent</code> and <code>AffinityGroup</code>.
+ *
+ * @author Jiri Kremser
+ */
+public interface TopologyGWTService extends RemoteService {
+
+ /**
+ * Returns all the servers with agent count.
+ *
+ * @param pageControl the page control instance
+ * @return a list of all available servers (the servers in
<code>MAINTENANCE</code> or <code>DOWN</code> mode are included as
well)
+ * @throws RuntimeException
+ */
+ List<ServerWithAgentCountComposite> getServers(PageControl pageControl) throws
RuntimeException;
+
+ /**
+ * Deletes the servers with provided ids.
+ *
+ * @param serverIds array of server ids
+ * @throws RuntimeException
+ */
+ void deleteServers(int[] serverIds) throws RuntimeException;
+
+ /**
+ * Updates the server mode to particular servers.
+ *
+ * @param serverIds the array of ids of the servers whose modes are object of update
+ * @param mode the new operation mode
+ * @throws RuntimeException
+ */
+ void updateServerMode(int[] serverIds, Server.OperationMode mode) throws
RuntimeException;
+
+ /**
+ * Updates the server.
+ *
+ * @param server instance of Server
+ * @throws RuntimeException
+ */
+ void updateServer(Server server) throws RuntimeException;
+
+ /**
+ * Returns the list of <code>FailoverListDetails</code> for a particular
agent.
+ *
+ * @param agentId the id the agent
+ * @param pageControl the page control instance
+ * @return a list of <code>FailoverListDetails</code> instances
+ * @throws RuntimeException
+ */
+ List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId,
PageControl pageControl) throws RuntimeException;;
+
+ /**
+ * Finder for <code>PartitionEvent</code> instances
+ *
+ * @param criteria the criteria for finding partition events
+ * @return a list of <code>codePartitionEvent</code> instances
+ * @throws RuntimeException
+ */
+ PageList<PartitionEvent> findPartitionEventsByCriteria(PartitionEventCriteria
criteria) throws RuntimeException;
+
+ /**
+ * Finder for <code>Server</code> instances
+ *
+ * @param criteria the criteria for finding servers
+ * @return a list of <code>Server</code> instances
+ * @throws RuntimeException
+ */
+ PageList<Server> findServersByCriteria(ServerCriteria criteria) throws
RuntimeException;
+
+ /**
+ * Finder for <code>Agent</code> instances
+ *
+ * @param criteria the criteria for finding agents
+ * @return a list of <code>Agent</code> instances
+ * @throws RuntimeException
+ */
+ PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws
RuntimeException;
+
+ /**
+ * Request forcing the repartition of the cluster. All agents should eventually
reconnects to its most preferred server
+ * (The first one in their failover list.)
+ *
+ * @throws RuntimeException
+ */
+ void cloudPartitionEventRequest() throws RuntimeException;
+
+ /**
+ * Deletes all the partition events.
+ *
+ * @throws RuntimeException
+ */
+ void purgeAllEvents() throws RuntimeException;
+
+ /**
+ * Deletes some partition events.
+ *
+ * @param eventIds the list of ids of partition events to delete
+ * @throws RuntimeException
+ */
+ void deletePartitionEvents(int[] eventIds) throws RuntimeException;
+
+ /**
+ * Returns the list of <code>PartitionEventDetails</code> instances.
+ *
+ * @param partitionEventId
+ * @param pageControl the page control instance
+ * @return list of <code>PartitionEventDetails</code> instances
+ * @throws RuntimeException
+ */
+ PageList<PartitionEventDetails> getPartitionEventDetails(int partitionEventId,
PageControl pageControl)
+ throws RuntimeException;
+
+ /**
+ * Returns the list with <code>AffinityGroupCountComposite</code>
instances, i.e. affinity groups with agent and server
+ * counts.
+ *
+ * @param pageControl the page control instance
+ * @return list with <code>AffinityGroupCountComposite</code> instances
+ * @throws RuntimeException
+ */
+ PageList<AffinityGroupCountComposite>
getAffinityGroupCountComposites(PageControl pageControl)
+ throws RuntimeException;
+
+ /**
+ * Deletes some affinity groups.
+ *
+ * @param affinityGroupIds array of ids of affinity group to delete
+ * @return the number of deleted affinity groups
+ * @throws RuntimeException
+ */
+ int deleteAffinityGroups(int[] affinityGroupIds) throws RuntimeException;
+
+ /**
+ * Creates new affinity group.
+ *
+ * @param affinityGroup instance of <code>AffinityGroup</code> to create
+ * @return the new id of the affinity group
+ * @throws RuntimeException
+ */
+ int createAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException;
+
+ /**
+ * Updates existing affinity group.
+ *
+ * @param affinityGroup instance of <code>AffinityGroup</code>
+ * @throws RuntimeException
+ */
+ void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException;
+
+ /**
+ * Returns the affinity group based on the provided id.
+ *
+ * @param affinityGroupId the id of an affinity group
+ * @return the instance of <code>AffinityGroup</code>
+ * @throws RuntimeException
+ */
+ AffinityGroup getAffinityGroupById(int affinityGroupId) throws RuntimeException;
+
+ /**
+ * Add servers to an existing affinity group.
+ *
+ * @param affinityGroupId id of the affinity group into which the servers should be
added
+ * @param serverIds array of ids of servers to be added
+ * @throws RuntimeException
+ */
+ void addServersToGroup(int affinityGroupId, Integer[] serverIds) throws
RuntimeException;
+
+ /**
+ * Removes the servers from the affinity group. There is no need to provide the id of
affinity group,
+ * because it is part of the server data.
+ *
+ * @param serverIds array of ids of servers to be removed
+ * @throws RuntimeException
+ */
+ void removeServersFromGroup(Integer[] serverIds) throws RuntimeException;
+
+ /**
+ * Add agents to an existing affinity group.
+ *
+ * @param affinityGroupId id of the affinity group into which the agents should be
added
+ * @param agentIds array of ids of agents to be added
+ * @throws RuntimeException
+ */
+ void addAgentsToGroup(int affinityGroupId, Integer[] agentIds) throws
RuntimeException;
+
+ /**
+ * Removes the agents from the affinity group. There is no need to provide the id of
affinity group,
+ * because it is part of the agent data.
+ *
+ * @param agentIds array of ids of agents to be removed
+ * @throws RuntimeException
+ */
+ void removeAgentsFromGroup(Integer[] agentIds) throws RuntimeException;
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java
deleted file mode 100644
index ab46527..0000000
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.enterprise.gui.coregui.server.gwt;
-
-import java.util.List;
-
-import org.apache.commons.lang.ArrayUtils;
-
-import org.rhq.core.domain.cloud.AffinityGroup;
-import org.rhq.core.domain.cloud.FailoverListDetails;
-import org.rhq.core.domain.cloud.PartitionEvent;
-import org.rhq.core.domain.cloud.PartitionEventDetails;
-import org.rhq.core.domain.cloud.PartitionEventType;
-import org.rhq.core.domain.cloud.Server;
-import org.rhq.core.domain.cloud.Server.OperationMode;
-import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite;
-import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
-import org.rhq.core.domain.criteria.AgentCriteria;
-import org.rhq.core.domain.criteria.PartitionEventCriteria;
-import org.rhq.core.domain.criteria.ServerCriteria;
-import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.gwt.CloudGWTService;
-import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
-import org.rhq.enterprise.server.cloud.AffinityGroupManagerLocal;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
-import org.rhq.enterprise.server.cloud.PartitionEventManagerLocal;
-import org.rhq.enterprise.server.core.AgentManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * @author Jiri Kremser
- */
-public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements
CloudGWTService {
-
- private static final long serialVersionUID = 1L;
-
- private CloudManagerLocal cloudManager = LookupUtil.getCloudManager();
-
- private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
-
- private PartitionEventManagerLocal partitionEventManager =
LookupUtil.getPartitionEventManager();
-
- private AffinityGroupManagerLocal affinityGroupManager =
LookupUtil.getAffinityGroupManager();
-
- @Override
- public PageList<ServerWithAgentCountComposite> getServers(PageControl pc)
throws RuntimeException {
- try {
- return
SerialUtility.prepare(cloudManager.getServerComposites(getSessionSubject(), pc),
- "CloudGWTServiceImpl.getServers");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void deleteServers(int[] serverIds) throws RuntimeException {
- try {
- cloudManager.deleteServers(getSessionSubject(),
ArrayUtils.toObject(serverIds));
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void updateServerMode(int[] serverIds, OperationMode mode) throws
RuntimeException {
- try {
- cloudManager.updateServerMode(getSessionSubject(),
ArrayUtils.toObject(serverIds), mode);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId,
PageControl pc)
- throws RuntimeException {
- try {
- return SerialUtility.prepare(
- cloudManager.getFailoverListDetailsByAgentId(getSessionSubject(),
agentId, pc),
- "CloudGWTServiceImpl.getFailoverListDetailsByAgentId");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public PageList<PartitionEvent>
findPartitionEventsByCriteria(PartitionEventCriteria criteria)
- throws RuntimeException {
- try {
- return SerialUtility.prepare(
- partitionEventManager.findPartitionEventsByCriteria(getSessionSubject(),
criteria),
- "CloudGWTServiceImpl.findPartitionEventsByCriteria");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public PageList<Server> findServersByCriteria(ServerCriteria criteria) throws
RuntimeException {
- try {
- return
SerialUtility.prepare(cloudManager.findServersByCriteria(getSessionSubject(), criteria),
- "CloudGWTServiceImpl.findServersByCriteria");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws
RuntimeException {
- try {
- return
SerialUtility.prepare(agentManager.findAgentsByCriteria(getSessionSubject(), criteria),
- "CloudGWTServiceImpl.findAgentsByCriteria");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void cloudPartitionEventRequest() throws RuntimeException {
- try {
- partitionEventManager.cloudPartitionEventRequest(getSessionSubject(),
- PartitionEventType.ADMIN_INITIATED_PARTITION, "");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void purgeAllEvents() throws RuntimeException {
- try {
- partitionEventManager.purgeAllEvents(getSessionSubject());
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void deletePartitionEvents(int[] eventIds) throws RuntimeException {
- try {
- partitionEventManager.deletePartitionEvents(getSessionSubject(),
ArrayUtils.toObject(eventIds));
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public PageList<PartitionEventDetails> getPartitionEventDetails(int
partitionEventId, PageControl pageControl)
- throws RuntimeException {
- try {
- return SerialUtility.prepare(
- partitionEventManager.getPartitionEventDetails(getSessionSubject(),
partitionEventId, pageControl),
- "CloudGWTServiceImpl.getPartitionEventDetails");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public PageList<AffinityGroupCountComposite>
getAffinityGroupCountComposites(PageControl pageControl)
- throws RuntimeException {
- try {
- return
SerialUtility.prepare(affinityGroupManager.getComposites(getSessionSubject(),
pageControl),
- "CloudGWTServiceImpl.getAffinityGroupCountComposites");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public int deleteAffinityGroups(int[] affinityGroupIds) throws RuntimeException {
- try {
- return affinityGroupManager.delete(getSessionSubject(),
ArrayUtils.toObject(affinityGroupIds));
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public int createAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException
{
- try {
- return affinityGroupManager.create(getSessionSubject(), affinityGroup);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public AffinityGroup getAffinityGroupById(int affinityGroupId) throws
RuntimeException {
- try {
- return
SerialUtility.prepare(affinityGroupManager.getById(getSessionSubject(), affinityGroupId),
- "CloudGWTServiceImpl.getAffinityGroupById");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void addServersToGroup(int affinityGroupId, Integer[] serverIds) throws
RuntimeException {
- try {
- affinityGroupManager.addServersToGroup(getSessionSubject(), affinityGroupId,
serverIds);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void removeServersFromGroup(Integer[] serverIds) throws RuntimeException {
- try {
- affinityGroupManager.removeServersFromGroup(getSessionSubject(), serverIds);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void addAgentsToGroup(int affinityGroupId, Integer[] agentIds) throws
RuntimeException {
- try {
- affinityGroupManager.addAgentsToGroup(getSessionSubject(), affinityGroupId,
agentIds);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void removeAgentsFromGroup(Integer[] agentIds) throws RuntimeException {
- try {
- affinityGroupManager.removeAgentsFromGroup(getSessionSubject(), agentIds);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void updateServer(Server server) throws RuntimeException {
- try {
- cloudManager.updateServer(getSessionSubject(), server);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
- @Override
- public void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException
{
- try {
- affinityGroupManager.update(getSessionSubject(), affinityGroup);
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
-
-}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TopologyGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TopologyGWTServiceImpl.java
new file mode 100644
index 0000000..4445368
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TopologyGWTServiceImpl.java
@@ -0,0 +1,272 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.server.gwt;
+
+import java.util.List;
+
+import org.apache.commons.lang.ArrayUtils;
+
+import org.rhq.core.domain.cloud.AffinityGroup;
+import org.rhq.core.domain.cloud.FailoverListDetails;
+import org.rhq.core.domain.cloud.PartitionEvent;
+import org.rhq.core.domain.cloud.PartitionEventDetails;
+import org.rhq.core.domain.cloud.PartitionEventType;
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.cloud.Server.OperationMode;
+import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite;
+import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
+import org.rhq.core.domain.criteria.AgentCriteria;
+import org.rhq.core.domain.criteria.PartitionEventCriteria;
+import org.rhq.core.domain.criteria.ServerCriteria;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.TopologyGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.cloud.AffinityGroupManagerLocal;
+import org.rhq.enterprise.server.cloud.PartitionEventManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
+import org.rhq.enterprise.server.core.AgentManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Jiri Kremser
+ */
+public class TopologyGWTServiceImpl extends AbstractGWTServiceImpl implements
TopologyGWTService {
+
+ private static final long serialVersionUID = 1L;
+
+ private TopologyManagerLocal topologyManager = LookupUtil.getTopologyManager();
+
+ private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
+
+ private PartitionEventManagerLocal partitionEventManager =
LookupUtil.getPartitionEventManager();
+
+ private AffinityGroupManagerLocal affinityGroupManager =
LookupUtil.getAffinityGroupManager();
+
+ @Override
+ public PageList<ServerWithAgentCountComposite> getServers(PageControl pc)
throws RuntimeException {
+ try {
+ return
SerialUtility.prepare(topologyManager.getServerComposites(getSessionSubject(), pc),
+ "TopologyGWTServiceImpl.getServers");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void deleteServers(int[] serverIds) throws RuntimeException {
+ try {
+ topologyManager.deleteServers(getSessionSubject(),
ArrayUtils.toObject(serverIds));
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void updateServerMode(int[] serverIds, OperationMode mode) throws
RuntimeException {
+ try {
+ topologyManager.updateServerMode(getSessionSubject(),
ArrayUtils.toObject(serverIds), mode);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId,
PageControl pc)
+ throws RuntimeException {
+ try {
+ return SerialUtility.prepare(
+ topologyManager.getFailoverListDetailsByAgentId(getSessionSubject(),
agentId, pc),
+ "TopologyGWTServiceImpl.getFailoverListDetailsByAgentId");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public PageList<PartitionEvent>
findPartitionEventsByCriteria(PartitionEventCriteria criteria)
+ throws RuntimeException {
+ try {
+ return SerialUtility.prepare(
+ partitionEventManager.findPartitionEventsByCriteria(getSessionSubject(),
criteria),
+ "TopologyGWTServiceImpl.findPartitionEventsByCriteria");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public PageList<Server> findServersByCriteria(ServerCriteria criteria) throws
RuntimeException {
+ try {
+ return
SerialUtility.prepare(topologyManager.findServersByCriteria(getSessionSubject(),
criteria),
+ "TopologyGWTServiceImpl.findServersByCriteria");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws
RuntimeException {
+ try {
+ return
SerialUtility.prepare(agentManager.findAgentsByCriteria(getSessionSubject(), criteria),
+ "TopologyGWTServiceImpl.findAgentsByCriteria");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void cloudPartitionEventRequest() throws RuntimeException {
+ try {
+ partitionEventManager.cloudPartitionEventRequest(getSessionSubject(),
+ PartitionEventType.ADMIN_INITIATED_PARTITION, "");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void purgeAllEvents() throws RuntimeException {
+ try {
+ partitionEventManager.purgeAllEvents(getSessionSubject());
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void deletePartitionEvents(int[] eventIds) throws RuntimeException {
+ try {
+ partitionEventManager.deletePartitionEvents(getSessionSubject(),
ArrayUtils.toObject(eventIds));
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public PageList<PartitionEventDetails> getPartitionEventDetails(int
partitionEventId, PageControl pageControl)
+ throws RuntimeException {
+ try {
+ return SerialUtility.prepare(
+ partitionEventManager.getPartitionEventDetails(getSessionSubject(),
partitionEventId, pageControl),
+ "TopologyGWTServiceImpl.getPartitionEventDetails");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public PageList<AffinityGroupCountComposite>
getAffinityGroupCountComposites(PageControl pageControl)
+ throws RuntimeException {
+ try {
+ return
SerialUtility.prepare(affinityGroupManager.getComposites(getSessionSubject(),
pageControl),
+ "TopologyGWTServiceImpl.getAffinityGroupCountComposites");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public int deleteAffinityGroups(int[] affinityGroupIds) throws RuntimeException {
+ try {
+ return affinityGroupManager.delete(getSessionSubject(),
ArrayUtils.toObject(affinityGroupIds));
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public int createAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException
{
+ try {
+ return affinityGroupManager.create(getSessionSubject(), affinityGroup);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public AffinityGroup getAffinityGroupById(int affinityGroupId) throws
RuntimeException {
+ try {
+ return
SerialUtility.prepare(affinityGroupManager.getById(getSessionSubject(), affinityGroupId),
+ "TopologyGWTServiceImpl.getAffinityGroupById");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void addServersToGroup(int affinityGroupId, Integer[] serverIds) throws
RuntimeException {
+ try {
+ affinityGroupManager.addServersToGroup(getSessionSubject(), affinityGroupId,
serverIds);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void removeServersFromGroup(Integer[] serverIds) throws RuntimeException {
+ try {
+ affinityGroupManager.removeServersFromGroup(getSessionSubject(), serverIds);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void addAgentsToGroup(int affinityGroupId, Integer[] agentIds) throws
RuntimeException {
+ try {
+ affinityGroupManager.addAgentsToGroup(getSessionSubject(), affinityGroupId,
agentIds);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void removeAgentsFromGroup(Integer[] agentIds) throws RuntimeException {
+ try {
+ affinityGroupManager.removeAgentsFromGroup(getSessionSubject(), agentIds);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void updateServer(Server server) throws RuntimeException {
+ try {
+ topologyManager.updateServer(getSessionSubject(), server);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException
{
+ try {
+ affinityGroupManager.update(getSessionSubject(), affinityGroup);
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ListServersUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ListServersUIBean.java
index ef4b65a..cc85b4d 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ListServersUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ListServersUIBean.java
@@ -31,13 +31,13 @@ import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
public class ListServersUIBean extends PagedDataTableUIBean {
public static final String MANAGED_BEAN_NAME = "ListServersUIBean";
- private CloudManagerLocal cloudManager = LookupUtil.getCloudManager();
+ private TopologyManagerLocal topologyManager = LookupUtil.getTopologyManager();
public ListServersUIBean() {
}
@@ -49,7 +49,7 @@ public class ListServersUIBean extends PagedDataTableUIBean {
if (ids.length > 0) {
try {
- cloudManager.deleteServers(subject, ids);
+ topologyManager.deleteServers(subject, ids);
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Removed
[" + ids.length
+ "] servers from the cloud.");
@@ -70,7 +70,7 @@ public class ListServersUIBean extends PagedDataTableUIBean {
if (ids.length > 0) {
try {
- cloudManager.updateServerMode(EnterpriseFacesContextUtility.getSubject(),
ids, mode);
+
topologyManager.updateServerMode(EnterpriseFacesContextUtility.getSubject(), ids, mode);
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Set
[" + ids.length + "] servers to mode "
+ mode);
@@ -109,7 +109,7 @@ public class ListServersUIBean extends PagedDataTableUIBean {
public PageList<ServerWithAgentCountComposite> fetchPage(PageControl pc) {
Subject subject = EnterpriseFacesContextUtility.getSubject();
- PageList<ServerWithAgentCountComposite> results =
cloudManager.getServerComposites(subject, pc);
+ PageList<ServerWithAgentCountComposite> results =
topologyManager.getServerComposites(subject, pc);
return results;
}
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewAgentUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewAgentUIBean.java
index 4ccba78..be91add 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewAgentUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewAgentUIBean.java
@@ -32,7 +32,7 @@ import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.authz.PermissionException;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -47,7 +47,7 @@ public class ViewAgentUIBean extends PagedDataTableUIBean {
public static final String MANAGED_BEAN_NAME = "ViewAgentUIBean";
private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
- private CloudManagerLocal cloudManager = LookupUtil.getCloudManager();
+ private TopologyManagerLocal topologyManager = LookupUtil.getTopologyManager();
private Agent agent;
@@ -81,7 +81,7 @@ public class ViewAgentUIBean extends PagedDataTableUIBean {
@Override
public PageList<FailoverListDetails> fetchPage(PageControl pc) {
int agentId = getAgent().getId();
- PageList<FailoverListDetails> pageList =
cloudManager.getFailoverListDetailsByAgentId(
+ PageList<FailoverListDetails> pageList =
topologyManager.getFailoverListDetailsByAgentId(
EnterpriseFacesContextUtility.getSubject(), agentId, pc);
return pageList;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewServerUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewServerUIBean.java
index 7811b57..0674cf5 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewServerUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/ha/ViewServerUIBean.java
@@ -33,7 +33,7 @@ import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.authz.PermissionException;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -41,13 +41,13 @@ public class ViewServerUIBean extends PagedDataTableUIBean {
public static final String MANAGED_BEAN_NAME = "ViewServerUIBean";
private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
- private CloudManagerLocal cloudManager = LookupUtil.getCloudManager();
+ private TopologyManagerLocal topologyManager = LookupUtil.getTopologyManager();
private Server server;
public ViewServerUIBean() {
hasPermission();
int serverId =
FacesContextUtility.getRequiredRequestParameter("serverId", Integer.class);
- server = cloudManager.getServerById(serverId);
+ server = topologyManager.getServerById(serverId);
}
@Override
@@ -69,7 +69,7 @@ public class ViewServerUIBean extends PagedDataTableUIBean {
public String save() {
try {
- cloudManager.updateServer(getSubject(), getServer());
+ topologyManager.updateServer(getSubject(), getServer());
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO,
"This server's public address and ports have been
updated.");
} catch (Exception e) {
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/test/AlertConditionTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/test/AlertConditionTest.java
index a02d19f..1eaea93 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/test/AlertConditionTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/test/AlertConditionTest.java
@@ -685,7 +685,7 @@ public class AlertConditionTest extends UpdatePluginMetadataTestBase
{
private void deleteServerIdentity() throws Exception {
if (server != null) {
cleanupAgent(); // can't remove the server before we purge the agent
-
LookupUtil.getCloudManager().deleteServer(LookupUtil.getSubjectManager().getOverlord(),
server.getId());
+
LookupUtil.getTopologyManager().deleteServer(LookupUtil.getSubjectManager().getOverlord(),
server.getId());
server = null;
}
}
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/FailoverListManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/FailoverListManagerBeanTest.java
index 2494ece..8a95e80 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/FailoverListManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/FailoverListManagerBeanTest.java
@@ -55,7 +55,7 @@ public class FailoverListManagerBeanTest extends AbstractEJB3Test {
private FailoverListManagerLocal failoverListManager;
private AgentManagerLocal agentManager;
private PartitionEventManagerLocal partitionEventManager;
- private CloudManagerLocal cloudManager;
+ private TopologyManagerLocal topologyManager;
private AffinityGroupManagerLocal affinityGroupManager;
private Subject overlord;
@@ -70,7 +70,7 @@ public class FailoverListManagerBeanTest extends AbstractEJB3Test {
agentManager = LookupUtil.getAgentManager();
failoverListManager = LookupUtil.getFailoverListManager();
partitionEventManager = LookupUtil.getPartitionEventManager();
- cloudManager = LookupUtil.getCloudManager();
+ topologyManager = LookupUtil.getTopologyManager();
affinityGroupManager = LookupUtil.getAffinityGroupManager();
overlord = LookupUtil.getSubjectManager().getOverlord();
@@ -95,9 +95,9 @@ public class FailoverListManagerBeanTest extends AbstractEJB3Test {
try {
for (Server server : servers) {
// must set to down to allow for a delete
-
cloudManager.updateServerMode(LookupUtil.getSubjectManager().getOverlord(),
+
topologyManager.updateServerMode(LookupUtil.getSubjectManager().getOverlord(),
new Integer[] { server.getId() }, Server.OperationMode.DOWN);
-
cloudManager.deleteServer(LookupUtil.getSubjectManager().getOverlord(), server.getId());
+
topologyManager.deleteServer(LookupUtil.getSubjectManager().getOverlord(),
server.getId());
}
for (Agent agent : agents) {
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java
index 3857afc..b32ad30 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java
@@ -178,9 +178,9 @@ public class CoreServerServiceImplTest extends AbstractEJB3Test {
protected void afterMethod() throws Exception {
// cleanup our test server
-
LookupUtil.getCloudManager().updateServerMode(LookupUtil.getSubjectManager().getOverlord(),
+
LookupUtil.getTopologyManager().updateServerMode(LookupUtil.getSubjectManager().getOverlord(),
new Integer[] { server.getId() }, OperationMode.DOWN);
-
LookupUtil.getCloudManager().deleteServer(LookupUtil.getSubjectManager().getOverlord(),
server.getId());
+
LookupUtil.getTopologyManager().deleteServer(LookupUtil.getSubjectManager().getOverlord(),
server.getId());
// shutdown our mock mbean server
unprepareCustomServerService(CoreServerMBean.OBJECT_NAME);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
index 0466a7c..6e755ae 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
@@ -118,25 +118,25 @@ public interface AffinityGroupManagerLocal {
/**
* @deprecated portal war was using it (use finders
<code>AgentManagerBean.findAgentsByCriteria()</code> and
- * <code>CloudManagerBean.findServersByCriteria()</code> instead)
+ * <code>TopologyManagerBean.findServersByCriteria()</code> instead)
*/
PageList<Server> getServerMembers(Subject subject, int affinityGroupId,
PageControl pageControl);
/**
* @deprecated portal war was using it (use finders
<code>AgentManagerBean.findAgentsByCriteria()</code> and
- * <code>CloudManagerBean.findServersByCriteria()</code> instead)
+ * <code>TopologyManagerBean.findServersByCriteria()</code> instead)
*/
PageList<Server> getServerNonMembers(Subject subject, int affinityGroupId,
PageControl pageControl);
/**
* @deprecated portal war was using it (use finders
<code>AgentManagerBean.findAgentsByCriteria()</code> and
- * <code>CloudManagerBean.findServersByCriteria()</code> instead)
+ * <code>TopologyManagerBean.findServersByCriteria()</code> instead)
*/
PageList<Agent> getAgentMembers(Subject subject, int affinityGroupId,
PageControl pageControl);
/**
* @deprecated portal war was using it (use finders
<code>AgentManagerBean.findAgentsByCriteria()</code> and
- * <code>CloudManagerBean.findServersByCriteria()</code> instead)
+ * <code>TopologyManagerBean.findServersByCriteria()</code> instead)
*/
PageList<Agent> getAgentNonMembers(Subject subject, int affinityGroupId,
PageControl pageControl);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
deleted file mode 100644
index 2c775d4..0000000
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.server.cloud;
-
-import java.util.List;
-
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.cloud.FailoverListDetails;
-import org.rhq.core.domain.cloud.PartitionEventType;
-import org.rhq.core.domain.cloud.Server;
-import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
-import org.rhq.core.domain.criteria.ServerCriteria;
-import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.domain.server.PersistenceUtility;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
-import org.rhq.enterprise.server.authz.RequiredPermission;
-import org.rhq.enterprise.server.authz.RequiredPermissions;
-import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
-import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
-import org.rhq.enterprise.server.util.CriteriaQueryRunner;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * This class manages and reports information about the RHQ Server Cloud as a whole.
- * It does not discern which server is which, and can be called from any server in
- * the cloud and will operate identically the same results.
- *
- * @author Joseph Marques
- */
-@Stateless
-public class CloudManagerBean implements CloudManagerLocal {
- private final Log log = LogFactory.getLog(CloudManagerBean.class);
-
- // A time sufficient to determine whether a server is down. Can be based on the
initial delay set for the server instance
- // job updating the server mtimes. See StartupServlet.
- private static final long SERVER_DOWN_INTERVAL = 1000L * 2 * 60;
-
- @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
- private EntityManager entityManager;
-
- @EJB
- private CloudManagerLocal cloudManager;
-
- @EJB
- private FailoverListManagerLocal failoverListManager;
-
- @EJB
- private PartitionEventManagerLocal partitionEventManager;
-
- @EJB
- private AuthorizationManagerLocal authorizationManager;
-
- @EJB
- //@IgnoreDependency
- private ServerManagerLocal serverManager;
-
- public List<Agent> getAgentsByServerName(String serverName) {
- Server server = cloudManager.getServerByName(serverName);
- List<Agent> agents = server.getAgents();
- agents.size(); // iterating over this collection out of a transactional
boundaries will throw LazyInitExceptions
- return agents;
- }
-
- public Server getServerById(int serverId) {
- Server server = entityManager.find(Server.class, serverId);
- return server;
- }
-
- public Server getServerByName(String serverName) {
- Query query = entityManager.createNamedQuery(Server.QUERY_FIND_BY_NAME);
- query.setParameter("name", serverName);
-
- try {
- Server server = (Server) query.getSingleResult();
- return server;
- } catch (NoResultException nre) {
- log.info("Server[name=" + serverName + "] not found, returning
null...");
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- public List<Server> getAllCloudServers() {
- Query query =
entityManager.createNamedQuery(Server.QUERY_FIND_ALL_CLOUD_MEMBERS);
- List<Server> results = query.getResultList();
- return results;
- }
-
- @SuppressWarnings("unchecked")
- public List<Server> getAllServers() {
- Query query = entityManager.createNamedQuery(Server.QUERY_FIND_ALL);
- List<Server> results = query.getResultList();
- return results;
- }
-
- @SuppressWarnings("unchecked")
- @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
- @RequiredPermission(Permission.MANAGE_INVENTORY) })
- public PageList<ServerWithAgentCountComposite> getServerComposites(Subject
subject, PageControl pc) {
- pc.initDefaultOrderingField("s.name");
-
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
Server.QUERY_FIND_ALL_COMPOSITES, pc);
-
- List<ServerWithAgentCountComposite> results = query.getResultList();
- int count = getServerCount();
-
- return new PageList<ServerWithAgentCountComposite>(results, count, pc);
- }
-
- public int getServerCount() {
- Query query = PersistenceUtility.createCountQuery(entityManager,
Server.QUERY_FIND_ALL);
-
- try {
- long serverCount = (Long) query.getSingleResult();
- return (int) serverCount;
- } catch (NoResultException nre) {
- log.debug("Could not get count of cloud instances, returning
0...");
- return 0;
- }
- }
-
- public int getNormalServerCount() {
- Query query = PersistenceUtility.createCountQuery(entityManager,
Server.QUERY_FIND_ALL_NORMAL_CLOUD_MEMBERS);
-
- try {
- long serverCount = (Long) query.getSingleResult();
- return (int) serverCount;
- } catch (NoResultException nre) {
- log.debug("Could not get count of normal cloud instances, returning
0...");
- return 0;
- }
- }
-
- @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
- @RequiredPermission(Permission.MANAGE_INVENTORY) })
- public void deleteServers(Subject subject, Integer[] serverIds) throws
CloudManagerException {
- if (serverIds == null) {
- return;
- }
-
- for (Integer nextServerId : serverIds) {
- cloudManager.deleteServer(subject, nextServerId);
- }
- }
-
- @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
- @RequiredPermission(Permission.MANAGE_INVENTORY) })
- public void deleteServer(Subject subject, Integer serverId) throws
CloudManagerException {
- try {
- Server server = entityManager.find(Server.class, serverId);
-
- if (Server.OperationMode.NORMAL == server.getOperationMode()) {
- throw new CloudManagerException("Could not delete server " +
server.getName()
- + ". Server must be down or in maintenance mode. Current
operating mode is: "
- + server.getOperationMode().name());
- }
-
- // Delete any server list entries referencing this server
- failoverListManager.deleteServerListDetailsForServer(serverId);
-
- // Delete any agent references to this server
- Query query =
entityManager.createNamedQuery(Agent.QUERY_REMOVE_SERVER_REFERENCE);
- query.setParameter("serverId", serverId);
- query.executeUpdate();
-
- // Then, delete the server
- query = entityManager.createNamedQuery(Server.QUERY_DELETE_BY_ID);
- query.setParameter("serverId", serverId);
- query.executeUpdate();
-
- entityManager.flush();
- entityManager.clear();
-
- log.info("Removed server " + server);
-
- // Now, request a cloud repartitioning due to the server removal
-
partitionEventManager.cloudPartitionEventRequest(LookupUtil.getSubjectManager().getOverlord(),
- PartitionEventType.SERVER_DELETION, server.getName());
-
- } catch (Exception e) {
- throw new CloudManagerException("Could not delete server[id=" +
serverId + "]: " + e.getMessage(), e);
- }
- }
-
- @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
- @RequiredPermission(Permission.MANAGE_INVENTORY) })
- public void updateServerMode(Subject subject, Integer[] serverIds,
Server.OperationMode mode) {
- if (serverIds == null) {
- return;
- }
-
- if (mode == null) {
- throw new IllegalArgumentException("mode can not be null");
- }
-
- if (serverIds.length > 0) {
- try {
- for (Integer id : serverIds) {
- Server server = entityManager.find(Server.class, id);
-
- if (server.getOperationMode() == mode) {
- // ignore if there is no change
- continue;
- }
-
- // Audit servers being set to DOWN since the state change can't
be reported any other way. Servers
- // be set to any other mode will be handled when the cloud job
established the current operating mode.
- if (Server.OperationMode.DOWN == mode) {
- String audit = server.getName() + ": " +
server.getOperationMode().name() + " --> " + mode;
-
-
partitionEventManager.auditPartitionEvent(LookupUtil.getSubjectManager().getOverlord(),
- PartitionEventType.OPERATION_MODE_CHANGE, audit);
- }
- server.setOperationMode(mode);
- }
- } catch (Exception e) {
- log.debug("Failed to update HA server modes: " + e);
- }
- }
- }
-
- @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
- @RequiredPermission(Permission.MANAGE_INVENTORY) })
- public Server updateServer(Subject subject, Server server) {
- return entityManager.merge(server);
- }
-
- @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
- @RequiredPermission(Permission.MANAGE_INVENTORY) })
- public PageList<FailoverListDetails> getFailoverListDetailsByAgentId(Subject
subject, int agentId, PageControl pc) {
- pc.initDefaultOrderingField("fld.ordinal");
-
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- FailoverListDetails.QUERY_GET_VIA_AGENT_ID_WITH_SERVERS, pc);
- Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- FailoverListDetails.QUERY_GET_VIA_AGENT_ID);
-
- query.setParameter("agentId", agentId);
- countQuery.setParameter("agentId", agentId);
-
- @SuppressWarnings("unchecked")
- List<FailoverListDetails> list = query.getResultList();
- long count = (Long) countQuery.getSingleResult();
-
- return new PageList<FailoverListDetails>(list, (int) count, pc);
- }
-
- public void markStaleServersDown(Subject subject) {
- if (!authorizationManager.isOverlord(subject)) {
- throw new IllegalArgumentException("The markStaleServersDown method must
be called by the overlord");
- }
-
- long staleTime = System.currentTimeMillis() - SERVER_DOWN_INTERVAL;
-
- String serverName = null;
- try {
- serverName = serverManager.getIdentity();
- if (log.isDebugEnabled()) {
- log.debug(serverName + " is marking stale servers DOWN");
- }
- } catch (Exception e) {
- log.error("Could not determine which instance is marking stale servers
DOWN");
- }
- Query query =
entityManager.createNamedQuery(Server.QUERY_UPDATE_SET_STALE_DOWN);
- query.setParameter("downMode", Server.OperationMode.DOWN);
- query.setParameter("normalMode", Server.OperationMode.NORMAL);
- query.setParameter("staleTime", staleTime);
- query.setParameter("thisServerName", serverName); // might be null
- int resultCount = query.executeUpdate();
-
- if (log.isDebugEnabled()) {
- log.debug(String.valueOf(resultCount) + " stale servers were marked
DOWN");
- }
-
- // Perform requested partition events. Note that we only need to execute one
cloud partition
- // regardless of the number of pending requests, as the work would be
duplicated.
- partitionEventManager.processRequestedPartitionEvents();
- }
-
- @RequiredPermission(Permission.MANAGE_SETTINGS)
- public PageList<Server> findServersByCriteria(Subject subject, ServerCriteria
criteria) {
- CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
- CriteriaQueryRunner<Server> runner = new
CriteriaQueryRunner<Server>(criteria, generator, entityManager);
- return runner.execute();
- }
-}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerException.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerException.java
deleted file mode 100644
index dce22cf..0000000
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.server.cloud;
-
-/**
- * @author Joseph Marques
- */
-public class CloudManagerException extends AffinityGroupException {
-
- private static final long serialVersionUID = 1L;
-
- public CloudManagerException() {
- }
-
- public CloudManagerException(String message) {
- super(message);
- }
-
- public CloudManagerException(Throwable cause) {
- super(cause);
- }
-
- public CloudManagerException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
deleted file mode 100644
index 25a9145..0000000
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.server.cloud;
-
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.cloud.FailoverListDetails;
-import org.rhq.core.domain.cloud.Server;
-import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
-import org.rhq.core.domain.criteria.ServerCriteria;
-import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-
-/**
- * @author Joseph Marques
- */
-@Local
-public interface CloudManagerLocal {
-
- void deleteServers(Subject subject, Integer[] serverIds) throws
CloudManagerException;
-
- void deleteServer(Subject subject, Integer serverId) throws CloudManagerException;
-
- List<Agent> getAgentsByServerName(String serverName);
-
- /**
- *
- * @param serverId
- * @return the server
- * @deprecated Use the <code>findServersByCriteria()</code> instead.
- */
- Server getServerById(int serverId);
-
- /**
- *
- * @param serverName
- * @return the server
- * @deprecated Use the <code>findServersByCriteria()</code> instead.
- */
- Server getServerByName(String serverName);
-
- /**
- * Return every server registered in the database considered part of the active
cloud. This will exclude, for example,
- * servers in INSTALLED mode or any other mode that should not be included when
performing cloud operations such as partitioning.
- * @return All servers available to the cloud.
- *
- */
- List<Server> getAllCloudServers();
-
- /**
- * Return every server registered in the database.
- * @return All servers, regardless of operation mode.
- * @deprecated Use the <code>findServersByCriteria()</code> instead.
- */
- List<Server> getAllServers();
-
-
- /**
- * Returns all servers with the agent counts
- *
- * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
- *
- * @param subject the caller
- * @param pc
- * @return list of <code>ServerWithAgentCountComposite</code>
- */
- PageList<ServerWithAgentCountComposite> getServerComposites(Subject subject,
PageControl pc);
-
- /**
- * Returns the number of servers that are part of the "server cloud", which
excludes
- * servers that have been installed but not associated with the cloud.
- * The returned count will include those servers that are down or in maintenance
mode,
- * in addition to those servers that are currently running in a normal state.
- *
- * @return count of servers in the cloud
- */
- int getServerCount();
-
- /**
- * Returns the number of servers that are part of the "server cloud" that
are currently
- * running in "normal" mode.
- *
- * This excludes all other servers such as those servers that have been installed
but
- * not associated with the cloud, servers that are down or in maintenance mode.
- *
- * @return count of servers in the cloud that are in a normal running state
- */
- int getNormalServerCount();
-
- /**
- * Updates the server operation mode for multiple servers.
- *
- * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
- *
- * @param subject the caller
- * @param serverIds
- * @param mode desired server operation mode
- */
- void updateServerMode(Subject subject, Integer[] serverIds, Server.OperationMode
mode);
-
- /**
- * Updates the server.
- *
- * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
- *
- * @param subject the caller.
- * @param server
- * @return
- */
- Server updateServer(Subject subject, Server server);
-
- /**
- *
- * the subject needs to have MANAGE_SETTINGS permissions.
- *
- * @param subject
- * @param agentId
- * @param pc
- * @return
- */
- PageList<FailoverListDetails> getFailoverListDetailsByAgentId(Subject subject,
int agentId, PageControl pc);
-
- void markStaleServersDown(Subject subject);
-
- /**
- * Fetches the server based on provided criteria.
- *
- * the subject needs to have MANAGE_SETTINGS permissions.
- *
- * @param subject caller
- * @param criteria the criteria
- * @return list of servers
- */
- PageList<Server> findServersByCriteria(Subject subject, ServerCriteria
criteria);
-}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/FailoverListManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/FailoverListManagerBean.java
index 56de2e5..7d5cc79 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/FailoverListManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/FailoverListManagerBean.java
@@ -73,7 +73,7 @@ public class FailoverListManagerBean implements FailoverListManagerLocal
{
@EJB
//@IgnoreDependency
- CloudManagerLocal cloudManager;
+ TopologyManagerLocal topologyManager;
@EJB
AgentManagerLocal agentManager;
@@ -131,7 +131,7 @@ public class FailoverListManagerBean implements
FailoverListManagerLocal {
}
private FailoverListComposite generateServerList(PartitionEvent event, Agent agent)
{
- List<Server> servers = cloudManager.getAllCloudServers();
+ List<Server> servers = topologyManager.getAllCloudServers();
List<Agent> agents = new ArrayList<Agent>(1);
agents.add(agent);
@@ -151,7 +151,7 @@ public class FailoverListManagerBean implements
FailoverListManagerLocal {
}
public Map<Agent, FailoverListComposite> refresh(PartitionEvent event) {
- List<Server> servers = cloudManager.getAllCloudServers();
+ List<Server> servers = topologyManager.getAllCloudServers();
List<Agent> agents = agentManager.getAllAgents();
// persist results immediate, which will be the only writes (as opposed to reads)
in this transaction
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
index 38b8233..dc851da 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
@@ -79,7 +79,7 @@ public class StatusManagerBean implements StatusManagerLocal {
@EJB
//@IgnoreDependency
- CloudManagerLocal cloudManager;
+ TopologyManagerLocal topologyManager;
@EJB
//@IgnoreDependency
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerBean.java
new file mode 100644
index 0000000..7926504
--- /dev/null
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerBean.java
@@ -0,0 +1,316 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.cloud;
+
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.cloud.FailoverListDetails;
+import org.rhq.core.domain.cloud.PartitionEventType;
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
+import org.rhq.core.domain.criteria.ServerCriteria;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.server.PersistenceUtility;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.authz.RequiredPermission;
+import org.rhq.enterprise.server.authz.RequiredPermissions;
+import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * This class manages and reports information about the RHQ Server Cloud as a whole.
+ * It does not discern which server is which, and can be called from any server in
+ * the cloud and will operate identically the same results.
+ *
+ * @author Joseph Marques
+ */
+@Stateless
+public class TopologyManagerBean implements TopologyManagerLocal {
+ private final Log log = LogFactory.getLog(TopologyManagerBean.class);
+
+ // A time sufficient to determine whether a server is down. Can be based on the
initial delay set for the server instance
+ // job updating the server mtimes. See StartupServlet.
+ private static final long SERVER_DOWN_INTERVAL = 1000L * 2 * 60;
+
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ private EntityManager entityManager;
+
+ @EJB
+ private TopologyManagerLocal topologyManager;
+
+ @EJB
+ private FailoverListManagerLocal failoverListManager;
+
+ @EJB
+ private PartitionEventManagerLocal partitionEventManager;
+
+ @EJB
+ private AuthorizationManagerLocal authorizationManager;
+
+ @EJB
+ //@IgnoreDependency
+ private ServerManagerLocal serverManager;
+
+ public List<Agent> getAgentsByServerName(String serverName) {
+ Server server = topologyManager.getServerByName(serverName);
+ List<Agent> agents = server.getAgents();
+ agents.size(); // iterating over this collection out of a transactional
boundaries will throw LazyInitExceptions
+ return agents;
+ }
+
+ public Server getServerById(int serverId) {
+ Server server = entityManager.find(Server.class, serverId);
+ return server;
+ }
+
+ public Server getServerByName(String serverName) {
+ Query query = entityManager.createNamedQuery(Server.QUERY_FIND_BY_NAME);
+ query.setParameter("name", serverName);
+
+ try {
+ Server server = (Server) query.getSingleResult();
+ return server;
+ } catch (NoResultException nre) {
+ log.info("Server[name=" + serverName + "] not found, returning
null...");
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Server> getAllCloudServers() {
+ Query query =
entityManager.createNamedQuery(Server.QUERY_FIND_ALL_CLOUD_MEMBERS);
+ List<Server> results = query.getResultList();
+ return results;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Server> getAllServers() {
+ Query query = entityManager.createNamedQuery(Server.QUERY_FIND_ALL);
+ List<Server> results = query.getResultList();
+ return results;
+ }
+
+ @SuppressWarnings("unchecked")
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
+ public PageList<ServerWithAgentCountComposite> getServerComposites(Subject
subject, PageControl pc) {
+ pc.initDefaultOrderingField("s.name");
+
+ Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
Server.QUERY_FIND_ALL_COMPOSITES, pc);
+
+ List<ServerWithAgentCountComposite> results = query.getResultList();
+ int count = getServerCount();
+
+ return new PageList<ServerWithAgentCountComposite>(results, count, pc);
+ }
+
+ public int getServerCount() {
+ Query query = PersistenceUtility.createCountQuery(entityManager,
Server.QUERY_FIND_ALL);
+
+ try {
+ long serverCount = (Long) query.getSingleResult();
+ return (int) serverCount;
+ } catch (NoResultException nre) {
+ log.debug("Could not get count of cloud instances, returning
0...");
+ return 0;
+ }
+ }
+
+ public int getNormalServerCount() {
+ Query query = PersistenceUtility.createCountQuery(entityManager,
Server.QUERY_FIND_ALL_NORMAL_CLOUD_MEMBERS);
+
+ try {
+ long serverCount = (Long) query.getSingleResult();
+ return (int) serverCount;
+ } catch (NoResultException nre) {
+ log.debug("Could not get count of normal cloud instances, returning
0...");
+ return 0;
+ }
+ }
+
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
+ public void deleteServers(Subject subject, Integer[] serverIds) throws
TopologyManagerException {
+ if (serverIds == null) {
+ return;
+ }
+
+ for (Integer nextServerId : serverIds) {
+ topologyManager.deleteServer(subject, nextServerId);
+ }
+ }
+
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
+ public void deleteServer(Subject subject, Integer serverId) throws
TopologyManagerException {
+ try {
+ Server server = entityManager.find(Server.class, serverId);
+
+ if (Server.OperationMode.NORMAL == server.getOperationMode()) {
+ throw new TopologyManagerException("Could not delete server " +
server.getName()
+ + ". Server must be down or in maintenance mode. Current
operating mode is: "
+ + server.getOperationMode().name());
+ }
+
+ // Delete any server list entries referencing this server
+ failoverListManager.deleteServerListDetailsForServer(serverId);
+
+ // Delete any agent references to this server
+ Query query =
entityManager.createNamedQuery(Agent.QUERY_REMOVE_SERVER_REFERENCE);
+ query.setParameter("serverId", serverId);
+ query.executeUpdate();
+
+ // Then, delete the server
+ query = entityManager.createNamedQuery(Server.QUERY_DELETE_BY_ID);
+ query.setParameter("serverId", serverId);
+ query.executeUpdate();
+
+ entityManager.flush();
+ entityManager.clear();
+
+ log.info("Removed server " + server);
+
+ // Now, request a cloud repartitioning due to the server removal
+
partitionEventManager.cloudPartitionEventRequest(LookupUtil.getSubjectManager().getOverlord(),
+ PartitionEventType.SERVER_DELETION, server.getName());
+
+ } catch (Exception e) {
+ throw new TopologyManagerException("Could not delete server[id=" +
serverId + "]: " + e.getMessage(), e);
+ }
+ }
+
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
+ public void updateServerMode(Subject subject, Integer[] serverIds,
Server.OperationMode mode) {
+ if (serverIds == null) {
+ return;
+ }
+
+ if (mode == null) {
+ throw new IllegalArgumentException("mode can not be null");
+ }
+
+ if (serverIds.length > 0) {
+ try {
+ for (Integer id : serverIds) {
+ Server server = entityManager.find(Server.class, id);
+
+ if (server.getOperationMode() == mode) {
+ // ignore if there is no change
+ continue;
+ }
+
+ // Audit servers being set to DOWN since the state change can't
be reported any other way. Servers
+ // be set to any other mode will be handled when the cloud job
established the current operating mode.
+ if (Server.OperationMode.DOWN == mode) {
+ String audit = server.getName() + ": " +
server.getOperationMode().name() + " --> " + mode;
+
+
partitionEventManager.auditPartitionEvent(LookupUtil.getSubjectManager().getOverlord(),
+ PartitionEventType.OPERATION_MODE_CHANGE, audit);
+ }
+ server.setOperationMode(mode);
+ }
+ } catch (Exception e) {
+ log.debug("Failed to update HA server modes: " + e);
+ }
+ }
+ }
+
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
+ public Server updateServer(Subject subject, Server server) {
+ return entityManager.merge(server);
+ }
+
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
+ public PageList<FailoverListDetails> getFailoverListDetailsByAgentId(Subject
subject, int agentId, PageControl pc) {
+ pc.initDefaultOrderingField("fld.ordinal");
+
+ Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
+ FailoverListDetails.QUERY_GET_VIA_AGENT_ID_WITH_SERVERS, pc);
+ Query countQuery = PersistenceUtility.createCountQuery(entityManager,
+ FailoverListDetails.QUERY_GET_VIA_AGENT_ID);
+
+ query.setParameter("agentId", agentId);
+ countQuery.setParameter("agentId", agentId);
+
+ @SuppressWarnings("unchecked")
+ List<FailoverListDetails> list = query.getResultList();
+ long count = (Long) countQuery.getSingleResult();
+
+ return new PageList<FailoverListDetails>(list, (int) count, pc);
+ }
+
+ public void markStaleServersDown(Subject subject) {
+ if (!authorizationManager.isOverlord(subject)) {
+ throw new IllegalArgumentException("The markStaleServersDown method must
be called by the overlord");
+ }
+
+ long staleTime = System.currentTimeMillis() - SERVER_DOWN_INTERVAL;
+
+ String serverName = null;
+ try {
+ serverName = serverManager.getIdentity();
+ if (log.isDebugEnabled()) {
+ log.debug(serverName + " is marking stale servers DOWN");
+ }
+ } catch (Exception e) {
+ log.error("Could not determine which instance is marking stale servers
DOWN");
+ }
+ Query query =
entityManager.createNamedQuery(Server.QUERY_UPDATE_SET_STALE_DOWN);
+ query.setParameter("downMode", Server.OperationMode.DOWN);
+ query.setParameter("normalMode", Server.OperationMode.NORMAL);
+ query.setParameter("staleTime", staleTime);
+ query.setParameter("thisServerName", serverName); // might be null
+ int resultCount = query.executeUpdate();
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.valueOf(resultCount) + " stale servers were marked
DOWN");
+ }
+
+ // Perform requested partition events. Note that we only need to execute one
cloud partition
+ // regardless of the number of pending requests, as the work would be
duplicated.
+ partitionEventManager.processRequestedPartitionEvents();
+ }
+
+ @RequiredPermission(Permission.MANAGE_SETTINGS)
+ public PageList<Server> findServersByCriteria(Subject subject, ServerCriteria
criteria) {
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
+ CriteriaQueryRunner<Server> runner = new
CriteriaQueryRunner<Server>(criteria, generator, entityManager);
+ return runner.execute();
+ }
+}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerException.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerException.java
new file mode 100644
index 0000000..22ba34a
--- /dev/null
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerException.java
@@ -0,0 +1,43 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.cloud;
+
+/**
+ * @author Joseph Marques
+ */
+public class TopologyManagerException extends AffinityGroupException {
+
+ private static final long serialVersionUID = 1L;
+
+ public TopologyManagerException() {
+ }
+
+ public TopologyManagerException(String message) {
+ super(message);
+ }
+
+ public TopologyManagerException(Throwable cause) {
+ super(cause);
+ }
+
+ public TopologyManagerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerLocal.java
new file mode 100644
index 0000000..f098e54
--- /dev/null
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/TopologyManagerLocal.java
@@ -0,0 +1,155 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.cloud;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.cloud.FailoverListDetails;
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite;
+import org.rhq.core.domain.criteria.ServerCriteria;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+
+/**
+ * @author Joseph Marques
+ */
+@Local
+public interface TopologyManagerLocal {
+
+ void deleteServers(Subject subject, Integer[] serverIds) throws
TopologyManagerException;
+
+ void deleteServer(Subject subject, Integer serverId) throws
TopologyManagerException;
+
+ List<Agent> getAgentsByServerName(String serverName);
+
+ /**
+ *
+ * @param serverId
+ * @return the server
+ * @deprecated Use the <code>findServersByCriteria()</code> instead.
+ */
+ Server getServerById(int serverId);
+
+ /**
+ *
+ * @param serverName
+ * @return the server
+ * @deprecated Use the <code>findServersByCriteria()</code> instead.
+ */
+ Server getServerByName(String serverName);
+
+ /**
+ * Return every server registered in the database considered part of the active
cloud. This will exclude, for example,
+ * servers in INSTALLED mode or any other mode that should not be included when
performing cloud operations such as partitioning.
+ * @return All servers available to the cloud.
+ *
+ */
+ List<Server> getAllCloudServers();
+
+ /**
+ * Return every server registered in the database.
+ * @return All servers, regardless of operation mode.
+ * @deprecated Use the <code>findServersByCriteria()</code> instead.
+ */
+ List<Server> getAllServers();
+
+
+ /**
+ * Returns all servers with the agent counts
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
+ * @param pc
+ * @return list of <code>ServerWithAgentCountComposite</code>
+ */
+ PageList<ServerWithAgentCountComposite> getServerComposites(Subject subject,
PageControl pc);
+
+ /**
+ * Returns the number of servers that are part of the "server cloud", which
excludes
+ * servers that have been installed but not associated with the cloud.
+ * The returned count will include those servers that are down or in maintenance
mode,
+ * in addition to those servers that are currently running in a normal state.
+ *
+ * @return count of servers in the cloud
+ */
+ int getServerCount();
+
+ /**
+ * Returns the number of servers that are part of the "server cloud" that
are currently
+ * running in "normal" mode.
+ *
+ * This excludes all other servers such as those servers that have been installed
but
+ * not associated with the cloud, servers that are down or in maintenance mode.
+ *
+ * @return count of servers in the cloud that are in a normal running state
+ */
+ int getNormalServerCount();
+
+ /**
+ * Updates the server operation mode for multiple servers.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
+ * @param serverIds
+ * @param mode desired server operation mode
+ */
+ void updateServerMode(Subject subject, Integer[] serverIds, Server.OperationMode
mode);
+
+ /**
+ * Updates the server.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller.
+ * @param server
+ * @return
+ */
+ Server updateServer(Subject subject, Server server);
+
+ /**
+ *
+ * the subject needs to have MANAGE_SETTINGS permissions.
+ *
+ * @param subject
+ * @param agentId
+ * @param pc
+ * @return
+ */
+ PageList<FailoverListDetails> getFailoverListDetailsByAgentId(Subject subject,
int agentId, PageControl pc);
+
+ void markStaleServersDown(Subject subject);
+
+ /**
+ * Fetches the server based on provided criteria.
+ *
+ * the subject needs to have MANAGE_SETTINGS permissions.
+ *
+ * @param subject caller
+ * @param criteria the criteria
+ * @return list of servers
+ */
+ PageList<Server> findServersByCriteria(Subject subject, ServerCriteria
criteria);
+}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
index b74df73..4300313 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
@@ -46,9 +46,9 @@ import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.communications.GlobalSuspendCommandListener;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
import org.rhq.enterprise.server.cloud.PartitionEventManagerLocal;
import org.rhq.enterprise.server.cloud.StatusManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil;
/**
@@ -79,7 +79,7 @@ public class ServerManagerBean implements ServerManagerLocal {
private EntityManager entityManager;
@EJB
- private CloudManagerLocal cloudManager;
+ private TopologyManagerLocal topologyManager;
@EJB
private StatusManagerLocal agentStatusManager;
@@ -141,7 +141,7 @@ public class ServerManagerBean implements ServerManagerLocal {
public List<Agent> getAgents() {
String identity = getIdentity();
- List<Agent> results = cloudManager.getAgentsByServerName(identity);
+ List<Agent> results = topologyManager.getAgentsByServerName(identity);
return results;
}
@@ -152,7 +152,7 @@ public class ServerManagerBean implements ServerManagerLocal {
public boolean getAndClearServerStatus() {
String identity = getIdentity();
- Server server = cloudManager.getServerByName(identity);
+ Server server = topologyManager.getServerByName(identity);
if (server == null) {
return false; // don't reload caches if we don't know who we are
}
@@ -163,7 +163,7 @@ public class ServerManagerBean implements ServerManagerLocal {
public Server getServer() throws ServerNotFoundException {
String identity = getIdentity();
- Server result = cloudManager.getServerByName(identity);
+ Server result = topologyManager.getServerByName(identity);
if (result == null) {
throw new ServerNotFoundException("Could not find server; is the "
+ RHQ_SERVER_NAME_PROPERTY
+ " property set in rhq-server.properties?");
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java
index 0749543..dd2e244 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java
@@ -41,7 +41,7 @@ import org.rhq.core.domain.cloud.Server.OperationMode;
import org.rhq.core.util.file.FileUtil;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -70,7 +70,7 @@ public class ShutdownListener {
private ServerManagerLocal serverManager;
@EJB
- private CloudManagerLocal cloudManager;
+ private TopologyManagerLocal topologyManager;
@Resource(name = "RHQ_DS", mappedName = RHQConstants.DATASOURCE_JNDI_NAME)
private DataSource dataSource;
@@ -169,7 +169,7 @@ public class ShutdownListener {
// Set the server operation mode to DOWN unless in MM
Server server = serverManager.getServer();
if (Server.OperationMode.MAINTENANCE != server.getOperationMode()) {
-
cloudManager.updateServerMode(LookupUtil.getSubjectManager().getOverlord(), new Integer[]
{ server.getId() }, OperationMode.DOWN);
+
topologyManager.updateServerMode(LookupUtil.getSubjectManager().getOverlord(), new
Integer[] { server.getId() }, OperationMode.DOWN);
}
} catch (Throwable t) {
// only show ugly stack traces if the user runs the server in debug mode
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
index 3240c1e..aa153d5 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
@@ -63,7 +63,7 @@ import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator;
import org.rhq.enterprise.server.auth.SessionManager;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.cloud.instance.CacheConsistencyManagerLocal;
import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException;
@@ -112,7 +112,7 @@ public class StartupBean {
private CacheConsistencyManagerLocal cacheConsistencyManager;
@EJB
- private CloudManagerLocal cloudManager;
+ private TopologyManagerLocal topologyManager;
@EJB
private ResourceTypeManagerLocal resourceTypeManager;
@@ -258,7 +258,7 @@ public class StartupBean {
log.info("Server is configured to start up in MAINTENANCE mode.");
Server server = serverManager.getServer();
Integer[] serverId = new Integer[] { server.getId() };
- cloudManager.updateServerMode(LookupUtil.getSubjectManager().getOverlord(),
serverId,
+
topologyManager.updateServerMode(LookupUtil.getSubjectManager().getOverlord(), serverId,
OperationMode.MAINTENANCE);
}
@@ -284,7 +284,7 @@ public class StartupBean {
*/
private void createDefaultServerIfNecessary() {
String identity = serverManager.getIdentity();
- Server server = cloudManager.getServerByName(identity);
+ Server server = topologyManager.getServerByName(identity);
if (server == null) {
server = new Server();
server.setName(identity);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
index da89754..e2e5338 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
@@ -178,7 +178,7 @@ abstract class AbstractJobWrapper implements Job {
// we only refire immediately if we are in an HA environment- which means
another server might
// be able to take over - and that other server might have its master PC
running for us to execute in.
- boolean isHA = LookupUtil.getCloudManager().getNormalServerCount() > 1;
+ boolean isHA = LookupUtil.getTopologyManager().getNormalServerCount() >
1;
exception.setRefireImmediately(isHA);
// abort this invocation now - we can't run without the plugin
containers
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/CloudManagerJob.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/CloudManagerJob.java
index 7540d7e..4922ffd 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/CloudManagerJob.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/CloudManagerJob.java
@@ -35,7 +35,7 @@ public class CloudManagerJob extends AbstractStatefulJob {
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
log.debug("Begin scanning for servers that missed their heartbeat");
try {
- LookupUtil.getCloudManager().markStaleServersDown(overlord);
+ LookupUtil.getTopologyManager().markStaleServersDown(overlord);
} finally {
log.debug("Finished scanning for servers that missed their
heartbeat");
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
index f1b685a..b6ed2b2 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
@@ -62,8 +62,8 @@ import org.rhq.enterprise.server.bundle.BundleManagerBean;
import org.rhq.enterprise.server.bundle.BundleManagerLocal;
import org.rhq.enterprise.server.cloud.AffinityGroupManagerBean;
import org.rhq.enterprise.server.cloud.AffinityGroupManagerLocal;
-import org.rhq.enterprise.server.cloud.CloudManagerBean;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerBean;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.cloud.FailoverListManagerBean;
import org.rhq.enterprise.server.cloud.FailoverListManagerLocal;
import org.rhq.enterprise.server.cloud.PartitionEventManagerBean;
@@ -469,8 +469,8 @@ public final class LookupUtil {
return lookupLocal(AffinityGroupManagerBean.class);
}
- public static CloudManagerLocal getCloudManager() {
- return lookupLocal(CloudManagerBean.class);
+ public static TopologyManagerLocal getTopologyManager() {
+ return lookupLocal(TopologyManagerBean.class);
}
public static ClusterManagerLocal getClusterManager() {
diff --git a/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
b/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
index b7c5c66..6ce7bb2 100644
--- a/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
+++ b/modules/enterprise/server/jar/src/main/resources/META-INF/jboss.xml
@@ -102,7 +102,7 @@
<!--
- The CacheConsistencyManagerBean, CloudManagerBean, ServerManagerBean,
StatusManagerBean, and SystemManagerBean
+ The CacheConsistencyManagerBean, TopologyManagerBean, ServerManagerBean,
StatusManagerBean, and SystemManagerBean
SLSB's are all invoked, either directly or indirectly, by EJB timers. Since
EJB timer invocations are always
done in new threads, using the default SLSB pool impl (ThreadlocalPool) would
cause a new instance of this
SLSB to be created every time it was invoked by an EJB timer. This would be bad
if only because an existing
@@ -128,7 +128,7 @@
</session>
<session>
- <ejb-name>CloudManagerBean</ejb-name>
+ <ejb-name>TopologyManagerBean</ejb-name>
<pool-config>
<pool-class>org.jboss.ejb3.StrictMaxPool</pool-class>
<pool-max-size>30</pool-max-size>
diff --git
a/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
b/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
index 88eb3ba..2dfc404 100644
---
a/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
+++
b/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
@@ -20,7 +20,7 @@ import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
-import org.rhq.enterprise.server.cloud.CloudManagerLocal;
+import org.rhq.enterprise.server.cloud.TopologyManagerLocal;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.operation.ResourceOperationSchedule;
import org.rhq.enterprise.server.plugin.pc.ControlFacet;
@@ -57,7 +57,7 @@ public class CloudServerPluginComponent implements
ServerPluginComponent, Contro
ControlResults results = new ControlResults();
- CloudManagerLocal cloudMgr = LookupUtil.getCloudManager();
+ TopologyManagerLocal cloudMgr = LookupUtil.getTopologyManager();
Server server = cloudMgr.getServerByName(serverName);
if (server == null) {
@@ -91,7 +91,7 @@ public class CloudServerPluginComponent implements
ServerPluginComponent, Contro
public void syncServerEndpoints(ScheduledJobInvocationContext context) {
log.debug("Preparing to sync server endpoints.");
- CloudManagerLocal cloudMgr = LookupUtil.getCloudManager();
+ TopologyManagerLocal cloudMgr = LookupUtil.getTopologyManager();
List<Server> servers = cloudMgr.getAllServers();
purgeStaleServers(context, servers);
commit 17527ede423834ae3aef36021f3b8d162240cfea
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Dec 20 19:47:11 2012 +0100
ServerCriteria now allows filtering by multiple operation modes, AgentCriteria allows
filtering by agenttoken
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
index ba1a470..b535141 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
@@ -46,6 +46,7 @@ public class AgentCriteria extends Criteria {
private String filterName;
private String filterAddress;
private Integer filterPort;
+ private String filterAgenttoken;
private Integer filterServerId; // requires override
private Integer filterAffinityGroupId; // requires override
@@ -56,8 +57,8 @@ public class AgentCriteria extends Criteria {
private PageOrdering sortName;
public AgentCriteria() {
- filterOverrides.put("serverId", "server.id = ?");
- filterOverrides.put("affinityGroupId", "affinityGroup.id =
?");
+ filterOverrides.put("serverId", "server.id = ?");
+ filterOverrides.put("affinityGroupId", "affinityGroup.id =
?");
}
public Class<?> getPersistentClass() {
@@ -71,7 +72,7 @@ public class AgentCriteria extends Criteria {
public void addFilterName(String filterName) {
this.filterName = filterName;
}
-
+
public void addFilterAffinityGroupId(Integer filterAffinityGroupId) {
this.filterAffinityGroupId = filterAffinityGroupId;
}
@@ -84,14 +85,18 @@ public class AgentCriteria extends Criteria {
this.filterPort = filterPort;
}
+ public void addFilterAgenttoken(String filterAgenttoken) {
+ this.filterAgenttoken = filterAgenttoken;
+ }
+
public void addFilterServerId(Integer filterServerId) {
this.filterServerId = filterServerId;
}
-
+
public void fetchAffinityGroup(boolean fetchAffinityGroup) {
this.fetchAffinityGroup = fetchAffinityGroup;
}
-
+
public void fetchServer(boolean fetchServer) {
this.fetchServer = fetchServer;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
index b00b3d7..ebbdbc6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
@@ -19,6 +19,9 @@
package org.rhq.core.domain.criteria;
+import java.util.Arrays;
+import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -28,6 +31,7 @@ import org.rhq.core.domain.util.PageOrdering;
/**
* Criteria object for querying {@link Server}s.
+ * Only subject with MANAGE_SETTINGS can fetch these instances.
*
* @author Jiri Kremser
*/
@@ -48,7 +52,7 @@ public class ServerCriteria extends Criteria {
private String filterAddress;
private Integer filterPort;
private Integer filterSecurePort;
- private OperationMode filterOperationMode; // requires override
+ private List<OperationMode> filterOperationMode; // requires override
private Integer filterComputePower;
private Integer filterAffinityGroupId; // requires override
@@ -60,8 +64,8 @@ public class ServerCriteria extends Criteria {
private PageOrdering sortComputePower;
public ServerCriteria() {
- // filterOverrides.put("operationMode", "operationMode IN (
? )");
- filterOverrides.put("affinityGroupId", "affinityGroup.id =
?");
+ filterOverrides.put("operationMode", "operationMode IN ( ?
)");
+ filterOverrides.put("affinityGroupId", "affinityGroup.id =
?");
}
public Class<?> getPersistentClass() {
@@ -88,8 +92,10 @@ public class ServerCriteria extends Criteria {
this.filterSecurePort = filterSecurePort;
}
- public void addFilterOperationMode(OperationMode operationMode) {
- this.filterOperationMode = operationMode;
+ public void addFilterOperationMode(OperationMode... operationMode) {
+ if (operationMode != null && operationMode.length > 0) {
+ this.filterOperationMode = Arrays.asList(operationMode);
+ }
}
public void addFilterComputePower(Integer filterComputePower) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
index 04949ef..f7c8083 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java
@@ -126,12 +126,7 @@ public class AffinityGroupAgentsSelector extends
AbstractSelector<Agent, AgentCr
@Override
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
- String search = (String)
availableFilterForm.getValue(FIELD_NAME.propertyName());
- Criteria criteria = new Criteria();
- if (null != search) {
- criteria.addCriteria(FIELD_NAME.propertyName(), search);
- }
- return criteria;
+ return availableFilterForm.getValuesAsCriteria();
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
index fcfe892..d1d97d4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java
@@ -37,7 +37,6 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.CloseClickEvent;
import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -49,7 +48,7 @@ import org.rhq.core.domain.criteria.ServerCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.IconEnum;
-import org.rhq.enterprise.gui.coregui.client.components.form.SortedSelectItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.EnumSelectItem;
import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -89,25 +88,13 @@ public class AffinityGroupServersSelector extends
AbstractSelector<Server, Serve
availableFilterForm.setNumCols(4);
availableFilterForm.setWidth("75%");
final TextItem search = new TextItem(FIELD_NAME.propertyName(),
MSG.common_title_search());
- final SelectItem operationModeSelect = new
SortedSelectItem(ServerDatasource.FILTER_OPERATION_MODE,
- MSG.view_adminTopology_serverDetail_operationMode());
- operationModeSelect.setValueMap(buildOperationModeOptions());
- operationModeSelect.setValue("ALL");
+ final EnumSelectItem operationModeSelect = new
EnumSelectItem(ServerDatasource.FILTER_OPERATION_MODE,
+ MSG.view_adminTopology_serverDetail_operationMode(), OperationMode.class,
null, null);
availableFilterForm.setItems(search, operationModeSelect);
}
return availableFilterForm;
}
- private String[] buildOperationModeOptions() {
- OperationMode[] modes = OperationMode.values();
- String[] options = new String[modes.length + 1];
- for (int i = 0; i < modes.length; i++) {
- options[i] = modes[i].toString();
- }
- options[modes.length] = "ALL";
- return options;
- }
-
private void prepareMembers(final AffinityGroupServersSelector selector) {
ServerCriteria criteria = new ServerCriteria();
criteria.addFilterAffinityGroupId(affinityGroupId);
@@ -144,16 +131,7 @@ public class AffinityGroupServersSelector extends
AbstractSelector<Server, Serve
@Override
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
- String search = (String)
availableFilterForm.getValue(FIELD_NAME.propertyName());
- String operationMode = (String)
availableFilterForm.getValue(ServerDatasource.FILTER_OPERATION_MODE);
- Criteria criteria = new Criteria();
- if (null != search) {
- criteria.addCriteria(FIELD_NAME.propertyName(), search);
- }
- if (operationMode != null && !"ALL".equals(operationMode)) {
- criteria.addCriteria(ServerDatasource.FILTER_OPERATION_MODE, operationMode);
- }
- return criteria;
+ return availableFilterForm.getValuesAsCriteria();
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
index 31dd28b..f35aaee 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.admin.topology;
import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_ADDRESS;
import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP;
import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP_ID;
+import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AGENTTOKEN;
import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_ID;
import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_LAST_AVAILABILITY_REPORT;
import static
org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_NAME;
@@ -59,6 +60,7 @@ public class AgentDatasource extends RPCDataSource<Agent,
AgentCriteria> {
// filters
public static final String FILTER_ADDRESS = FIELD_ADDRESS.propertyName();
public static final String FILTER_PORT = FIELD_PORT.propertyName();
+ public static final String FILTER_AGENTTOKEN = FIELD_AGENTTOKEN.propertyName();
public static final String FILTER_SERVER_ID = "serverId";
public static final String FILTER_AFFINITY_GROUP_ID = "affinityGroupId";
@@ -167,6 +169,7 @@ public class AgentDatasource extends RPCDataSource<Agent,
AgentCriteria> {
criteria.addFilterName(getFilter(request, FIELD_NAME.propertyName(),
String.class));
criteria.addFilterAddress(getFilter(request, FILTER_ADDRESS, String.class));
criteria.addFilterPort(getFilter(request, FILTER_PORT, Integer.class));
+ criteria.addFilterAgenttoken(getFilter(request, FILTER_AGENTTOKEN,
String.class));
criteria.addFilterServerId(getFilter(request, FILTER_SERVER_ID, Integer.class));
criteria.addFilterAffinityGroupId(getFilter(request, FILTER_AFFINITY_GROUP_ID,
Integer.class));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java
index 7935446..71d9d5a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java
@@ -39,6 +39,8 @@ public enum AgentDatasourceField {
FIELD_ADDRESS("address",
CoreGUI.getMessages().view_adminTopology_agent_agentBindAddress()),
FIELD_PORT("port",
CoreGUI.getMessages().view_adminTopology_agent_agentBindPort()),
+
+ FIELD_AGENTTOKEN("agenttoken",
CoreGUI.getMessages().view_adminTopology_agentDetail_token()),
FIELD_LAST_AVAILABILITY_REPORT("lastAvailabilityReport",
CoreGUI.getMessages()
.view_adminTopology_agent_lastAvailabilityReport()),
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
index 2eb0d87..39bd457 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java
@@ -95,6 +95,11 @@ public class PartitionEventDatasource extends
RPCDataSource<PartitionEvent, Part
@Override
protected void executeFetch(final DSRequest request, final DSResponse response,
PartitionEventCriteria criteria) {
+ if (criteria == null) {
+ response.setTotalRows(0);
+ processResponse(request.getRequestId(), response);
+ return;
+ }
GWTServiceLookup.getCloudService().findPartitionEventsByCriteria(criteria,
new AsyncCallback<PageList<PartitionEvent>>() {
public void onSuccess(PageList<PartitionEvent> result) {
@@ -134,12 +139,18 @@ public class PartitionEventDatasource extends
RPCDataSource<PartitionEvent, Part
@Override
protected PartitionEventCriteria getFetchCriteria(DSRequest request) {
+ ExecutionStatus[] statusesFilter = getArrayFilter(request,
FILTER_EXECUTION_STATUS, ExecutionStatus.class);
+ PartitionEventType[] typesFilter = getArrayFilter(request, FILTER_EVENT_TYPE,
PartitionEventType.class);
+ if (statusesFilter == null || statusesFilter.length == 0 || typesFilter == null
|| typesFilter.length == 0) {
+ return null; // user didn't select any ex. status or event type - return
null to indicate no data should
+ // be displayed
+ }
PartitionEventCriteria criteria = new PartitionEventCriteria();
// printRequestCriteria(request);
criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(),
Integer.class));
criteria.addFilterEventDetail(getFilter(request,
FIELD_EVENT_DETAIL.propertyName(), String.class));
- criteria.addFilterExecutionStatus(getArrayFilter(request,
FILTER_EXECUTION_STATUS, ExecutionStatus.class));
- criteria.addFilterEventType(getArrayFilter(request, FILTER_EVENT_TYPE,
PartitionEventType.class));
+ criteria.addFilterExecutionStatus(statusesFilter);
+ criteria.addFilterEventType(typesFilter);
//@todo: Remove me when finished debugging search expression
Log.debug(" *** PartitionEventCriteria Search String: " +
getFilter(request, "search", String.class));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
index 736e5b6..09ea8c3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java
@@ -111,6 +111,11 @@ public class ServerDatasource extends
AbstractServerNodeDatasource<Server, Serve
@Override
protected void executeFetch(final DSRequest request, final DSResponse response,
ServerCriteria criteria) {
+ if (criteria == null) {
+ response.setTotalRows(0);
+ processResponse(request.getRequestId(), response);
+ return;
+ }
if (affinityGroupId != null) {
criteria.addFilterAffinityGroupId(affinityGroupId);
}
@@ -179,6 +184,10 @@ public class ServerDatasource extends
AbstractServerNodeDatasource<Server, Serve
@Override
protected ServerCriteria getFetchCriteria(DSRequest request) {
+ OperationMode[] modesFilter = getArrayFilter(request, FILTER_OPERATION_MODE,
OperationMode.class);
+ if (modesFilter == null || modesFilter.length == 0) {
+ return null; // user didn't select any modes - return null to indicate no
data should be displayed
+ }
ServerCriteria criteria = new ServerCriteria();
// printRequestCriteria(request);
criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(),
Integer.class));
@@ -186,7 +195,7 @@ public class ServerDatasource extends
AbstractServerNodeDatasource<Server, Serve
criteria.addFilterAddress(getFilter(request, FILTER_ADDRESS, String.class));
criteria.addFilterPort(getFilter(request, FILTER_PORT, Integer.class));
criteria.addFilterSecurePort(getFilter(request, FILTER_SECURE_PORT,
Integer.class));
- criteria.addFilterOperationMode(getFilter(request, FILTER_OPERATION_MODE,
OperationMode.class));
+ criteria.addFilterOperationMode(modesFilter);
criteria.addFilterComputePower(getFilter(request, FILTER_COMPUTE_POWER,
Integer.class));
criteria.addFilterAffinityGroupId(getFilter(request, FILTER_AFFINITY_GROUP_ID,
Integer.class));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index bf6d10a..c4222fc 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -51,6 +51,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.cloud.PartitionEvent.ExecutionStatus;
import org.rhq.core.domain.cloud.PartitionEventType;
+import org.rhq.core.domain.cloud.Server.OperationMode;
import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.drift.DriftCategory;
import org.rhq.core.domain.event.EventSeverity;
@@ -605,6 +606,8 @@ public abstract class RPCDataSource<T, C extends BaseCriteria>
extends DataSourc
return (S[]) new ExecutionStatus[size];
} else if (genericEnumType == PartitionEventType.class) {
return (S[]) new PartitionEventType[size];
+ } else if (genericEnumType == OperationMode.class) {
+ return (S[]) new OperationMode[size];
} else {
throw new
IllegalArgumentException(MSG.dataSource_rpc_error_unsupportedEnumType(genericEnumType.getName()));
}
commit 84a7565038764cea982692bd25e5060c28fa7d3c
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Dec 20 17:29:01 2012 +0100
JavaDoc for SLSBs (describing needed permissions)
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
index b18b5d6..ba1a470 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
@@ -28,6 +28,7 @@ import org.rhq.core.domain.util.PageOrdering;
/**
* Criteria object for querying {@link Server}s.
+ * Only subject with MANAGE_SETTINGS can fetch these instances.
*
* @author Jiri Kremser
*/
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
index 13ad211..975d425 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
@@ -32,6 +32,7 @@ import org.rhq.core.domain.util.PageOrdering;
/**
* Criteria object for querying {@link PartitionEvent}s.
+ * Only subject with MANAGE_SETTINGS can fetch these instances.
*
* @author Jiri Kremser
*/
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
index 37029b4..0466a7c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerLocal.java
@@ -35,28 +35,81 @@ import org.rhq.core.domain.util.PageList;
public interface AffinityGroupManagerLocal {
AffinityGroup getById(Subject subject, int affinityGroupId);
+ /**
+ * Creates a new affinity group.
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
+ * @param affinityGroup @see AffinityGroup
+ * @return new id of the group
+ * @throws AffinityGroupException
+ */
int create(Subject subject, AffinityGroup affinityGroup) throws
AffinityGroupException;
+ /**
+ * Deletes the affinity groups.
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
+ * @param affinityGroupIds
+ * @return
+ */
int delete(Subject subject, Integer[] affinityGroupIds);
+ /**
+ * Updates the affinity group.
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
+ * @param affinityGroup @see AffinityGroup
+ * @return
+ * @throws AffinityGroupException
+ */
AffinityGroup update(Subject subject, AffinityGroup affinityGroup) throws
AffinityGroupException;
+ /**
+ * Adds agents to the affinity group.
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
+ * @param affinityGroupId
+ * @param agentIds
+ */
void addAgentsToGroup(Subject subject, int affinityGroupId, Integer[] agentIds);
/**
* This should only be called if the agent is currently assigned to an affinity group
and that group
- * is being removed, setting the agent to no affinity. Otherwise, unnecessary
partition events can be generated.
- * @param subject
+ * is being removed, setting the agent to no affinity. Otherwise, unnecessary
partition events can be generated.
+ *
+ * Subjects needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
* @param agentIds
*/
void removeAgentsFromGroup(Subject subject, Integer[] agentIds);
+ /**
+ * Adds servers to the affinity group.
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
+ * @param affinityGroupId
+ * @param serverIds
+ */
void addServersToGroup(Subject subject, int affinityGroupId, Integer[] serverIds);
/**
* This should only be called if the server is currently assigned to an affinity
group and that group
* is being removed, setting the server to no affinity. Otherwise, unnecessary
partition events can be generated.
- * @param subject
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject the Subject instance
* @param agentIds
*/
void removeServersFromGroup(Subject subject, Integer[] serverIds);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
index 8ba595a..25a9145 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java
@@ -43,23 +43,47 @@ public interface CloudManagerLocal {
List<Agent> getAgentsByServerName(String serverName);
+ /**
+ *
+ * @param serverId
+ * @return the server
+ * @deprecated Use the <code>findServersByCriteria()</code> instead.
+ */
Server getServerById(int serverId);
+ /**
+ *
+ * @param serverName
+ * @return the server
+ * @deprecated Use the <code>findServersByCriteria()</code> instead.
+ */
Server getServerByName(String serverName);
/**
* Return every server registered in the database considered part of the active
cloud. This will exclude, for example,
* servers in INSTALLED mode or any other mode that should not be included when
performing cloud operations such as partitioning.
* @return All servers available to the cloud.
+ *
*/
List<Server> getAllCloudServers();
/**
* Return every server registered in the database.
* @return All servers, regardless of operation mode.
+ * @deprecated Use the <code>findServersByCriteria()</code> instead.
*/
List<Server> getAllServers();
+
+ /**
+ * Returns all servers with the agent counts
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
+ * @param pc
+ * @return list of <code>ServerWithAgentCountComposite</code>
+ */
PageList<ServerWithAgentCountComposite> getServerComposites(Subject subject,
PageControl pc);
/**
@@ -83,10 +107,37 @@ public interface CloudManagerLocal {
*/
int getNormalServerCount();
+ /**
+ * Updates the server operation mode for multiple servers.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
+ * @param serverIds
+ * @param mode desired server operation mode
+ */
void updateServerMode(Subject subject, Integer[] serverIds, Server.OperationMode
mode);
+ /**
+ * Updates the server.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller.
+ * @param server
+ * @return
+ */
Server updateServer(Subject subject, Server server);
+ /**
+ *
+ * the subject needs to have MANAGE_SETTINGS permissions.
+ *
+ * @param subject
+ * @param agentId
+ * @param pc
+ * @return
+ */
PageList<FailoverListDetails> getFailoverListDetailsByAgentId(Subject subject,
int agentId, PageControl pc);
void markStaleServersDown(Subject subject);
@@ -94,9 +145,11 @@ public interface CloudManagerLocal {
/**
* Fetches the server based on provided criteria.
*
+ * the subject needs to have MANAGE_SETTINGS permissions.
+ *
* @param subject caller
* @param criteria the criteria
- * @return
+ * @return list of servers
*/
PageList<Server> findServersByCriteria(Subject subject, ServerCriteria
criteria);
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerBean.java
index 961af25..4618fda 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerBean.java
@@ -254,7 +254,8 @@ public class PartitionEventManagerBean implements
PartitionEventManagerLocal {
return new PageList<PartitionEventDetails>(detailsList, (int) count,
pageControl);
}
- @RequiredPermission(Permission.MANAGE_SETTINGS)
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
+ @RequiredPermission(Permission.MANAGE_INVENTORY) })
public PageList<PartitionEvent> findPartitionEventsByCriteria(Subject subject,
PartitionEventCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
CriteriaQueryRunner<PartitionEvent> runner = new
CriteriaQueryRunner<PartitionEvent>(criteria, generator,
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerLocal.java
index f0a1bf2..4a4805e9 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerLocal.java
@@ -56,8 +56,11 @@ public interface PartitionEventManagerLocal {
String eventDetail);
/**
- * This call requests full repartitioning of the agent population by the recurring
cluster manager job.
- * @param subject
+ * This call requests full repartitioning of the agent population by the recurring
cluster manager job.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
* @param eventType
* @param eventDetail Any useful information regarding the event generation. Should
be suitable for display.
* Typically a relevant server name.
@@ -82,10 +85,22 @@ public interface PartitionEventManagerLocal {
/**
* This is primarily a test entry point.
- * @param event
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject
+ * @param partitionEventIds
*/
void deletePartitionEvents(Subject subject, Integer[] partitionEventIds);
+ /**
+ * Deletes all the partition events.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject
+ * @return count of deleted events
+ */
int purgeAllEvents(Subject subject);
PartitionEvent getPartitionEvent(Subject subject, int partitionEventId);
@@ -93,14 +108,26 @@ public interface PartitionEventManagerLocal {
PageList<PartitionEvent> getPartitionEvents(Subject subject, PartitionEventType
type, ExecutionStatus status,
String details, PageControl pageControl);
+ /**
+ * Returns the partition event details.
+ *
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
+ * @param partitionEventId
+ * @param pageControl
+ * @return list with partition event details
+ */
PageList<PartitionEventDetails> getPartitionEventDetails(Subject subject, int
partitionEventId,
PageControl pageControl);
/**
- * the subject needs to have MANAGE_INVENTORY permission.
+ * Fetches the partition events based on provided criteria.
*
- * @param subject
- * @param criteria
+ * the subject needs to have MANAGE_INVENTORY and MANAGE_SETTINGS permissions.
+ *
+ * @param subject the caller
+ * @param criteria the criteria
* @return list with partition events
*/
PageList<PartitionEvent> findPartitionEventsByCriteria(Subject subject,
PartitionEventCriteria criteria);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
index 5494e4d..7c003ac 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
@@ -102,6 +102,7 @@ public interface AgentManagerLocal {
* Returns a collection of all agents currently in inventory.
*
* @return list of all known agents in inventory
+ * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
List<Agent> getAllAgents();
@@ -110,6 +111,7 @@ public interface AgentManagerLocal {
*
* @param serverId the server to filter the agent list by. pass null to view
unfiltered results.
* @return list of all known agents in inventory
+ * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
PageList<Agent> getAgentsByServer(Subject subject, Integer serverId,
PageControl pageControl);
@@ -127,6 +129,7 @@ public interface AgentManagerLocal {
* @param agentName
*
* @return the agent whose name matches the given name; <code>null</code>
if there is no agent with the given name
+ * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByName(String agentName);
@@ -137,6 +140,7 @@ public interface AgentManagerLocal {
* @param agentId
*
* @return the agent whose id matches the given id; <code>null</code> if
there is no agent with the given id
+ * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByID(int agentId);
@@ -148,6 +152,7 @@ public interface AgentManagerLocal {
*
* @return the agent whose agent token matches the given token;
<code>null</code> if there is no agent with the
* given token
+ * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByAgentToken(String token);
@@ -160,6 +165,7 @@ public interface AgentManagerLocal {
*
* @return the agent to be known at the given address and port;
<code>null</code> if there is no agent with the
* given token
+ * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByAddressAndPort(String address, int port);
@@ -310,5 +316,14 @@ public interface AgentManagerLocal {
*/
public PingRequest handlePingRequest(PingRequest request);
+ /**
+ * Fetches the agents based on provided criteria.
+ *
+ * Subject needs MANAGE_SETTINGS and MANAGE_INVENTORY permissions.
+ *
+ * @param subject caller
+ * @param criteria the criteria
+ * @return list of agents
+ */
PageList<Agent> findAgentsByCriteria(Subject subject, AgentCriteria criteria);
}
\ No newline at end of file