[rhq] 2 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/CustomResourceGroupTreeGrid.java | 23 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 182 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 42 +-
5 files changed, 165 insertions(+), 99 deletions(-)
New commits:
commit cc672ab2ab3839dde8ce9672b8703cb54ea0ed1e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 25 11:24:07 2011 -0400
ResourceGroupTree navigation work
- fix various issues with tree select and context menu nav
- some refactoring for clarity
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/CustomResourceGroupTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/CustomResourceGroupTreeGrid.java
index 5e4ff6f..349c5e7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/CustomResourceGroupTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/CustomResourceGroupTreeGrid.java
@@ -22,7 +22,6 @@ import com.smartgwt.client.data.Record;
import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
@@ -48,19 +47,15 @@ public class CustomResourceGroupTreeGrid extends LocatableTreeGrid {
return node.getIcon();
}
- // if this node is associated with a resource type AND a cluster key, it is a cluster node
- // if this node is associated only with a resource type, it is a auto type group node.
- // if this node is not associated with either a resource type or cluster key, it is a subcategory node (which uses the default icon)
- ResourceType resourceType = node.getResourceType();
- if (resourceType != null) {
- ClusterKey clusterKey = node.getClusterKey();
- if (clusterKey != null) {
- String icon = ImageManager.getClusteredResourceIcon(resourceType.getCategory());
- return icon;
- } else {
- boolean open = getTree().isOpen((TreeNode) record);
- return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
- }
+ if (node.isAutoClusterNode()) {
+ ResourceType resourceType = node.getResourceType();
+ String icon = ImageManager.getClusteredResourceIcon(resourceType.getCategory());
+ return icon;
+
+ } else if (node.isCompatibleGroupTopNode() || node.isAutoGroupNode()) {
+ boolean open = getTree().isOpen((TreeNode) record);
+ return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
+
}
// use the default image - which is typically for subcategory nodes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
index 27cf7d6..7ad3a74 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
@@ -43,8 +43,8 @@ public class ResourceGroupTreeContextMenu extends ResourceGroupContextMenu {
public void showContextMenu(ResourceGroupEnhancedTreeNode node) {
- final ClusterKey clusterKey = (ClusterKey) node.getAttributeAsObject("key");
- if (clusterKey != null) {
+ if (node.isAutoClusterNode()) {
+ final ClusterKey clusterKey = (ClusterKey) node.getAttributeAsObject("key");
GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(clusterKey, true,
new AsyncCallback<ResourceGroup>() {
@Override
@@ -58,7 +58,8 @@ public class ResourceGroupTreeContextMenu extends ResourceGroupContextMenu {
showContextMenu(result);
}
});
- } else {
+
+ } else if (node.isCompatibleGroupTopNode()) {
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(Integer.parseInt(node.getAttribute("id")));
GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index d3f4fbd..04fbfbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -93,17 +93,21 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
private static final String FAKE_ROOT_ID = "__fakeRoot__"; // id of the parent node of our real root node
private TreeGrid treeGrid;
-
private ViewId currentViewId;
- private int rootGroupId;
- private int selectedGroupId;
- private String selectedNodeId;
-
+ private Map<Integer, ResourceType> typeMap;
private ResourceGroupTreeContextMenu contextMenu;
+ // the root (top of tree) compat or mixed group
private ResourceGroup rootResourceGroup;
- private Map<Integer, ResourceType> typeMap;
- private ResourceGroup selectedGroup;
+
+ // the root (top of tree) compat or mixed group id (may bet set prior to rootResourceGroup fetch)
+ private int rootGroupId;
+
+ // the currently selected tree node
+ private String currentNodeId;
+
+ // the currently selected group backing the tree node
+ private ResourceGroup currentGroup;
private Comparator<ResourceGroupEnhancedTreeNode> treeNodeComparator = new Comparator<ResourceGroupEnhancedTreeNode>() {
@Override
@@ -164,76 +168,93 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
}
});
- addMember(this.treeGrid);
-
contextMenu = new ResourceGroupTreeContextMenu(extendLocatorId("contextMenu"));
treeGrid.setContextMenu(contextMenu);
+ treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
+ public void onNodeContextClick(final NodeContextClickEvent event) {
+ // stop the browser right-click menu
+ event.cancel();
+
+ // don't select the node on a right click, since we're not navigating to it, and
+ // re-select the current node if necessary
+ ResourceGroupEnhancedTreeNode contextNode = (ResourceGroupEnhancedTreeNode) event.getNode();
+
+ if (null != currentNodeId) {
+ TreeNode currentNode = treeGrid.getTree().findById(currentNodeId);
+ if (!contextNode.equals(currentNode)) {
+ treeGrid.deselectRecord(contextNode);
+ treeGrid.selectRecord(currentNode);
+ }
+ }
+
+ // only show the context menu for cluster nodes and our top root node
+ if (contextNode.isCompatibleGroupTopNode() || contextNode.isAutoClusterNode()) {
+ contextMenu.showContextMenu(contextNode);
+ }
+ }
+ });
+
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- @Override
+
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (!selectionEvent.isRightButtonDown() && selectionEvent.getState()) {
- selectedNodeId = null; // if user selected a valid node, we'll set this later
- ResourceGroupEnhancedTreeNode selectedNode = (ResourceGroupEnhancedTreeNode) selectionEvent
- .getRecord();
- com.allen_sauer.gwt.log.client.Log.info("Node selected in tree: " + selectedNode);
-
- ResourceType type = selectedNode.getResourceType();
- ClusterKey key = selectedNode.getClusterKey();
- if (type != null) {
- if (key != null) {
- // the user selected a cluster node - let's switch to that cluster group view
- com.allen_sauer.gwt.log.client.Log.debug("Selecting cluster group [" + key + "]...");
- selectedNodeId = selectedNode.getID();
- selectClusterGroup(key);
+
+ ResourceGroupEnhancedTreeNode newNode = (ResourceGroupEnhancedTreeNode) selectionEvent.getRecord();
+ TreeNode currentNode = (null != currentNodeId) ? treeGrid.getTree().findById(currentNodeId) : null;
+
+ // if re-selecting the current node just return, otherwise deselect the currently selected node
+ if (null != currentNode) {
+ if (newNode.equals(currentNode)) {
+ return;
} else {
- if (selectedNode.getParentID().equals(FAKE_ROOT_ID)) {
- // the user selected the top group node
- selectedNodeId = selectedNode.getID();
- String groupId = selectedNodeId;
- com.allen_sauer.gwt.log.client.Log.debug("Selecting group [" + groupId + "]...");
- String viewPath = LinkManager.getResourceGroupLink(Integer.parseInt(groupId));
- CoreGUI.goToView(viewPath, true);
- } else {
- // the user selected a auto type group node; we have got nothing to show, so cancel the selection of this node
- treeGrid.deselectRecord(selectedNode);
- }
+ treeGrid.deselectRecord(currentNode);
}
- } else {
- // the user selected a subcategory; we have got nothing to show, so cancel the selection of this node
- treeGrid.deselectRecord(selectedNode);
}
- }
- return;
- }
- });
- treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
- public void onNodeContextClick(final NodeContextClickEvent event) {
- // stop the browser right-click menu
- event.cancel();
+ com.allen_sauer.gwt.log.client.Log.debug("Node selected in tree: " + newNode);
- // don't select the node on a right click, since we're not navigating to it
- ResourceGroupEnhancedTreeNode node = (ResourceGroupEnhancedTreeNode) event.getNode();
- treeGrid.deselectRecord(node);
- if (null != selectedNodeId) {
- treeGrid.selectRecord(treeGrid.getTree().findById(selectedNodeId));
- }
+ if (newNode.isCompatibleGroupTopNode()) {
+ currentNodeId = newNode.getID();
+ com.allen_sauer.gwt.log.client.Log.debug("Selecting compatible group [" + currentNodeId
+ + "]...");
+ String viewPath = LinkManager.getResourceGroupLink(Integer.parseInt(currentNodeId));
+ String currentViewPath = History.getToken();
+ if (!currentViewPath.startsWith(viewPath.substring(1))) {
+ CoreGUI.goToView(viewPath, true);
+ } else {
+ // this should not be necessary but for otherwise the top node does not always show selected
+ treeGrid.markForRedraw();
+ }
- // only show the context menu for cluster nodes and our top root node
- ResourceType type = node.getResourceType();
- ClusterKey key = node.getClusterKey();
- if (type != null && (key != null || node.getParentID().equals(FAKE_ROOT_ID))) {
- contextMenu.showContextMenu(node);
+ } else if (newNode.isAutoClusterNode()) {
+ ClusterKey key = newNode.getClusterKey();
+ com.allen_sauer.gwt.log.client.Log.debug("Selecting autocluster group [" + key + "]...");
+ currentNodeId = newNode.getID();
+ // the user selected a cluster node - let's switch to that cluster group view
+ selectClusterGroup(key);
+
+ } else if (newNode.isMixedGroupTopNode()) {
+ currentNodeId = newNode.getID();
+ com.allen_sauer.gwt.log.client.Log.debug("Selecting mixed group [" + currentNodeId + "]...");
+
+ } else {
+ // a subcategory node, deselect and reselect the current node
+ treeGrid.deselectRecord(newNode);
+ if (null != currentNode) {
+ treeGrid.selectRecord(currentNode);
+ }
+ }
}
+
+ return;
}
});
+ addMember(this.treeGrid);
}
public void setSelectedGroup(final int groupId, boolean isAutoCluster) {
- this.selectedGroupId = groupId;
-
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(groupId);
criteria.addFilterVisible(Boolean.valueOf(!isAutoCluster));
@@ -241,16 +262,15 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
new AsyncCallback<PageList<ResourceGroup>>() {
- @Override
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
MSG.view_tree_common_loadFailed_group(String.valueOf(groupId)), caught);
}
- @Override
public void onSuccess(PageList<ResourceGroup> result) {
ResourceGroup group = result.get(0);
- ResourceGroupTreeView.this.selectedGroup = group;
+ ResourceGroupTreeView.this.currentGroup = group;
GroupCategory groupCategory = group.getGroupCategory();
switch (groupCategory) {
@@ -271,8 +291,9 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
Tree tree = new Tree();
tree.setRoot(fakeRoot);
treeGrid.setData(tree);
- treeGrid.markForRedraw();
+ treeGrid.selectRecord(rootNode);
break;
+
case COMPATIBLE:
if (group.getClusterResourceGroup() == null) {
// This is a straight up compatible group.
@@ -293,14 +314,14 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
// Still looking at the same compat-recursive tree
ResourceGroupEnhancedTreeNode selectedNode;
- if (this.selectedGroup.getClusterKey() != null) {
+ if (this.currentGroup.getClusterKey() != null) {
// a child cluster node leaf was selected
selectedNode = (ResourceGroupEnhancedTreeNode) treeGrid.getTree().find(
- ResourceGroupEnhancedTreeNode.CLUSTER_KEY, this.selectedGroup.getClusterKey());
+ ResourceGroupEnhancedTreeNode.CLUSTER_KEY, this.currentGroup.getClusterKey());
} else {
// the top root node, representing the group itself, was selected
selectedNode = (ResourceGroupEnhancedTreeNode) treeGrid.getTree().findById(
- String.valueOf(this.selectedGroup.getId()));
+ String.valueOf(this.currentGroup.getId()));
}
if (selectedNode != null) {
@@ -331,7 +352,7 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
ResourceTypeRepository.Cache.getInstance().getResourceTypes(typeIds.toArray(new Integer[typeIds.size()]),
EnumSet.of(ResourceTypeRepository.MetadataType.subCategory),
new ResourceTypeRepository.TypesLoadedCallback() {
- @Override
+
public void onTypesLoaded(Map<Integer, ResourceType> types) {
ResourceGroupTreeView.this.typeMap = types;
loadTree(root);
@@ -342,12 +363,11 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
private void selectClusterGroup(ClusterKey key) {
GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(key, true,
new AsyncCallback<ResourceGroup>() {
- @Override
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_createFailed_autoCluster(), caught);
}
- @Override
public void onSuccess(ResourceGroup result) {
renderAutoCluster(result);
}
@@ -387,7 +407,7 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
treeGrid.setData(tree);
treeGrid.getTree().openFolder(rootNode);
- treeGrid.markForRedraw();
+ treeGrid.selectRecord(rootNode);
}
public void loadTree(ResourceGroupEnhancedTreeNode parentNode, ClusterFlyweight parentClusterGroup,
@@ -636,5 +656,29 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
setAttribute(RESOURCE_TYPE, rt);
}
+ public boolean isTopNode() {
+ return getParentID().equals(FAKE_ROOT_ID);
+ }
+
+ public boolean isMixedGroupTopNode() {
+ return isTopNode() && (null == getResourceType());
+ }
+
+ public boolean isCompatibleGroupTopNode() {
+ return isTopNode() && (null != getResourceType()) && (null == getClusterKey());
+ }
+
+ public boolean isAutoGroupNode() {
+ return !isTopNode() && (null != getResourceType()) && (null == getClusterKey());
+ }
+
+ public boolean isAutoClusterNode() {
+ return (null != getResourceType()) && (null != getClusterKey()) && !isTopNode();
+ }
+
+ public boolean isSubCategoryNode() {
+ return (null == getResourceType()) && !isMixedGroupTopNode();
+ }
+
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 9870a42..455f414 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -115,6 +115,7 @@ public class ResourceTreeView extends LocatableVLayout {
setShowResizeBar(true);
}
+ @Override
public void onInit() {
// TODO (ips): Are we intentionally avoiding calling super.onInit() here? If so, why?
}
@@ -141,6 +142,7 @@ public class ResourceTreeView extends LocatableVLayout {
autoGroupContextMenu = new ResourceGroupContextMenu(extendLocatorId("autoGroupContextMenu"));
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (!selectionEvent.isRightButtonDown() && selectionEvent.getState()) {
ListGridRecord selectedRecord = treeGrid.getSelectedRecord();
@@ -168,6 +170,7 @@ public class ResourceTreeView extends LocatableVLayout {
AutoGroupTreeNode agNode = (AutoGroupTreeNode) selectedRecord;
selectedNodeId = agNode.getID();
getAutoGroupBackingGroup(agNode, new AsyncCallback<ResourceGroup>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_selection(),
caught);
@@ -192,27 +195,35 @@ public class ResourceTreeView extends LocatableVLayout {
// setContextMenu(resourceContextMenu);
treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
+
public void onNodeContextClick(final NodeContextClickEvent event) {
// stop the browser right-click menu
event.cancel();
// don't select the node on a right click, since we're not navigating to it
treeGrid.deselectRecord(event.getNode());
+ TreeNode eventNode = event.getNode();
+
+ // re-select the current node if necessary
if (null != selectedNodeId) {
- treeGrid.selectRecord(treeGrid.getTree().findById(selectedNodeId));
+ TreeNode selectedNode = treeGrid.getTree().findById(selectedNodeId);
+ if (!eventNode.equals(selectedNode)) {
+ treeGrid.selectRecord(selectedNode);
+ }
}
- if (event.getNode() instanceof AutoGroupTreeNode) {
- showContextMenu((AutoGroupTreeNode) event.getNode());
- } else if (event.getNode() instanceof ResourceTreeNode) {
- if (!((ResourceTreeNode) event.getNode()).isLocked()) {
- showContextMenu((ResourceTreeNode) event.getNode());
+ if (eventNode instanceof AutoGroupTreeNode) {
+ showContextMenu((AutoGroupTreeNode) eventNode);
+ } else if (eventNode instanceof ResourceTreeNode) {
+ if (!((ResourceTreeNode) eventNode).isLocked()) {
+ showContextMenu((ResourceTreeNode) eventNode);
}
}
}
});
treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
+
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
updateSelection();
}
@@ -236,6 +247,7 @@ public class ResourceTreeView extends LocatableVLayout {
criteria.addFilterAutoGroupParentResourceId(agNode.getParentResource().getId());
criteria.addFilterVisible(false);
resourceGroupService.findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_node(), caught);
}
@@ -315,6 +327,7 @@ public class ResourceTreeView extends LocatableVLayout {
private void showContextMenu(AutoGroupTreeNode agNode) {
getAutoGroupBackingGroup(agNode, new AsyncCallback<ResourceGroup>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_selection(), caught);
}
@@ -334,6 +347,7 @@ public class ResourceTreeView extends LocatableVLayout {
criteria.addFilterId(resourceId);
GWTServiceLookup.getResourceService().findResourceCompositesByCriteria(criteria,
new AsyncCallback<PageList<ResourceComposite>>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId)),
@@ -359,6 +373,7 @@ public class ResourceTreeView extends LocatableVLayout {
ResourceTypeRepository.MetadataType.resourceConfigurationDefinition,
ResourceTypeRepository.MetadataType.measurements),
new ResourceTypeRepository.TypeLoadedCallback() {
+
public void onTypesLoaded(ResourceType type) {
buildResourceContextMenu(resourceComposite, type);
resourceContextMenu.showContextMenu();
@@ -386,6 +401,7 @@ public class ResourceTreeView extends LocatableVLayout {
// plugin config
MenuItem pluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
pluginConfiguration.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent event) {
CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Inventory", "ConnectionSettings"));
}
@@ -400,6 +416,7 @@ public class ResourceTreeView extends LocatableVLayout {
resourceConfiguration.setEnabled(enabled);
if (enabled) {
resourceConfiguration.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent event) {
CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Configuration", "Current"));
}
@@ -420,6 +437,7 @@ public class ResourceTreeView extends LocatableVLayout {
for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
operationItem.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent event) {
CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(),
ResourceDetailView.Tab.OPERATIONS, ResourceDetailView.OperationsSubTab.SCHEDULES)
@@ -445,6 +463,7 @@ public class ResourceTreeView extends LocatableVLayout {
MenuItem createItem = new MenuItem(childType.getName());
createItem.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent event) {
ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
}
@@ -470,6 +489,7 @@ public class ResourceTreeView extends LocatableVLayout {
MenuItem importItem = new MenuItem(childType.getName());
importItem.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent event) {
ResourceFactoryImportWizard.showImportWizard(resource, childType);
}
@@ -497,6 +517,7 @@ public class ResourceTreeView extends LocatableVLayout {
criteria.addFilterSupportsManualAdd(true);
criteria.fetchParentResourceTypes(true);
rts.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_manualAddChildren(),
caught);
@@ -508,6 +529,7 @@ public class ResourceTreeView extends LocatableVLayout {
MenuItem item = new MenuItem(type.getName());
item.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent event) {
ResourceFactoryImportWizard.showImportWizard(resource, type);
}
@@ -527,6 +549,7 @@ public class ResourceTreeView extends LocatableVLayout {
DashboardCriteria criteria = new DashboardCriteria();
GWTServiceLookup.getDashboardService().findDashboardsByCriteria(criteria,
new AsyncCallback<PageList<Dashboard>>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_dashboard(),
caught);
@@ -547,6 +570,7 @@ public class ResourceTreeView extends LocatableVLayout {
defSubItem.addItem(addToDBItem);
addToDBItem.addClickHandler(new ClickHandler() {
+
public void onClick(MenuItemClickEvent menuItemClickEvent) {
DashboardPortlet p = new DashboardPortlet(MSG
.view_tree_common_contextMenu_resourceGraph(), ResourceGraphPortlet.KEY, 250);
@@ -559,6 +583,7 @@ public class ResourceTreeView extends LocatableVLayout {
GWTServiceLookup.getDashboardService().storeDashboard(d,
new AsyncCallback<Dashboard>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
@@ -651,6 +676,7 @@ public class ResourceTreeView extends LocatableVLayout {
addMember(treeGrid);
treeGrid.fetchData(treeGrid.getCriteria(), new DSCallback() {
+
public void execute(DSResponse response, Object rawData, DSRequest request) {
Log.info("Done fetching data for tree.");
updateSelection();
@@ -670,6 +696,7 @@ public class ResourceTreeView extends LocatableVLayout {
ResourceTypeRepository.MetadataType.children,
ResourceTypeRepository.MetadataType.subCategory),
new ResourceTypeRepository.ResourceTypeLoadedCallback() {
+
public void onResourceTypeLoaded(List<Resource> result) {
treeGrid.getTree()
.linkNodes(ResourceTreeDatasource.buildNodes(lineage, lockedData));
@@ -710,6 +737,7 @@ public class ResourceTreeView extends LocatableVLayout {
criteria.addFilterVisible(false);
criteria.fetchResourceType(true);
resourceGroupService.findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_node(), caught);
}
@@ -719,12 +747,10 @@ public class ResourceTreeView extends LocatableVLayout {
// load the tree up to the autogroup's parent resource
loadTree(backingGroup.getAutoGroupParentResource().getId(), new AsyncCallback<Void>() {
- @Override
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_children(), caught);
}
- @Override
public void onSuccess(Void arg) {
// get the node ID and use it to add a map entry, then call this again to finish up...
selectedNodeId = AutoGroupTreeNode.idOf(backingGroup.getAutoGroupParentResource(),
commit 22f96df0829e252b3c3de748bbddc7a5d7710704
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 25 11:13:55 2011 -0400
Selenium - Make the Login and Registration dialogs locatable.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index 3a5fa85..865793a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -39,7 +39,6 @@ import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -69,6 +68,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* @author Greg Hinkle
@@ -78,8 +78,8 @@ public class LoginView extends LocatableCanvas {
private static boolean loginShowing = false;
- private Window window;
- private DynamicForm form;
+ private LocatableWindow window;
+ private LocatableDynamicForm form;
private LocatableDynamicForm inputForm;
private SubmitItem loginButton;
@@ -157,7 +157,7 @@ public class LoginView extends LocatableCanvas {
form.setFields(logo, header, new RowSpacerItem(), user, password, loginButton);
- window = new Window();
+ window = new LocatableWindow(extendLocatorId("LoginWindow"));
window.setWidth(400);
window.setHeight(275);
window.setTitle(MSG.common_title_welcome());
@@ -367,7 +367,7 @@ public class LoginView extends LocatableCanvas {
row.addMember(logoutLabel);
column.addMember(row);
- window = new Window();
+ window = new LocatableWindow(extendLocatorId("RegistrationWindow"));
window.setWidth(670);
window.setHeight(330);
window.setTitle(MSG.view_login_registerUser());
13 years, 2 months
[rhq] modules/enterprise
by Simeon Pinder
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java | 7 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java | 10 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java | 11 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java | 14 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java | 11 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceAlertsPortlet.java | 37 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java | 4 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java | 4 -
11 files changed, 58 insertions(+), 47 deletions(-)
New commits:
commit 12051d6e7026198b07aa7f9e8176488ebfd27986
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Mar 25 01:14:11 2011 -0400
i)number Resource/Group*Portlet refresh/redraw fixes
ii)general cleanup of some porlet classes.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
index ae9069b..2cb7f74 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
@@ -134,16 +134,15 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource {
criteria.addFilterPriorities(filterPriorities);
}
}
+
PageControl pc = new PageControl();
//result sort order
property = portletConfig.getSimple(Constant.RESULT_SORT_ORDER);
if (property != null) {
String currentSetting = property.getStringValue();
if (currentSetting.trim().isEmpty() || currentSetting.equalsIgnoreCase(PageOrdering.DESC.name())) {
- criteria.addSortCtime(PageOrdering.DESC);
pc.setPrimarySortOrder(PageOrdering.DESC);
} else {
- criteria.addSortCtime(PageOrdering.ASC);
pc.setPrimarySortOrder(PageOrdering.ASC);
}
}
@@ -186,8 +185,8 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource {
property = portletConfig.getSimple(Constant.RESULT_COUNT);
if (property != null) {
String currentSetting = property.getStringValue();
- if (currentSetting.trim().isEmpty() || currentSetting.equalsIgnoreCase("5")) {
- pc.setPageSize(5);
+ if (currentSetting.trim().isEmpty() || currentSetting.equalsIgnoreCase(Constant.RESULT_COUNT_DEFAULT)) {
+ pc.setPageSize(Integer.valueOf(Constant.RESULT_COUNT_DEFAULT));
} else {
pc.setPageSize(Integer.valueOf(currentSetting));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java
index 740d549..6ac9afe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java
@@ -75,6 +75,7 @@ public class GroupAlertsPortlet extends AlertHistoryView implements CustomSettin
public static final String RESOURCES_SELECTED = MSG.common_label_selected_resources();
public static final String defaultResourceValue = RESOURCES_ALL;
public static final String ID = "id";
+ private boolean currentlyRefreshing = false;
// set on initial configuration, the window for this portlet view.
protected PortletWindow portletWindow;
@@ -269,7 +270,7 @@ public class GroupAlertsPortlet extends AlertHistoryView implements CustomSettin
}
public boolean isRefreshing() {
- return false;
+ return this.currentlyRefreshing;
}
@Override
@@ -320,7 +321,6 @@ public class GroupAlertsPortlet extends AlertHistoryView implements CustomSettin
protected void onInit() {
super.onInit();
initializeUi();
- // getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
}
@Override
@@ -332,6 +332,12 @@ public class GroupAlertsPortlet extends AlertHistoryView implements CustomSettin
MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()), String.valueOf(count)));
}
}
+
+ @Override
+ public void redraw() {
+ super.redraw();
+ refresh();//is table so need to call this to reload
+ }
}
/** Bundles a ResourceSelector instance with labeling in Canvas for display.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
index 4d163ab..6ef8a59 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
@@ -215,6 +215,7 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
public void onFailure(Throwable caught) {
Log.debug("Error retrieving installed bundle deployments for group [" + groupId + "]:"
+ caught.getMessage());
+ currentlyLoading = false;
}
@Override
@@ -258,6 +259,7 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
recentBundleDeployContent.addChild(column);
recentBundleDeployContent.markForRedraw();
markForRedraw();
+ currentlyLoading = false;
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
index 3b069c5..b4761e9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
@@ -103,6 +103,8 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
@Override
protected void onInit() {
super.onInit();
+ //disable the refresh timer for this run
+ currentlyLoading = true;
initializeUi();
redraw();
}
@@ -151,7 +153,6 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
}
protected void loadData() {
- currentlyLoading = true;
getRecentEventUpdates();
}
@@ -235,6 +236,7 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
Log
.debug("Error retrieving recent event counts for group [" + groupId + "]:"
+ caught.getMessage());
+ setCurrentlyRefreshing(false);
}
@Override
@@ -288,12 +290,14 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
recentEventsContent.addChild(column);
recentEventsContent.markForRedraw();
markForRedraw();
+ setCurrentlyRefreshing(false);
}
});
}
public void startRefreshCycle() {
refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
+ markForRedraw();
}
@Override
@@ -303,6 +307,7 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
super.onDestroy();
}
+ @Override
public boolean isRefreshing() {
return this.currentlyLoading;
}
@@ -312,4 +317,8 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
super.redraw();
loadData();
}
+
+ protected void setCurrentlyRefreshing(boolean currentlyRefreshing) {
+ this.currentlyLoading = currentlyRefreshing;
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index 898c04b..d6dbf19 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -121,6 +121,7 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
@Override
protected void onInit() {
super.onInit();
+ setRefreshing(true);
initializeUi();
loadData();
}
@@ -274,6 +275,7 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
public void onFailure(Throwable caught) {
Log.debug("Error retrieving resource group composite for group [" + groupId + "]:"
+ caught.getMessage());
+ setRefreshing(false);
}
@Override
@@ -325,6 +327,7 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
Log
.debug("Error retrieving recent metrics charting data for group ["
+ groupId + "]:" + caught.getMessage());
+ setRefreshing(false);
}
@Override
@@ -433,6 +436,7 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
AbstractActivityView.RECENT_MEASUREMENTS_NONE);
column.addMember(row);
}
+ setRefreshing(false);
}
});
}
@@ -442,6 +446,7 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
LocatableDynamicForm row = AbstractActivityView.createEmptyDisplayRow(recentMeasurementsContent
.extendLocatorId("None"), AbstractActivityView.RECENT_MEASUREMENTS_NONE);
column.addMember(row);
+ setRefreshing(false);
}
}
});
@@ -454,8 +459,12 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
recentMeasurementsContent.markForRedraw();
}
+ @Override
public void startRefreshCycle() {
refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
+ //call out to 3rd party javascript lib
+ BrowserUtility.graphSparkLines();
+ recentMeasurementsContent.markForRedraw();
}
@Override
@@ -465,6 +474,7 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
super.onDestroy();
}
+ @Override
public boolean isRefreshing() {
return this.currentlyLoading;
}
@@ -486,4 +496,8 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
public String getBaseViewPath() {
return baseViewPath;
}
+
+ protected void setRefreshing(boolean currentlyRefreshing) {
+ this.currentlyLoading = currentlyRefreshing;
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
index 265e200..008c34b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
@@ -204,6 +204,7 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
public void onFailure(Throwable caught) {
Log.debug("Error retrieving recent out of bound metrics for group [" + groupId + "]:"
+ caught.getMessage());
+ currentlyLoading = false;
}
@Override
@@ -238,12 +239,14 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
}
recentOobContent.addChild(column);
recentOobContent.markForRedraw();
+ currentlyLoading = false;
}
});
}
public void startRefreshCycle() {
refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
+ recentOobContent.markForRedraw();
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
index 10031d1..9a9a124 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
@@ -78,6 +78,7 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
public static final String NAME = MSG.view_portlet_defaultName_group_operations();
protected static final String ID = "id";
+ protected boolean currentlyRefreshing = false;
// set on initial configuration, the window for this portlet view.
protected PortletWindow portletWindow;
@@ -126,6 +127,8 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
@Override
protected void onInit() {
super.onInit();
+ //disable the refresh timer for this run
+ currentlyRefreshing = true;
initializeUi();
loadData();
}
@@ -157,6 +160,7 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
public void onFailure(Throwable caught) {
Log.debug("Error retrieving resource group composite for group [" + groupId + "]:"
+ caught.getMessage());
+ currentlyRefreshing = false;
}
@Override
@@ -186,6 +190,7 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
}
recentOperationsContent.addChild(groupOperations);
recentOperationsContent.markForRedraw();
+ currentlyRefreshing = false;
}
});
}
@@ -308,7 +313,7 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
}
public boolean isRefreshing() {
- return false;
+ return currentlyRefreshing;
}
private boolean isAutoGroup() {
@@ -328,6 +333,10 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
super.redraw();
loadData();
}
+
+ protected void setCurrentlyRefreshing(boolean currentlyRefreshing) {
+ this.currentlyRefreshing = currentlyRefreshing;
+ }
}
/** Provide implementation of GroupOperationsHistoryListView using datasource
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
index e58b1da..da5a0ee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
@@ -213,6 +213,7 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
public void onFailure(Throwable caught) {
Log.debug("Error retrieving installed package history for group [" + groupId + "]:"
+ caught.getMessage());
+ currentlyLoading = false;
}
@Override
@@ -255,6 +256,7 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
recentPkgHistoryContent.addChild(column);
recentPkgHistoryContent.markForRedraw();
markForRedraw();
+ currentlyLoading = false;
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceAlertsPortlet.java
index c79b9f9..ff3a9939 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceAlertsPortlet.java
@@ -20,16 +20,11 @@ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource;
import com.google.gwt.user.client.History;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.events.DoubleClickEvent;
-import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.alert.AlertPortletConfigurationDataSource;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
@@ -139,10 +134,6 @@ public class ResourceAlertsPortlet extends GroupAlertsPortlet {
}
- public AlertPortletConfigurationDataSource getDataSource() {
- return dataSource;
- }
-
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
@@ -151,34 +142,6 @@ public class ResourceAlertsPortlet extends GroupAlertsPortlet {
return new ResourceAlertsPortlet(locatorId);
}
}
-
- @Override
- protected void configureTable() {
- super.configureTable();
-
- setListGridDoubleClickHandler(new DoubleClickHandler() {
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- ListGrid listGrid = (ListGrid) event.getSource();
- ListGridRecord[] selectedRows = listGrid.getSelection();
- if (selectedRows != null && selectedRows.length == 1) {
- Integer recordId = getId(selectedRows[0]);
- Integer resourceId = selectedRows[0].getAttributeAsInt("resourceId");
- CoreGUI.goToView(LinkManager.getSubsystemAlertHistoryLink(resourceId, recordId));
- }
- }
- });
- }
-
- @Override
- protected void refreshTableInfo() {
- super.refreshTableInfo();
- if (getTableInfo() != null) {
- int count = getListGrid().getSelection().length;
- getTableInfo().setContents(
- MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()), String.valueOf(count)));
- }
- }
}
/** Bundles a ResourceSelector instance with labeling in Canvas for display.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index e907ce6..a77796f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -164,6 +164,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
public void onFailure(Throwable caught) {
Log.debug("Error retrieving resource resource composite for resource [" + resourceId + "]:"
+ caught.getMessage());
+ setRefreshing(false);
}
@Override
@@ -214,6 +215,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
Log
.debug("Error retrieving recent metrics charting data for resource ["
+ resourceId + "]:" + caught.getMessage());
+ setRefreshing(false);
}
@Override
@@ -322,11 +324,11 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
AbstractActivityView.RECENT_MEASUREMENTS_NONE);
column.addMember(row);
}
+ setRefreshing(false);
}
});
}
});
- // }
}
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
index c584aaa..a0ef80ffba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
@@ -84,7 +84,7 @@ public class ResourceOperationsPortlet extends GroupOperationsPortlet {
@Override
protected void onInit() {
- // super.onInit();
+ setCurrentlyRefreshing(true);
initializeUi();
loadData();
}
@@ -165,6 +165,7 @@ public class ResourceOperationsPortlet extends GroupOperationsPortlet {
public void onFailure(Throwable caught) {
Log.debug("Error retrieving resource composite for resource [" + resourceId + "]:"
+ caught.getMessage());
+ setCurrentlyRefreshing(false);
}
@Override
@@ -186,6 +187,7 @@ public class ResourceOperationsPortlet extends GroupOperationsPortlet {
recentOperationsContent.addChild(resourceOperations);
recentOperationsContent.markForRedraw();
}
+ setCurrentlyRefreshing(false);
}
});
}
13 years, 2 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java | 34 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 6 +
2 files changed, 35 insertions(+), 5 deletions(-)
New commits:
commit e5b698ed50fdd6638999cb6e1ebcb2d63e1a6194
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 15:54:48 2011 -0400
be more fault tolerant of invalid portlets that might be in the DB.
this happens during development as portlets are changed and removed.
could also happen when upgrading to a new version of RHQ that removed a portlet.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index fa76473..520a948 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -24,7 +24,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupAlertsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupBundleDeploymentsPortlet;
@@ -53,6 +57,8 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.Inventor
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Simeon Pinder
@@ -177,9 +183,31 @@ public class PortletFactory {
PortletViewFactory viewFactory = registeredPortletFactoryMap.get(storedPortlet.getPortletKey());
if (viewFactory == null) {//check group view factory
viewFactory = registeredGroupPortletFactoryMap.get(storedPortlet.getPortletKey());
- }
- if (viewFactory == null) {//check resource view factory
- viewFactory = registeredResourcePortletFactoryMap.get(storedPortlet.getPortletKey());
+
+ if (viewFactory == null) {//check resource view factory
+ viewFactory = registeredResourcePortletFactoryMap.get(storedPortlet.getPortletKey());
+
+ if (viewFactory == null) {
+ Message msg = new Message("Bad portlet: " + storedPortlet, Severity.Warning);
+ CoreGUI.getMessageCenter().notify(msg);
+ class InvalidPortlet extends Label implements Portlet {
+ InvalidPortlet() {
+ super(CoreGUI.getMessages().view_portlet_factory_invalidPortlet());
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new Label(getContents());
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ }
+ }
+ ;
+ return new InvalidPortlet();
+ }
+ }
}
Portlet view = viewFactory.getInstance(locatorId);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index a149de8..b8ce183 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1442,6 +1442,8 @@ view_dashboards_portlets_refresh_success2=Stopping reload for portlets that auto
view_dashboardsManager_error1 = Failed to add new dashboard
view_dashboardsManager_message_title_details = <h1>Welcome to RHQ</h1>\n<p>The RHQ project is an abstraction and plug-in based systems management suite that provides extensible and integrated systems management for multiple products and platforms across a set of core features. The project is designed with layered modules that provide a flexible architecture for deployment. It delivers a core user interface that delivers audited and historical management across an entire enterprise. A Server/Agent architecture provides remote management and plugins implement all specific support for managed products.</p>\n <p>This default dashboard can be edited by clicking the (edit mode) button above.</p>
+view_portlet_factory_invalidPortlet = This is an obsolete portlet that is no longer valid. Please delete it.
+
view_portlet_defaultName_autodiscovery = Discovery Queue
view_portlet_defaultName_favoriteResources = Favorite Resources
view_portlet_defaultName_resourceMetric = Resource Metric Graph
commit c599feb1ee9146f09f14db319efd07a4b7c6acd7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 15:49:55 2011 -0400
remove the ~, which was our old marker we used to use
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 56b7270..a149de8 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1418,7 +1418,7 @@ view_type_typeTreeLoadFailure = Failed to load resource type tree data
# Tabs
view_tabs_invalidSubTab = Invalid subtab: {0}
-view_tabs_invalidTab = Invalid tab: {0}~
+view_tabs_invalidTab = Invalid tab: {0}
# Group Tree
group_tree_partialClusterTooltip = {0} out of {1} group members have a ''{2}'' resource
@@ -1513,7 +1513,7 @@ view_portlet_operations_config_scheduled_enable = Whether to enable scheduled op
view_portlet_operations_config_scheduled_maximum = Maximum number of Scheduled operations to display.
view_portlet_operations_config_completed = completed operations
view_portlet_operations_config_show_last = show Last
-view_portlet_operations_config_show_next = show Next~
+view_portlet_operations_config_show_next = show Next
view_portlet_operations_disabled = (Results currently disabled. Change settings to enable results.
view_portlet_platform_platform_error_1 = Failed to load platform metrics
13 years, 2 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java | 17 +++++++---
1 file changed, 13 insertions(+), 4 deletions(-)
New commits:
commit 5ef481fe24f2a468ade1ca50eccce7f1a606916e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 12:00:41 2011 -0400
be able to not specify a width. this isn't used today, but can be in the future - just pass in a negative width
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
index e28dab2..2393132 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
@@ -341,11 +341,20 @@ public abstract class AncestryUtil {
Map<Integer, ResourceType> types = ((MapWrapper) record.getAttributeAsObject(RESOURCE_ANCESTRY_TYPES)).getMap();
Integer resourceTypeId = record.getAttributeAsInt(RESOURCE_TYPE_ID);
ResourceType type = types.get(resourceTypeId);
- width = (width <= 0) ? 500 : width;
- StringBuilder sb = new StringBuilder("<p style='width:");
- sb.append(width);
- sb.append("px'>");
+ // note: if width is negative, we do not explicitly define a width in the HTML, thus enabling auto-resizing.
+ Integer widthObj = null;
+ if (width >= 0) {
+ widthObj = (width == 0) ? Integer.valueOf(500) : Integer.valueOf(width);
+ }
+
+ StringBuilder sb = new StringBuilder("<p");
+ if (widthObj != null) {
+ sb.append(" style='width:");
+ sb.append(widthObj.toString());
+ sb.append("px'");
+ }
+ sb.append(">");
sb.append(getResourceLongName(resourceName, type));
13 years, 2 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 15 ++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java | 16 +++++++---
2 files changed, 23 insertions(+), 8 deletions(-)
New commits:
commit 9b0627038c5f77cf610d74acd993b6953e12a68a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 11:54:47 2011 -0400
BZ 609135 - fix the favorites button so its context menu is popped up
at the bottom of the button, like a typical context menu.
also get the ancestry items to be auto-sized
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index ba5e649..fd45110 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -70,8 +70,11 @@ public class FavoritesButton extends LocatableIMenuButton {
final Menu favoriteGroupsMenu = new Menu();
final Menu recentlyViewedMenu = new Menu();
favoriteResourcesMenu.setSubmenuDirection("left");
+ favoriteResourcesMenu.setAutoWidth();
favoriteGroupsMenu.setSubmenuDirection("left");
+ favoriteGroupsMenu.setAutoWidth();
recentlyViewedMenu.setSubmenuDirection("left");
+ recentlyViewedMenu.setAutoWidth();
MenuItem favoriteResourcesMenuItem = new MenuItem(MSG.favorites_resources(), "Favorite_Resource_16.png");
favoriteResourcesMenuItem.setSubmenu(favoriteResourcesMenu);
favoriteResourcesMenu.setEmptyMessage(MSG.common_val_none());
@@ -102,7 +105,7 @@ public class FavoritesButton extends LocatableIMenuButton {
// if we have no menu items at all, then show the empty menu now
if (favoriteGroupIds.isEmpty() && favoriteResourceIds.isEmpty() && recentResourceIds.isEmpty()
&& recentGroupIds.isEmpty()) {
- favoritesMenu.showContextMenu();
+ favoritesMenu.showNextTo(FavoritesButton.this, "bottom");
return;
}
@@ -149,7 +152,7 @@ public class FavoritesButton extends LocatableIMenuButton {
buildRecentlyViewedMenu(favorites, recentlyViewedMenu, recentResourceIds,
recentGroupIds, typesWrapper);
- favoritesMenu.showContextMenu();
+ favoritesMenu.showNextTo(FavoritesButton.this, "bottom");
}
});
}
@@ -185,9 +188,11 @@ public class FavoritesButton extends LocatableIMenuButton {
item.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, resource.getResourceType().getId());
item.setAttribute(AncestryUtil.RESOURCE_ANCESTRY_TYPES, typesWrapper);
Menu ancestryMenu = new Menu();
- MenuItem ancestryItem = new MenuItem(AncestryUtil.getAncestryHoverHTML(item, 0));
+ MenuItem ancestryItem = new MenuItem(AncestryUtil.getAncestryHoverHTML(item, -1));
ancestryItem.setEnabled(false);
ancestryMenu.setItems(ancestryItem);
+ ancestryMenu.setSubmenuDirection("left");
+ ancestryMenu.setAutoWidth();
item.setSubmenu(ancestryMenu);
item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@@ -260,9 +265,11 @@ public class FavoritesButton extends LocatableIMenuButton {
item.setAttribute(AncestryUtil.RESOURCE_ANCESTRY_TYPES, typesWrapper);
Menu ancestryMenu = new Menu();
- MenuItem ancestryItem = new MenuItem(AncestryUtil.getAncestryHoverHTML(item, 0));
+ MenuItem ancestryItem = new MenuItem(AncestryUtil.getAncestryHoverHTML(item, -1));
ancestryItem.setEnabled(false);
ancestryMenu.setItems(ancestryItem);
+ ancestryMenu.setSubmenuDirection("left");
+ ancestryMenu.setAutoWidth();
item.setSubmenu(ancestryMenu);
item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
index 20d9937..e28dab2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
@@ -259,12 +259,20 @@ public abstract class AncestryUtil {
ResourceType type = types.get(resourceTypeId);
String resourceLongName = getResourceLongName(resourceName, type);
- width = (width <= 0) ? 500 : width;
+ // note: if width is negative, we do not explicitly define a width in the HTML, thus enabling auto-resizing.
+ Integer widthObj = null;
+ if (width >= 0) {
+ widthObj = (width == 0) ? Integer.valueOf(500) : Integer.valueOf(width);
+ }
// decode ancestry
- StringBuilder sb = new StringBuilder("<p style='width:");
- sb.append(width);
- sb.append("px'>");
+ StringBuilder sb = new StringBuilder("<p");
+ if (widthObj != null) {
+ sb.append(" style='width:");
+ sb.append(widthObj.toString());
+ sb.append("px'");
+ }
+ sb.append(">");
String title = (null != ancestry) ? TITLE_ANCESTRY : TITLE_PLATFORM;
sb.append(title);
sb.append(resourceLongName);
13 years, 2 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java | 50 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java | 15 ++-
2 files changed, 38 insertions(+), 27 deletions(-)
New commits:
commit 0fb1eb897c78c2fb00941619699a837351399f35
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 10:53:21 2011 -0400
forgot these two classes as part of the datasource refactoring to have separate getFetchCriteria method
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
index efb48d4..ae9069b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
@@ -81,8 +81,34 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource {
/** Override the executeFetch for AlertPortlet to allow specifying smaller than total
* result displays.
*/
- protected void executeFetch(final DSRequest request, final DSResponse response) {
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response, final AlertCriteria criteria) {
final long start = System.currentTimeMillis();
+
+ getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_alerts_loadFailed(), caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Alert> result) {
+ long fetchTime = System.currentTimeMillis() - start;
+ Log.info(result.size() + " alerts fetched in: " + fetchTime + "ms");
+ if (entityContext.type != EntityContext.Type.Resource) {
+ dataRetrieved(result, response, request);
+ } else {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.size());
+ processResponse(request.getRequestId(), response);
+ }
+ }
+ });
+ }
+
+ @Override
+ protected AlertCriteria getFetchCriteria(DSRequest request) {
AlertCriteria criteria = new AlertCriteria();
//initialize to only five for quick queries.
criteria.setPageControl(new PageControl(0, Integer
@@ -176,27 +202,7 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource {
}
criteria.fetchAlertDefinition(true);
criteria.fetchRecoveryAlertDefinition(true);
-
- getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_alerts_loadFailed(), caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<Alert> result) {
- long fetchTime = System.currentTimeMillis() - start;
- Log.info(result.size() + " alerts fetched in: " + fetchTime + "ms");
- if (entityContext.type != EntityContext.Type.Resource) {
- dataRetrieved(result, response, request);
- } else {
- response.setData(buildRecords(result));
- response.setTotalRows(result.size());
- processResponse(request.getRequestId(), response);
- }
- }
- });
+ return criteria;
}
public String getAlertResourcesToUse() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
index f80a435..a2d0aba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
@@ -35,11 +35,8 @@ public class AlertPortletDataSource extends AlertDataSource {
this.portlet = recentAlertsPortlet;
}
- /** Override the executeFetch for AlertPortlet to allow specifying smaller than total
- * result displays.
- */
- protected void executeFetch(final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
+ @Override
+ protected AlertCriteria getFetchCriteria(DSRequest request) {
//retrieve previous settings from portlet config
if ((portlet != null) && (this.portlet instanceof DashboardPortlet)) {
//must check for whether portlet config
@@ -86,6 +83,14 @@ public class AlertPortletDataSource extends AlertDataSource {
criteria.addFilterPriorities(AlertPriority.getByLegacyIndex(getAlertPriorityIndex()));
}
+ return criteria;
+ }
+
+ /** Override the executeFetch for AlertPortlet to allow specifying smaller than total
+ * result displays.
+ */
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response, final AlertCriteria criteria) {
getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
public void onFailure(Throwable caught) {
13 years, 2 months
[rhq] modules/plugins
by lkrejci
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 771b04e9238e84bb9f269a552b1af837ee33ad85
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Mar 24 15:13:50 2011 +0100
BZ 689833 - fixing the discovery regression. The original fix for this bug caused the discovery to be unable to determine the name to use for the localhost entry.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
index 6b9e686..873d5b8 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
@@ -369,7 +369,8 @@ public enum HttpdAddressUtility {
}
if (address.host == null || address.isHostDefault() || address.isHostWildcard()) {
- address = getLocalhost(address.port);
+ Address localhost = getLocalhost(address.port);
+ address.host = localhost.host;
}
updateWithServerName(address, ag);
13 years, 2 months
[rhq] 2 commits - modules/enterprise modules/plugins
by Simeon Pinder
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/GwtRelativeDurationConverter.java | 8
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java | 1056 ++++------
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java | 4
modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 12
6 files changed, 540 insertions(+), 558 deletions(-)
New commits:
commit f1560f9c48866f34949566ce368e0288d3d72757
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Mar 24 00:31:35 2011 -0400
i)fix for default portlet list for mixed groups
ii)fix for relativeDuration display
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
index 5396bc0..efb48d4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
@@ -87,6 +87,7 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource {
//initialize to only five for quick queries.
criteria.setPageControl(new PageControl(0, Integer
.valueOf(PortletConfigurationEditorComponent.Constant.RESULT_COUNT_DEFAULT)));
+
//retrieve previous settings from portlet config
if ((portlet != null) && (this.portlet instanceof DashboardPortlet)) {
Configuration portletConfig = configuration;
@@ -160,10 +161,8 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource {
if (property != null) {
String currentSetting = property.getStringValue();
if (currentSetting.trim().isEmpty() || currentSetting.equalsIgnoreCase("5")) {
- PageControl pageControl = new PageControl(0, 5);
pc.setPageSize(5);
} else {
- PageControl pageControl = new PageControl(0, Integer.valueOf(currentSetting));
pc.setPageSize(Integer.valueOf(currentSetting));
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index e8ee80c..4c19ac1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -515,9 +515,14 @@ public class DashboardView extends LocatableVLayout {
//filter out portlets not relevent for facets
Set<ResourceTypeFacet> facets = composite.getResourceFacets().getFacets();
GroupCategory groupCategory = composite.getResourceGroup().getGroupCategory();
- // ResourceGroup group = composite.getResourceGroup();
- //compatible if not a compatible group may need to do some pruning.
+ //if not a compatible group may need to do some pruning.
if (groupCategory != GroupCategory.COMPATIBLE) {
+ groupKeyNameMap.remove(GroupOperationsPortlet.KEY);
+ groupKeyNameMap.remove(GroupMetricsPortlet.KEY);
+ groupKeyNameMap.remove(GroupOobsPortlet.KEY);
+ groupKeyNameMap.remove(GroupPkgHistoryPortlet.KEY);
+ } else {
+ //for compatible may still need to do some pruning.
if (!facets.isEmpty()) {
//Operations related portlets(Config,PkgHistory)
if (!facets.contains(ResourceTypeFacet.OPERATION)) {
@@ -533,12 +538,8 @@ public class DashboardView extends LocatableVLayout {
groupKeyNameMap.remove(GroupPkgHistoryPortlet.KEY);
}
}
- // //EVENT related portlets
- // if (!facets.contains(ResourceTypeFacet.EVENT)) {
- // groupKeyNameMap.remove(GroupEventsPortlet.KEY);
- // }
-
}
+
}
return groupKeyNameMap;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/GwtRelativeDurationConverter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/GwtRelativeDurationConverter.java
index 1679e3f..803df4c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/GwtRelativeDurationConverter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/GwtRelativeDurationConverter.java
@@ -32,13 +32,15 @@ public class GwtRelativeDurationConverter {
public static TimeZone tz = null;
public static String format(long eventMillis) {
- int dayOfYearToday = Integer.parseInt(dayFormatter.format(new Date(System.currentTimeMillis())));
+ long now = System.currentTimeMillis();
+ int dayOfYearToday = Integer.parseInt(dayFormatter.format(new Date(now)));
int dayOfYearEvent = Integer.parseInt(dayFormatter.format(new Date(eventMillis)));
String result = null;
- if (dayOfYearEvent == dayOfYearToday) {
+ //add additional check to fix when dayOfYear and dayOfYearToday is same but month apart.
+ if ((dayOfYearEvent == dayOfYearToday) & ((now - eventMillis) < MILLIS_IN_DAY)) {
// <time>
result = formatter.format(new Date(eventMillis));
- } else if (dayOfYearEvent == dayOfYearToday - 1) {
+ } else if ((dayOfYearEvent == dayOfYearToday - 1) & ((now - eventMillis) < MILLIS_IN_DAY * 28)) {
// "yesterday" <time>
result = MSG.common_label_yesterday() + ", " + formatter.format(new Date(eventMillis));
} else {
commit 7a2b59a994595f2d2aa7a340b4c2ce4a99651539
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Mar 23 20:56:25 2011 -0400
BZ 689992: adding ability to update start/stop max times for jbossAs5 plugin.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java
index 5f7ae4f..f58051e 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java
@@ -34,7 +34,9 @@ import org.mc4j.ems.connection.EmsConnection;
import org.mc4j.ems.connection.bean.EmsBean;
import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.mc4j.ems.connection.bean.parameter.EmsParameter;
+
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.operation.OperationResult;
@@ -51,108 +53,105 @@ import org.rhq.core.system.SystemInfo;
* @author Jay Shaughnessy
*/
public class ApplicationServerOperationsDelegate {
- /**
- * max amount of time to wait for server to show as unavailable after
- * executing stop - in milliseconds
- */
- private static final long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
-
- /**
- * amount of time to wait between availability checks when performing a stop
- * - in milliseconds
- */
- private static final long STOP_WAIT_INTERVAL = 1000L * 5; // 5 seconds
-
- /**
- * amount of time to wait for stop to complete after the loop that checks
- * for DOWN availability terminates - in milliseconds
- */
- private static final long STOP_WAIT_FINAL = 1000L * 30; // 30 seconds
-
- /** max amount of time to wait for start to complete - in milliseconds */
- private static final long START_WAIT_MAX = 1000L * 300; // 5 minutes
-
- /**
- * amount of time to wait between availability checks when performing a
- * start - in milliseconds
- */
- private static final long START_WAIT_INTERVAL = 1000L * 5; // 5 seconds
-
- private final Log log = LogFactory
- .getLog(ApplicationServerOperationsDelegate.class);
-
- private static final String SEPARATOR = "\n-----------------------\n";
-
- static final String DEFAULT_START_SCRIPT = "bin" + File.separator + "run."
- + ((File.separatorChar == '/') ? "sh" : "bat");
- static final String DEFAULT_SHUTDOWN_SCRIPT = "bin" + File.separator
- + "shutdown." + ((File.separatorChar == '/') ? "sh" : "bat");
-
- /**
- * Server component against which the operations are being performed.
- */
- private ApplicationServerComponent serverComponent;
-
- private File configPath;
-
- // Constructors --------------------------------------------
-
- public ApplicationServerOperationsDelegate(
- ApplicationServerComponent serverComponent) {
- this.serverComponent = serverComponent;
- }
-
- // Public --------------------------------------------
-
- /**
- * Performs the specified operation. The result of the operation will be
- * indicated in the return. If there is an error, an
- * <code>RuntimeException</code> will be thrown.
- *
- * @param operation
- * the operation to perform
- * @param parameters
- * parameters to the operation call
- *
- * @return if successful, the result object will contain a success message
- *
- * @throws RuntimeException
- * if any errors occur while trying to perform the operation
- */
- public OperationResult invoke(
- ApplicationServerSupportedOperations operation,
- Configuration parameters) throws InterruptedException {
- OperationResult result = null;
-
- switch (operation) {
- case START: {
- result = start();
- break;
- }
- case SHUTDOWN: {
- result = shutDown();
- break;
- }
- case RESTART: {
- result = restart();
- break;
- }
- }
-
- return result;
- }
-
- // Private --------------------------------------------
-
- /**
- * Starts the underlying AS server.
- *
- * @return success message if no errors are encountered
- * @throws InterruptedException
- * if the plugin container stops this operation while its
- * executing
- */
- private OperationResult start() throws InterruptedException {
+ /**
+ * max amount of time to wait for server to show as unavailable after
+ * executing stop - in milliseconds
+ */
+ private static long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
+
+ /**
+ * amount of time to wait between availability checks when performing a stop
+ * - in milliseconds
+ */
+ private static final long STOP_WAIT_INTERVAL = 1000L * 5; // 5 seconds
+
+ /**
+ * amount of time to wait for stop to complete after the loop that checks
+ * for DOWN availability terminates - in milliseconds
+ */
+ private static final long STOP_WAIT_FINAL = 1000L * 30; // 30 seconds
+
+ /** max amount of time to wait for start to complete - in milliseconds */
+ private static long START_WAIT_MAX = 1000L * 300; // 5 minutes
+
+ /**
+ * amount of time to wait between availability checks when performing a
+ * start - in milliseconds
+ */
+ private static final long START_WAIT_INTERVAL = 1000L * 5; // 5 seconds
+
+ private final Log log = LogFactory.getLog(ApplicationServerOperationsDelegate.class);
+
+ private static final String SEPARATOR = "\n-----------------------\n";
+
+ static final String DEFAULT_START_SCRIPT = "bin" + File.separator + "run."
+ + ((File.separatorChar == '/') ? "sh" : "bat");
+ static final String DEFAULT_SHUTDOWN_SCRIPT = "bin" + File.separator + "shutdown."
+ + ((File.separatorChar == '/') ? "sh" : "bat");
+
+ /**
+ * Server component against which the operations are being performed.
+ */
+ private ApplicationServerComponent serverComponent;
+
+ private File configPath;
+
+ // Constructors --------------------------------------------
+
+ public ApplicationServerOperationsDelegate(ApplicationServerComponent serverComponent) {
+ this.serverComponent = serverComponent;
+ }
+
+ // Public --------------------------------------------
+
+ /**
+ * Performs the specified operation. The result of the operation will be
+ * indicated in the return. If there is an error, an
+ * <code>RuntimeException</code> will be thrown.
+ *
+ * @param operation
+ * the operation to perform
+ * @param parameters
+ * parameters to the operation call
+ *
+ * @return if successful, the result object will contain a success message
+ *
+ * @throws RuntimeException
+ * if any errors occur while trying to perform the operation
+ */
+ public OperationResult invoke(ApplicationServerSupportedOperations operation, Configuration parameters)
+ throws InterruptedException {
+ OperationResult result = null;
+
+ switch (operation) {
+ case START: {
+ result = start();
+ break;
+ }
+ case SHUTDOWN: {
+ result = shutDown();
+ break;
+ }
+ case RESTART: {
+ result = restart();
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ // Private --------------------------------------------
+
+ /**
+ * Starts the underlying AS server.
+ *
+ * @return success message if no errors are encountered
+ * @throws InterruptedException
+ * if the plugin container stops this operation while its
+ * executing
+ */
+ private OperationResult start() throws InterruptedException {
AvailabilityType avail = this.serverComponent.getAvailability();
if (avail == AvailabilityType.UP) {
OperationResult result = new OperationResult();
@@ -161,25 +160,20 @@ public class ApplicationServerOperationsDelegate {
}
Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
File startScriptFile = getStartScriptPath();
- validateScriptFile(
- startScriptFile,
- ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP);
+ validateScriptFile(startScriptFile, ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP);
// The optional command prefix (e.g. sudo or nohup).
- String prefix = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP)
- .getStringValue();
- String configName = getConfigurationSet();
- String bindAddress = pluginConfig.getSimpleValue(
- ApplicationServerPluginConfigurationProperties.BIND_ADDRESS, null);
+ String prefix = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP).getStringValue();
+ String configName = getConfigurationSet();
+ String bindAddress = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.BIND_ADDRESS,
+ null);
- ProcessExecution processExecution;
- if (prefix == null || prefix.replaceAll("\\s", "").equals("")) {
- // Prefix is either null or contains ONLY whitespace characters.
+ ProcessExecution processExecution;
+ if (prefix == null || prefix.replaceAll("\\s", "").equals("")) {
+ // Prefix is either null or contains ONLY whitespace characters.
- processExecution = ProcessExecutionUtility
- .createProcessExecution(startScriptFile);
+ processExecution = ProcessExecutionUtility.createProcessExecution(startScriptFile);
processExecution.getArguments().add("-c");
processExecution.getArguments().add(configName);
@@ -188,111 +182,103 @@ public class ApplicationServerOperationsDelegate {
processExecution.getArguments().add("-b");
processExecution.getArguments().add(bindAddress);
}
- } else {
- // The process execution should be tied to the process represented
- // as the prefix. If there are any other
- // tokens in the prefix, consider them arguments to the prefix
- // process.
- StringTokenizer prefixTokenizer = new StringTokenizer(prefix);
- String processName = prefixTokenizer.nextToken();
- File prefixProcess = new File(processName);
-
- processExecution = ProcessExecutionUtility
- .createProcessExecution(prefixProcess);
-
- while (prefixTokenizer.hasMoreTokens()) {
- String prefixArgument = prefixTokenizer.nextToken();
- processExecution.getArguments().add(prefixArgument);
- }
-
- // Add the AS start script and its options as a single argument to the prefix command.
- String startScriptArgument = startScriptFile.getAbsolutePath();
- startScriptArgument += " -c " + configName;
- if (bindAddress != null) {
- startScriptArgument += " -b " + bindAddress;
- }
- processExecution.getArguments().add(startScriptArgument);
- }
-
- initProcessExecution(processExecution, startScriptFile);
-
- long start = System.currentTimeMillis();
- if (log.isDebugEnabled()) {
- log.debug("About to execute the following process: [" + processExecution + "]");
- }
- SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
- ProcessExecutionResults results = systemInfo
- .executeProcess(processExecution);
- logExecutionResults(results);
-
- if (results.getError() == null) {
- avail = waitForServerToStart(start);
- } else {
- log.error(
- "Error from process execution while starting the AS instance. Exit code ["
- + results.getExitCode() + "]", results.getError());
- avail = this.serverComponent.getAvailability();
- }
-
- // If, after the loop, the Server is still down, consider the start to be a failure.
- OperationResult result;
+ } else {
+ // The process execution should be tied to the process represented
+ // as the prefix. If there are any other
+ // tokens in the prefix, consider them arguments to the prefix
+ // process.
+ StringTokenizer prefixTokenizer = new StringTokenizer(prefix);
+ String processName = prefixTokenizer.nextToken();
+ File prefixProcess = new File(processName);
+
+ processExecution = ProcessExecutionUtility.createProcessExecution(prefixProcess);
+
+ while (prefixTokenizer.hasMoreTokens()) {
+ String prefixArgument = prefixTokenizer.nextToken();
+ processExecution.getArguments().add(prefixArgument);
+ }
+
+ // Add the AS start script and its options as a single argument to the prefix command.
+ String startScriptArgument = startScriptFile.getAbsolutePath();
+ startScriptArgument += " -c " + configName;
+ if (bindAddress != null) {
+ startScriptArgument += " -b " + bindAddress;
+ }
+ processExecution.getArguments().add(startScriptArgument);
+ }
+
+ initProcessExecution(processExecution, startScriptFile);
+
+ long start = System.currentTimeMillis();
+ if (log.isDebugEnabled()) {
+ log.debug("About to execute the following process: [" + processExecution + "]");
+ }
+ SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
+ ProcessExecutionResults results = systemInfo.executeProcess(processExecution);
+ logExecutionResults(results);
+
+ if (results.getError() == null) {
+ avail = waitForServerToStart(start);
+ } else {
+ log.error("Error from process execution while starting the AS instance. Exit code ["
+ + results.getExitCode() + "]", results.getError());
+ avail = this.serverComponent.getAvailability();
+ }
+
+ // If, after the loop, the Server is still down, consider the start to be a failure.
+ OperationResult result;
if (avail == AvailabilityType.DOWN) {
- result = new OperationResult();
+ result = new OperationResult();
result.setErrorMessage("The server failed to start: " + results.getCapturedOutput());
- } else {
- result = new OperationResult("The server has been started.");
- }
+ } else {
+ result = new OperationResult("The server has been started.");
+ }
return result;
- }
-
- private String getConfigurationSet() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- configPath = resolvePathRelativeToHomeDir(getRequiredPropertyValue(
- pluginConfig,
- ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR));
-
- if (!configPath.exists()) {
- throw new InvalidPluginConfigurationException(
- "Configuration path '" + configPath + "' does not exist.");
- }
- return pluginConfig.getSimpleValue(
- ApplicationServerPluginConfigurationProperties.SERVER_NAME,
- configPath.getName());
- }
-
- private void initProcessExecution(ProcessExecution processExecution,
- File scriptFile) {
- // NOTE: For both run.bat and shutdown.bat, the current working dir must
- // be set to the script's parent dir
- // (e.g. ${JBOSS_HOME}/bin) for the script to work.
- processExecution.setWorkingDirectory(scriptFile.getParent());
-
- // Both scripts require the JAVA_HOME env var to be set.
- File javaHomeDir = getJavaHomePath();
- if (javaHomeDir == null) {
- throw new IllegalStateException(
- "The '"
- + ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + "' connection property must be set in order to start the application server or to stop it via script.");
- }
-
- validateJavaHomePathProperty();
- processExecution.getEnvironmentVariables().put("JAVA_HOME",
- javaHomeDir.getPath());
-
- processExecution.setCaptureOutput(true);
- processExecution.setWaitForCompletion(1000L); // 1 second // TODO:
- // Should we wait longer than one second?
- processExecution.setKillOnTimeout(false);
- }
-
- /**
- * Shuts down the server by dispatching to shutdown via script or JMX. Waits
- * until the server is down.
- *
- * @return The result of the shutdown operation - is successful
- */
- private OperationResult shutDown() {
+ }
+
+ private String getConfigurationSet() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ configPath = resolvePathRelativeToHomeDir(getRequiredPropertyValue(pluginConfig,
+ ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR));
+
+ if (!configPath.exists()) {
+ throw new InvalidPluginConfigurationException("Configuration path '" + configPath + "' does not exist.");
+ }
+ return pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.SERVER_NAME, configPath
+ .getName());
+ }
+
+ private void initProcessExecution(ProcessExecution processExecution, File scriptFile) {
+ // NOTE: For both run.bat and shutdown.bat, the current working dir must
+ // be set to the script's parent dir
+ // (e.g. ${JBOSS_HOME}/bin) for the script to work.
+ processExecution.setWorkingDirectory(scriptFile.getParent());
+
+ // Both scripts require the JAVA_HOME env var to be set.
+ File javaHomeDir = getJavaHomePath();
+ if (javaHomeDir == null) {
+ throw new IllegalStateException(
+ "The '"
+ + ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + "' connection property must be set in order to start the application server or to stop it via script.");
+ }
+
+ validateJavaHomePathProperty();
+ processExecution.getEnvironmentVariables().put("JAVA_HOME", javaHomeDir.getPath());
+
+ processExecution.setCaptureOutput(true);
+ processExecution.setWaitForCompletion(1000L); // 1 second // TODO:
+ // Should we wait longer than one second?
+ processExecution.setKillOnTimeout(false);
+ }
+
+ /**
+ * Shuts down the server by dispatching to shutdown via script or JMX. Waits
+ * until the server is down.
+ *
+ * @return The result of the shutdown operation - is successful
+ */
+ private OperationResult shutDown() {
AvailabilityType avail = this.serverComponent.getAvailability();
if (avail == AvailabilityType.DOWN) {
OperationResult result = new OperationResult();
@@ -301,339 +287,319 @@ public class ApplicationServerOperationsDelegate {
}
Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- ApplicationServerShutdownMethod shutdownMethod = Enum
- .valueOf(
- ApplicationServerShutdownMethod.class,
- pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_METHOD_CONFIG_PROP)
- .getStringValue());
- String resultMessage = ApplicationServerShutdownMethod.JMX
- .equals(shutdownMethod) ? shutdownViaJmx()
- : shutdownViaScript();
+ ApplicationServerShutdownMethod shutdownMethod = Enum.valueOf(ApplicationServerShutdownMethod.class,
+ pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.SHUTDOWN_METHOD_CONFIG_PROP)
+ .getStringValue());
+ String resultMessage = ApplicationServerShutdownMethod.JMX.equals(shutdownMethod) ? shutdownViaJmx()
+ : shutdownViaScript();
avail = waitForServerToShutdown();
- OperationResult result;
+ OperationResult result;
if (avail == AvailabilityType.UP) {
- result = new OperationResult();
+ result = new OperationResult();
result.setErrorMessage("The server failed to shut down.");
- } else {
- return new OperationResult(resultMessage);
- }
+ } else {
+ return new OperationResult(resultMessage);
+ }
return result;
- }
-
- /**
- * Shuts down the AS server using a shutdown script.
- *
- * @return success message if no errors are encountered
- */
- private String shutdownViaScript() {
- File shutdownScriptFile = getShutdownScriptPath();
- validateScriptFile(
- shutdownScriptFile,
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP);
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String prefix = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP)
- .getStringValue();
- ProcessExecution processExecution = ProcessExecutionUtility
- .createProcessExecution(prefix, shutdownScriptFile);
-
- initProcessExecution(processExecution, shutdownScriptFile);
-
- String server = pluginConfig.getSimple(
- ApplicationServerPluginConfigurationProperties.NAMING_URL)
- .getStringValue();
- if (server != null) {
- processExecution.getArguments().add("--server=" + server);
- }
-
- String user = pluginConfig.getSimple(
- ApplicationServerComponent.PRINCIPAL_CONFIG_PROP)
- .getStringValue();
- if (user != null) {
- processExecution.getArguments().add("--user=" + user);
- }
-
- String password = pluginConfig.getSimple(
- ApplicationServerComponent.CREDENTIALS_CONFIG_PROP)
- .getStringValue();
- if (password != null) {
- processExecution.getArguments().add("--password=" + password);
- }
-
- processExecution.getArguments().add("--shutdown");
-
- /*
- * This tells shutdown.bat not to call the Windows PAUSE command, which
- * would cause the script to hang indefinitely waiting for input.
- * noinspection ConstantConditions
- */
- processExecution.getEnvironmentVariables().put("NOPAUSE", "1");
-
- if (log.isDebugEnabled()) {
- log.debug("About to execute the following process: ["
- + processExecution + "]");
- }
- SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
- ProcessExecutionResults results = systemInfo
- .executeProcess(processExecution);
- logExecutionResults(results);
-
- if (results.getError() != null) {
- throw new RuntimeException(
- "Error executing shutdown script while stopping AS instance. Exit code ["
- + results.getExitCode() + "]", results.getError());
- }
-
- return "The server has been shut down.";
- }
-
- private void logExecutionResults(ProcessExecutionResults results) {
- // Always log the output at info level. On Unix we could switch
- // depending on a exitCode being !=0, but ...
- log.info("Exit code from process execution: " + results.getExitCode());
- log.info("Output from process execution: " + SEPARATOR
- + results.getCapturedOutput() + SEPARATOR);
- }
-
- /**
- * Shuts down the AS server via a JMX call.
- *
- * @return success message if no errors are encountered
- */
- private String shutdownViaJmx() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String mbeanName = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_CONFIG_PROP)
- .getStringValue();
- String operationName = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP)
- .getStringValue();
-
- EmsConnection connection = this.serverComponent.getEmsConnection();
- if (connection == null) {
- throw new RuntimeException("Can not connect to the server");
- }
- EmsBean bean = connection.getBean(mbeanName);
- EmsOperation operation = bean.getOperation(operationName);
- /*
- * Now see if we got the 'real' method (the one with no param) or the
- * overloaded one. This is a workaround for a bug in EMS that prevents
- * finding operations with same name and different signature.
- * http://sourceforge
- * .net/tracker/index.php?func=detail&aid=2007692&group_id
- * =60228&atid=493495
- *
- * In addition, as we offer the user to specify any MBean and any
- * method, we'd need a clever way for the user to specify parameters
- * anyway.
- */
- List<EmsParameter> params = operation.getParameters();
- int count = params.size();
- if (count == 0)
- operation.invoke(new Object[0]);
- else { // overloaded operation
- operation.invoke(new Object[] { 0 }); // return code of 0
- }
-
- return "The server has been shut down.";
- }
-
- private void validateScriptFile(File scriptFile, String scriptPropertyName) {
- if (!scriptFile.exists()) {
- throw new RuntimeException("Script (" + scriptFile
- + ") specified via '" + scriptPropertyName
- + "' connection property does not exist.");
- }
-
- if (scriptFile.isDirectory()) {
- throw new RuntimeException("Script (" + scriptFile
- + ") specified via '" + scriptPropertyName
- + "' connection property is a directory, not a file.");
- }
- }
-
- /**
- * Restart the server by first trying a shutdown and then a start. This is
- * fail fast.
- *
- * @return A success message on success
- */
- private OperationResult restart() {
- try {
- shutDown();
- } catch (Exception e) {
- throw new RuntimeException("Shutdown may have failed: " + e);
- }
-
- try {
- start();
- } catch (Exception e) {
- throw new RuntimeException("Start following shutdown may have failed: " + e);
- }
-
- return new OperationResult("Server has been restarted.");
-
- }
-
- private AvailabilityType waitForServerToStart(long start)
- throws InterruptedException {
- AvailabilityType avail;
- while (((avail = this.serverComponent.getAvailability()) == AvailabilityType.DOWN)
- && (System.currentTimeMillis() < (start + START_WAIT_MAX))) {
- try {
- Thread.sleep(START_WAIT_INTERVAL);
- } catch (InterruptedException e) {
- // ignore
- }
- }
- return avail;
- }
-
- private AvailabilityType waitForServerToShutdown() {
- long start = System.currentTimeMillis();
+ }
+
+ /**
+ * Shuts down the AS server using a shutdown script.
+ *
+ * @return success message if no errors are encountered
+ */
+ private String shutdownViaScript() {
+ File shutdownScriptFile = getShutdownScriptPath();
+ validateScriptFile(shutdownScriptFile,
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP);
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String prefix = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP).getStringValue();
+ ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(prefix, shutdownScriptFile);
+
+ initProcessExecution(processExecution, shutdownScriptFile);
+
+ String server = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.NAMING_URL)
+ .getStringValue();
+ if (server != null) {
+ processExecution.getArguments().add("--server=" + server);
+ }
+
+ String user = pluginConfig.getSimple(ApplicationServerComponent.PRINCIPAL_CONFIG_PROP).getStringValue();
+ if (user != null) {
+ processExecution.getArguments().add("--user=" + user);
+ }
+
+ String password = pluginConfig.getSimple(ApplicationServerComponent.CREDENTIALS_CONFIG_PROP).getStringValue();
+ if (password != null) {
+ processExecution.getArguments().add("--password=" + password);
+ }
+
+ processExecution.getArguments().add("--shutdown");
+
+ /*
+ * This tells shutdown.bat not to call the Windows PAUSE command, which
+ * would cause the script to hang indefinitely waiting for input.
+ * noinspection ConstantConditions
+ */
+ processExecution.getEnvironmentVariables().put("NOPAUSE", "1");
+
+ if (log.isDebugEnabled()) {
+ log.debug("About to execute the following process: [" + processExecution + "]");
+ }
+ SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
+ ProcessExecutionResults results = systemInfo.executeProcess(processExecution);
+ logExecutionResults(results);
+
+ if (results.getError() != null) {
+ throw new RuntimeException("Error executing shutdown script while stopping AS instance. Exit code ["
+ + results.getExitCode() + "]", results.getError());
+ }
+
+ return "The server has been shut down.";
+ }
+
+ private void logExecutionResults(ProcessExecutionResults results) {
+ // Always log the output at info level. On Unix we could switch
+ // depending on a exitCode being !=0, but ...
+ log.info("Exit code from process execution: " + results.getExitCode());
+ log.info("Output from process execution: " + SEPARATOR + results.getCapturedOutput() + SEPARATOR);
+ }
+
+ /**
+ * Shuts down the AS server via a JMX call.
+ *
+ * @return success message if no errors are encountered
+ */
+ private String shutdownViaJmx() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String mbeanName = pluginConfig.getSimple(
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_CONFIG_PROP).getStringValue();
+ String operationName = pluginConfig.getSimple(
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP).getStringValue();
+
+ EmsConnection connection = this.serverComponent.getEmsConnection();
+ if (connection == null) {
+ throw new RuntimeException("Can not connect to the server");
+ }
+ EmsBean bean = connection.getBean(mbeanName);
+ EmsOperation operation = bean.getOperation(operationName);
+ /*
+ * Now see if we got the 'real' method (the one with no param) or the
+ * overloaded one. This is a workaround for a bug in EMS that prevents
+ * finding operations with same name and different signature.
+ * http://sourceforge
+ * .net/tracker/index.php?func=detail&aid=2007692&group_id
+ * =60228&atid=493495
+ *
+ * In addition, as we offer the user to specify any MBean and any
+ * method, we'd need a clever way for the user to specify parameters
+ * anyway.
+ */
+ List<EmsParameter> params = operation.getParameters();
+ int count = params.size();
+ if (count == 0)
+ operation.invoke(new Object[0]);
+ else { // overloaded operation
+ operation.invoke(new Object[] { 0 }); // return code of 0
+ }
+
+ return "The server has been shut down.";
+ }
+
+ private void validateScriptFile(File scriptFile, String scriptPropertyName) {
+ if (!scriptFile.exists()) {
+ throw new RuntimeException("Script (" + scriptFile + ") specified via '" + scriptPropertyName
+ + "' connection property does not exist.");
+ }
+
+ if (scriptFile.isDirectory()) {
+ throw new RuntimeException("Script (" + scriptFile + ") specified via '" + scriptPropertyName
+ + "' connection property is a directory, not a file.");
+ }
+ }
+
+ /**
+ * Restart the server by first trying a shutdown and then a start. This is
+ * fail fast.
+ *
+ * @return A success message on success
+ */
+ private OperationResult restart() {
+ try {
+ shutDown();
+ } catch (Exception e) {
+ throw new RuntimeException("Shutdown may have failed: " + e);
+ }
+
+ try {
+ start();
+ } catch (Exception e) {
+ throw new RuntimeException("Start following shutdown may have failed: " + e);
+ }
+
+ return new OperationResult("Server has been restarted.");
+
+ }
+
+ private AvailabilityType waitForServerToStart(long start) throws InterruptedException {
AvailabilityType avail;
+ //detect whether startWaitMax property has been set.
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ PropertySimple property = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.START_WAIT_MAX_PROP);
+ //if set and valid, update startWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ START_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
+ while (((avail = this.serverComponent.getAvailability()) == AvailabilityType.DOWN)
+ && (System.currentTimeMillis() < (start + START_WAIT_MAX))) {
+ try {
+ Thread.sleep(START_WAIT_INTERVAL);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ return avail;
+ }
+
+ private AvailabilityType waitForServerToShutdown() {
+ long start = System.currentTimeMillis();
+ AvailabilityType avail;
+ //detect whether stopWaitMax property has been set.
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ PropertySimple property = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.STOP_WAIT_MAX_PROP);
+ //if set and valid update stopWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ STOP_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
while (((avail = this.serverComponent.getAvailability()) == AvailabilityType.UP)
- && (System.currentTimeMillis() < (start + STOP_WAIT_MAX))) {
- try {
- Thread.sleep(STOP_WAIT_INTERVAL);
- } catch (InterruptedException e) {
- // ignore
- }
- }
-
- // After the server becomes unavailable, wait a little longer to hopefully
- // ensure shutdown is complete.
- try {
- Thread.sleep(STOP_WAIT_FINAL);
- } catch (InterruptedException e) {
- // ignore
- }
- return avail;
- }
-
- /**
- * Return the absolute path of this JBoss server's start script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\run.sh").
- *
- * @return the absolute path of this JBoss server's start script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\run.sh")
- */
- @NotNull
- public File getStartScriptPath() {
- Configuration pluginConfig = serverComponent.getResourceContext()
- .getPluginConfiguration();
- String startScript = pluginConfig
- .getSimpleValue(
- ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP,
- DEFAULT_START_SCRIPT);
- File startScriptFile = resolvePathRelativeToHomeDir(startScript);
- return startScriptFile;
- }
-
- @NotNull
- private File resolvePathRelativeToHomeDir(@NotNull String path) {
- return resolvePathRelativeToHomeDir(serverComponent
- .getResourceContext().getPluginConfiguration(), path);
- }
-
- @NotNull
- private File resolvePathRelativeToHomeDir(Configuration pluginConfig,
- @NotNull String path) {
- File configDir = new File(path);
- if (!configDir.isAbsolute()) {
- String jbossHomeDir = getRequiredPropertyValue(pluginConfig,
- ApplicationServerPluginConfigurationProperties.HOME_DIR);
- configDir = new File(jbossHomeDir, path);
- }
-
- return configDir;
- }
-
- @NotNull
- private String getRequiredPropertyValue(@NotNull Configuration config,
- @NotNull String propName) {
- String propValue = config.getSimpleValue(propName, null);
- if (propValue == null) {
- // Something's not right - neither autodiscovery, nor the config
- // edit GUI, should ever allow this.
- throw new IllegalStateException("Required property '" + propName
- + "' is not set.");
- }
-
- return propValue;
- }
-
- /**
- * Return the absolute path of this JBoss server's shutdown script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh").
- *
- * @return the absolute path of this JBoss server's shutdown script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh")
- */
- @NotNull
- public File getShutdownScriptPath() {
- Configuration pluginConfig = serverComponent.getResourceContext()
- .getPluginConfiguration();
- String shutdownScript = pluginConfig
- .getSimpleValue(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP,
- DEFAULT_SHUTDOWN_SCRIPT);
- File shutdownScriptFile = resolvePathRelativeToHomeDir(shutdownScript);
- return shutdownScriptFile;
- }
-
- /**
- * Return the absolute path of this JBoss server's JAVA_HOME directory (e.g. "C:\opt\jdk1.5.0_14"), as defined by
+ && (System.currentTimeMillis() < (start + STOP_WAIT_MAX))) {
+ try {
+ Thread.sleep(STOP_WAIT_INTERVAL);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+
+ // After the server becomes unavailable, wait a little longer to hopefully
+ // ensure shutdown is complete.
+ try {
+ Thread.sleep(STOP_WAIT_FINAL);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ return avail;
+ }
+
+ /**
+ * Return the absolute path of this JBoss server's start script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\run.sh").
+ *
+ * @return the absolute path of this JBoss server's start script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\run.sh")
+ */
+ @NotNull
+ public File getStartScriptPath() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String startScript = pluginConfig.getSimpleValue(
+ ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP, DEFAULT_START_SCRIPT);
+ File startScriptFile = resolvePathRelativeToHomeDir(startScript);
+ return startScriptFile;
+ }
+
+ @NotNull
+ private File resolvePathRelativeToHomeDir(@NotNull String path) {
+ return resolvePathRelativeToHomeDir(serverComponent.getResourceContext().getPluginConfiguration(), path);
+ }
+
+ @NotNull
+ private File resolvePathRelativeToHomeDir(Configuration pluginConfig, @NotNull String path) {
+ File configDir = new File(path);
+ if (!configDir.isAbsolute()) {
+ String jbossHomeDir = getRequiredPropertyValue(pluginConfig,
+ ApplicationServerPluginConfigurationProperties.HOME_DIR);
+ configDir = new File(jbossHomeDir, path);
+ }
+
+ return configDir;
+ }
+
+ @NotNull
+ private String getRequiredPropertyValue(@NotNull Configuration config, @NotNull String propName) {
+ String propValue = config.getSimpleValue(propName, null);
+ if (propValue == null) {
+ // Something's not right - neither autodiscovery, nor the config
+ // edit GUI, should ever allow this.
+ throw new IllegalStateException("Required property '" + propName + "' is not set.");
+ }
+
+ return propValue;
+ }
+
+ /**
+ * Return the absolute path of this JBoss server's shutdown script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh").
+ *
+ * @return the absolute path of this JBoss server's shutdown script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh")
+ */
+ @NotNull
+ public File getShutdownScriptPath() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String shutdownScript = pluginConfig.getSimpleValue(
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP, DEFAULT_SHUTDOWN_SCRIPT);
+ File shutdownScriptFile = resolvePathRelativeToHomeDir(shutdownScript);
+ return shutdownScriptFile;
+ }
+
+ /**
+ * Return the absolute path of this JBoss server's JAVA_HOME directory (e.g. "C:\opt\jdk1.5.0_14"), as defined by
* the 'javaHome' plugin config prop, or null if that prop is not set.
- *
- * @return the absolute path of this JBoss server's JAVA_HOME directory, as defined by
+ *
+ * @return the absolute path of this JBoss server's JAVA_HOME directory, as defined by
* the 'javaHome' plugin config prop, or null if that prop is not set
- */
- @Nullable
- public File getJavaHomePath() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String javaHomePath = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.JAVA_HOME,
- null);
- File javaHome = (javaHomePath != null) ? new File(javaHomePath) : null;
- return javaHome;
- }
-
- void validateJavaHomePathProperty() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String javaHome = pluginConfig.getSimple(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME)
- .getStringValue();
- if (javaHome != null) {
- File javaHomeDir = new File(javaHome);
- if (!javaHomeDir.isAbsolute()) {
- throw new InvalidPluginConfigurationException(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + " connection property ('"
- + javaHomeDir
- + "') is not an absolute path. Note, on Windows, absolute paths must start with the drive letter (e.g. C:).");
- }
-
- if (!javaHomeDir.exists()) {
- throw new InvalidPluginConfigurationException(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + " connection property ('"
- + javaHomeDir
- + "') does not exist.");
- }
-
- if (!javaHomeDir.isDirectory()) {
- throw new InvalidPluginConfigurationException(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + " connection property ('"
- + javaHomeDir
- + "') is not a directory.");
- }
- }
- }
+ */
+ @Nullable
+ public File getJavaHomePath() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String javaHomePath = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.JAVA_HOME,
+ null);
+ File javaHome = (javaHomePath != null) ? new File(javaHomePath) : null;
+ return javaHome;
+ }
+
+ void validateJavaHomePathProperty() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String javaHome = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.JAVA_HOME)
+ .getStringValue();
+ if (javaHome != null) {
+ File javaHomeDir = new File(javaHome);
+ if (!javaHomeDir.isAbsolute()) {
+ throw new InvalidPluginConfigurationException(
+ ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + " connection property ('"
+ + javaHomeDir
+ + "') is not an absolute path. Note, on Windows, absolute paths must start with the drive letter (e.g. C:).");
+ }
+
+ if (!javaHomeDir.exists()) {
+ throw new InvalidPluginConfigurationException(ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + " connection property ('" + javaHomeDir + "') does not exist.");
+ }
+
+ if (!javaHomeDir.isDirectory()) {
+ throw new InvalidPluginConfigurationException(ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + " connection property ('" + javaHomeDir + "') is not a directory.");
+ }
+ }
+ }
}
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
index 3489fd4..c770844 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
@@ -33,11 +33,13 @@ public class ApplicationServerPluginConfigurationProperties {
public static final String HOME_DIR = "homeDir";
public static final String CLIENT_URL = "clientUrl";
public static final String LIB_URL = "libUrl";
- public static final String COMMON_LIB_URL = "commonLibUrl";
+ public static final String COMMON_LIB_URL = "commonLibUrl";
public static final String SERVER_HOME_DIR = "serverHomeDir";
public static final String JAVA_HOME = "javaHome";
public static final String BIND_ADDRESS = "bindAddress";
public static final String START_SCRIPT_CONFIG_PROP = "startScript";
+ public static final String START_WAIT_MAX_PROP = "startWaitMax";
+ public static final String STOP_WAIT_MAX_PROP = "stopWaitMax";
public static final String SHUTDOWN_SCRIPT_CONFIG_PROP = "shutdownScript";
public static final String SHUTDOWN_MBEAN_CONFIG_PROP = "shutdownMBeanName";
public static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP = "shutdownMBeanOperation";
diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
index 421ac28..b88813c 100644
--- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
@@ -1018,6 +1018,18 @@
this property must be set in order for the Start operation to work,
or for the Shutdown operation to work when the shutdown method is set
to 'shutdown script'."/>
+ <c:simple-property name="startWaitMax" required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that must elapse before the server is considered to have failed to start up. The default is 5 minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
+ <c:simple-property name="stopWaitMax" required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that must elapse before the server is considered to have failed to stop. The default is 2.5 minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
</c:group>
<c:group name="advanced" displayName="Advanced" hiddenByDefault="true">
13 years, 2 months
[rhq] Branch 'as7plugin' - 4 commits - modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 5
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 67 +++---
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java | 4
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceDiscovery.java | 4
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingDiscovery.java | 108 ----------
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemComponent.java | 58 -----
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java | 2
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 18 -
8 files changed, 60 insertions(+), 206 deletions(-)
New commits:
commit 4c3726f4046e43d05e96cb71e413c6e6356db298
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Mar 24 13:13:49 2011 +0100
Support reading metrics.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index c136b20..0fb28b1 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -130,6 +130,11 @@ public class ASConnection {
return tree;
}
+ JsonNode getAttributeValue(@Nullable String base, @Nullable String attributeName) throws Exception {
+ String op = "operation=attribute&name=" + attributeName;
+ return getLevelData(base,op);
+ }
+
boolean isErrorReply(JsonNode in) {
if (in.has("outcome")) {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index f700597..ad3516e 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -23,7 +23,6 @@ import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonNode;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -44,13 +43,9 @@ import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.rhq.core.pluginapi.operation.OperationContext;
-import org.rhq.core.pluginapi.operation.OperationFacet;
-import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -117,26 +112,24 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
/**
* Gather measurement data
- * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
+ * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
*/
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
- JsonNode obj = connection.getLevelData(key,false,true);
for (MeasurementScheduleRequest req : metrics) {
- if (obj.has(req.getName())) {
-/*
- String val = obj.getString(req.getName());
- if (req.getDataType()== DataType.MEASUREMENT) {
-
- Double d = Double.parseDouble(val);
- MeasurementDataNumeric data = new MeasurementDataNumeric(req,d);
- report.addData(data);
- } else if (req.getDataType()== DataType.TRAIT) {
- MeasurementDataTrait data = new MeasurementDataTrait(req,val);
- report.addData(data);
- }
-*/
+
+ JsonNode obj = connection.getAttributeValue(key, req.getName()); // TODO batching
+
+ String val = obj.getValueAsText();
+ if (req.getDataType()== DataType.MEASUREMENT) {
+
+ Double d = Double.parseDouble(val);
+ MeasurementDataNumeric data = new MeasurementDataNumeric(req,d);
+ report.addData(data);
+ } else if (req.getDataType()== DataType.TRAIT) {
+ MeasurementDataTrait data = new MeasurementDataTrait(req,val);
+ report.addData(data);
}
}
}
commit bbee70600f8faf000892e14a5fdea2a749f0bfb6
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Mar 24 09:49:46 2011 +0100
Bindings are now a list of maps within the binding group.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index 28c0592..f700597 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -25,10 +25,12 @@ import org.codehaus.jackson.JsonNode;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
@@ -149,7 +151,7 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
public Configuration loadResourceConfiguration() throws Exception {
ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
- JsonNode json = connection.getLevelData(key,false,false); // TODO path ? key?
+ JsonNode json = connection.getLevelData(key,true,false); // TODO path ? key?
Configuration ret = new Configuration();
@@ -160,12 +162,30 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
ret.put(propertySimple);
} else if (propDef instanceof PropertyDefinitionList) {
PropertyList propertyList = new PropertyList(propDef.getName());
- Iterator<JsonNode> values = sub.getElements();
- while (values.hasNext()) {
- JsonNode node = values.next();
- String value = node.getTextValue();
- PropertySimple propertySimple = new PropertySimple(propDef.getName(),value);
- propertyList.add(propertySimple);
+ if (((PropertyDefinitionList) propDef).getMemberDefinition()==null) {
+ Iterator<JsonNode> values = sub.getElements();
+ while (values.hasNext()) {
+ JsonNode node = values.next();
+ String value = node.getTextValue();
+ PropertySimple propertySimple = new PropertySimple(propDef.getName(),value);
+ propertyList.add(propertySimple);
+ }
+ }
+ else if (((PropertyDefinitionList) propDef).getMemberDefinition() instanceof PropertyDefinitionMap) {
+ Iterator<String> entries = sub.getFieldNames();
+ while (entries.hasNext()) {
+ String entryKey = entries.next();
+ JsonNode node = sub.findPath(entryKey);
+ PropertyMap map = new PropertyMap(((PropertyDefinitionList) propDef).getMemberDefinition().getName()); // TODO : name from def or 'entryKey' ?
+ Iterator<String> fields = node.getFieldNames(); // TODO loop over fields from map and not from json
+ while (fields.hasNext()) {
+ String key = fields.next();
+
+ PropertySimple propertySimple = new PropertySimple(key,node.findValue(key).getValueAsText());
+ map.put(propertySimple);
+ }
+ propertyList.add(map);
+ }
}
ret.put(propertyList);
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingDiscovery.java
deleted file mode 100644
index c9b7a5e..0000000
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingDiscovery.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.modules.plugins.jbossas7;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.modules.plugins.jbossas7.json.Domain;
-import org.rhq.modules.plugins.jbossas7.json.SocketBindingGroup;
-
-/**
- * Discover single bindings in a socket binding group
- *
- * TODO: Is this better a resource-configuration on the parent?
- *
- * @author Heiko W. Rupp
- */
-@SuppressWarnings("unused")
-public class SocketBindingDiscovery implements ResourceDiscoveryComponent<BaseComponent> {
-
- private final Log log = LogFactory.getLog(this.getClass());
-
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<BaseComponent> context)
- throws Exception {
-
- Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(1);
-
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES,false);
- mapper.configure(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING,true);
-
- BaseComponent parentComponent = context.getParentResourceComponent();
- ASConnection connection = parentComponent.getASConnection();
-
- String path = parentComponent.getPath();
-
-
- JsonNode json = connection.getLevelData(path,true,false);
- if (!connection.isErrorReply(json)) {
-
- SocketBindingGroup bindingGroup = mapper.readValue(json, new TypeReference<SocketBindingGroup>() {});
- // TODO put bindingGroup. {name, default-interface, port-offset into parent
-
-
- for (Map.Entry<String,SocketBindingGroup.Binding> entry: bindingGroup.bindings.entrySet()) {
-
- String key = entry.getKey();
- String cpath = path + "/socket-binding/" + key;
-
-
- String resKey = context.getParentResourceContext().getResourceKey() + "/" + key;
- String name = resKey.substring(resKey.lastIndexOf("/") + 1);
-
- Configuration config = context.getDefaultPluginConfiguration();
-
- PropertySimple propertySimple = new PropertySimple("path",cpath);
- config.put(propertySimple);
-
- DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
- context.getResourceType(), // DataType
- path, // Key
- name, // Name
- null, // Version
- "Binding Group", // Description
- config,
- null);
- details.add(detail);
- log.info("Added " + detail);
- }
-
- return details;
-
- }
-
- return Collections.emptySet();
- }
-
-}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 9a04f04..7abbfeb 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -223,16 +223,18 @@
<resource-configuration>
<c:simple-property name="default-interface" readOnly="true" displayName="Default Interface" description="Default Interface for these bindings. See NetworkInterfaces for its definition" required="false"/>
<c:simple-property name="port-offset" readOnly="true" displayName="Port Offset" description="Offset from standard ports for this group" required="false"/>
+ <c:list-property name="socket-binding">
+ <c:map-property name="binding">
+ <c:simple-property name="name" description="The name of the socket. Services which need to access the socket configuration information will find it using this name."/>
+ <c:simple-property name="interface" description="Name of the interface to which the socket should be bound, or, for multicast sockets, the interface on which it should listen. This should be one of the declared interfaces." required="false"/>
+ <c:simple-property name="port" description="Number of the port to which the socket should be bound." type="integer"/>
+ <c:simple-property name="fixed-port" description="Whether the port value should remain fixed even if numeric offsets are applied to the other sockets in the socket group." type="boolean"/>
+ <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." />
+ <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer"/>
+ </c:map-property>
+ </c:list-property>
</resource-configuration>
- <service name="SocketBinding"
- discovery="SocketBindingDiscovery"
- class="BaseComponent">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true"/>
- </plugin-configuration>
-
- </service>
</service>
commit 296dba2916369ca75012995cbf7aa1863745e9b0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 23 21:19:19 2011 +0100
Fix naming for 'singleton' subsystems
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
index 75683cb..a017194 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
@@ -106,7 +106,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
else {
- String resKey = context.getParentResourceContext().getResourceKey();
+ String resKey = path;
String name = resKey.substring(resKey.lastIndexOf("/") + 1);
commit 3a14db1b4c745bd66b863f872c3fd062bb296f9f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 23 21:09:45 2011 +0100
SubsystemComponent is (currently) not needed.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java
index abf6d35..d23cd5d 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java
@@ -28,9 +28,9 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
*
* @author Heiko W. Rupp
*/
-public class DatasourceComponent implements ResourceComponent<SubsystemComponent> {
+public class DatasourceComponent implements ResourceComponent<BaseComponent> {
- public void start(ResourceContext<SubsystemComponent> subsystemComponentResourceContext) throws InvalidPluginConfigurationException, Exception {
+ public void start(ResourceContext<BaseComponent> subsystemComponentResourceContext) throws InvalidPluginConfigurationException, Exception {
// TODO: Customise this generated block
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceDiscovery.java
index d756543..e205c29 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceDiscovery.java
@@ -32,9 +32,9 @@ import java.util.Set;
*
* @author Heiko W. Rupp
*/
-public class DatasourceDiscovery implements ResourceDiscoveryComponent<SubsystemComponent> {
+public class DatasourceDiscovery implements ResourceDiscoveryComponent<BaseComponent> {
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<SubsystemComponent> discoveryContext) throws InvalidPluginConfigurationException, Exception {
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<BaseComponent> discoveryContext) throws InvalidPluginConfigurationException, Exception {
/*
if (subsys instanceof DataSourcesSubsystemElement) {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemComponent.java
deleted file mode 100644
index 09d753c..0000000
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemComponent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.modules.plugins.jbossas7;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-
-/**
- * Resource component for subsystems
- *
- * Deprecated - use BaseComponent
- * @author Heiko W. Rupp
- */
-@Deprecated
-public class SubsystemComponent implements ResourceComponent<BaseComponent> {
-
- ResourceContext<BaseComponent> context;
- Configuration config;
- String path;
- String key ;
-
- public void start(ResourceContext<BaseComponent> context) throws InvalidPluginConfigurationException, Exception {
- this.config = context.getPluginConfiguration();
- path = config.getSimpleValue("path", null);
- this.context = context;
- key = context.getResourceKey();
-
- }
-
- public void stop() {
- // TODO: Customise this generated block
- }
-
- public AvailabilityType getAvailability() {
- return AvailabilityType.UP; // TODO: Customise this generated block
- }
-
-
-}
13 years, 2 months
[rhq] modules/plugins
by mazz
modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 2 --
1 file changed, 2 deletions(-)
New commits:
commit af9ff8bfcf561ca49eb6af2385ae7cb717a96199
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 09:04:55 2011 -0400
BZ 535572 - we don't want to support the agent talking to the server over the http or https transport protocol, so remove them from the options.
diff --git a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
index 438cbd5..bf48dcd 100644
--- a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
@@ -379,8 +379,6 @@
<c:option name="sslservlet" value="sslservlet" />
<c:option name="socket" value="socket" />
<c:option name="sslsocket" value="sslsocket" />
- <c:option name="http" value="http" />
- <c:option name="https" value="https" />
</c:property-options>
</c:simple-property>
<c:simple-property name="rhq.agent.server.bind-address" type="string" activationPolicy="restart" required="true" default="127.0.0.1" displayName="RHQ Server IP Address" description="The RHQ Server address that it is bound to" />
13 years, 2 months