[rhq] modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java | 22 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java | 72 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 50 ++++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 17 +-
4 files changed, 104 insertions(+), 57 deletions(-)
New commits:
commit c36bfe4e917c6e8cbb8b814d1b0b1001e3c8a926
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 7 18:24:06 2010 -0400
Resource Tree Work
- Fix dual tree building for new trees
- Fix issue with duplicate resources for tree population
- Fix issue when navigating directly to an autogroup
- Reselect previous selected node when selecting locked or subctageory nodes
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java
index 713a558..a707e15 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java
@@ -48,4 +48,26 @@ public class ResourceLineageComposite implements Serializable {
public boolean isLocked() {
return isLocked;
}
+
+ /*
+ * Uses Resource.equals() so composites for the same Resource will be equal.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ResourceLineageComposite)) {
+ return false;
+ }
+
+ ResourceLineageComposite other = (ResourceLineageComposite) obj;
+ return this.resource.equals(other.getResource());
+ }
+
+ /*
+ * Uses Resource.hascode()
+ */
+ @Override
+ public int hashCode() {
+ return this.resource.hashCode();
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 17012f8..43d6b8c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -61,9 +61,9 @@ public class ResourceTreeDatasource extends DataSource {
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
public ResourceTreeDatasource(List<Resource> initialData, List<Resource> lockedData) {
- setClientOnly(false);
- setDataProtocol(DSProtocol.CLIENTCUSTOM);
- setDataFormat(DSDataFormat.CUSTOM);
+ this.setClientOnly(false);
+ this.setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ this.setDataFormat(DSDataFormat.CUSTOM);
this.initialData = initialData;
this.lockedData = (null != lockedData) ? lockedData : new ArrayList<Resource>();
@@ -80,9 +80,9 @@ public class ResourceTreeDatasource extends DataSource {
DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
parentIdField.setForeignKey("id");
- setDropExtraFields(false);
+ this.setDropExtraFields(false);
- setFields(idDataField, nameDataField, descriptionDataField);
+ this.setFields(idDataField, nameDataField, descriptionDataField);
}
@Override
@@ -116,40 +116,42 @@ public class ResourceTreeDatasource extends DataSource {
//final long start = System.currentTimeMillis();
String parentResourceId = request.getCriteria().getAttribute("parentId");
- // com.allen_sauer.gwt.log.client.Log.info("All attributes: " + Arrays.toString(request.getCriteria().getAttributes()));
+ //com.allen_sauer.gwt.log.client.Log.info("All attributes: " + Arrays.toString(request.getCriteria().getAttributes()));
ResourceCriteria criteria = new ResourceCriteria();
if (parentResourceId == null) {
- com.allen_sauer.gwt.log.client.Log.info("ResourceTreeDatasource: Loading initial data...");
-
- // criteria.addFilterId(rootId);
-
- processIncomingData(initialData, response, requestId);
- response.setStatus(DSResponse.STATUS_SUCCESS);
- return;
+ // If this gets called more than once it's a problem. Don't load initial data more than once.
+ // Subsequent fetches should be due to parent node tree expansion
+ if (null != this.initialData) {
+ com.allen_sauer.gwt.log.client.Log.debug("ResourceTreeDatasource: Loading initial data...");
+
+ processIncomingData(this.initialData, response, requestId);
+ response.setStatus(DSResponse.STATUS_SUCCESS);
+ this.initialData = null;
+ } else {
+ processResponse(requestId, response);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ }
} else {
- com.allen_sauer.gwt.log.client.Log.info("ResourceTreeDatasource: Loading Resource [" + parentResourceId
+ com.allen_sauer.gwt.log.client.Log.debug("ResourceTreeDatasource: Loading Resource [" + parentResourceId
+ "]...");
criteria.addFilterParentResourceId(Integer.parseInt(parentResourceId));
- }
-
- // The server is already eager fetch resource type
- // * criteria.fetchResourceType(true);
- resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load resource data for tree", caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(requestId, response);
- }
+ resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource data for tree", caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(requestId, response);
+ }
- public void onSuccess(PageList<Resource> result) {
- processIncomingData(result, response, requestId);
- }
- });
+ public void onSuccess(PageList<Resource> result) {
+ processIncomingData(result, response, requestId);
+ }
+ });
+ }
}
private void processIncomingData(List<Resource> result, final DSResponse response, final String requestId) {
@@ -182,11 +184,7 @@ public class ResourceTreeDatasource extends DataSource {
}
List<TreeNode> result = introduceTypeAndCategoryNodes(resourceNodes);
- com.allen_sauer.gwt.log.client.Log.debug("\nSTARTING FINAL TREE\n");
- for (TreeNode node : result) {
- com.allen_sauer.gwt.log.client.Log.debug("Final: " + node);
- }
- com.allen_sauer.gwt.log.client.Log.debug("\nENDING FINAL TREE\n");
+
return result.toArray(new TreeNode[result.size()]);
}
@@ -198,6 +196,7 @@ public class ResourceTreeDatasource extends DataSource {
// The resulting list of nodes, including AG and SC nodes. The list is ordered to ensure all
// referenced parent nodes have lower indexes than the referencing child.
List<TreeNode> allNodes = new ArrayList<TreeNode>(resourceNodes.size());
+
// Keep track of the node IDs added so far to ensure we don't add the same node more than once. Note
// that the list of resourceNodes passed in may have duplicates as the caller may not be able to
// ensure a clean set.
@@ -205,13 +204,14 @@ public class ResourceTreeDatasource extends DataSource {
for (ResourceTreeNode resourceNode : resourceNodes) {
if (allNodeIds.contains(resourceNode.getID())) {
- com.allen_sauer.gwt.log.client.Log.debug("skipping duplicate resourceNode: " + resourceNode);
+ com.allen_sauer.gwt.log.client.Log.debug("Duplicate ResourceTreeNode - Skipping: " + resourceNode);
continue;
}
Resource resource = resourceNode.getResource();
if (resourceNode.isParentSubCategory()) {
+
// If the parent node is a subcategory node, make sure the subcategory node is in the
// tree prior to the resource node. Note that it could itself be a tree of subcategories.
addSubCategoryNodes(allNodes, allNodeIds, resource);
@@ -225,6 +225,7 @@ public class ResourceTreeDatasource extends DataSource {
AutoGroupTreeNode autogroupNode = new AutoGroupTreeNode(resource);
if (autogroupNode.isParentSubcategory()) {
+
// If the parent node of the autogroup node is a subcategory node, make sure the subcategory
// node is in the tree prior to the autogroup node. Note that it could itself be a
// tree of subcategories.
@@ -232,12 +233,10 @@ public class ResourceTreeDatasource extends DataSource {
}
allNodeIds.add(resourceNode.getParentID());
- com.allen_sauer.gwt.log.client.Log.debug("Adding " + autogroupNode);
allNodes.add(autogroupNode);
}
}
- com.allen_sauer.gwt.log.client.Log.debug("Adding " + resourceNode + " to tree...");
allNodeIds.add(resourceNode.getID());
allNodes.add(resourceNode);
}
@@ -259,7 +258,6 @@ public class ResourceTreeDatasource extends DataSource {
if (!allNodeIds.contains(subCategoryNodeId)) {
SubCategoryTreeNode subCategoryNode = new SubCategoryTreeNode(subCategory, parentResource);
allNodeIds.add(subCategoryNodeId);
- com.allen_sauer.gwt.log.client.Log.debug("Adding " + subCategoryNode);
allNodes.add(insertAt, subCategoryNode);
}
} while ((subCategory = subCategory.getParentSubCategory()) != null);
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 1b1ebc6..88b00ad 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
@@ -126,7 +126,9 @@ public class ResourceTreeView extends LocatableVLayout {
treeGrid.setOpenerImage("resources/dir.png");
treeGrid.setOpenerIconSize(16);
- treeGrid.setAutoFetchData(true);
+ // don't auto-fetch data, the initial fetch is requested manually using initial lineage information
+ treeGrid.setAutoFetchData(false);
+
treeGrid.setAnimateFolders(false);
treeGrid.setSelectionType(SelectionStyle.SINGLE);
treeGrid.setShowRollOver(false);
@@ -155,8 +157,10 @@ public class ResourceTreeView extends LocatableVLayout {
CoreGUI.goToView(viewPath);
}
} else {
- // TODO: Can we select the previous node? Or do we need a "Locked" hover etc...
- treeGrid.deselectAllRecords();
+ treeGrid.deselectRecord(resourceNode);
+ if (null != selectedNodeId) {
+ treeGrid.selectRecord(treeGrid.getTree().findById(selectedNodeId));
+ }
}
} else if (selectedRecord instanceof AutoGroupTreeNode) {
com.allen_sauer.gwt.log.client.Log.info("AutoGroup Node selected in tree: " + selectedRecord);
@@ -173,7 +177,11 @@ public class ResourceTreeView extends LocatableVLayout {
}
});
} else {
- com.allen_sauer.gwt.log.client.Log.info("Unhandled Node selected in tree: " + selectedRecord);
+ // TODO: probably clicked on a subcategory, do we need a message?
+ treeGrid.deselectRecord(selectedRecord);
+ if (null != selectedNodeId) {
+ treeGrid.selectRecord(treeGrid.getTree().findById(selectedNodeId));
+ }
}
}
}
@@ -616,12 +624,12 @@ public class ResourceTreeView extends LocatableVLayout {
} else {
// This is for cases where we have to load the tree fresh including down to the currently visible node
- loadTree(selectedResourceId);
+ loadTree(selectedResourceId, null);
}
}
- private void loadTree(final int selectedResourceId) {
+ private void loadTree(final int selectedResourceId, final AsyncCallback<Void> callback) {
selectedNodeId = ResourceTreeNode.idOf(selectedResourceId);
final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
@@ -666,6 +674,10 @@ public class ResourceTreeView extends LocatableVLayout {
public void execute(DSResponse response, Object rawData, DSRequest request) {
System.out.println("Done fetching data for tree.");
updateSelection();
+
+ if (null != callback) {
+ callback.onSuccess(null);
+ }
}
});
@@ -694,7 +706,6 @@ public class ResourceTreeView extends LocatableVLayout {
}
});
-
}
}
});
@@ -724,16 +735,25 @@ public class ResourceTreeView extends LocatableVLayout {
}
public void onSuccess(PageList<ResourceGroup> result) {
- ResourceGroup backingGroup = result.get(0);
+ final ResourceGroup backingGroup = result.get(0);
// load the tree up to the autogroup's parent resource
- loadTree(backingGroup.getAutoGroupParentResource().getId());
+ loadTree(backingGroup.getAutoGroupParentResource().getId(), new AsyncCallback<Void>() {
- // get the node ID and use it to add a map entry, then call this again to finish up...
- selectedNodeId = AutoGroupTreeNode.idOf(backingGroup.getAutoGroupParentResource(), backingGroup
- .getResourceType());
- AutoGroupTreeNode agNode = (AutoGroupTreeNode) treeGrid.getTree().findById(selectedNodeId);
- autoGroupNodeMap.put(backingGroup.getId(), agNode);
- updateSelection();
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load tree", 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(),
+ backingGroup.getResourceType());
+ AutoGroupTreeNode agNode = (AutoGroupTreeNode) treeGrid.getTree().findById(selectedNodeId);
+ autoGroupNodeMap.put(backingGroup.getId(), agNode);
+ updateSelection();
+ }
+ });
}
});
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 9f5693b..62091bc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -751,6 +751,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// get children
Set<Resource> children = ancestor.getResource().getChildResources();
+ // remove any that are in the ancestry to avoid repeated handling
+ children.removeAll(rawResourceLineage);
// only add the viewable children
List<Resource> viewableChildren = new ArrayList<Resource>(children.size());
for (Resource child : children) {
@@ -760,8 +762,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
if (isCommitted && isViewable) {
// if not a direct ancestor add to the list (direct ancestors already added by default)
if (!rawResourceLineage.contains(child)) {
+ // ensure we have the parent in the entity
child.getParentResource().getId();
- result.add(new ResourceLineageComposite(child, false));
+ ResourceLineageComposite composite = new ResourceLineageComposite(child, false);
+ result.add(composite);
}
viewableChildren.add(child);
}
@@ -770,6 +774,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// get grandchildren
for (Resource child : viewableChildren) {
// This ensures Hibernate actually fetches the parent Resource.
+ // ensure we have the parent
child.getParentResource().getId();
Set<Resource> grandChildren = child.getChildResources();
for (Resource grandChild : grandChildren) {
@@ -779,8 +784,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
if (isCommitted && isViewable) {
// if not a direct ancestor add to the list (direct ancestors already added by default)
if (!rawResourceLineage.contains(grandChild)) {
+ // ensure we have the parent in the entity
grandChild.getParentResource().getId();
- result.add(new ResourceLineageComposite(grandChild, false));
+ ResourceLineageComposite composite = new ResourceLineageComposite(grandChild, false);
+ result.add(composite);
}
}
}
@@ -1813,7 +1820,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
try {
resource = getResourceById(overlord, resourceError.getResource().getId());
} catch (ResourceNotFoundException rnfe) {
- throw new ResourceNotFoundException("Resource error contains an unknown Resource id: " + resourceError);
+ throw new ResourceNotFoundException("Resource error an unknown Resource id: " + resourceError);
}
if (resourceError.getErrorType() == ResourceErrorType.INVALID_PLUGIN_CONFIGURATION
@@ -1881,7 +1888,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
Query query = entityManager.createNamedQuery(Resource.QUERY_FIND_PLATFORM_BY_AGENT);
query.setParameter("category", ResourceCategory.PLATFORM);
query.setParameter("agent", agent);
-
+
try {
Resource platform = (Resource) query.getSingleResult();
return platform;
@@ -2087,7 +2094,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// ListIterator<ResourceFlyweight> iter = resources.listIterator();
// while (iter.hasNext()) {
// ResourceFlyweight res = iter.next();
- // res.setLocked(!visibleIdSet.contains(res.getId()));
+ // res.setLocked(!visibleIdSet.(res.getId()));
// }
// }
13 years, 8 months
[rhq] modules/plugins
by ips
modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 2ed9702c13f07cecf26573bf4057a468c6fbf40a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 7 17:59:57 2010 -0400
remove a remaining use of the no-longer-valid c:option 'default' attribute
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 d59b312..2361c2d 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
@@ -417,7 +417,7 @@
<c:simple-property name="rhq.communications.connector.security.keystore.type"
type="string" activationPolicy="restart" required="false" default="JKS" displayName="Incoming: Keystore Type">
<c:property-options allowCustomValue="true">
- <c:option name="JKS" value="JKS" default="true" />
+ <c:option name="JKS" value="JKS" />
<c:option name="PKCS12" value="PKCS12" />
</c:property-options>
</c:simple-property>
13 years, 8 months
[rhq] modules/core modules/enterprise modules/plugins
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java | 4 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java | 1 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java | 6 +++---
modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 10 +++++-----
4 files changed, 12 insertions(+), 9 deletions(-)
New commits:
commit f7e8e4c7cbd4bb0080fbc9fc9921316f5738448b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 7 17:55:56 2010 -0400
add no-arg ctor to ResourceConfigurationComposite to make GWT happy; remove a few remaining uses of the no-longer-valid c:option 'default' attribute in as5 plugin descriptor
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
index 3ce48ee..e00e29d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
@@ -35,6 +35,10 @@ public class ResourceConfigurationComposite implements Serializable{
*/
private Configuration configuration;
+ // No-arg constructor required by GWT
+ protected ResourceConfigurationComposite() {
+ }
+
public ResourceConfigurationComposite(int resourceId, Configuration configuration) {
this.resourceId = resourceId;
this.configuration = configuration;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
index af0882f..e4df2b8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
@@ -163,5 +163,4 @@ public class SubjectCriteria extends Criteria {
addSortField("department");
this.sortDepartment = sortDepartment;
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java
index f363993..545a6af 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java
@@ -77,7 +77,7 @@ public class AggregateConfigurationBuilder {
}
// If the property is a Map, recurse into it and group together its child properties.
else if (propertyDefinition instanceof PropertyDefinitionMap) {
- List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new ArrayList();
+ List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new ArrayList<AbstractPropertyMap>();
for (AbstractPropertyMap sourceParentPropertyMap : sourceParentPropertyMaps) {
PropertyMap nestedSourceParentPropertyMap = sourceParentPropertyMap
.getMap(propertyDefinition.getName());
@@ -139,14 +139,14 @@ public class AggregateConfigurationBuilder {
private static Map<String, Map<String, Integer>> createMemberNameValueFrequenciesMap(
List<AbstractPropertyMap> sourceParentPropertyMaps) {
- Map<String, Map<String, Integer>> nameValueFrequenciesMap = new HashMap();
+ Map<String, Map<String, Integer>> nameValueFrequenciesMap = new HashMap<String, Map<String, Integer>>();
for (AbstractPropertyMap map : sourceParentPropertyMaps) {
for (String propertyName : map.getMap().keySet()) {
PropertySimple propertySimple = map.getSimple(propertyName);
String propertyValue = (propertySimple != null) ? propertySimple.getStringValue() : null;
Map<String, Integer> valueFrequencies = nameValueFrequenciesMap.get(propertyName);
if (valueFrequencies == null) {
- valueFrequencies = new HashMap();
+ valueFrequencies = new HashMap<String, Integer>();
nameValueFrequenciesMap.put(propertyName, valueFrequencies);
}
Integer valueFrequency = (valueFrequencies.containsKey(propertyValue)) ? (valueFrequencies
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 473daf1..bab4121 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
@@ -447,7 +447,7 @@
</c:description>
</c:simple-property>
- <c:simple-property name="track-statements" type="string"
+ <c:simple-property name="track-statements" type="string" default="yes-no-warnings"
displayName="Track Statements" required="false">
<c:description>
Whether to check for unclosed Statements and ResultSets when connections are returned to the pool. The
@@ -456,15 +456,15 @@
<c:property-options>
<c:option name="No" value="no"/>
<c:option name="Yes" value="yes"/>
- <c:option name="Yes, but no warnings" value="yes-no-warnings" default="true"/>
+ <c:option name="Yes, but no warnings" value="yes-no-warnings"/>
</c:property-options>
</c:simple-property>
- <c:simple-property name="transaction-isolation" required="false"
+ <c:simple-property name="transaction-isolation" required="false" default="TRANSACTION_READ_COMMITTED"
description="The Transaction Isolation level. The default setting is to use whichever isolation level is provided by default by the database.">
<c:property-options>
<c:option value="TRANSACTION_READ_UNCOMMITTED" name="Read Uncommitted"/>
- <c:option value="TRANSACTION_READ_COMMITTED" default="true" name="Read Committed"/>
+ <c:option value="TRANSACTION_READ_COMMITTED" name="Read Committed"/>
<c:option value="TRANSACTION_REPEATABLE_READ" name="Repeatable Read"/>
<c:option value="TRANSACTION_SERIALIZABLE" name="Serializable"/>
<c:option value="TRANSACTION_NONE" name="None"/>
@@ -1003,7 +1003,7 @@
description="The method used to execute the Shut Down operation;
defaults to 'JMX MBean'.">
<c:property-options>
- <c:option value="JMX" name="JMX MBean" default="true"/>
+ <c:option value="JMX" name="JMX MBean"/>
<c:option value="SCRIPT" name="shutdown script"/>
</c:property-options>
</c:simple-property>
13 years, 8 months
[rhq] modules/core modules/enterprise
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java | 50 ++
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java | 15
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java | 167 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 57 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupMemberConfiguration.java | 81 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 47 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 48 ++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/TestConfigurationFactory.java | 16
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/recentlyApproved/ViewAction.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/disambiguation/MutableDisambiguationReport.java | 3
modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml | 4
modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/rhq-serverplugin.xml | 2
modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml | 4
modules/enterprise/server/plugins/cobbler/src/main/resources/META-INF/rhq-serverplugin.xml | 2
modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml | 2
20 files changed, 491 insertions(+), 58 deletions(-)
New commits:
commit 9c9af766eee99ddf5c9f14929841e223a5cbc714
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 7 17:27:41 2010 -0400
fix a few spots i missed when removing is_default field from propdef enum entity
; more work on the group config editor and group resource config view
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
new file mode 100644
index 0000000..3ce48ee
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/composite/ResourceConfigurationComposite.java
@@ -0,0 +1,50 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.domain.configuration.composite;
+
+import java.io.Serializable;
+
+import org.rhq.core.domain.configuration.Configuration;
+
+/**
+ * @author Ian Springer
+ */
+public class ResourceConfigurationComposite implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ private int resourceId;
+ /**
+ * This could be a resource config or a plugin config depending on the context.
+ */
+ private Configuration configuration;
+
+ public ResourceConfigurationComposite(int resourceId, Configuration configuration) {
+ this.resourceId = resourceId;
+ this.configuration = configuration;
+ }
+
+ public int getResourceId() {
+ return resourceId;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
index 4412cec..a121510 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
@@ -63,13 +63,6 @@ public class PropertyDefinitionEnumeration implements Serializable {
@Column(name = "ORDER_INDEX", nullable = false)
private int orderIndex = -1;
- @Column(name = "IS_DEFAULT")
- @Deprecated
- /**
- * @deprecated - not used; TODO: remove in dbsetup/dbupgrade scripts
- */
- private boolean isDefault;
-
@JoinColumn(name = "PROPERTY_DEF_ID")
@ManyToOne
@XmlTransient
@@ -125,14 +118,6 @@ public class PropertyDefinitionEnumeration implements Serializable {
this.value = value;
}
- public boolean isDefault() {
- return isDefault;
- }
-
- public void setDefault(boolean aDefault) {
- isDefault = aDefault;
- }
-
public int getOrderIndex() {
return orderIndex;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
index a83d1f8..f54354b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
@@ -20,14 +20,13 @@
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
package org.rhq.core.domain.resource.composite;
import java.io.Serializable;
import java.util.List;
/**
- * Contains information about disambiguation of a resource name.
+ * Contains information about disambiguation of a Resource name.
*
* @author Lukas Krejci
*/
@@ -37,6 +36,7 @@ public class DisambiguationReport<T> implements Serializable {
private T original;
private List<Resource> parents;
private ResourceType resourceType;
+ private String name;
public static class ResourceType implements Serializable {
@@ -127,12 +127,13 @@ public class DisambiguationReport<T> implements Serializable {
public DisambiguationReport() {
}
- public DisambiguationReport(T original, List<Resource> parents, ResourceType resourceType) {
+ public DisambiguationReport(T original, List<Resource> parents, ResourceType resourceType, String name) {
this.original = original;
// this.parents = Collections.unmodifiableList(parents);
//spinder: the returned type is not Serializable and causes GWT serialization errors.
this.parents = parents;
this.resourceType = resourceType;
+ this.name = name;
}
public T getOriginal() {
@@ -155,6 +156,14 @@ public class DisambiguationReport<T> implements Serializable {
return resourceType;
}
+ /**
+ *
+ * @return the Resource name
+ */
+ public String getName() {
+ return name;
+ }
+
public String toString() {
return "DisambiguationReport(type=" + resourceType + ", parents=" + parents + ", original=" + original + ")";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java
new file mode 100644
index 0000000..f363993
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/AggregateConfigurationBuilder.java
@@ -0,0 +1,167 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.configuration;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.rhq.core.domain.configuration.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.Configuration;
+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;
+
+/**
+ * @author Ian Springer
+ */
+public class AggregateConfigurationBuilder {
+ public static Configuration buildAggregateConfiguration(List<Configuration> configurations,
+ ConfigurationDefinition configurationDefinition) {
+ Configuration aggregateConfiguration = new Configuration();
+
+ if (configurations.isEmpty()) {
+ return aggregateConfiguration;
+ }
+
+ Map<String, PropertyDefinition> childPropertyDefinitions = configurationDefinition.getPropertyDefinitions();
+ for (PropertyDefinition childPropertyDefinition : childPropertyDefinitions.values()) {
+ buildAggregateProperty(childPropertyDefinition, configurations, aggregateConfiguration);
+ }
+
+ return aggregateConfiguration;
+ }
+
+ private static void buildAggregateProperty(PropertyDefinition propertyDefinition,
+ List<? extends AbstractPropertyMap> sourceParentPropertyMaps, AbstractPropertyMap targetParentPropertyMap) {
+ if (propertyDefinition instanceof PropertyDefinitionSimple) {
+ String sampleValue = getSimpleValue(sourceParentPropertyMaps.get(0), propertyDefinition.getName());
+ boolean valuesHomogeneous = true;
+ for (int i = 1; i < sourceParentPropertyMaps.size(); i++) {
+ String value = getSimpleValue(sourceParentPropertyMaps.get(i), propertyDefinition.getName());
+ if ((value == null && sampleValue != null) || (value != null && !value.equals(sampleValue))) {
+ valuesHomogeneous = false;
+ break;
+ }
+ }
+ PropertySimple propertySimple = new PropertySimple(propertyDefinition.getName(),
+ (valuesHomogeneous) ? sampleValue : null);
+ targetParentPropertyMap.put(propertySimple);
+ if (valuesHomogeneous) {
+ // Set override to true so the config renderer will know the prop is homogeneous.
+ propertySimple.setOverride(true);
+ }
+ }
+ // If the property is a Map, recurse into it and group together its child properties.
+ else if (propertyDefinition instanceof PropertyDefinitionMap) {
+ List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new ArrayList();
+ for (AbstractPropertyMap sourceParentPropertyMap : sourceParentPropertyMaps) {
+ PropertyMap nestedSourceParentPropertyMap = sourceParentPropertyMap
+ .getMap(propertyDefinition.getName());
+ nestedSourceParentPropertyMaps
+ .add((nestedSourceParentPropertyMap != null) ? nestedSourceParentPropertyMap : new PropertyMap(
+ propertyDefinition.getName()));
+ }
+ PropertyMap targetPropertyMap = new PropertyMap(propertyDefinition.getName());
+ targetParentPropertyMap.put(targetPropertyMap);
+ buildAggregatePropertyMap((PropertyDefinitionMap) propertyDefinition, nestedSourceParentPropertyMaps,
+ targetPropertyMap);
+ } else if (propertyDefinition instanceof PropertyDefinitionList) {
+ PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
+ PropertyDefinition listMemberPropertyDefinition = propertyDefinitionList.getMemberDefinition();
+ PropertyList targetPropertyList = new PropertyList(propertyDefinition.getName());
+ targetParentPropertyMap.put(targetPropertyList);
+ if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
+ PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition;
+ // TODO: How do we group together Lists of Maps? Not trivial...
+ }
+ }
+ }
+
+ private static void buildAggregatePropertyMap(PropertyDefinitionMap propertyDefinitionMap,
+ List<AbstractPropertyMap> sourceParentPropertyMaps, AbstractPropertyMap targetParentPropertyMap) {
+ Map<String, PropertyDefinition> childPropertyDefinitions = propertyDefinitionMap.getPropertyDefinitions();
+ if (!childPropertyDefinitions.isEmpty()) {
+ for (PropertyDefinition childPropertyDefinition : childPropertyDefinitions.values())
+ buildAggregateProperty(childPropertyDefinition, sourceParentPropertyMaps, targetParentPropertyMap);
+ } else {
+ buildAggregateOpenPropertyMap(sourceParentPropertyMaps, targetParentPropertyMap);
+ }
+ }
+
+ private static void buildAggregateOpenPropertyMap(List<AbstractPropertyMap> sourceParentPropertyMaps,
+ AbstractPropertyMap targetParentPropertyMap) {
+ Map<String, Map<String, Integer>> memberNameValueFrequenciesMap = createMemberNameValueFrequenciesMap(sourceParentPropertyMaps);
+ for (String memberName : memberNameValueFrequenciesMap.keySet()) {
+ // Add each unique member to the target map, so the renderer will be able to display it on the main
+ // config page.
+ PropertySimple member = new PropertySimple(memberName, null);
+ targetParentPropertyMap.put(member);
+ // Also add it to each of the source config maps that don't already contain it, so that they can be
+ // rendered as unset on the propSet page.
+ for (AbstractPropertyMap map : sourceParentPropertyMaps) {
+ if (map.get(memberName) == null)
+ map.put(new PropertySimple(memberName, null));
+ }
+ Map<String, Integer> valueFrequencies = memberNameValueFrequenciesMap.get(memberName);
+ if (valueFrequencies.size() == 1
+ && valueFrequencies.values().iterator().next() == sourceParentPropertyMaps.size()) {
+ // Set override to true so the renderers will know the prop is homogenous.
+ member.setOverride(true);
+ // And set the value, so it can be displayed on the main config page.
+ member.setStringValue(valueFrequencies.keySet().iterator().next());
+ }
+ }
+ }
+
+ private static Map<String, Map<String, Integer>> createMemberNameValueFrequenciesMap(
+ List<AbstractPropertyMap> sourceParentPropertyMaps) {
+ Map<String, Map<String, Integer>> nameValueFrequenciesMap = new HashMap();
+ for (AbstractPropertyMap map : sourceParentPropertyMaps) {
+ for (String propertyName : map.getMap().keySet()) {
+ PropertySimple propertySimple = map.getSimple(propertyName);
+ String propertyValue = (propertySimple != null) ? propertySimple.getStringValue() : null;
+ Map<String, Integer> valueFrequencies = nameValueFrequenciesMap.get(propertyName);
+ if (valueFrequencies == null) {
+ valueFrequencies = new HashMap();
+ nameValueFrequenciesMap.put(propertyName, valueFrequencies);
+ }
+ Integer valueFrequency = (valueFrequencies.containsKey(propertyValue)) ? (valueFrequencies
+ .get(propertyValue) + 1) : 1;
+ valueFrequencies.put(propertyValue, valueFrequency);
+ }
+ }
+ return nameValueFrequenciesMap;
+ }
+
+ private static String getSimpleValue(AbstractPropertyMap parentPropertyMap, String propertyName) {
+ PropertySimple samplePropertySimple = parentPropertyMap.getSimple(propertyName);
+ return (samplePropertySimple != null) ? samplePropertySimple.getStringValue() : null;
+ }
+
+ private AggregateConfigurationBuilder() {
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index d47f8e1..8a4d9fa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -501,7 +501,7 @@ public class ConfigurationEditor extends LocatableVLayout {
return section;
}
- private DynamicForm buildPropertiesForm(String locatorId, Collection<PropertyDefinition> propertyDefinitions,
+ protected DynamicForm buildPropertiesForm(String locatorId, Collection<PropertyDefinition> propertyDefinitions,
AbstractPropertyMap propertyMap, boolean firePropertyChangedEvents) {
LocatableDynamicForm form = new LocatableDynamicForm(locatorId);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index a7150e1..4bdb9e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -33,7 +33,10 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.events.FormItemClickHandler;
+import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.configuration.Configuration;
@@ -53,15 +56,53 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Ian Springer
*/
public class GroupConfigurationEditor extends ConfigurationEditor {
- private Map<String, Configuration> memberConfigurations;
+ private List<GroupMemberConfiguration> memberConfigurations;
public GroupConfigurationEditor(String locatorId, ConfigurationDefinition configurationDefinition,
- Configuration aggregateConfiguration,
- Map<String, Configuration> memberConfigurations) {
- super(locatorId, configurationDefinition, aggregateConfiguration);
+ List<GroupMemberConfiguration> memberConfigurations) {
+ super(locatorId, configurationDefinition, buildAggregateConfiguration(memberConfigurations, configurationDefinition));
this.memberConfigurations = memberConfigurations;
}
+ private static Configuration buildAggregateConfiguration(
+ List<GroupMemberConfiguration> memberConfigurations,
+ ConfigurationDefinition configurationDefinition) {
+ List<Configuration> configurations = new ArrayList<Configuration>(memberConfigurations.size());
+ for (GroupMemberConfiguration memberConfiguration : memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ configurations.add(configuration);
+ }
+ return AggregateConfigurationBuilder.buildAggregateConfiguration(configurations, configurationDefinition);
+ }
+
+ @Override
+ protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
+ final PropertySimple propertySimple) {
+ final FormItem item;
+ if (propertySimple.getOverride()) {
+ item = super.buildSimpleField(propertyDefinitionSimple, propertySimple);
+ } else {
+ item = new StaticTextItem();
+ item.setTitle("<i>Member Values Differ</i>");
+ item.setIcons();
+ }
+
+ // Add the icon that user can click to edit the member values.
+ FormItemIcon icon = new FormItemIcon();
+ icon.setSrc("[SKIN]/actions/edit.png");
+ icon.setName("Edit Member Values");
+ icon.addFormItemClickHandler(new FormItemClickHandler() {
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ // TODO: Pass the actual index, rather than null, if the prop is inside a list.
+ displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"), propertyDefinitionSimple, item,
+ propertySimple, null);
+ }
+ });
+ item.setIcons(icon);
+
+ return item;
+ }
+
private void displayMemberValuesEditor(String locatorId, PropertyDefinitionSimple propertyDefinitionSimple,
final FormItem aggregateValueItem,
final PropertySimple aggregatePropertySimple, Integer index) {
@@ -88,11 +129,13 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
// Add data rows.
final Map<String, PropertySimple> memberProperties = new HashMap<String, PropertySimple>(this.memberConfigurations.size());
final List<FormItem> valueItems = new ArrayList<FormItem>(this.memberConfigurations.size());
- for (String memberName : this.memberConfigurations.keySet()) {
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ // TODO: Format the disambiguated member name.
+ String memberName = memberConfiguration.getLabel();
StaticTextItem memberItem = new StaticTextItem("member", memberName);
items.add(memberItem);
- Configuration memberConfiguration = this.memberConfigurations.get(memberName);
- PropertySimple memberPropertySimple = getPropertySimple(memberConfiguration, propertyDefinitionSimple, index);
+ Configuration configuration = memberConfiguration.getConfiguration();
+ PropertySimple memberPropertySimple = getPropertySimple(configuration, propertyDefinitionSimple, index);
memberProperties.put(memberName, memberPropertySimple);
FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple);
valueItem.setAttribute("rhq:property", memberPropertySimple);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupMemberConfiguration.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupMemberConfiguration.java
new file mode 100644
index 0000000..a9e04ac
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupMemberConfiguration.java
@@ -0,0 +1,81 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.configuration;
+
+import org.rhq.core.domain.configuration.Configuration;
+
+/**
+ * @author Ian Springer
+ */
+public class GroupMemberConfiguration {
+ private int id;
+ private String label;
+ private Configuration configuration;
+
+ public GroupMemberConfiguration(int id, String label, Configuration configuration) {
+ this.id = id;
+ this.label = (label != null) ? label : String.valueOf(id);
+ this.configuration = configuration;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ GroupMemberConfiguration that = (GroupMemberConfiguration)o;
+
+ if (id != that.id) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return "GroupMemberConfiguration{" +
+ "id=" + id +
+ ", label='" + label + '\'' +
+ ", configuration=" + configuration +
+ '}';
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index 4010ae0..e0be6ef 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -1,12 +1,16 @@
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.List;
+
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.configuration.ConfigurationUpdateStillInProgressException;
@@ -28,13 +32,14 @@ public interface ConfigurationGWTService extends RemoteService {
PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(
Integer resourceId, Long beginDate, Long endDate, boolean suppressOldest, PageControl pc);
-
ResourceConfigurationUpdate updateResourceConfiguration(int resourceId, Configuration configuration);
PluginConfigurationUpdate updatePluginConfiguration(int resourceId, Configuration configuration);
PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdatesByCriteria(ResourceConfigurationUpdateCriteria criteria);
+ List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroup(int groupId);
+
RawConfiguration dummy(RawConfiguration config);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 8d8db75..b41d7f0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -46,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.ResourceGroupMembershipView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits.TraitsView;
@@ -250,8 +251,11 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
visible = groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.CONFIGURATION);
if (updateTab(this.configurationTab, visible, visible && this.permissions.isConfigureRead())) {
- updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
- "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
+ //updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
+ // "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
+ updateSubTab(this.configurationTab, this.configCurrent,
+ new GroupResourceConfigurationEditView(this.configCurrent.extendLocatorId("View"),
+ this.groupComposite), true, true);
updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(
"/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true, true);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index d77b10e..ee2297c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -18,11 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+import java.util.ArrayList;
import java.util.EnumSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -30,17 +34,23 @@ import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
@@ -52,11 +62,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Ian Springer
*/
public class GroupResourceConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener {
+ private final ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
private ResourceGroup group;
private ResourcePermission resourcePermission;
private ConfigurationDefinition configurationDefinition;
private Configuration aggregateConfiguration;
- private Map<Integer, Configuration> memberConfigurations;
+ private List<GroupMemberConfiguration> memberConfigurations;
private ConfigurationEditor editor;
private IButton saveButton;
@@ -112,7 +124,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
private void initEditor() {
if (this.configurationDefinition != null && this.aggregateConfiguration != null) {
this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
- this.aggregateConfiguration, null);
+ this.memberConfigurations);
this.editor.setOverflow(Overflow.AUTO);
this.editor.addPropertyValueChangeListener(this);
this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
@@ -121,7 +133,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
}
private void loadConfigurationDefinition() {
- if (configurationDefinition == null) {
+ if (this.configurationDefinition == null) {
final ResourceType type = this.group.getResourceType();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
@@ -138,25 +150,34 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
}
private void loadConfigurations() {
- // TODO
this.aggregateConfiguration = null;
- /*configurationService.getResourceConfiguration(resourceId, new AsyncCallback<Configuration>() {
+ this.memberConfigurations = null;
+ this.configurationService.findResourceConfigurationsForGroup(group.getId(), new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
public void onFailure(Throwable caught) {
- showError(caught);
+ CoreGUI.getErrorHandler().handleError("Failed to retrieve member Resource configurations for " + group + ".", caught);
}
- public void onSuccess(Configuration result) {
- configuration = result;
- Log.info("Config retreived in: " + (System.currentTimeMillis() - start));
+ public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
+ memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
+ for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
+ String parentsHtml = ReportDecorator.decorateResourceLineage(result.getParents());
+ int resourceId = result.getOriginal().getResourceId();
+ String resourceHtml = ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ result.getResourceType(), result.getName(), resourceId);
+ String label = parentsHtml + ReportDecorator.DEFAULT_SEPARATOR + resourceHtml;
+ GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
+ result.getOriginal().getConfiguration());
+ memberConfigurations.add(memberConfiguration);
+ }
initEditor();
}
- });*/
+ });
}
- private void save() {
- Configuration updatedConfiguration = this.editor.getConfiguration();
-
+ private void save() {
// TODO
+
+ SC.say("Boo!");
/*
GWTServiceLookup.getConfigurationService().updateResourceConfiguration(resource.getId(), updatedConfiguration,
new AsyncCallback<ResourceConfigurationUpdate>() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
index 4bddff6..396f07a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
@@ -28,6 +28,7 @@ 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.ConfigurationTemplate;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
@@ -45,6 +46,12 @@ import org.rhq.core.domain.configuration.definition.PropertySimpleType;
public abstract class TestConfigurationFactory {
public static ConfigurationDefinition createConfigurationDefinition() {
ConfigurationDefinition configurationDefinition = new ConfigurationDefinition("TestConfig", "a test config");
+
+ ConfigurationTemplate defaultTemplate = new ConfigurationTemplate(ConfigurationTemplate.DEFAULT_TEMPLATE_NAME, "default template");
+ configurationDefinition.putTemplate(defaultTemplate);
+ Configuration defaultConfiguration = new Configuration();
+ defaultTemplate.setConfiguration(defaultConfiguration);
+
Map<String, PropertyDefinition> propertyDefinitions = new HashMap<String, PropertyDefinition>();
configurationDefinition.setPropertyDefinitions(propertyDefinitions);
@@ -85,9 +92,10 @@ public abstract class TestConfigurationFactory {
"a String enum prop with <=5 items - should be rendered as radio buttons", false,
PropertySimpleType.STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
+ defaultConfiguration.put(new PropertySimple("StringEnum1", "NJ"));
ArrayList<PropertyDefinitionEnumeration> propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
propDefEnums.add(new PropertyDefinitionEnumeration("NY", "NY"));
- propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ", true));
+ propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ"));
propDefEnums.add(new PropertyDefinitionEnumeration("PA", "PA"));
simplePropDef.setEnumeratedValues(propDefEnums, false);
addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
@@ -95,9 +103,10 @@ public abstract class TestConfigurationFactory {
simplePropDef = new PropertyDefinitionSimple("StringEnum2",
"a String enum prop with >5 items - should be rendered as a popup menu", false, PropertySimpleType.STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
+ defaultConfiguration.put(new PropertySimple("StringEnum2", "blue"));
propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
propDefEnums.add(new PropertyDefinitionEnumeration("red", "red"));
- propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange", true));
+ propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange"));
propDefEnums.add(new PropertyDefinitionEnumeration("yellow", "yellow"));
propDefEnums.add(new PropertyDefinitionEnumeration("green", "green"));
propDefEnums.add(new PropertyDefinitionEnumeration("blue", "blue"));
@@ -186,9 +195,10 @@ public abstract class TestConfigurationFactory {
PropertyDefinitionSimple enumExample = new PropertyDefinitionSimple("myEnum",
"a grouped enum prop with <=5 items", false, PropertySimpleType.STRING);
enumExample.setDisplayName(enumExample.getName());
+ defaultConfiguration.put(new PropertySimple("myEnum", "Burlington"));
ArrayList<PropertyDefinitionEnumeration> myEnums = new ArrayList<PropertyDefinitionEnumeration>();
myEnums.add(new PropertyDefinitionEnumeration("Burlington", "Burlington"));
- myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden", true));
+ myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden"));
myEnums.add(new PropertyDefinitionEnumeration("Gloucester", "Gloucester"));
enumExample.setEnumeratedValues(myEnums, false);
addPropertyDefinition(propertyDefinitions, enumExample, orderIndex++);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index 08d8046..abd6592 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -1,17 +1,29 @@
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.IntExtractor;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.resource.disambiguation.DefaultDisambiguationUpdateStrategies;
+import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implements ConfigurationGWTService {
@@ -19,6 +31,8 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
private static final long serialVersionUID = 1L;
private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+ private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+ private ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
public Configuration getPluginConfiguration(int resourceId) {
try {
@@ -101,9 +115,43 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ public List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroup(
+ int groupId) {
+ try {
+ ResourceGroup group = this.groupManager.getResourceGroup(getSessionSubject(), groupId);
+ Map<Integer,Configuration> configurations =
+ this.configurationManager.getResourceConfigurationMapForCompatibleGroup(group);
+ List<ResourceConfigurationComposite> configurationComposites =
+ new ArrayList<ResourceConfigurationComposite>(configurations.size());
+ for (Integer resourceId : configurations.keySet()) {
+ Configuration configuration = configurations.get(resourceId);
+ ResourceConfigurationComposite configurationComposite =
+ new ResourceConfigurationComposite(resourceId, configuration);
+ configurationComposites.add(configurationComposite);
+ }
+
+ // Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
+ List<DisambiguationReport<ResourceConfigurationComposite>> disambiguatedConfigurationComposites = resourceManager
+ .disambiguate(configurationComposites, RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR,
+ DefaultDisambiguationUpdateStrategies.getDefault());
+
+ return disambiguatedConfigurationComposites;
+ } catch (RuntimeException e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
public RawConfiguration dummy(RawConfiguration config) {
com.allen_sauer.gwt.log.client.Log.info(config.getPath());
return new RawConfiguration();
// Dummy method for gwt compiler
}
+
+ private static final IntExtractor<ResourceConfigurationComposite> RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR =
+ new IntExtractor<ResourceConfigurationComposite>() {
+ public int extract(ResourceConfigurationComposite configurationComposite) {
+ return configurationComposite.getResourceId();
+ }
+ };
+
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/TestConfigurationFactory.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/TestConfigurationFactory.java
index ccc5eeb..e9092fc 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/TestConfigurationFactory.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/TestConfigurationFactory.java
@@ -26,6 +26,7 @@ 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.ConfigurationTemplate;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
@@ -40,6 +41,12 @@ import org.rhq.core.domain.configuration.definition.PropertySimpleType;
public abstract class TestConfigurationFactory {
public static ConfigurationDefinition createConfigurationDefinition() {
ConfigurationDefinition configurationDefinition = new ConfigurationDefinition("TestConfig", "a test config");
+
+ ConfigurationTemplate defaultTemplate = new ConfigurationTemplate(ConfigurationTemplate.DEFAULT_TEMPLATE_NAME, "default template");
+ configurationDefinition.putTemplate(defaultTemplate);
+ Configuration defaultConfiguration = new Configuration();
+ defaultTemplate.setConfiguration(defaultConfiguration);
+
Map<String, PropertyDefinition> propertyDefinitions = new HashMap<String, PropertyDefinition>();
configurationDefinition.setPropertyDefinitions(propertyDefinitions);
@@ -77,9 +84,10 @@ public abstract class TestConfigurationFactory {
simplePropDef = new PropertyDefinitionSimple("StringEnum1",
"a String enum prop with <=5 items - should be rendered as radio buttons", false, PropertySimpleType.STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
+ defaultConfiguration.put(new PropertySimple("StringEnum1", "NJ"));
ArrayList<PropertyDefinitionEnumeration> propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
propDefEnums.add(new PropertyDefinitionEnumeration("NY", "NY"));
- propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ", true));
+ propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ"));
propDefEnums.add(new PropertyDefinitionEnumeration("PA", "PA"));
simplePropDef.setEnumeratedValues(propDefEnums, false);
propertyDefinitions.put(simplePropDef.getName(), simplePropDef);
@@ -87,9 +95,10 @@ public abstract class TestConfigurationFactory {
simplePropDef = new PropertyDefinitionSimple("StringEnum2",
"a String enum prop with >5 items - should be rendered as a popup menu", false, PropertySimpleType.STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
+ defaultConfiguration.put(new PropertySimple("StringEnum2", "blue"));
propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
propDefEnums.add(new PropertyDefinitionEnumeration("red", "red"));
- propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange", true));
+ propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange"));
propDefEnums.add(new PropertyDefinitionEnumeration("yellow", "yellow"));
propDefEnums.add(new PropertyDefinitionEnumeration("green", "green"));
propDefEnums.add(new PropertyDefinitionEnumeration("blue", "blue"));
@@ -176,9 +185,10 @@ public abstract class TestConfigurationFactory {
PropertyDefinitionSimple enumExample = new PropertyDefinitionSimple("myEnum",
"a grouped enum prop with <=5 items", false, PropertySimpleType.STRING);
enumExample.setDisplayName(enumExample.getName());
+ defaultConfiguration.put(new PropertySimple("myEnum", "Burlington"));
ArrayList<PropertyDefinitionEnumeration> myEnums = new ArrayList<PropertyDefinitionEnumeration>();
myEnums.add(new PropertyDefinitionEnumeration("Burlington", "Burlington"));
- myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden", true));
+ myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden"));
myEnums.add(new PropertyDefinitionEnumeration("Gloucester", "Gloucester"));
enumExample.setEnumeratedValues(myEnums, false);
propertyDefinitions.put(enumExample.getName(), enumExample);
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/recentlyApproved/ViewAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/recentlyApproved/ViewAction.java
index 90d59a3..e3d4723 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/recentlyApproved/ViewAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/recentlyApproved/ViewAction.java
@@ -44,7 +44,6 @@ import org.rhq.enterprise.gui.legacy.WebUserPreferences.RecentlyApprovedPortletP
import org.rhq.enterprise.gui.legacy.util.SessionUtils;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.disambiguation.DefaultDisambiguationUpdateStrategies;
-import org.rhq.enterprise.server.resource.disambiguation.DisambiguationUpdateStrategy;
import org.rhq.enterprise.server.util.LookupUtil;
public class ViewAction extends TilesAction {
@@ -155,7 +154,7 @@ public class ViewAction extends TilesAction {
}
public DisambiguatedRecentlyAddedResourceComposite(DisambiguationReport<RecentlyAddedResourceComposite> report) {
- super(report.getOriginal(), report.getParents(), report.getResourceType());
+ super(report.getOriginal(), report.getParents(), report.getResourceType(), report.getName());
children = new ArrayList<DisambiguatedRecentlyAddedResourceComposite>();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/disambiguation/MutableDisambiguationReport.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/disambiguation/MutableDisambiguationReport.java
index 3084285..8c4f78b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/disambiguation/MutableDisambiguationReport.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/disambiguation/MutableDisambiguationReport.java
@@ -99,9 +99,10 @@ public class MutableDisambiguationReport<T> {
realParents.add(p.getResource());
}
}
- return new DisambiguationReport<T>(original, realParents, resource.resourceType.getResourceType());
+ return new DisambiguationReport<T>(original, realParents, resource.resourceType.getResourceType(), resource.name);
}
+ @Override
public String toString() {
return "MutableDisambiguationReport[resource=" + resource + ", parents=" + parents + "]";
}
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml
index dfb28f6..5493cbc 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -40,9 +40,9 @@
<alert-configuration>
<c:simple-property name="targetAddress" displayName="Address of the receiver" type="string"
description="Address of the receiver. This may e.g. be a telephone number"/>
- <c:simple-property name="kind" displayName="Type of notification" type="string" default="Voice">
+ <c:simple-property name="kind" displayName="Type of notification" type="string" default="VOICE">
<c:property-options>
- <c:option value="VOICE" name="Voice" default="true"/>
+ <c:option value="VOICE" name="Voice"/>
<c:option value="SMS" name="SMS"/>
<!--
<c:option value="MMS"/>
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/rhq-serverplugin.xml
index df5d936..30c89a0 100644
--- a/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -45,7 +45,7 @@
default="JRuby">
<c:property-options>
- <c:option value="jruby" name="Ruby" default="true"/>
+ <c:option value="JRuby" name="Ruby"/>
<c:option value="JavaScript"/>
</c:property-options>
</c:simple-property>
diff --git a/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml
index cf87641..edd7531 100644
--- a/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -22,9 +22,9 @@
<serverplugin:plugin-configuration>
<c:simple-property name="login" type="string" description="Login to the provider" required="true"/>
<c:simple-property name="password" type="password" description="Password for the provider" required="true"/>
- <c:simple-property name="environment">
+ <c:simple-property name="environment" default="sandbox">
<c:property-options>
- <c:option value="sandbox" default="true"/>
+ <c:option value="sandbox"/>
<c:option value="production"/>
</c:property-options>
</c:simple-property>
diff --git a/modules/enterprise/server/plugins/cobbler/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/cobbler/src/main/resources/META-INF/rhq-serverplugin.xml
index 1bcc161..6109a85 100644
--- a/modules/enterprise/server/plugins/cobbler/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/cobbler/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -60,7 +60,7 @@
<c:simple-property name="scheduleType" type="string" required="true" default="cron" summary="true" description="Indicates the type of trigger this synchronize job will use">
<c:property-options>
<c:option value="periodic"/>
- <c:option value="cron" default="true"/>
+ <c:option value="cron"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="scheduleTrigger" type="string" required="true" default="0 0/30 * * * ?" summary="true" description="Determines how often Cobbler will be synchronized with RHQ content. Based on the schedule type, this is either the period, in milliseconds, or the cron expression."/>
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
index fe6e665..f69104f 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -54,7 +54,7 @@
<!--<c:simple-property name="scheduleType" type="string" required="true" default="cron" summary="true">-->
<!--<c:property-options>-->
<!--<c:option value="periodic"/>-->
- <!--<c:option value="cron" default="true"/>-->
+ <!--<c:option value="cron"/>-->
<!--</c:property-options>-->
<!--</c:simple-property>-->
<!--<c:simple-property name="scheduleTrigger" type="string" required="true" default="0 0/30 * * * ?" summary="true"/>-->
13 years, 8 months
[rhq] modules/core
by Heiko W. Rupp
modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 50c2b4a82e511ef60041f8bd34301a0958cc67f9
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Oct 7 22:52:41 2010 +0200
Update help to better suit reality
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java
index cb93aa2..e8c1c05 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java
@@ -323,6 +323,7 @@ public class StandaloneContainer {
for (Command comm : EnumSet.allOf(Command.class)) {
System.out.println(comm + " ( " + comm.getAbbrev() + " ), " + comm.getArgs() + " : " + comm.getHelp());
}
+ System.out.println("Also check out !h for help on history commands");
break;
case INVOKE:
invokeOps(tokens);
@@ -707,7 +708,7 @@ public class StandaloneContainer {
NATIVE("n", "e | d | s", 1, "Enables/disables native system or shows native status"), //
QUIT("quit", "", 0, "Terminates the application"), //
RESOURCES("res", "", 0, "Shows the discovered resources"), //
- SET("set", "resourceId n", 2,
+ SET("set", "'resource' N", 2,
"Sets the resource id to work with. N can be a number or '$r' as result of last find resource call"), //
WAIT("w", "milliseconds", 1, "Waits the given amount of time"),
P_CONFIG("pc", "", 0, "Shows the plugin configuration of the current resource."),
13 years, 8 months
[rhq] Branch 'perftest' - 2 commits - modules/enterprise modules/helpers
by Heiko W. Rupp
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java | 1
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java | 1
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java | 47 ++++++++--
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/PerformanceReportExporter.java | 3
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/PerformanceReporting.java | 13 ++
5 files changed, 59 insertions(+), 6 deletions(-)
New commits:
commit 9eda0b88681d50ee721abe1008e2951e404b8a94
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Oct 7 22:42:16 2010 +0200
Add support for daily rolling file names, so that it gets easier to compare reports over time.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
index 5a79853..71adcb5 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
@@ -106,6 +106,7 @@ public class AbstractEJB3PerformanceTest extends AbstractEJB3Test {
try {
PerformanceReportExporter exporter = exporterClazz.newInstance();
exporter.setBaseFile(file);
+ exporter.setRolling(pr.rolling());
exporter.export(timings,result);
}
catch (Exception e) {
diff --git a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
index 4eaf30c..6d9c7f6 100644
--- a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
+++ b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
@@ -20,10 +20,14 @@ package org.rhq.helpers.perftest.support.reporting;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
+import org.rhq.helpers.perftest.support.testng.PerformanceReporting;
import org.testng.ITestResult;
import java.io.*;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Comparator;
+import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
@@ -39,27 +43,32 @@ public class ExcelExporter implements PerformanceReportExporter {
private static final String DOT_XLS = ".xls";
String baseFileName ;
+ PerformanceReporting.Rolling rolling;
CellStyle integerStyle;
CellStyle boldText;
@Override
public void setBaseFile(String fileName) {
- if (!fileName.endsWith(DOT_XLS))
- baseFileName = fileName + DOT_XLS;
- else
baseFileName = fileName;
}
@Override
+ public void setRolling(PerformanceReporting.Rolling rolling) {
+ this.rolling = rolling;
+ }
+
+ @Override
public void export(Map<String, Long> timings, ITestResult result) {
Workbook wb;
InputStream inp = null;
+ String fileName = getFileName();
+
// Check if Workbook is present - otherwise create it
try {
- inp = new FileInputStream(baseFileName);
+ inp = new FileInputStream(fileName);
wb = new HSSFWorkbook(inp);
} catch (Exception e) {
wb = new HSSFWorkbook();
@@ -88,7 +97,7 @@ public class ExcelExporter implements PerformanceReportExporter {
createDetailsSheet(wb,timings,result);
// Write the output to a file
- FileOutputStream fileOut = new FileOutputStream(baseFileName);
+ FileOutputStream fileOut = new FileOutputStream(fileName);
wb.write(fileOut);
fileOut.close();
if (inp!=null)
@@ -272,4 +281,32 @@ public class ExcelExporter implements PerformanceReportExporter {
Row ret = sheet.createRow(lastRow+1);
return ret;
}
+
+
+ /**
+ * Return the filename to use based on the baseFileName and
+ * the the rolling argument of the @PerformanceReporting annotation
+ * @return filename for the excel file ending on .xls
+ */
+ private String getFileName() {
+ String fileName = baseFileName;
+ DateFormat df ;
+ String suffix = "";
+
+ switch (rolling) {
+ case HOURLY:
+ df = new SimpleDateFormat("yyMMdd-kk");
+ suffix = df.format(new Date());
+ break;
+ case DAILY:
+ df = new SimpleDateFormat("yyMMdd");
+ suffix = df.format(new Date());
+ default:
+ break;
+ }
+
+ fileName = fileName + "-" + suffix + DOT_XLS;
+
+ return fileName;
+ }
}
diff --git a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/PerformanceReportExporter.java b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/PerformanceReportExporter.java
index 537da7e..301acfb 100644
--- a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/PerformanceReportExporter.java
+++ b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/PerformanceReportExporter.java
@@ -18,6 +18,7 @@
*/
package org.rhq.helpers.perftest.support.reporting;
+import org.rhq.helpers.perftest.support.testng.PerformanceReporting;
import org.testng.ITestResult;
import java.util.Map;
@@ -32,5 +33,7 @@ public interface PerformanceReportExporter {
public void setBaseFile(String fileName);
+ public void setRolling(PerformanceReporting.Rolling rolling);
+
public void export(Map<String,Long> timings, ITestResult result);
}
diff --git a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/PerformanceReporting.java b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/PerformanceReporting.java
index 6673d5b..927a868 100644
--- a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/PerformanceReporting.java
+++ b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/PerformanceReporting.java
@@ -16,7 +16,20 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
public @interface PerformanceReporting {
+ /** Base file name of the report without any .xls suffix */
String baseFilename() default "performance-report";
+ /** Exporter class to use to export the report */
Class<? extends PerformanceReportExporter> exporter() ;
+
+ /** Should reports be rolled over or overwritten. Gives the frequency of
+ * new file creation
+ */
+ Rolling rolling() default Rolling.DAILY;
+
+ public enum Rolling {
+ NONE,
+ DAILY,
+ HOURLY;
+ }
}
commit 6549db167388738f3ebdcea0f3d7ee3249287ded
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Oct 6 10:26:06 2010 +0200
Tiny cleanup
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index a0d27f0..a96ac9b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -153,7 +153,6 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
assertLinear(purge1000,purge3000,3,"Purge3");
assertLinear(purge1000,purge5000,5,"Purge3");
-// commitTimings(false);
}
/**
13 years, 8 months
[rhq] 3 commits - modules/core modules/enterprise modules/plugins
by ips
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java | 4
modules/core/client-api/src/main/resources/rhq-configuration.xsd | 11
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml | 1
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 7
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java | 29 -
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 54 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 201 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java | 255 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 199 +++++++
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 21
modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 6
modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml | 16
modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml | 10
modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml | 5
modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml | 4
modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml | 4
modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml | 4
modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml | 8
modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 28 -
modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml | 17
modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml | 3
modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml | 5
24 files changed, 527 insertions(+), 368 deletions(-)
New commits:
commit 5dacfc94663d163f92d499f6ccddf901e6207b05
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 7 12:44:02 2010 -0400
start of group resource config view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
new file mode 100644
index 0000000..d77b10e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -0,0 +1,199 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for editing a group's configuration.
+ *
+ * @author Ian Springer
+ */
+public class GroupResourceConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener {
+ private ResourceGroup group;
+ private ResourcePermission resourcePermission;
+ private ConfigurationDefinition configurationDefinition;
+ private Configuration aggregateConfiguration;
+ private Map<Integer, Configuration> memberConfigurations;
+
+ private ConfigurationEditor editor;
+ private IButton saveButton;
+
+ public GroupResourceConfigurationEditView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+
+ this.group = groupComposite.getResourceGroup();
+ this.resourcePermission = groupComposite.getResourcePermission();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ build();
+ }
+
+ public void build() {
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+
+ toolStrip.addMember(new LayoutSpacer());
+
+ this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), "Save");
+ this.saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+ toolStrip.addMember(saveButton);
+
+ addMember(toolStrip);
+ reloadConfiguration();
+
+ if (!this.resourcePermission.isConfigureWrite()) {
+ Message message = new Message("You do not have permission to edit this group's configuration.",
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+ }
+
+ private void reloadConfiguration() {
+ this.saveButton.disable();
+ if (editor != null) {
+ editor.destroy();
+ removeMember(editor);
+ }
+
+ loadConfigurationDefinition();
+ loadConfigurations();
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.aggregateConfiguration != null) {
+ this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
+ this.aggregateConfiguration, null);
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.addPropertyValueChangeListener(this);
+ this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
+ addMember(this.editor);
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (configurationDefinition == null) {
+ final ResourceType type = this.group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition = types.get(type.getId()).getResourceConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Configuration is not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfigurations() {
+ // TODO
+ this.aggregateConfiguration = null;
+ /*configurationService.getResourceConfiguration(resourceId, new AsyncCallback<Configuration>() {
+ public void onFailure(Throwable caught) {
+ showError(caught);
+ }
+
+ public void onSuccess(Configuration result) {
+ configuration = result;
+ Log.info("Config retreived in: " + (System.currentTimeMillis() - start));
+ initEditor();
+ }
+ });*/
+ }
+
+ private void save() {
+ Configuration updatedConfiguration = this.editor.getConfiguration();
+
+ // TODO
+/*
+ GWTServiceLookup.getConfigurationService().updateResourceConfiguration(resource.getId(), updatedConfiguration,
+ new AsyncCallback<ResourceConfigurationUpdate>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update configuration.", caught);
+ }
+
+ public void onSuccess(ResourceConfigurationUpdate result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Configuration updated.",
+ "Configuration updated for Resource [" + resource.getName() + "].",
+ Message.Severity.Info));
+ reloadConfiguration();
+ }
+ });
+*/
+ }
+
+ @Override
+ public void propertyValueChanged(PropertyValueChangeEvent event) {
+ MessageCenter messageCenter = CoreGUI.getMessageCenter();
+ Message message;
+ if (event.isValidationStateChanged()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
+ this.saveButton.enable();
+ message = new Message("All configuration properties have valid values, so the configuration can now be saved.",
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
+ } else {
+ this.saveButton.disable();
+ message = new Message("The following configuration properties have invalid values: "
+ + invalidPropertyNames + ". The values must be corrected before the configuration can be saved.",
+ Message.Severity.Error, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
+ }
+ messageCenter.notify(message);
+ } else {
+ this.saveButton.enable();
+ }
+ }
+}
commit 1d814e59264be7bb2c4fcc6a54be6518cc61be53
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 7 12:41:34 2010 -0400
get rid of unused is_default field in PropertyDefinitionEnumeration (https://bugzilla.redhat.com/show_bug.cgi?id=536496)
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java
index 9d09ba1..72e107a 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java
@@ -265,8 +265,8 @@ public class ConfigurationMetadataParser {
name = option.getValue();
}
- parentProperty.addEnumeratedValues(new PropertyDefinitionEnumeration(name, option.getValue(), option
- .isDefault()));
+ PropertyDefinitionEnumeration enumeration = new PropertyDefinitionEnumeration(name, option.getValue());
+ parentProperty.addEnumeratedValues(enumeration);
}
parentProperty.setAllowCustomEnumeratedValue(options.isAllowCustomValue());
diff --git a/modules/core/client-api/src/main/resources/rhq-configuration.xsd b/modules/core/client-api/src/main/resources/rhq-configuration.xsd
index 590f459..fe898f2 100644
--- a/modules/core/client-api/src/main/resources/rhq-configuration.xsd
+++ b/modules/core/client-api/src/main/resources/rhq-configuration.xsd
@@ -442,7 +442,7 @@
<xs:complexType name="option">
<xs:annotation>
- <xs:documentation>Used to describe items available in a property with a list type.
+ <xs:documentation>Describes an allowed value for an enumerated simple property.
</xs:documentation>
</xs:annotation>
<xs:attribute name="name" use="optional">
@@ -463,15 +463,6 @@
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
- <xs:attribute name="default" default="false" use="optional">
- <xs:annotation>
- <xs:documentation>Indicates this item is the default item in the list. Default value is false.
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:boolean"/>
- </xs:simpleType>
- </xs:attribute>
</xs:complexType>
<!-- == Property Constraints ================= -->
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 4cf8ae1..cb7f1d7 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.97</db.schema.version>
+ <db.schema.version>2.98</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
index 4db0a57..209a8a9 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
@@ -54,7 +54,6 @@
<column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/>
<column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/>
<column name="ORDER_INDEX" type="INTEGER" required="false"/>
- <column name="IS_DEFAULT" type="BOOLEAN" required="false"/>
<column name="NAME" type="VARCHAR2" required="false" size="100"/>
<column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/>
</table>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index b477b09..70e4c46 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3240,7 +3240,12 @@
</statement>
</schema-directSQL>
</schemaSpec>
-
+
+ <schemaSpec version="2.98">
+ <!-- Remove is_default field from simple prop def enums -->
+ <schema-deleteColumn ignoreError="true" table="RHQ_CONF_PROP_DEF_ENUM" column="IS_DEFAULT" />
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
index fbcabb4..4412cec 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java
@@ -64,6 +64,10 @@ public class PropertyDefinitionEnumeration implements Serializable {
private int orderIndex = -1;
@Column(name = "IS_DEFAULT")
+ @Deprecated
+ /**
+ * @deprecated - not used; TODO: remove in dbsetup/dbupgrade scripts
+ */
private boolean isDefault;
@JoinColumn(name = "PROPERTY_DEF_ID")
@@ -76,13 +80,8 @@ public class PropertyDefinitionEnumeration implements Serializable {
}
public PropertyDefinitionEnumeration(@NotNull String name, String value) {
- this(name, value, false);
- }
-
- public PropertyDefinitionEnumeration(@NotNull String name, String value, boolean isDefault) {
this.name = name;
this.value = value;
- this.isDefault = isDefault;
}
// @PrePersist
@@ -142,39 +141,27 @@ public class PropertyDefinitionEnumeration implements Serializable {
this.orderIndex = orderIndex;
}
- /**
- * Two items are equal if they have the same name and share the same PropertyDefinitionSimple
- */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
-
- if ((o == null) || (!(o instanceof PropertyDefinitionEnumeration))) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
- PropertyDefinitionEnumeration that = (PropertyDefinitionEnumeration) o;
+ PropertyDefinitionEnumeration that = (PropertyDefinitionEnumeration)o;
- if ((name != null) ? (!name.equals(that.name)) : (that.name != null)) {
+ if (!value.equals(that.value)) {
return false;
}
- /*if ((propertyDefinitionSimple != null) ? (!propertyDefinitionSimple.equals(that.propertyDefinitionSimple))
- : (that.propertyDefinitionSimple != null)) {
- return false;
- }*/
-
return true;
}
@Override
public int hashCode() {
- int result;
- result = ((name != null) ? name.hashCode() : 0);
- // result = (31 * result) + ((propertyDefinitionSimple != null) ? propertyDefinitionSimple.hashCode() : 0);
- return result;
+ return value.hashCode();
}
@Override
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java
index 782dc99..174aa8e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java
@@ -24,7 +24,6 @@ package org.rhq.core.domain.configuration.definition;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index b3f5aa3..420aa01 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -150,7 +150,7 @@
UseCanonicalName DNS is intended for use with mass IP-based virtual hosting to support ancient clients that do not provide a Host: header. With this option Apache does a reverse DNS lookup on the server IP address that the client connected to in order to work out self-referential URLs.
</c:description>
<c:property-options>
- <c:option value="Off" default="true"/>
+ <c:option value="Off"/>
<c:option value="On"/>
<c:option value="DNS"/>
</c:property-options>
@@ -163,7 +163,7 @@
In many situations Apache must construct a self-referential URL -- that is, a URL that refers back to the same server. With UseCanonicalPhysicalPort On Apache will, when constructing the canonical port for the server to honor the UseCanonicalName directive, provide the actual physical port number being used by this request as a potential port. With UseCanonicalPhysicalPort Off Apache will not ever use the actual physical port number, instead relying on all configured information to construct a valid port number.
</c:description>
<c:property-options>
- <c:option value="Off" default="true"/>
+ <c:option value="Off"/>
<c:option value="On"/>
</c:property-options>
</c:simple-property>
@@ -175,16 +175,16 @@
The Options directive controls which server features are available in a particular directory.
</c:description>
<c:map-property name="Options">
- <c:simple-property name="Mode">
+ <c:simple-property name="Mode" default="Set">
<c:property-options>
- <c:option value="Set" default="true"/>
+ <c:option value="Set"/>
<c:option value="Add"/>
<c:option value="Remove"/>
</c:property-options>
</c:simple-property>
- <c:simple-property name="Option">
+ <c:simple-property name="Option" default="All">
<c:property-options>
- <c:option value="All" default="true"/>
+ <c:option value="All"/>
<c:option value="None"/>
<c:option value="ExecCGI"/>
<c:option value="FollowSymLinks"/>
@@ -295,7 +295,7 @@
<c:simple-property name="augeasEnabled" displayName="Enable augeas support" description="Enable augeas support" default="no">
<c:property-options>
<c:option value="yes" name="Yes"/>
- <c:option value="no" name="No" default="true"/>
+ <c:option value="no" name="No"/>
</c:property-options>
</c:simple-property>
@@ -309,10 +309,11 @@
</c:group>
<c:group name="Virtual Hosts">
- <c:simple-property name="vhostCreationPolicy" displayName="Virtual Hosts Configuration Placement" description="How should the new virtual host definitions be put in the configuration" default="vhost-per-file">
+ <c:simple-property name="vhostCreationPolicy" displayName="Virtual Hosts Configuration Placement"
+ description="How should the new virtual host definitions be put in the configuration" default="vhost-per-file">
<c:property-options>
<c:option value="single-file" name="In the main configuration file"/>
- <c:option value="vhost-per-file" name="Each Virtual Host in a standalone file" default="true"/>
+ <c:option value="vhost-per-file" name="Each Virtual Host in a standalone file"/>
</c:property-options>
</c:simple-property>
@@ -339,7 +340,7 @@
<c:option name="debug" value="debug"/>
<c:option name="info" value="info"/>
<c:option name="warn" value="warn"/>
- <c:option name="error" value="error" default="true"/>
+ <c:option name="error" value="error"/>
<c:option name="fatal" value="fatal"/>
</c:property-options>
</c:simple-property>
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 47ca3e0..473daf1 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
@@ -572,9 +572,9 @@
</c:description>
<c:map-property name="config-property">
<c:simple-property name="name" description="The name of the configuration property." />
- <c:simple-property name="type" description="The type of the configuration property.">
+ <c:simple-property name="type" description="The type of the configuration property." default="java.lang.String">
<c:property-options>
- <c:option value="java.lang.String" default="true"/>
+ <c:option value="java.lang.String"/>
<c:option value="java.lang.Boolean"/>
<c:option value="java.lang.Integer"/>
<c:option value="java.lang.Double"/>
@@ -1067,7 +1067,7 @@
<c:option name="debug" value="debug"/>
<c:option name="info" value="info"/>
<c:option name="warn" value="warn"/>
- <c:option name="error" value="error" default="true"/>
+ <c:option name="error" value="error"/>
<c:option name="fatal" value="fatal"/>
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
index b3ea3f5..19eed1e 100644
--- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
@@ -62,7 +62,7 @@
description="The method used to execute the Shutdown operation;
defaults to 'JMX MBean'.">
<c:property-options>
- <c:option value="JMX" name="JMX MBean" default="true"/>
+ <c:option value="JMX" name="JMX MBean"/>
<c:option value="SCRIPT" name="shutdown script"/>
</c:property-options>
</c:simple-property>
@@ -103,7 +103,7 @@
<c:option name="debug" value="debug"/>
<c:option name="info" value="info"/>
<c:option name="warn" value="warn"/>
- <c:option name="error" value="error" default="true"/>
+ <c:option name="error" value="error"/>
<c:option name="fatal" value="fatal"/>
</c:property-options>
</c:simple-property>
@@ -443,10 +443,10 @@
<resource-configuration>
<c:group name="connection" displayName="Connection Information">
- <c:simple-property name="type">
+ <c:simple-property name="type" default="local-tx-datasource">
<c:property-options>
<c:option value="no-tx-datasource" name="No TX Datasource"/>
- <c:option value="local-tx-datasource" name="Local TX Datasource" default="true"/>
+ <c:option value="local-tx-datasource" name="Local TX Datasource"/>
<c:option value="xa-datasource" name="XA Datasource"/>
</c:property-options>
</c:simple-property>
@@ -466,11 +466,11 @@
</c:group>
<c:group name="advanced" displayName="Advanced">
- <c:simple-property name="transaction-isolation" required="false"
+ <c:simple-property name="transaction-isolation" required="false" default="TRANSACTION_READ_COMMITTED"
description="The Transaction Isolation level. The default setting is to use whichever isolation level is provided by default by the database.">
<c:property-options>
<c:option value="TRANSACTION_READ_UNCOMMITTED" name="Read Uncommitted"/>
- <c:option value="TRANSACTION_READ_COMMITTED" default="true" name="Read Committed"/>
+ <c:option value="TRANSACTION_READ_COMMITTED" name="Read Committed"/>
<c:option value="TRANSACTION_REPEATABLE_READ" name="Repeatable Read"/>
<c:option value="TRANSACTION_SERIALIZABLE" name="Serializable"/>
<c:option value="TRANSACTION_NONE" name="None"/>
@@ -749,11 +749,11 @@
<c:simple-property name="transaction-type"
type="string"
displayName="Transaction Type"
- default="true"
+ default="Local Transaction"
description="Whether to use local or xa transactions. If nothing is specified, the default of local will be used."
required="false">
<c:property-options>
- <c:option value="Local Transaction" default="true"/>
+ <c:option value="Local Transaction"/>
<c:option value="XA Transaction"/>
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml
index 2ef0f4f..61c4d08 100644
--- a/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml
@@ -99,8 +99,8 @@
<c:simple-property name="Flavour" default="treecache"
description="Is this going to be a Pojo Cache or a Tree Cache">
<c:property-options>
- <c:option name="POJO Cache" value="cache" default="false"/>
- <c:option name="Tree Cache" value="treecache" default="true"/>
+ <c:option name="POJO Cache" value="cache"/>
+ <c:option name="Tree Cache" value="treecache"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="TransactionManagerLookupClass"
@@ -110,7 +110,7 @@
description="The isolation level for access to the cache">
<c:property-options>
<c:option value="SERIALIZABLE"/>
- <c:option value="REPEATABLE_READ" default="true"/>
+ <c:option value="REPEATABLE_READ"/>
<c:option value="READ_COMMITTED"/>
<c:option value="READ_UNCOMMITTED"/>
<c:option value="NONE"/>
@@ -119,12 +119,12 @@
<c:simple-property name="NodeLockingScheme" default="PESSIMISTIC">
<c:property-options>
<c:option value="OPTIMISTIC"/>
- <c:option value="PESSIMISTIC" default="true"/>
+ <c:option value="PESSIMISTIC"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="CacheMode" default="LOCAL">
<c:property-options>
- <c:option value="LOCAL" default="true"/>
+ <c:option value="LOCAL"/>
<c:option value="REPL_ASYNC"/>
<c:option value="REPL_SYNC"/>
</c:property-options>
diff --git a/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml
index dc5a4cf..b142a22 100644
--- a/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml
@@ -17,9 +17,10 @@
<!-- Properties are connection/lookup configurations. They are values that the
plugin components need to connect and interact with the resource. -->
<plugin-configuration>
- <c:simple-property name="type" type="string" description="The EMS connection type for this JMX Server">
+ <c:simple-property name="type" type="string" default="LocalVMTypeDescriptor"
+ description="The EMS connection type for this JMX Server">
<c:property-options>
- <c:option value="LocalVMTypeDescriptor" name="Local" default="true"/>
+ <c:option value="LocalVMTypeDescriptor" name="Local"/>
<c:option value="org.mc4j.ems.connection.support.metadata.JBossConnectionTypeDescriptor" name="JBoss"/>
<c:option value="org.mc4j.ems.connection.support.metadata.Tomcat55ConnectionTypeDescriptor" name="Tomcat"/>
<c:option value="org.mc4j.ems.connection.support.metadata.JDMKConnectionTypeDescriptor" name="JDMK"/>
diff --git a/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml
index a280d27..0053a9d 100644
--- a/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml
@@ -17,9 +17,9 @@
supportsManualAdd="true">
<plugin-configuration>
- <c:simple-property name="detectionMechanism" required="true" defaultValue="EXTERNAL" description="Determines how to perform network resource detection. 'external' means that an external executable tool (e.g. lsof) will be used; 'internal' means internal Java detection code provided by the RHQ plugin will be used.">
+ <c:simple-property name="detectionMechanism" required="true" default="EXTERNAL" description="Determines how to perform network resource detection. 'external' means that an external executable tool (e.g. lsof) will be used; 'internal' means internal Java detection code provided by the RHQ plugin will be used.">
<c:property-options>
- <c:option value="EXTERNAL" default="true" />
+ <c:option value="EXTERNAL" />
<c:option value="INTERNAL" />
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
index 1db41e0..a3b869c 100644
--- a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
@@ -21,7 +21,7 @@
<c:simple-property name="validateResponseCode" type="boolean" default="false"/>
<c:simple-property name="sslProtocol" default="none">
<c:property-options>
- <c:option value="none" default="true"/>
+ <c:option value="none"/>
<c:option value="SSL"/>
<c:option value="TLS"/>
</c:property-options>
@@ -29,7 +29,7 @@
<c:simple-property name="method" default="GET">
<c:property-options>
<c:option value="HEAD"/>
- <c:option value="GET" default="true"/>
+ <c:option value="GET"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="followRedirects" type="boolean" default="false"/>
diff --git a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml
index 34a4e71..06900c8 100644
--- a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml
@@ -175,10 +175,10 @@
<c:simple-property name="file" type="file"/>
<c:simple-property name="directory" type="directory"/>
- <c:simple-property name="enum">
+ <c:simple-property name="enum" default="Blue">
<c:property-options>
<c:option value="red" name="Red"/>
- <c:option value="blue" name="Blue" default="true"/>
+ <c:option value="blue" name="Blue"/>
<c:option value="green" name="Green"/>
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml
index 5a4a8a7..493382e 100644
--- a/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml
@@ -156,13 +156,13 @@
<c:simple-property name="logTrackingMinimumSeverity" displayName="Minimum Severity" required="false" default="Warning" description="The minimum severity of log messages that will be collected. If not specified, there is no minimum severity (i.e. all will be collected).">
<c:property-options>
<c:option value="Information"/>
- <c:option value="Warning" default="true"/>
+ <c:option value="Warning"/>
<c:option value="Error"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="logTrackingType" summary="true" required="true" default="file" description="Defines if the log messages are to be found by polling a file or listening to a TCP socket">
<c:property-options>
- <c:option value="file" default="true"/>
+ <c:option value="file"/>
<c:option value="listener"/>
</c:property-options>
</c:simple-property>
@@ -220,7 +220,7 @@
<c:simple-property name="minimumSeverity" default="Warning" description="The minimum severity event that will be collected">
<c:property-options>
<c:option value="Information"/>
- <c:option value="Warning" default="true"/>
+ <c:option value="Warning"/>
<c:option value="Error"/>
</c:property-options>
</c:simple-property>
@@ -573,7 +573,7 @@
<plugin-configuration>
<c:simple-property name="type" default="pidFile" description="Choice of using a pid file or a PIQL query to find the process to monitor">
<c:property-options>
- <c:option value="pidFile" default="true" name="Pid File"/>
+ <c:option value="pidFile" name="Pid File"/>
<c:option value="piql" name="Process Query"/>
</c:property-options>
</c:simple-property>
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 df799fe..d59b312 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
@@ -36,7 +36,7 @@
to determine if an event should be fired for that entry. If not
specified, no filtering of log entries will be done based on their
detail."/>
- <c:simple-property name="minimumSeverity" required="false" default="error"
+ <c:simple-property name="minimumSeverity" required="false" default="ERROR"
description="The minimum severity of log messages that should be collected for this
source. If not specified, there is no minimum severity (i.e. all
log messages will be collected).">
@@ -44,7 +44,7 @@
<c:option name="debug" value="DEBUG"/>
<c:option name="info" value="INFO"/>
<c:option name="warn" value="WARN"/>
- <c:option name="error" value="ERROR" default="true"/>
+ <c:option name="error" value="ERROR"/>
<c:option name="fatal" value="FATAL"/>
</c:property-options>
</c:simple-property>
@@ -364,7 +364,7 @@
<c:description>Communication settings that define the endpoints of this RHQ Agent and its RHQ Server</c:description>
<c:simple-property name="rhq.agent.server.transport" type="string" activationPolicy="restart" required="true" default="servlet" displayName="RHQ Server Transport Protocol" description="The transport protocol used to send commands to the RHQ Server. If you want secure communications, the RHQ Server must use an SSL-enabled transport">
<c:property-options>
- <c:option name="servlet" value="servlet" default="true" />
+ <c:option name="servlet" value="servlet" />
<c:option name="sslservlet" value="sslservlet" />
<c:option name="socket" value="socket" />
<c:option name="sslsocket" value="sslsocket" />
@@ -382,7 +382,7 @@
<c:simple-property name="rhq.agent.server.alias" type="string" activationPolicy="restart" required="false" default="rhqserver" displayName="RHQ Server Alias" description="If the RHQ Server IP address is not defined, this is the DNS alias name that will be looked up to determine the RHQ Server IP address." />
<c:simple-property name="rhq.communications.connector.transport" type="string" activationPolicy="restart" required="true" default="socket" displayName="Agent Transport Protocol" description="The transport protocol used to receive commands from the RHQ Server. e.g. socket, sslsocket. If you want secure communications, you must use an SSL-enabled transport">
<c:property-options>
- <c:option name="socket" value="socket" default="true" />
+ <c:option name="socket" value="socket" />
<c:option name="sslsocket" value="sslsocket" />
</c:property-options>
</c:simple-property>
@@ -399,7 +399,7 @@
<c:simple-property name="rhq.communications.connector.security.secure-socket-protocol"
type="string" activationPolicy="restart" required="false" default="TLS" displayName="Incoming: Secure Socket Protocol">
<c:property-options allowCustomValue="true">
- <c:option name="TLS" value="TLS" default="true" />
+ <c:option name="TLS" value="TLS" />
<c:option name="SSL_TLS" value="SSL_TLS" />
<c:option name="SSL" value="SSL" />
<c:option name="SSLv3" value="SSLv3" />
@@ -410,7 +410,7 @@
<c:simple-property name="rhq.communications.connector.security.keystore.algorithm"
type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Incoming: Keystore Algorithm" >
<c:property-options allowCustomValue="true">
- <c:option name="SunX509" value="SunX509" default="true" />
+ <c:option name="SunX509" value="SunX509" />
<c:option name="IbmX509" value="IbmX509" />
</c:property-options>
</c:simple-property>
@@ -432,14 +432,14 @@
<c:simple-property name="rhq.communications.connector.security.truststore.algorithm"
type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Incoming: Truststore Algorithm">
<c:property-options allowCustomValue="true">
- <c:option name="SunX509" value="SunX509" default="true" />
+ <c:option name="SunX509" value="SunX509" />
<c:option name="IbmX509" value="IbmX509" />
</c:property-options>
</c:simple-property>
<c:simple-property name="rhq.communications.connector.security.truststore.type"
type="string" activationPolicy="restart" required="false" default="JKS" displayName="Incoming: Truststore Type">
<c:property-options allowCustomValue="true">
- <c:option name="JKS" value="JKS" default="true" />
+ <c:option name="JKS" value="JKS" />
<c:option name="PKCS12" value="PKCS12" />
</c:property-options>
</c:simple-property>
@@ -449,7 +449,7 @@
type="string" activationPolicy="restart" required="false" default="none" displayName="Incoming: Client Authentication Mode"
description="Determines if the agent should authenticate a RHQ Server before accepting incoming commands from it">
<c:property-options>
- <c:option name="none" value="none" default="true" />
+ <c:option name="none" value="none" />
<c:option name="want" value="want" />
<c:option name="need" value="need" />
</c:property-options>
@@ -458,7 +458,7 @@
<c:simple-property name="rhq.agent.client.security.secure-socket-protocol"
type="string" activationPolicy="restart" required="false" default="TLS" displayName="Outgoing: Secure Socket Protocol">
<c:property-options allowCustomValue="true">
- <c:option name="TLS" value="TLS" default="true" />
+ <c:option name="TLS" value="TLS" />
<c:option name="SSL_TLS" value="SSL_TLS" />
<c:option name="SSL" value="SSL" />
<c:option name="SSLv3" value="SSLv3" />
@@ -469,14 +469,14 @@
<c:simple-property name="rhq.agent.client.security.keystore.algorithm"
type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Outgoing: Keystore Algorithm">
<c:property-options allowCustomValue="true">
- <c:option name="SunX509" value="SunX509" default="true" />
+ <c:option name="SunX509" value="SunX509" />
<c:option name="IbmX509" value="IbmX509" />
</c:property-options>
</c:simple-property>
<c:simple-property name="rhq.agent.client.security.keystore.type"
type="string" activationPolicy="restart" required="false" default="JKS" displayName="Outgoing: Keystore Type">
<c:property-options allowCustomValue="true">
- <c:option name="JKS" value="JKS" default="true" />
+ <c:option name="JKS" value="JKS" />
<c:option name="PKCS12" value="PKCS12" />
</c:property-options>
</c:simple-property>
@@ -491,14 +491,14 @@
<c:simple-property name="rhq.agent.client.security.truststore.algorithm"
type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Outgoing: Truststore Algorithm">
<c:property-options allowCustomValue="true">
- <c:option name="SunX509" value="SunX509" default="true" />
+ <c:option name="SunX509" value="SunX509" />
<c:option name="IbmX509" value="IbmX509" />
</c:property-options>
</c:simple-property>
<c:simple-property name="rhq.agent.client.security.truststore.type"
type="string" activationPolicy="restart" required="false" default="JKS" displayName="Outgoing: Truststore Type">
<c:property-options allowCustomValue="true">
- <c:option name="JKS" value="JKS" default="true" />
+ <c:option name="JKS" value="JKS" />
<c:option name="PKCS12" value="PKCS12" />
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml
index 06f359f..b5abbdf 100644
--- a/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml
@@ -64,7 +64,8 @@
<c:group name="Settings">
- <c:simple-property name="Protocol" required="false" description="
+ <c:simple-property name="Protocol" required="false" default="2"
+ description="
Specifies the protocol versions sshd(8) supports. The possible
values are `1' and `2'. Multiple versions must be comma-separat-
ed. The default is ``2,1''. Note that the order of the protocol
@@ -73,12 +74,13 @@
ing ``2,1'' is identical to ``1,2''.">
<c:property-options>
<c:option value="1" name="Version 1 Only"/>
- <c:option value="2" default="true" name="Version 2 Only"/>
+ <c:option value="2" name="Version 2 Only"/>
<c:option value="1,2" name="Both Version 1 and Version 2"/>
</c:property-options>
</c:simple-property>
- <c:simple-property name="LogLevel" required="false" description="
+ <c:simple-property name="LogLevel" required="false" default="INFO"
+ description="
Gives the verbosity level that is used when logging messages from
sshd(8). The possible values are: QUIET, FATAL, ERROR, INFO,
VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
@@ -89,18 +91,18 @@
<c:option value="QUIET" name="QUIET"/>
<c:option value="FATAL" name="FATAL"/>
<c:option value="ERROR" name="ERROR"/>
- <c:option value="INFO" default="true" name="INFO"/>
+ <c:option value="INFO" name="INFO"/>
<c:option value="VERBOSE" name="VERBOSE"/>
<c:option value="DEBUG" name="DEBUG"/>
<c:option value="DEBUG1" name="DEBUG1"/>
<c:option value="DEBUG2" name="DEBUG2"/>
<c:option value="DEBUG3" name="DEBUG3"/>
-
</c:property-options>
</c:simple-property>
- <c:simple-property name="PermitRootLogin" required="false" description="
+ <c:simple-property name="PermitRootLogin" required="false" default="yes"
+ description="
Specifies whether root can log in using ssh(1). The argument
must be ``yes'', ``without-password'', ``forced-commands-only'',
or ``no''. The default is ``yes''.
@@ -116,11 +118,10 @@
If this option is set to ``no'', root is not allowed to log in.">
<c:property-options>
- <c:option value="yes" name="Allow Login" default="true"/>
+ <c:option value="yes" name="Allow Login"/>
<c:option value="no" name="Deny Login"/>
<c:option value="without-password" name="Login without password"/>
<c:option value="forced-commands-only" name="Allow commands only"/>
-
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
index 4ba4d91..5d511cc 100644
--- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
@@ -69,8 +69,7 @@
name="RPM System V init script" />
<c:option
value="SCRIPT"
- name="shutdown script"
- default="true" />
+ name="shutdown script" />
</c:property-options>
</c:simple-property>
diff --git a/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml
index fc11bab..a066afc 100644
--- a/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+
<plugin name="Twitter"
displayName="Twitter Plugin"
package="org.rhq.plugins.twitter"
@@ -7,7 +8,6 @@
description="Monitor various timelines on Twitter"
xmlns:c="urn:xmlns:rhq-configuration">
-
<server
name="Twitter"
discovery="TwitterDiscovery"
@@ -68,7 +68,7 @@
<plugin-configuration>
<c:simple-property name="kind" default="user">
<c:property-options allowCustomValue="false">
- <c:option value="user" name="User timeline" default="true"/>
+ <c:option value="user" name="User timeline"/>
<c:option value="search" name="Keyword search"/>
</c:property-options>
</c:simple-property>
@@ -86,5 +86,4 @@
</server>
-
</plugin>
commit f60319dfe12918ff42bcaada1d0f0fecbb3a346a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Oct 6 18:31:29 2010 -0400
start of the group config editor component
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index ed165ea..d47f8e1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -73,6 +73,7 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.validator.CustomValidator;
import com.smartgwt.client.widgets.form.validator.FloatRangeValidator;
import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator;
+import com.smartgwt.client.widgets.form.validator.LengthRangeValidator;
import com.smartgwt.client.widgets.form.validator.RegExpValidator;
import com.smartgwt.client.widgets.form.validator.Validator;
import com.smartgwt.client.widgets.grid.ListGrid;
@@ -147,6 +148,11 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
* @author Ian Springer
*/
+//
+// Note: There was a failed attempt at an editor composed with ListGrid components instead of DynamicForm components,
+// but there were problems with having different editors active for different rows in the table at the same time.
+// Smart says they're working on enhancing this area, but the DynamicForm might be a better option anyway. (ghinkle)
+//
@SuppressWarnings({"UnnecessarySemicolon"})
public class ConfigurationEditor extends LocatableVLayout {
private static final String RHQ_PROPERTY_ATTRIBUTE_NAME = "rhq:property";
@@ -732,7 +738,7 @@ public class ConfigurationEditor extends LocatableVLayout {
VLayout canvas = new VLayout();
canvas.addMember(propertyGrid);
- if (!isReadOnly(propertyDefinitionMap)) {
+ if (!isReadOnly(propertyDefinitionMap, propertyMap)) {
// Map is not read-only - add footer with New and Delete buttons to allow user to add or remove members.
ToolStrip footer = new ToolStrip();
footer.setPadding(5);
@@ -1034,7 +1040,7 @@ public class ConfigurationEditor extends LocatableVLayout {
membersItem.setValueMap(memberValueToIndexMap);
listGrid.setItems(membersItem);
- if (!isReadOnly(propertyDefinitionList)) {
+ if (!isReadOnly(propertyDefinitionList, propertyList)) {
// List is not read-only - add footer with New and Delete buttons to allow user to add or remove members.
ToolStrip footer = new ToolStrip();
footer.setPadding(5);
@@ -1199,8 +1205,8 @@ public class ConfigurationEditor extends LocatableVLayout {
return memberValueToIndexMap;
}
- private FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
- final PropertySimple propertySimple) {
+ protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
+ final PropertySimple propertySimple) {
Log.debug("Building simple field for " + propertySimple + "...");
FormItem valueItem = null;
@@ -1267,7 +1273,8 @@ public class ConfigurationEditor extends LocatableVLayout {
List<Validator> validators = buildValidators(propertyDefinitionSimple, propertySimple);
valueItem.setValidators(validators.toArray(new Validator[validators.size()]));
- valueItem.setDisabled(isReadOnly(propertyDefinitionSimple) || isUnset(propertyDefinitionSimple, propertySimple));
+ valueItem.setDisabled(isReadOnly(propertyDefinitionSimple, propertySimple)
+ || isUnset(propertyDefinitionSimple, propertySimple));
/*
Click handlers seem to be turned off for disabled fields... need an alternative
valueItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
@@ -1301,14 +1308,14 @@ public class ConfigurationEditor extends LocatableVLayout {
return currentProperty;
}
- private FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final PropertySimple property,
+ protected FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final PropertySimple property,
final FormItem valueItem) {
FormItem item;
if (!propertyDefinition.isRequired()) {
CheckboxItem unsetItem = new CheckboxItem();
boolean unset = isUnset(propertyDefinition, property);
unsetItem.setValue(unset);
- unsetItem.setDisabled(isReadOnly(propertyDefinition));
+ unsetItem.setDisabled(isReadOnly(propertyDefinition, property));
unsetItem.setShowLabel(false);
unsetItem.setShowTitle(false);
unsetItem.setLabelAsTitle(false);
@@ -1339,15 +1346,38 @@ public class ConfigurationEditor extends LocatableVLayout {
(propertySimple == null || propertySimple.getStringValue() == null));
}
- private boolean isReadOnly(PropertyDefinition propertyDefinition) {
- return propertyDefinition.isReadOnly() || this.readOnly;
+ private boolean isReadOnly(PropertyDefinition propertyDefinition, Property property) {
+ boolean isInvalidRequiredProperty = false;
+ if (property instanceof PropertySimple) {
+ PropertySimple propertySimple = (PropertySimple)property;
+ String errorMessage = propertySimple.getErrorMessage();
+ if ((null == propertySimple.getStringValue()) || "".equals(propertySimple.getStringValue())
+ || ((null != errorMessage) && (!"".equals(errorMessage.trim())))) {
+ // Required properties with no value, or an invalid value (assumed if we see an error message) should
+ // never be set to read-only, otherwise the user will have no way to give the property a new value and
+ // thereby get things to a valid state.
+ isInvalidRequiredProperty = true;
+ }
+ }
+ return !isInvalidRequiredProperty && (propertyDefinition.isReadOnly() || this.readOnly);
}
private List<Validator> buildValidators(PropertyDefinitionSimple propertyDefinition, Property property) {
List<Validator> validators = new ArrayList<Validator>();
- if (propertyDefinition.getConstraints() != null) {
- Set<Constraint> constraints = propertyDefinition.getConstraints();
+ switch (propertyDefinition.getType()) {
+ case STRING:
+ case LONG_STRING:
+ case FILE:
+ case DIRECTORY:
+ LengthRangeValidator validator = new LengthRangeValidator();
+ validator.setMax(PropertySimple.MAX_VALUE_LENGTH);
+ validators.add(validator);
+ break;
+ }
+
+ Set<Constraint> constraints = propertyDefinition.getConstraints();
+ if (constraints != null) {
for (Constraint constraint : constraints) {
if (constraint instanceof IntegerRangeConstraint) {
IntegerRangeConstraint integerConstraint = ((IntegerRangeConstraint) constraint);
@@ -1376,11 +1406,13 @@ public class ConfigurationEditor extends LocatableVLayout {
}
}
}
+
if (property.getErrorMessage() != null) {
this.invalidPropertyNames.add(property.getName());
PluginReportedErrorValidator validator = new PluginReportedErrorValidator(property);
validators.add(validator);
}
+
return validators;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
new file mode 100644
index 0000000..a7150e1
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -0,0 +1,201 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.configuration;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
+import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+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.PropertyDefinitionSimple;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A SmartGWT widget for editing a group of RHQ {@link Configuration}s that conform to the same
+ * {@link ConfigurationDefinition}.
+ *
+ * @author Ian Springer
+ */
+public class GroupConfigurationEditor extends ConfigurationEditor {
+ private Map<String, Configuration> memberConfigurations;
+
+ public GroupConfigurationEditor(String locatorId, ConfigurationDefinition configurationDefinition,
+ Configuration aggregateConfiguration,
+ Map<String, Configuration> memberConfigurations) {
+ super(locatorId, configurationDefinition, aggregateConfiguration);
+ this.memberConfigurations = memberConfigurations;
+ }
+
+ private void displayMemberValuesEditor(String locatorId, PropertyDefinitionSimple propertyDefinitionSimple,
+ final FormItem aggregateValueItem,
+ final PropertySimple aggregatePropertySimple, Integer index) {
+ LocatableVLayout layout = new LocatableVLayout(locatorId);
+ layout.setHeight100();
+
+ // TODO: Add 'Set All Values To' and 'Unset All' controls in a separate DynamicForm.
+
+ final DynamicForm form = new DynamicForm();
+ form.setHeight100();
+ form.setColWidths("55%", "5%", "40%");
+ layout.addMember(form);
+
+ // Add header row.
+ List<FormItem> items = new ArrayList<FormItem>();
+ StaticTextItem memberHeader = new StaticTextItem("memberHeader", "Member");
+ items.add(memberHeader);
+ StaticTextItem unsetHeader = new StaticTextItem("unsetHeader", "Unset");
+ items.add(unsetHeader);
+ StaticTextItem valueHeader = new StaticTextItem("valueHeader", "Value");
+ valueHeader.setEndRow(true);
+ items.add(valueHeader);
+
+ // Add data rows.
+ final Map<String, PropertySimple> memberProperties = new HashMap<String, PropertySimple>(this.memberConfigurations.size());
+ final List<FormItem> valueItems = new ArrayList<FormItem>(this.memberConfigurations.size());
+ for (String memberName : this.memberConfigurations.keySet()) {
+ StaticTextItem memberItem = new StaticTextItem("member", memberName);
+ items.add(memberItem);
+ Configuration memberConfiguration = this.memberConfigurations.get(memberName);
+ PropertySimple memberPropertySimple = getPropertySimple(memberConfiguration, propertyDefinitionSimple, index);
+ memberProperties.put(memberName, memberPropertySimple);
+ FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple);
+ valueItem.setAttribute("rhq:property", memberPropertySimple);
+ valueItems.add(valueItem);
+ FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple, memberPropertySimple, valueItem);
+ items.add(unsetItem);
+ items.add(valueItem);
+ valueItem.setEndRow(true);
+ }
+ form.setItems(items.toArray(new FormItem[items.size()]));
+
+ final Window popup = new Window();
+ popup.setTitle("Member Values for Property '" + propertyDefinitionSimple.getName());
+ popup.setWidth(800);
+ popup.setHeight(600);
+ popup.setIsModal(true);
+ popup.setShowModalMask(true);
+ popup.setShowCloseButton(false);
+ popup.centerInPage();
+
+ final IButton okButton = new IButton("OK");
+ okButton.disable();
+ okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ boolean valuesHomogeneous = true;
+ String firstValue = (String)valueItems.get(0).getValue();
+ for (FormItem valueItem : valueItems) {
+ String value = (String)valueItem.getValue();
+ if ((value != null && !value.equals(firstValue)) || firstValue != null) {
+ valuesHomogeneous = false;
+ }
+ PropertySimple memberPropertySimple =
+ (PropertySimple)valueItem.getAttributeAsObject("rhq:property");
+ memberPropertySimple.setStringValue(value);
+ memberPropertySimple.setErrorMessage(null);
+ }
+ if (valuesHomogeneous) {
+ // Values are all the same, so update the value of the aggregate property and set its override flag to true.
+ aggregateValueItem.setValue(firstValue);
+ // TODO: Will this cause a value changed event to fire for the aggregate form item?
+ aggregatePropertySimple.setStringValue(firstValue);
+ aggregatePropertySimple.setErrorMessage(null);
+ aggregatePropertySimple.setOverride(true);
+ }
+ popup.destroy();
+ }
+ });
+
+ // Only enable the OK button if all properties are valid.
+ form.addItemChangedHandler(new ItemChangedHandler() {
+ public void onItemChanged(ItemChangedEvent itemChangedEvent) {
+ okButton.setDisabled(!form.validate());
+ }
+ });
+
+ final IButton cancelButton = new IButton("Cancel");
+ cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ popup.destroy();
+ }
+ });
+
+ // TODO: Anchor the button bar at the bottom of the modal window, so it's always visible.
+ HLayout buttons = new HLayout();
+ buttons.setAlign(Alignment.CENTER);
+ buttons.setMembersMargin(10);
+ buttons.setMembers(okButton, cancelButton);
+ layout.addMember(buttons);
+
+ popup.addItem(layout);
+
+ popup.show();
+ }
+
+ private PropertySimple getPropertySimple(Configuration configuration,
+ PropertyDefinitionSimple propertyDefinitionSimple, Integer index) {
+ LinkedList<PropertyDefinition> propertyDefinitionHierarchy = new LinkedList<PropertyDefinition>();
+ PropertyDefinition currentPropertyDefinition = propertyDefinitionSimple;
+ do {
+ propertyDefinitionHierarchy.addFirst(currentPropertyDefinition);
+ if (currentPropertyDefinition.getParentPropertyMapDefinition() != null) {
+ currentPropertyDefinition = currentPropertyDefinition.getParentPropertyMapDefinition();
+ } else if (currentPropertyDefinition.getParentPropertyListDefinition() != null) {
+ currentPropertyDefinition = currentPropertyDefinition.getParentPropertyListDefinition();
+ } else if (currentPropertyDefinition.getConfigurationDefinition() == null) {
+ throw new IllegalStateException(currentPropertyDefinition + " has no parent.");
+ }
+ }
+ while (currentPropertyDefinition.getConfigurationDefinition() == null);
+
+ Property property = configuration.get(propertyDefinitionHierarchy.get(0).getName());
+ for (int i = 1, propertyDefinitionHierarchySize = propertyDefinitionHierarchy.size();
+ i < propertyDefinitionHierarchySize; i++) {
+ PropertyDefinition propertyDefinition = propertyDefinitionHierarchy.get(i);
+ if (property instanceof PropertyMap) {
+ PropertyMap propertyMap = (PropertyMap)property;
+ property = propertyMap.get(propertyDefinition.getName());
+ } else if (property instanceof PropertyList) {
+ PropertyList propertyList = (PropertyList)property;
+ property = propertyList.getList().get(index);
+ }
+ }
+
+ return (PropertySimple)property;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java
deleted file mode 100644
index 7136199..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.components.configuration;
-
-import org.rhq.core.domain.configuration.Configuration;
-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.PropertyGroupDefinition;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Autofit;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.WidgetCanvas;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.SectionStack;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import java.util.List;
-
-/**
- * Note: This was a failed attempt at an editor composed with ListGrid components instead of DynamicForm components.
- * I had problems with having different editors active for different rows in the table at the same time. Smart says
- * they're working on enhancing this area... but the DynamicForm might be a better option anyway.
- * @author Greg Hinkle
- */
-public class ListGridConfigurationEditor extends VLayout {
-
- private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
-
- private ConfigurationDefinition definition;
- private Configuration configuration;
-
- public ListGridConfigurationEditor() {
-
-
- setOverflow(Overflow.AUTO);
-
-
- configurationService.getResourceConfiguration(10005, new AsyncCallback<Configuration>() {
- public void onFailure(Throwable caught) {
- // TODO: Implement this method.
- }
-
- public void onSuccess(Configuration result) {
- configuration = result;
- com.allen_sauer.gwt.log.client.Log.info("Got config");
- reload();
- }
- });
-
- configurationService.getResourceConfigurationDefinition(10060, new AsyncCallback<ConfigurationDefinition>() {
- public void onFailure(Throwable caught) {
- // TODO: Implement this method.
- }
-
- public void onSuccess(ConfigurationDefinition result) {
- definition = result;
- com.allen_sauer.gwt.log.client.Log.info("Got def");
- reload();
- }
-
- ;
- });
- }
-
-
- public void reload() {
- if (definition == null || configuration == null) {
- return;
- }
-
- List<PropertyGroupDefinition> definitions = definition.getGroupDefinitions();
-
-
- final SectionStack sectionStack = new SectionStack();
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- sectionStack.setWidth100();
- sectionStack.setOverflow(Overflow.VISIBLE);
-
- for (PropertyGroupDefinition definition : definitions) {
- com.allen_sauer.gwt.log.client.Log.info("building: " + definition.getDisplayName());
- sectionStack.addSection(buildGroupSection(definition));
- }
-
- addMember(sectionStack);
-
- this.redraw();
- }
-
-
- public SectionStackSection buildGroupSection(PropertyGroupDefinition group) {
- SectionStackSection section = new SectionStackSection(group.getDisplayName() + "<div style='text-align: right; font-size: -2'>" + group.getDescription() + "</div>");
- section.setExpanded(true);
-
-
- ListGrid grid = new ListGrid();
- grid.setAlternateRecordStyles(true);
- grid.setSelectionType(SelectionStyle.NONE);
- grid.setEditByCell(false);
-
- grid.setShowHover(false);
- grid.setShowAllRecords(true);
- grid.setShowAllRecords(true);
- grid.setWrapCells(true);
- grid.setOverflow(Overflow.VISIBLE);
- grid.setBodyOverflow(Overflow.VISIBLE);
- grid.setCanSort(false);
-
- grid.setFixedRecordHeights(false);
- grid.setAutoFitMaxHeight(50);
- grid.setAutoFitData(Autofit.VERTICAL);
-
- grid.setAlwaysShowEditors(true);
-
-
- ListGridField nameField = new ListGridField("displayName", "Name", 180);
- nameField.setCanEdit(false);
- //nameField
-
- ListGridField unsetField = new ListGridField("unset", "unset", 25);
- unsetField.setType(ListGridFieldType.BOOLEAN);
- unsetField.setCanEdit(true);
-
- ListGridField valueField = new ListGridField("value", "Value", 160);
- valueField.setCanEdit(true);
-// valueField.setEditorType(new TextItem());
- valueField.setEditorType(new ConfigEditor());
-
-
- final ConfigEditor ce = new ConfigEditor();
- valueField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
-
-
- return ce.tc.getInnerHTML();
-// "<input type='radio' name='foo' checked='checked'/> alpha<br/>" +
-// "<input type='radio' name='foo' /> beta<br/>" +
-// "<input type='radio' name='foo' /> delta<br/>";
-
- }
- });
- ListGridField descriptionField = new ListGridField("description", "Description");
- descriptionField.setCanEdit(false);
- grid.setFields(nameField, unsetField, valueField, descriptionField);
-
-
- for (PropertyDefinition property : definition.getPropertiesInGroup(group.getName())) {
- grid.addData(new PropertyRecord(property));
- }
-
- section.addItem(grid);
- return section;
- }
-
-
- public class ConfigurationListGrid extends ListGrid {
-
- public ConfigurationListGrid() {
- super(); // TODO: Implement this method.
-
-
- }
-
-
- // Crap, they didn't implement the override for getEditorType yet
-
- }
-
-
- public class PropertyRecord extends ListGridRecord {
-
- PropertyDefinition propertyDefinition;
-
- public PropertyRecord(PropertyDefinition definition) {
- this.propertyDefinition = definition;
- setAttribute("name", definition.getName());
- setAttribute("displayName", definition.getDisplayName());
-
- setAttribute("required", definition.isRequired());
- setAttribute("readOnly", definition.isReadOnly());
-
- PropertySimple property = configuration.getSimple(definition.getName());
-
- setAttribute("unset", property.getStringValue() == null);
- setAttribute("value", property.getStringValue());
-
- setAttribute("description", definition.getDescription());
-
- }
- }
-
- public class ConfigEditor extends CanvasItem {
-
- int x = 1;
- TestCanvas tc = new TestCanvas();
-
- public ConfigEditor() {
- super();
-
- setCanvas(new WidgetCanvas(new Label("testing")));
- }
-
- @Override
- public Canvas getCanvas() {
-
- tc.val = "" + x++;
-
- return tc;
- }
-
-
- }
-
- public class TestCanvas extends Canvas {
-
- String val;
-
-
- @Override
- public String getInnerHTML() {
- return val;
- }
- }
-
-}
\ No newline at end of file
13 years, 8 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 5d3e86d97f8a49ab0a86d3a43b31c1f429602f7f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 7 10:02:51 2010 -0400
Fix a git merge problem
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 7cb28a3..8096fcf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -38,8 +38,7 @@
2. In hosted mode, the windows are not automatically closed,
although you can easily close them manually in the usual way
-->
- <!--
- -- When enabled FireFox is hard to use due to excessive popup window generation
+ <!-- When enabled FireFox is hard to use due to excessive popup window generation
<set-property name="log_WindowLogger" value="ENABLED" />
-->
13 years, 8 months
[rhq] 14 commits - .classpath modules/enterprise
by Jay Shaughnessy
.classpath | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java | 282 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 2
3 files changed, 176 insertions(+), 112 deletions(-)
New commits:
commit 59b91a699378df0cae55ea6575760e9f4ff6db2c
Merge: 20c1c7a... 6d06818...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 7 09:32:46 2010 -0400
Merge branch 'master-jay'
commit 6d06818fbee4c424aa539baaed36634aa513c785
Merge: e7acef3... b1efc02...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 7 08:59:31 2010 -0400
Unfortunately ended up mixing a merge resolution with feature work:
-- Fix ResourceTree rendering for direct nav to "deep" nodes (like JmsXA).
There were a few issues here. So far there have been some changes to
ensure proper ordering of tree nodes for parent-child relationships,
and more protection against node duplication.
This should fix the rendering but we have some other
issues resulting in the attemot to add duplicate resource nodes, and also,
I think, building the tree twice prior to rendering. I'll look into
these issues now but at least the tree should render correctly.
-- Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
diff --cc .classpath
index 0b4abf3,1a1236c..7d1cd22
--- a/.classpath
+++ b/.classpath
@@@ -252,10 -252,9 +252,9 @@@
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.0.3/gwt-user-2.0.3.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.0.3/gwt-dev-2.0.3.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.2/smartgwt-2.2.jar"/>
-- <classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/gwt-log/gwt-log/3.0.3/gwt-log-3.0.3.jar"/>
-- <classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
++ <classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/gwt-log/gwt-log/3.0.3/gwt-log-3.0.3.jar"/>
++ <classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/gwt-log/gwt-log/3.0.3/gwt-log-3.0.3.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index d577c4d,d577c4d..17012f8
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@@ -20,9 -20,9 +20,8 @@@ package org.rhq.enterprise.gui.coregui.
import java.util.ArrayList;
import java.util.EnumSet;
--import java.util.HashMap;
++import java.util.HashSet;
import java.util.List;
--import java.util.Map;
import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@@ -38,7 -38,7 +37,6 @@@ import com.smartgwt.client.widgets.tree
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
--import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceSubCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
@@@ -132,7 -132,7 +130,8 @@@ public class ResourceTreeDatasource ext
return;
} else {
-- com.allen_sauer.gwt.log.client.Log.info("ResourceTreeDatasource: Loading Resource [" + parentResourceId + "]...");
++ com.allen_sauer.gwt.log.client.Log.info("ResourceTreeDatasource: Loading Resource [" + parentResourceId
++ + "]...");
criteria.addFilterParentResourceId(Integer.parseInt(parentResourceId));
}
@@@ -176,85 -176,85 +175,196 @@@
* @return
*/
public static TreeNode[] buildNodes(List<Resource> resources, List<Resource> lockedData) {
-- ResourceTreeNode[] nodes = new ResourceTreeNode[resources.size()];
-- for (int i = 0; i < resources.size(); i++) {
-- Resource resource = resources.get(i);
++ List<ResourceTreeNode> resourceNodes = new ArrayList<ResourceTreeNode>(resources.size());
++ for (Resource resource : resources) {
ResourceTreeNode node = new ResourceTreeNode(resource, lockedData.contains(resource));
-- nodes[i] = node;
++ resourceNodes.add(node);
}
-- return introduceTypeAndCategoryNodes(nodes);
++ List<TreeNode> result = introduceTypeAndCategoryNodes(resourceNodes);
++ com.allen_sauer.gwt.log.client.Log.debug("\nSTARTING FINAL TREE\n");
++ for (TreeNode node : result) {
++ com.allen_sauer.gwt.log.client.Log.debug("Final: " + node);
++ }
++ com.allen_sauer.gwt.log.client.Log.debug("\nENDING FINAL TREE\n");
++ return result.toArray(new TreeNode[result.size()]);
}
-- private static TreeNode[] introduceTypeAndCategoryNodes(ResourceTreeNode[] resourceNodes) {
-- List<TreeNode> updatedNodes = new ArrayList<TreeNode>();
-- // Maps category node IDs to the corresponding category nodes.
-- Map<String, SubCategoryTreeNode> subcategoryNodes = new HashMap<String, SubCategoryTreeNode>();
-- // Maps autogroup/type node IDs to the corresponding autogroup/type nodes.
-- Map<String, AutoGroupTreeNode> autogroupNodes = new HashMap<String, AutoGroupTreeNode>();
++ /**
++ * @param resourceNodes ordered such that referenced parent nodes have lower indexes than the referencing child.
++ * @return a new List, properly ordered and including AG and Subcategory nodes.
++ */
++ private static List<TreeNode> introduceTypeAndCategoryNodes(final List<ResourceTreeNode> resourceNodes) {
++ // The resulting list of nodes, including AG and SC nodes. The list is ordered to ensure all
++ // referenced parent nodes have lower indexes than the referencing child.
++ List<TreeNode> allNodes = new ArrayList<TreeNode>(resourceNodes.size());
++ // Keep track of the node IDs added so far to ensure we don't add the same node more than once. Note
++ // that the list of resourceNodes passed in may have duplicates as the caller may not be able to
++ // ensure a clean set.
++ Set<String> allNodeIds = new HashSet<String>(resourceNodes.size() * 2);
for (ResourceTreeNode resourceNode : resourceNodes) {
-- updatedNodes.add(resourceNode);
++ if (allNodeIds.contains(resourceNode.getID())) {
++ com.allen_sauer.gwt.log.client.Log.debug("skipping duplicate resourceNode: " + resourceNode);
++ continue;
++ }
Resource resource = resourceNode.getResource();
-- ResourceType type = resource.getResourceType();
-- if (type.getCategory() != ResourceCategory.PLATFORM) {
-- String autogroupNodeId = AutoGroupTreeNode.idOf(resource);
-- if (!autogroupNodes.containsKey(autogroupNodeId)) {
-- Resource parentResource = resource.getParentResource();
-- ResourceSubCategory subcategory = type.getSubCategory();
-- if (subcategory != null) {
-- com.allen_sauer.gwt.log.client.Log.debug("Processing " + subcategory + "...");
-- do {
-- String subcategoryNodeId = SubCategoryTreeNode.idOf(subcategory, parentResource);
-- if (!subcategoryNodes.containsKey(subcategoryNodeId)) {
-- SubCategoryTreeNode subcategoryNode = new SubCategoryTreeNode(subcategory,
-- parentResource);
-- subcategoryNodes.put(subcategoryNode.getID(), subcategoryNode);
-- com.allen_sauer.gwt.log.client.Log.debug("Adding " + subcategoryNode + " to tree...");
-- updatedNodes.add(subcategoryNode);
-- }
-- } while ((subcategory = subcategory.getParentSubCategory()) != null);
-- }
-- if (!type.isSingleton()) {
-- AutoGroupTreeNode autogroupNode = new AutoGroupTreeNode(resource);
-- autogroupNodes.put(autogroupNodeId, autogroupNode);
-- com.allen_sauer.gwt.log.client.Log.debug("Adding " + autogroupNode + " to tree...");
-- updatedNodes.add(autogroupNode);
++ if (resourceNode.isParentSubCategory()) {
++ // If the parent node is a subcategory node, make sure the subcategory node is in the
++ // tree prior to the resource node. Note that it could itself be a tree of subcategories.
++ addSubCategoryNodes(allNodes, allNodeIds, resource);
++
++ } else if (resourceNode.isParentAutoGroup()) {
++
++ // If the parent node is an autogroup node, make sure the autogroup node is in the
++ // tree prior to the resource node.
++
++ if (!allNodeIds.contains(resourceNode.getParentID())) {
++ AutoGroupTreeNode autogroupNode = new AutoGroupTreeNode(resource);
++
++ if (autogroupNode.isParentSubcategory()) {
++ // If the parent node of the autogroup node is a subcategory node, make sure the subcategory
++ // node is in the tree prior to the autogroup node. Note that it could itself be a
++ // tree of subcategories.
++ addSubCategoryNodes(allNodes, allNodeIds, resource);
++
}
++ allNodeIds.add(resourceNode.getParentID());
++ com.allen_sauer.gwt.log.client.Log.debug("Adding " + autogroupNode);
++ allNodes.add(autogroupNode);
}
}
++
++ com.allen_sauer.gwt.log.client.Log.debug("Adding " + resourceNode + " to tree...");
++ allNodeIds.add(resourceNode.getID());
++ allNodes.add(resourceNode);
++ }
++
++ return allNodes;
++ }
++
++ // convenience routine to avoid code duplication
++ private static void addSubCategoryNodes(List<TreeNode> allNodes, Set<String> allNodeIds, Resource resource) {
++ Resource parentResource = resource.getParentResource();
++ ResourceType type = resource.getResourceType();
++ ResourceSubCategory subCategory = type.getSubCategory();
++ String subCategoryNodeId = null;
++ int insertAt = allNodes.size();
++
++ do {
++ subCategoryNodeId = SubCategoryTreeNode.idOf(subCategory, parentResource);
++
++ if (!allNodeIds.contains(subCategoryNodeId)) {
++ SubCategoryTreeNode subCategoryNode = new SubCategoryTreeNode(subCategory, parentResource);
++ allNodeIds.add(subCategoryNodeId);
++ com.allen_sauer.gwt.log.client.Log.debug("Adding " + subCategoryNode);
++ allNodes.add(insertAt, subCategoryNode);
++ }
++ } while ((subCategory = subCategory.getParentSubCategory()) != null);
++ }
++
++ public static class ResourceTreeNode extends EnhancedTreeNode {
++ private Resource resource;
++ private boolean isLocked;
++ private boolean parentAutoGroup = false;
++ private boolean parentSubCategory = false;
++
++ /**
++ * The parentID will be set to the parent resource at construction. It can be changed
++ * later (prior to tree linkage) if the resource node should logically be set to an
++ * autogroup or subcategory parent.
++ * @param resource
++ * @param isLocked
++ */
++ private ResourceTreeNode(Resource resource, boolean isLocked) {
++ this.resource = resource;
++ this.isLocked = isLocked;
++
++ String id = idOf(resource);
++ setID(id);
++
++ // a resource node can have any of three different parent node types; resource, subcategory or autogroup.
++ // this can be determined at construction time so set it properly now and assume the proper node
++ // structure will be in place later.
++ Resource parentResource = resource.getParentResource();
++ String parentId = null;
++
++ if (null != parentResource) {
++ // non-singletons will always be autogrouped
++ if (!resource.getResourceType().isSingleton()) {
++ parentId = AutoGroupTreeNode.idOf(resource);
++ this.parentAutoGroup = true;
++
++ } else {
++ ResourceSubCategory subCategory = resource.getResourceType().getSubCategory();
++ if (null != subCategory) {
++ parentId = SubCategoryTreeNode.idOf(subCategory, parentResource);
++ this.parentSubCategory = true;
++ } else
++ parentId = ResourceTreeNode.idOf(parentResource);
++ }
++ }
++ this.setParentID(parentId);
++
++ String name = resource.getName();
++ setName(name);
++
++ setAttribute(Attributes.DESCRIPTION, resource.getDescription());
++
++ Set<ResourceType> childTypes = resource.getResourceType().getChildResourceTypes();
++ setIsFolder((childTypes != null && !childTypes.isEmpty()));
++ }
++
++ public Resource getResource() {
++ return this.resource;
++ }
++
++ public boolean isLocked() {
++ return isLocked;
++ }
++
++ public boolean isParentAutoGroup() {
++ return parentAutoGroup;
++ }
++
++ public boolean isParentSubCategory() {
++ return parentSubCategory;
++ }
++
++ public static String idOf(Resource resource) {
++ return idOf(resource.getId());
}
-- return updatedNodes.toArray(new TreeNode[updatedNodes.size()]);
++ public static String idOf(int resourceId) {
++ return String.valueOf(resourceId);
++ }
}
/**
-- * The folder node for a Resource subcategory.
++ * The folder node for a Resource subCategory.
*/
public static class SubCategoryTreeNode extends EnhancedTreeNode {
++
public SubCategoryTreeNode(ResourceSubCategory category, Resource parentResource) {
String id = idOf(category, parentResource);
setID(id);
-- setAttribute(Attributes.ID, id);
ResourceSubCategory parentCategory = category.getParentSubCategory();
String parentId = (parentCategory != null) ? SubCategoryTreeNode.idOf(parentCategory, parentResource)
: ResourceTreeNode.idOf(parentResource);
setParentID(parentId);
-- setAttribute(Attributes.PARENT_ID, parentId);
-- // Note, subcategory names are typically already plural, so there's no need to pluralize them.
++ // Note, subCategory names are typically already plural, so there's no need to pluralize them.
String name = category.getDisplayName();
setName(name);
-- setAttribute(Attributes.NAME, name);
setAttribute(Attributes.DESCRIPTION, category.getDescription());
}
public static String idOf(ResourceSubCategory category, Resource parentResource) {
-- return "subcat" + category.getId() + "_" + parentResource.getId();
++ return "subcat_" + category.getId() + "_" + parentResource.getId();
}
}
@@@ -265,6 -265,6 +375,7 @@@
private Resource parentResource;
private ResourceType resourceType;
++ private boolean parentSubcategory = false;
/**
* @param resource requires resourceType field be set. requires parentResource field be set (null for no parent)
@@@ -276,15 -276,15 +387,21 @@@
String id = idOf(resource);
setID(id);
-- String parentId = parentIdOf(resource);
++ // parent node is either a subCategory node or a resource node
++ String parentId;
++ ResourceSubCategory subcategory = this.resourceType.getSubCategory();
++ if (subcategory != null) {
++ parentId = SubCategoryTreeNode.idOf(subcategory, this.parentResource);
++ this.parentSubcategory = true;
++ } else {
++ parentId = ResourceTreeNode.idOf(this.parentResource);
++ }
setParentID(parentId);
-- ResourceType type = resource.getResourceType();
-- String name = StringUtility.pluralize(type.getName());
++ String name = StringUtility.pluralize(this.resourceType.getName());
setName(name);
-- setAttribute(Attributes.NAME, name);
-- setAttribute(Attributes.DESCRIPTION, type.getDescription());
++ setAttribute(Attributes.DESCRIPTION, this.resourceType.getDescription());
}
public Resource getParentResource() {
@@@ -306,6 -306,6 +423,10 @@@
return this.getParentResource().getName() + " ( " + this.getResourceType().getName() + " )";
}
++ public boolean isParentSubcategory() {
++ return parentSubcategory;
++ }
++
/**
* Given a Resource, generate a unique ID for the AGNode.
*
@@@ -328,63 -328,63 +449,6 @@@
public static String idOf(Resource parentResource, ResourceType resourceType) {
return (parentResource != null) ? "autogroup_" + resourceType.getId() + "_" + parentResource.getId() : null;
}
--
-- // parent node is either a subcategory node or a resouce node
-- public static String parentIdOf(Resource resource) {
-- ResourceType type = resource.getResourceType();
-- ResourceSubCategory parentCategory = type.getSubCategory();
-- return (parentCategory != null) ? SubCategoryTreeNode.idOf(parentCategory, resource.getParentResource())
-- : ResourceTreeNode.idOf(resource.getParentResource());
-- }
}
-- public static class ResourceTreeNode extends EnhancedTreeNode {
-- private Resource resource;
-- private boolean isLocked;
--
-- private ResourceTreeNode(Resource resource, boolean isLocked) {
-- this.resource = resource;
-- this.isLocked = isLocked;
--
-- String id = idOf(resource);
-- setID(id);
-- setAttribute(Attributes.ID, id);
--
-- Resource parentResource = resource.getParentResource();
-- String parentId;
-- if (parentResource != null) {
-- parentId = resource.getResourceType().isSingleton() ? AutoGroupTreeNode.parentIdOf(resource)
-- : AutoGroupTreeNode.idOf(resource);
-- } else {
-- parentId = null;
-- }
-- setParentID(parentId);
-- setAttribute(Attributes.PARENT_ID, parentId);
--
-- String name = resource.getName();
-- setName(name);
-- setAttribute(Attributes.NAME, name);
--
-- setAttribute(Attributes.DESCRIPTION, resource.getDescription());
--
-- Set<ResourceType> childTypes = resource.getResourceType().getChildResourceTypes();
-- setIsFolder((childTypes != null && !childTypes.isEmpty()));
-- }
--
-- public Resource getResource() {
-- return this.resource;
-- }
--
-- public boolean isLocked() {
-- return isLocked;
-- }
--
-- public static String idOf(Resource resource) {
-- return idOf(resource.getId());
-- }
--
-- public static String idOf(int resourceId) {
-- return String.valueOf(resourceId);
-- }
-- }
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 97a7d2f,97a7d2f..aefb031
--- 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
@@@ -104,7 -104,7 +104,7 @@@ public class ResourceTreeView extends L
private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
// Maps autogroup/type backing group ids to the corresponding autogroup/type nodes.
-- Map<Integer, AutoGroupTreeNode> autoGroupNodeMap = new HashMap<Integer, AutoGroupTreeNode>();
++ private Map<Integer, AutoGroupTreeNode> autoGroupNodeMap = new HashMap<Integer, AutoGroupTreeNode>();
public ResourceTreeView(String locatorId) {
super(locatorId);
commit e7acef3bd0f3bcc2122316cbbbc96366924c69f3
Merge: 87af918... 885a5f5...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 4 18:06:53 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
commit 87af918747d582095353ede483dfa8e1c46b7a63
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 4 18:03:28 2010 -0400
Initial Manual Add Work
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index 7ad683a..8a0329e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -68,4 +68,6 @@ public interface ResourceGWTService extends RemoteService {
void unignoreResources(Integer[] resourceIds);
+ Resource manuallyAddResource(int resourceTypeId, int parentResourceId, Configuration pluginConfiguration);
+
}
\ No newline at end of file
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 d6cfdba..97a7d2f 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
@@ -300,9 +300,11 @@ public class ResourceTreeView extends LocatableVLayout {
// Update breadcrumbs
if (currentViewId != null) {
currentViewId.getBreadcrumbs().clear();
- for (int i = parents.length - 1; i >= 0; i--) {
- TreeNode n = parents[i];
- adjustBreadcrumb(n, currentViewId);
+ if (null != parents) {
+ for (int i = parents.length - 1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ adjustBreadcrumb(n, currentViewId);
+ }
}
adjustBreadcrumb(selectedNode, currentViewId);
CoreGUI.refreshBreadCrumbTrail();
@@ -456,13 +458,15 @@ public class ResourceTreeView extends LocatableVLayout {
for (final ResourceType childType : resourceType.getChildResourceTypes()) {
if (childType.isCreatable()) {
MenuItem createItem = new MenuItem(childType.getName());
- createChildSubMenu.addItem(createItem);
+
createItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
}
});
+ createChildSubMenu.addItem(createItem);
+
}
}
createChildMenu.setSubmenu(createChildSubMenu);
@@ -472,21 +476,30 @@ public class ResourceTreeView extends LocatableVLayout {
// Manually Add Menu
MenuItem importChildMenu = new MenuItem("Import");
Menu importChildSubMenu = new Menu();
- for (ResourceType childType : resourceType.getChildResourceTypes()) {
+ for (final ResourceType childType : resourceType.getChildResourceTypes()) {
if (childType.isSupportsManualAdd()) {
- importChildSubMenu.addItem(new MenuItem(childType.getName()));
- //todo action
+ MenuItem importItem = new MenuItem(childType.getName());
+
+ importItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryCreateWizard.showImportWizard(resource, childType);
+ }
+ });
+
+ importChildSubMenu.addItem(importItem);
}
}
+
if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
- loadManuallyAddServersToPlatforms(importChildSubMenu);
+ loadManuallyAddServersToPlatforms(importChildSubMenu, resource);
}
+
importChildMenu.setSubmenu(importChildSubMenu);
importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
resourceContextMenu.addItem(importChildMenu);
}
- private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
+ private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu, final Resource resource) {
ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
@@ -498,9 +511,16 @@ public class ResourceTreeView extends LocatableVLayout {
}
public void onSuccess(PageList<ResourceType> result) {
- for (ResourceType type : result) {
+ for (final ResourceType type : result) {
if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
MenuItem item = new MenuItem(type.getName());
+
+ item.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryCreateWizard.showImportWizard(resource, type);
+ }
+ });
+
manuallyAddMenu.addItem(item);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
index 84c6b55..5d7fbdc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
@@ -49,6 +49,7 @@ public class ConfigurationStep extends AbstractWizardStep {
}
public boolean nextPage() {
+ wizard.execute();
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
index 0db5af8..a588010 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
import java.util.Map;
+import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SelectItem;
@@ -49,10 +50,17 @@ public class ConfigurationTemplateStep extends AbstractWizardStep {
form = new LocatableDynamicForm("ResFactConfigTemplate");
- TextItem nameItem = new TextItem("resourceName", "Resource Name");
- nameItem.setRequired(true);
+ TextItem nameItem = null;
- SelectItem templateSelect = new SelectItem("template", "Template");
+ if (!this.wizard.isImport()) {
+ nameItem = new TextItem("resourceName", "New Resource Name");
+ nameItem.setWidth(300);
+ nameItem.setRequired(true);
+ }
+
+ SelectItem templateSelect = new SelectItem("template", "Connection Property Templates (Choose One)");
+ templateSelect.setTitleOrientation(TitleOrientation.TOP);
+ templateSelect.setWidth(300);
ConfigurationDefinition definition = wizard.getConfigurationDefinition();
@@ -64,9 +72,14 @@ public class ConfigurationTemplateStep extends AbstractWizardStep {
templateSelect.setDisabled(true);
}
- form.setItems(nameItem, templateSelect);
+ if (null != nameItem) {
+ form.setItems(nameItem, templateSelect);
+ } else {
+ form.setItems(templateSelect);
+ }
}
+
return form;
}
@@ -75,7 +88,7 @@ public class ConfigurationTemplateStep extends AbstractWizardStep {
}
public String getName() {
- return "New Resource";
+ return "Resource Information";
}
public Configuration getConfiguration() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
index bad2058..7968635 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
@@ -19,14 +19,9 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.EnumSet;
-import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@@ -48,6 +43,7 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
private ConfigurationDefinition configurationDefinition;
private Resource parentResource;
private ResourceType createType;
+ private boolean isImport; // manual add vs. create new child
private WizardView view;
@@ -55,10 +51,11 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
private ConfigurationStep configurationStep;
public ResourceFactoryCreateWizard(Resource parentResource, ResourceType createType,
- ConfigurationDefinition configurationDefinition) {
+ ConfigurationDefinition configurationDefinition, boolean isImport) {
this.parentResource = parentResource;
this.createType = createType;
this.configurationDefinition = configurationDefinition;
+ this.isImport = isImport;
assert parentResource != null;
assert createType != null;
@@ -66,8 +63,12 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- configurationTemplateStep = new ConfigurationTemplateStep(this);
- steps.add(configurationTemplateStep);
+ // skip the template step if this is an import (no resource name to be gathered) and the
+ // type has only the default template to offer for user selection.
+ if (!(this.isImport && this.configurationDefinition.getTemplates().size() < 2)) {
+ this.configurationTemplateStep = new ConfigurationTemplateStep(this);
+ steps.add(configurationTemplateStep);
+ }
configurationStep = new ConfigurationStep(this);
steps.add(configurationStep);
@@ -76,52 +77,57 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
}
public String getWindowTitle() {
- return "Resource Create Wizard";
+ return isImport() ? "Import Resource Wizard" : "Resource Create Wizard";
}
public String getTitle() {
- return "Create New " + createType.getName();
+ return (isImport() ? "Import Resource of Type: " : "Create New Resource of Type: ") + createType.getName();
}
public String getSubtitle() {
return null;
}
- public List<IButton> getCustomButtons(int step) {
- switch (step) {
- case 1:
- IButton createButton = new IButton("Create");
- createButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- execute();
- }
- });
- return Collections.singletonList(createButton);
- }
- return null;
- }
-
- private void execute() {
+ public void execute() {
- int parentReourceId = parentResource.getId();
+ int parentResourceId = parentResource.getId();
int createTypeId = createType.getId();
- String newResourceName = configurationTemplateStep.getResourceName();
Configuration newConfiguration = configurationStep.getConfiguration();
- GWTServiceLookup.getResourceService().createResource(parentReourceId, createTypeId, newResourceName,
- newConfiguration, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to create new resource", caught);
- view.closeDialog();
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Submitted request to create new resource ["
- + configurationTemplateStep.getResourceName() + "]", Message.Severity.Info));
- view.closeDialog();
- }
- });
+ if (isImport) {
+ GWTServiceLookup.getResourceService().manuallyAddResource(createTypeId, parentResourceId, newConfiguration,
+ new AsyncCallback<Resource>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to manually add resource", caught);
+ view.closeDialog();
+ }
+
+ public void onSuccess(Resource result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Submitted request to manually add [" + createType.getName() + "]",
+ Message.Severity.Info));
+ view.closeDialog();
+ }
+ });
+
+ } else {
+ String newResourceName = configurationTemplateStep.getResourceName();
+
+ GWTServiceLookup.getResourceService().createResource(parentResourceId, createTypeId, newResourceName,
+ newConfiguration, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create new resource", caught);
+ view.closeDialog();
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Submitted request to create new resource ["
+ + configurationTemplateStep.getResourceName() + "]", Message.Severity.Info));
+ view.closeDialog();
+ }
+ });
+ }
}
public void display() {
@@ -135,7 +141,19 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
ResourceFactoryCreateWizard wizard = new ResourceFactoryCreateWizard(parentResource, type, type
- .getResourceConfigurationDefinition());
+ .getResourceConfigurationDefinition(), false);
+ wizard.display();
+ }
+ });
+ }
+
+ public static void showImportWizard(final Resource parentResource, ResourceType childType) {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(childType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ ResourceFactoryCreateWizard wizard = new ResourceFactoryCreateWizard(parentResource, type, type
+ .getPluginConfigurationDefinition(), true);
wizard.display();
}
});
@@ -146,7 +164,8 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
}
public Configuration getConfiguration() {
- return configurationTemplateStep.getConfiguration();
+ return (null == configurationTemplateStep) ? this.configurationDefinition.getDefaultTemplate()
+ .createConfiguration() : configurationTemplateStep.getConfiguration();
}
public Resource getParentResource() {
@@ -157,6 +176,10 @@ public class ResourceFactoryCreateWizard extends AbstractWizard {
return createType;
}
+ public boolean isImport() {
+ return isImport;
+ }
+
public void cancel() {
// TODO: revert back to original state
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 4e14b75..d256222 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -202,7 +202,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
platform.setChildren(servers);
}
- return platforms;
+ return SerialUtility.prepare(platforms, "ResourceService.findRecentlyAddedResources");
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
@@ -281,4 +281,13 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
}
+ public Resource manuallyAddResource(int resourceTypeId, int parentResourceId, Configuration pluginConfiguration) {
+ try {
+ Resource result = discoveryBoss.manuallyAddResource(getSessionSubject(), resourceTypeId, parentResourceId,
+ pluginConfiguration);
+ return SerialUtility.prepare(result, "ResourceService.manuallyAddResource");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
}
\ No newline at end of file
commit f4c316bed1ed30f33cc6365421f051b945710870
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 4 15:06:46 2010 -0400
Disable the experimental browser window logging out of the box
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index ed2ce42..93d7ecb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -38,7 +38,7 @@
2. In hosted mode, the windows are not automatically closed,
although you can easily close them manually in the usual way
-->
- <set-property name="log_WindowLogger" value="ENABLED" />
+ <set-property name="log_WindowLogger" value="DISABLED" />
<!--
You probably will want to disable the default `DivLogger` as well:
commit 3e06a613d311af3100a6d0a605a43a07564c9406
Merge: e68906f... 614e969...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 21:12:36 2010 -0400
Merge branch 'master' into master-jay
commit e68906f5c7e3048921143a9d029a9e421c019f1d
Merge: a524764... 54400ac...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 18:18:10 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
diff --cc .classpath
index 0a567d7,0a567d7..9a892fa
--- a/.classpath
+++ b/.classpath
@@@ -255,5 -255,5 +255,6 @@@
<classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"/>
++ <classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/gwt-log/gwt-log/3.0.3/gwt-log-3.0.3.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit a5247649b27165b9f2356a2d0d8dc983eaf7f8db
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 18:00:25 2010 -0400
Reverting a change made in 6415ed10e3b0d967b712a7be0aa0a3fcf4ce95cb, it
breaks rendering of single-element paths (like "#Bundles or #Reports).
The BookmarkableView's renderView needs to be invoked.
I didn't see any ill effect of adding this back in, so I'm not sure of the
intent of the original change. May need more work.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 34cf23e..d685c41 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -300,12 +300,19 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
}
if (this.currentCanvas instanceof BookmarkableView) {
- viewPath.next();
- if (!viewPath.isEnd()) {
- ((BookmarkableView) this.currentCanvas).renderView(viewPath);
- }
+ ((BookmarkableView) this.currentCanvas).renderView(viewPath.next());
}
+ // reverting this is as it breaks rendering of single-element paths (like "#Bundles or
+ // #Reports. the BookmarkableView's renderView needs to be invoked.
+ //
+ //if (this.currentCanvas instanceof BookmarkableView) {
+ // viewPath.next();
+ // if (!viewPath.isEnd()) {
+ // ((BookmarkableView) this.currentCanvas).renderView(viewPath);
+ // }
+ //}
+
refreshBreadCrumbTrail();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index fb382fa..4dc2182 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -45,6 +45,7 @@ import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.deployment.BundleDeploymentView;
import org.rhq.enterprise.gui.coregui.client.bundle.destination.BundleDestinationListView;
@@ -98,7 +99,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
this.bundle = bundle;
- addMember(new BackButton(extendLocatorId("BackButton"), "Back to All Bundles", "Bundles"));
+ addMember(new BackButton(extendLocatorId("BackButton"), "Back to All Bundles", BundleTopView.VIEW_ID));
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
commit fe8861d6f05baadd45f2ee9cad1deec2236970bf
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 16:27:38 2010 -0400
add jxpath test dep lib
diff --git a/.classpath b/.classpath
index c13d973..0a567d7 100644
--- a/.classpath
+++ b/.classpath
@@ -254,5 +254,6 @@
<classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.2/smartgwt-2.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit 346c2223929d9d776a5bdc280fe87fcd159e2cb2
Merge: af34961... 77a5659...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 10:04:07 2010 -0400
Merge branch 'master' into master-jay
commit 77a56598165197564c6e165211a04ec31a9979f8
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Sep 28 12:35:44 2010 -0400
AutoGroup/ResourceTree work
- Fix up breadcrumbs for AutoGroup selections and also fix up some path
- issues that were happening when selecting AG resources.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index bb39f2d..34cf23e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -254,10 +254,13 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
if (viewPath.matches("(" + ResourceTopView.VIEW_ID + "|" + ResourceGroupTopView.VIEW_ID + ")/[^/]*")) {
// e.g. "Resource/10001"
if (!currentViewPath.startsWith(viewPath)) {
- // The Resource that was selected is not the same Resource that was previously selected -
- // grab the end portion of the previous history URL and append it to the new history URL,
- // so the same tab is selected for the new Resource.
- String suffix = currentViewPath.replaceFirst("^[^/]*/[^/]*", "");
+ // The Node that was selected is not the same Node that was previously selected - it
+ // may not even be the same node type. For example, the user could have moved from a
+ // resource to an autogroup in the same tree. Try to keep the tab selection sticky as best as
+ // possible while moving from one view to another by grabbing the end portion of the previous
+ // history URL and append it to the new history URL. The suffix is assumed to follow the
+ // ID (numeric) portion of the currentViewPath.
+ String suffix = currentViewPath.replaceFirst("\\D*[^/]*", "");
viewPath += suffix;
}
}
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 6a7cba9..0d16bea 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
@@ -236,7 +236,6 @@ public class ResourceTreeView extends LocatableVLayout {
// get back to this node given the id of the backing group (from the viewpath)
autoGroupNodeMap.put(result.getId(), agNode);
callback.onSuccess(result);
- //renderAutoGroup(result);
}
});
} else {
@@ -302,6 +301,23 @@ public class ResourceTreeView extends LocatableVLayout {
}
}
+ private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
+ if (node instanceof ResourceTreeNode) {
+ Resource nr = ((ResourceTreeNode) node).getResource();
+ String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
+ String icon = "types/" + nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
+
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
+
+ } else if (node instanceof AutoGroupTreeNode) {
+ String name = ((AutoGroupTreeNode) node).getBackingGroupName();
+ String display = node.getName() + " <span class=\"subtitle\">" + name + "</span>";
+ String icon = "types/" + ((AutoGroupTreeNode) node).getResourceType().getCategory() + "_up_16.png";
+
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
+ }
+ }
+
private void showContextMenu(AutoGroupTreeNode agNode) {
getAutoGroupBackingGroup(agNode, new AsyncCallback<ResourceGroup>() {
public void onFailure(Throwable caught) {
@@ -680,23 +696,6 @@ public class ResourceTreeView extends LocatableVLayout {
}
}
- private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
- if (node instanceof ResourceTreeNode) {
-
- Resource nr = ((ResourceTreeNode) node).getResource();
- String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
- String icon = "types/" + nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
-
- } else {
-
- // if (node.getName() != null) {
- // viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
- // }
- }
- }
-
/*private List<Resource> preload(final List<Resource> lineage) {
final ArrayList<Resource> list = new ArrayList<Resource>(lineage);
@@ -730,8 +729,9 @@ public class ResourceTreeView extends LocatableVLayout {
currentViewId = viewPath.getCurrent();
String currentViewIdPath = currentViewId.getPath();
if ("AutoGroup".equals(currentViewIdPath)) {
- ViewId nextViewId = viewPath.getNext();
- Integer autoGroupId = Integer.parseInt(nextViewId.getPath());
+ // Move the currentViewId to the ID portion to play better with other code
+ currentViewId = viewPath.getNext();
+ Integer autoGroupId = Integer.parseInt(currentViewId.getPath());
setSelectedAutoGroup(autoGroupId);
} else {
Integer resourceId = Integer.parseInt(currentViewId.getPath());
commit af349612d16eb487345a7bf9d9b2921c7854e475
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 09:57:45 2010 -0400
ResourceTree Authz work
- support for locked nodes
- support for autogroups for non-inventory managers. Now that AGs are
backed by compat groups it's necessary for non-inv-managers
to be able to create and access the private groups that they own. Private
groups (aka subject-owned groups) are new, they are basically groups
that are tagged with the creating subjectId. Those groups can be
created (via a new slsb call) and fetched (via a new ResourceGroupCriteria
filter) w/o inventory manager perms.
- note: i had to move rhq_subject to auth-schema from authz-schema and
slightly change the dbsetup order to make it ok for rhq_resource_group to
reference rhq_subject.
- schema spec bumped to 2.97
- added ResourceLineageComposite to combine Resource and locked/viewable
info.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 02aa606..4035ed5 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.96</db.schema.version>
+ <db.schema.version>2.97</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup-build.xml b/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
index f4993e5..b0ee520 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
@@ -39,7 +39,7 @@ To run the default target, you must set one of the following properties to true:
<property name="dbsetup.scripts.dir" value="${basedir}/src/main/scripts/dbsetup" />
<property name="dbsetup.output.dir" value="${basedir}/target/dbsetup" /> <!-- away from classes so it doesn't go into the jar -->
<!-- define the setup creation processing order. note, removals are done in the reverse order -->
- <property name="dbsetup.subsystems" value="config,cluster,inventory,auth,authz,search,dashboard,operation,event,alert,sysconfig,scheduler,amps,measurement,content,resource-request,jms,obsolete"/>
+ <property name="dbsetup.subsystems" value="config,cluster,auth,inventory,authz,search,dashboard,operation,event,alert,sysconfig,scheduler,amps,measurement,content,resource-request,jms,obsolete"/>
<property name="dbsetup.combined.schema" value="${dbsetup.output.dir}/all-schema.xml" />
<property name="dbsetup.combined.data" value="${dbsetup.output.dir}/all-data.xml" />
<property name="dbsetup.tstamp.file" value="${dbsetup.output.dir}/dbsetup-combine.tstamp" />
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/auth-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/auth-schema.xml
index d24b386..9b77256 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/auth-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/auth-schema.xml
@@ -16,5 +16,24 @@
</index>
</table>
+
+ <table name="RHQ_SUBJECT">
+ <column name="ID" default="sequence-only" initial="10001"
+ primarykey="true" required="true" type="INTEGER"/>
+ <column name="NAME" required="true" size="100" type="VARCHAR2"/>
+ <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/>
+ <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/>
+ <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/>
+ <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/>
+ <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/>
+ <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/>
+ <column name="DEPARTMENT" size="100" type="VARCHAR2"/>
+ <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/>
+ <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/>
+
+ <index name="RHQ_SUBJECT_AUTH_KEY" unique="true">
+ <field ref="NAME"/>
+ </index>
+ </table>
</dbsetup>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/authz-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/authz-schema.xml
index 8d9f738..b1385e9 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/authz-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/authz-schema.xml
@@ -50,25 +50,6 @@
</constraint>
</table>
- <table name="RHQ_SUBJECT">
- <column name="ID" default="sequence-only" initial="10001"
- primarykey="true" required="true" type="INTEGER"/>
- <column name="NAME" required="true" size="100" type="VARCHAR2"/>
- <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/>
- <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/>
- <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/>
- <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/>
- <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/>
- <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/>
- <column name="DEPARTMENT" size="100" type="VARCHAR2"/>
- <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/>
- <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/>
-
- <index name="RHQ_SUBJECT_AUTH_KEY" unique="true">
- <field ref="NAME"/>
- </index>
- </table>
-
<table name="RHQ_SUBJECT_ROLE_MAP">
<column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/>
<column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
index 6246880..5d89c2d 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
@@ -168,11 +168,14 @@
<column name="CATEGORY" type="VARCHAR2" size="20" required="true"/>
+ <!-- This is only set if this is a subject-owned group (like an autogroup) -->
+ <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/>
+
<!-- These two only set if this is a backing group for a resource auto-cluster -->
<column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/>
<column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/>
- <!-- This only set if this is a backing group for a resource auto-group -->
+ <!-- This is only set if this is a backing group for a resource auto-group -->
<column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/>
<column name="VISIBLE" type="BOOLEAN"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index f0940ab..b477b09 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3226,9 +3226,21 @@
REFERENCES RHQ_RESOURCE (ID)
</statement>
</schema-directSQL>
-
</schemaSpec>
-
+
+ <schemaSpec version="2.97">
+ <!-- Support subject-owned groups (e.g. autogroups) -->
+ <schema-addColumn table="RHQ_RESOURCE_GROUP" column="SUBJECT_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_RESOURCE_GROUP foreign key relation to RHQ_SUBJECT for owned groups">
+ ALTER TABLE RHQ_RESOURCE_GROUP
+ ADD CONSTRAINT RHQ_RG_SUBJECT_ID_FK
+ FOREIGN KEY (SUBJECT_ID)
+ REFERENCES RHQ_SUBJECT (ID)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index 477a128..4a93c1f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -24,11 +24,13 @@ package org.rhq.core.domain.auth;
import java.io.Serializable;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -37,6 +39,7 @@ import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
@@ -47,6 +50,7 @@ import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.Recordizable;
/**
@@ -271,6 +275,10 @@ public class Subject implements Serializable, Recordizable {
@ManyToMany
private java.util.Set<Role> ldapRoles;
+ // When a subject is removed any owned groups should also be removed
+ @OneToMany(mappedBy = "subject", fetch = FetchType.LAZY)
+ private List<ResourceGroup> ownedGroups = null;
+
@Transient
private Integer sessionId = null;
@@ -448,6 +456,14 @@ public class Subject implements Serializable, Recordizable {
getLdapRoles().remove(role);
}
+ public List<ResourceGroup> getOwnedGroups() {
+ return ownedGroups;
+ }
+
+ public void setOwnedGroups(List<ResourceGroup> ownedGroups) {
+ this.ownedGroups = ownedGroups;
+ }
+
@Override
public String toString() {
return "org.rhq.core.domain.auth.Subject[id=" + id + ",name=" + name + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
index 2278c7f..835821a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
@@ -46,6 +46,7 @@ public class ResourceGroupCriteria extends TaggedCriteria {
private Boolean filterRecursive;
private Integer filterResourceTypeId; // requires overrides
private String filterResourceTypeName; // requires overrides
+ private Integer filterSubjectId; // requires overrides
private Integer filterAutoGroupParentResourceId; // requires overrides
private String filterPluginName; // requires overrides
private GroupCategory filterGroupCategory;
@@ -56,6 +57,7 @@ public class ResourceGroupCriteria extends TaggedCriteria {
private Integer filterExplicitResourceTypeId; // requires overrides
private String filterExplicitResourceTypeName; // requires overrides
private Integer filterGroupDefinitionId; // requires overrides
+ private Boolean filterPrivate; /* if true, show only private groups for the calling user */
private Boolean filterVisible = true; /* only show visible groups by default */
private boolean fetchExplicitResources;
@@ -74,6 +76,7 @@ public class ResourceGroupCriteria extends TaggedCriteria {
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
filterOverrides.put("autoGroupParentResourceId", "autoGroupParentResource.id = ?");
+ filterOverrides.put("subjectId", "subject.id = ?");
filterOverrides.put("pluginName", "resourceType.plugin like ?");
filterOverrides.put("downMemberCount", "" //
+ "id IN ( SELECT implicitGroup.id " //
@@ -148,6 +151,14 @@ public class ResourceGroupCriteria extends TaggedCriteria {
this.filterResourceTypeName = filterResourceTypeName;
}
+ /**
+ * Requires MANAGE_INVENTORY. Use addFilterPrivate(true) to filter on the caller's private groups.
+ * @param filterSubjectId.
+ */
+ public void addFilterSubjectId(Integer filterSubjectId) {
+ this.filterSubjectId = filterSubjectId;
+ }
+
public void addFilterAutoGroupParentResourceId(Integer filterAutoGroupParentResourceId) {
this.filterAutoGroupParentResourceId = filterAutoGroupParentResourceId;
}
@@ -199,6 +210,14 @@ public class ResourceGroupCriteria extends TaggedCriteria {
this.filterGroupDefinitionId = filterGroupDefinitionId;
}
+ public void addFilterPrivate(Boolean filterPrivate) {
+ this.filterPrivate = filterPrivate;
+ }
+
+ public boolean isFilterPrivate() {
+ return (Boolean.TRUE.equals(this.filterPrivate));
+ }
+
public void addFilterVisible(Boolean filterVisible) {
this.filterVisible = filterVisible;
}
@@ -258,8 +277,8 @@ public class ResourceGroupCriteria extends TaggedCriteria {
@Override
public boolean isInventoryManagerRequired() {
- // presently only inventory managers can view/manage group definitions
- return this.filterGroupDefinitionId != null;
+ // presently only inventory managers can view/manage group definitions or see other user's private groups
+ return this.filterGroupDefinitionId != null || this.filterSubjectId != null;
}
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java
new file mode 100644
index 0000000..713a558
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceLineageComposite.java
@@ -0,0 +1,51 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.domain.resource.composite;
+
+import java.io.Serializable;
+
+import org.rhq.core.domain.resource.Resource;
+
+/**
+ * @author jay shaughnessy
+ */
+public class ResourceLineageComposite implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private Resource resource;
+ private boolean isLocked;
+
+ // for gwt serialization
+ @SuppressWarnings("unused")
+ private ResourceLineageComposite() {
+ }
+
+ public ResourceLineageComposite(Resource resource, boolean isLocked) {
+ this.resource = resource;
+ this.isLocked = isLocked;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public boolean isLocked() {
+ return isLocked;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 46d6bcb..5250c11 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -55,6 +55,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.bundle.BundleDestination;
import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
@@ -432,6 +433,12 @@ public class ResourceGroup extends Group {
@ManyToOne
private ResourceType resourceType; // if non-null, it implies a compatible group
+ // The group owner. Certain groups (like autogroups) are not associated with Roles. Instead, they
+ // are bound to specific owners. Subject-Owned groups defer to member-level authorization as needed.
+ @JoinColumn(name = "SUBJECT_ID", referencedColumnName = "ID", nullable = true)
+ @ManyToOne
+ private Subject subject = null;
+
@Column(name = "CLUSTER_KEY", nullable = true)
private String clusterKey;
@@ -612,6 +619,25 @@ public class ResourceGroup extends Group {
}
}
+ public Subject getSubject() {
+ return subject;
+ }
+
+ public void setSubject(Subject subject) {
+ if (this.id > 0 && null != this.subject) {
+ throw new IllegalStateException("The group owner can not be changed after the group is created.");
+ }
+
+ this.subject = subject;
+ }
+
+ /**
+ * @return true if this is a subject-owned group, private to the set subject
+ */
+ public boolean isPrivateGroup() {
+ return (null != this.subject);
+ }
+
public String getClusterKey() {
return clusterKey;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index b282e41..7ad683a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -32,6 +32,7 @@ import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -44,9 +45,7 @@ public interface ResourceGWTService extends RemoteService {
PageList<ResourceComposite> findResourceCompositesByCriteria(ResourceCriteria criteria);
- List<Resource> getResourceLineage(int resourceId);
-
- List<Resource> getResourceLineageAndSiblings(int resourceId);
+ List<ResourceLineageComposite> getResourceLineageAndSiblings(int resourceId);
List<RecentlyAddedResourceComposite> findRecentlyAddedResources(long ctime, int maxItems);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
index d968e19..f48fd96 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
@@ -37,6 +37,14 @@ public interface ResourceGroupGWTService extends RemoteService {
GroupDefinition createGroupDefinition(GroupDefinition groupDefinition);
+ /**
+ * The owner will be set to the session subject.
+ * @param group
+ * @param resourceIds initial members
+ * @return
+ */
+ ResourceGroup createPrivateResourceGroup(ResourceGroup group, int[] resourceIds);
+
ResourceGroup createResourceGroup(ResourceGroup group, int[] resourceIds);
void deleteGroupDefinitions(int[] groupDefinitionIds);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 50700f2..33b22e9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -243,4 +243,9 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
public String getSubTabName() {
return subTabName;
}
+
+ public String getBaseViewPath() {
+ return baseViewPath;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index e5bfc72..90388fc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -271,7 +271,12 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(groupId);
- criteria.addFilterVisible(null);
+
+ // for autogroups we need to add more criteria
+ if (AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath())) {
+ criteria.addFilterVisible(null);
+ criteria.addFilterPrivate(true);
+ }
GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
new AsyncCallback<PageList<ResourceGroupComposite>>() {
@@ -281,6 +286,11 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
}
public void onSuccess(PageList<ResourceGroupComposite> result) {
+ if (result.isEmpty()) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to load group composite for group with id " + groupId);
+ }
+
groupComposite = result.get(0);
loadResourceType(groupComposite, viewPath, globalPermissions);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index 71e6c61..f1dad07 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -23,6 +23,7 @@ import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.ResourceTreeNode;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
@@ -40,15 +41,19 @@ public class CustomResourceTreeGrid extends LocatableTreeGrid {
if (record instanceof TreeNode) {
boolean open = getTree().isOpen((TreeNode) record);
- if (record instanceof ResourceTreeDatasource.ResourceTreeNode) {
- Resource resource = ((ResourceTreeDatasource.ResourceTreeNode) record).getResource();
+ if (record instanceof ResourceTreeNode) {
+ ResourceTreeNode node = (ResourceTreeNode) record;
- boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
+ if (node.isLocked()) {
+ return "global/Locked_16.png";
- String category = resource.getResourceType().getCategory().getDisplayName();
-
- return "types/" + category + "_" + (up ? "up" : "down") + "_16.png";
+ } else {
+ Resource resource = ((ResourceTreeDatasource.ResourceTreeNode) record).getResource();
+ String category = resource.getResourceType().getCategory().getDisplayName();
+ boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
+ return "types/" + category + "_" + (up ? "up" : "down") + "_16.png";
+ }
} else {
return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 3ad6835..5f9e07c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -30,7 +30,6 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.fields.DataSourceImageField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.types.DSDataFormat;
@@ -38,8 +37,6 @@ import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.ResourceAvailability;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceSubCategory;
@@ -61,15 +58,17 @@ import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
*/
public class ResourceTreeDatasource extends DataSource {
private List<Resource> initialData;
+ private List<Resource> lockedData;
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
- public ResourceTreeDatasource(List<Resource> initialData) {
+ public ResourceTreeDatasource(List<Resource> initialData, List<Resource> lockedData) {
setClientOnly(false);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
this.initialData = initialData;
+ this.lockedData = (null != lockedData) ? lockedData : new ArrayList<Resource>();
DataSourceField idDataField = new DataSourceTextField("id", "ID");
idDataField.setPrimaryKey(true);
@@ -80,22 +79,12 @@ public class ResourceTreeDatasource extends DataSource {
DataSourceTextField descriptionDataField = new DataSourceTextField("description", "Description");
descriptionDataField.setCanEdit(false);
- DataSourceImageField availabilityDataField = new DataSourceImageField("currentAvailability", "Availability");
- descriptionDataField.setCanEdit(false);
-
DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
parentIdField.setForeignKey("id");
- // parentIdField.setRootValue(rootId);
-
- // DataSourceTextField parentKeyField = new DataSourceTextField("parentKey", "Parent KEY");
- // parentKeyField.setForeignKey("id");
- // parentKeyField.setRootValue(rootId);
-
- // nameDataField.setType(FieldType.);
setDropExtraFields(false);
- setFields(idDataField, nameDataField, descriptionDataField, availabilityDataField);
+ setFields(idDataField, nameDataField, descriptionDataField);
}
@Override
@@ -127,7 +116,7 @@ public class ResourceTreeDatasource extends DataSource {
}
public void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
+ //final long start = System.currentTimeMillis();
String parentResourceId = request.getCriteria().getAttribute("parentId");
// System.out.println("All attributes: " + Arrays.toString(request.getCriteria().getAttributes()));
@@ -173,7 +162,7 @@ public class ResourceTreeDatasource extends DataSource {
ResourceTypeRepository.MetadataType.subCategory),
new ResourceTypeRepository.ResourceTypeLoadedCallback() {
public void onResourceTypeLoaded(List<Resource> result) {
- TreeNode[] treeNodes = buildNodes(result);
+ TreeNode[] treeNodes = buildNodes(result, lockedData);
response.setData(treeNodes);
processResponse(requestId, response);
response.setStatus(DSResponse.STATUS_SUCCESS);
@@ -187,11 +176,11 @@ public class ResourceTreeDatasource extends DataSource {
* @param resources
* @return
*/
- public static TreeNode[] buildNodes(List<Resource> resources) {
+ public static TreeNode[] buildNodes(List<Resource> resources, List<Resource> lockedData) {
ResourceTreeNode[] nodes = new ResourceTreeNode[resources.size()];
for (int i = 0; i < resources.size(); i++) {
Resource resource = resources.get(i);
- ResourceTreeNode node = new ResourceTreeNode(resource);
+ ResourceTreeNode node = new ResourceTreeNode(resource, lockedData.contains(resource));
nodes[i] = node;
}
@@ -350,9 +339,11 @@ public class ResourceTreeDatasource extends DataSource {
public static class ResourceTreeNode extends EnhancedTreeNode {
private Resource resource;
+ private boolean isLocked;
- private ResourceTreeNode(Resource resource) {
+ private ResourceTreeNode(Resource resource, boolean isLocked) {
this.resource = resource;
+ this.isLocked = isLocked;
String id = idOf(resource);
setID(id);
@@ -369,21 +360,12 @@ public class ResourceTreeDatasource extends DataSource {
setParentID(parentId);
setAttribute(Attributes.PARENT_ID, parentId);
- // System.out.println(id + " / " + parentId);
- // setAttribute("parentKey", resource.getParentResource() == null ? 0 : (resource.getParentResource().getId() + resource.getResourceType().getName()));
-
String name = resource.getName();
setName(name);
setAttribute(Attributes.NAME, name);
setAttribute(Attributes.DESCRIPTION, resource.getDescription());
- ResourceAvailability currentAvail = resource.getCurrentAvailability();
- setAttribute(
- "currentAvailability",
- (null != currentAvail && currentAvail.getAvailabilityType() == AvailabilityType.UP) ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
-
Set<ResourceType> childTypes = resource.getResourceType().getChildResourceTypes();
setIsFolder((childTypes != null && !childTypes.isEmpty()));
}
@@ -392,6 +374,10 @@ public class ResourceTreeDatasource extends DataSource {
return this.resource;
}
+ public boolean isLocked() {
+ return isLocked;
+ }
+
public static String idOf(Resource resource) {
return idOf(resource.getId());
}
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 0d16bea..4cea21b 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
@@ -63,6 +63,7 @@ import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
@@ -142,14 +143,20 @@ public class ResourceTreeView extends LocatableVLayout {
if (!selectionEvent.isRightButtonDown() && selectionEvent.getState()) {
ListGridRecord selectedRecord = treeGrid.getSelectedRecord();
if (selectedRecord instanceof ResourceTreeNode) {
- System.out.println("AutoGroup Node selected in tree: " + selectedRecord);
-
ResourceTreeNode resourceNode = (ResourceTreeNode) selectedRecord;
- selectedNodeId = resourceNode.getID();
- String viewPath = "Resource/" + resourceNode.getResource().getId();
- String currentViewPath = History.getToken();
- if (!currentViewPath.startsWith(viewPath)) {
- CoreGUI.goToView(viewPath);
+
+ if (!resourceNode.isLocked()) {
+ System.out.println("Resource Node selected in tree: " + selectedRecord);
+
+ selectedNodeId = resourceNode.getID();
+ String viewPath = "Resource/" + resourceNode.getResource().getId();
+ String currentViewPath = History.getToken();
+ if (!currentViewPath.startsWith(viewPath)) {
+ CoreGUI.goToView(viewPath);
+ }
+ } else {
+ // TODO: Can we select the previous node? Or do we need a "Locked" hover etc...
+ treeGrid.deselectAllRecords();
}
} else if (selectedRecord instanceof AutoGroupTreeNode) {
System.out.println("AutoGroup Node selected in tree: " + selectedRecord);
@@ -183,7 +190,9 @@ public class ResourceTreeView extends LocatableVLayout {
if (event.getNode() instanceof AutoGroupTreeNode) {
showContextMenu((AutoGroupTreeNode) event.getNode());
} else if (event.getNode() instanceof ResourceTreeNode) {
- showContextMenu((ResourceTreeNode) event.getNode());
+ if (!((ResourceTreeNode) event.getNode()).isLocked()) {
+ showContextMenu((ResourceTreeNode) event.getNode());
+ }
}
}
});
@@ -207,6 +216,7 @@ public class ResourceTreeView extends LocatableVLayout {
// get the backing group if it exists, otherwise create the group
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterPrivate(true);
criteria.addFilterResourceTypeId(agNode.getResourceType().getId());
criteria.addFilterAutoGroupParentResourceId(agNode.getParentResource().getId());
criteria.addFilterVisible(false);
@@ -224,8 +234,7 @@ public class ResourceTreeView extends LocatableVLayout {
backingGroup.setAutoGroupParentResource(agNode.getParentResource());
backingGroup.setResourceType(agNode.getResourceType());
backingGroup.setVisible(false);
- backingGroup.setRecursive(false);
- resourceGroupService.createResourceGroup(backingGroup, childIds,
+ resourceGroupService.createPrivateResourceGroup(backingGroup, childIds,
new AsyncCallback<ResourceGroup>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to create resource autogroup", caught);
@@ -596,65 +605,79 @@ public class ResourceTreeView extends LocatableVLayout {
selectedNodeId = ResourceTreeNode.idOf(selectedResourceId);
final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
- // This is an expensive call, but loads all nodes that are visible in the tree given a selected resource
- resourceService.getResourceLineageAndSiblings(selectedResourceId, new AsyncCallback<List<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to lookup platform for tree", caught);
- }
- public void onSuccess(List<Resource> result) {
- Resource root = result.get(0);
+ // This is an expensive call, but loads all nodes that are visible in the tree given a selected resource
+ resourceService.getResourceLineageAndSiblings(selectedResourceId,
+ new AsyncCallback<List<ResourceLineageComposite>>() {
- if (!root.equals(ResourceTreeView.this.rootResource)) {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to lookup platform for tree", caught);
+ }
- if (treeGrid != null) {
- treeGrid.destroy();
- }
- buildTree();
+ public void onSuccess(List<ResourceLineageComposite> result) {
+ Resource root = result.get(0).getResource();
- setRootResource(root);
+ final List<Resource> lineage = new ArrayList<Resource>(result.size());
+ final List<Resource> lockedData = new ArrayList<Resource>();
- // seed datasource with initial resource list
- ResourceTreeDatasource dataSource = new ResourceTreeDatasource(result);
- treeGrid.setDataSource(dataSource);
+ for (ResourceLineageComposite r : result) {
+ lineage.add(r.getResource());
+ if (r.isLocked()) {
+ lockedData.add(r.getResource());
+ }
+ }
- addMember(treeGrid);
+ if (!root.equals(ResourceTreeView.this.rootResource)) {
- treeGrid.fetchData(treeGrid.getCriteria(), new DSCallback() {
- public void execute(DSResponse response, Object rawData, DSRequest request) {
- System.out.println("Done fetching data for tree.");
- updateSelection();
+ if (treeGrid != null) {
+ treeGrid.destroy();
}
- });
+ buildTree();
- updateSelection();
+ setRootResource(root);
- } else {
- ResourceTypeRepository.Cache.getInstance().loadResourceTypes(
- result,
- EnumSet.of(ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.subCategory),
- new ResourceTypeRepository.ResourceTypeLoadedCallback() {
- public void onResourceTypeLoaded(List<Resource> result) {
- treeGrid.getTree().linkNodes(ResourceTreeDatasource.buildNodes(result));
-
- TreeNode selectedNode = treeGrid.getTree().findById(selectedNodeId);
- if (selectedNode != null) {
- updateSelection();
-
- } else {
- CoreGUI.getMessageCenter().notify(
- new Message("Failed to select Resource [" + selectedResourceId + "] in tree.",
- Message.Severity.Warning));
- }
+ // seed datasource with initial resource list and which ancestor resources are locked
+ ResourceTreeDatasource dataSource = new ResourceTreeDatasource(lineage, lockedData);
+ treeGrid.setDataSource(dataSource);
+ addMember(treeGrid);
+
+ treeGrid.fetchData(treeGrid.getCriteria(), new DSCallback() {
+ public void execute(DSResponse response, Object rawData, DSRequest request) {
+ System.out.println("Done fetching data for tree.");
+ updateSelection();
}
});
+ updateSelection();
+
+ } else {
+ ResourceTypeRepository.Cache.getInstance().loadResourceTypes(
+ lineage,
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory),
+ new ResourceTypeRepository.ResourceTypeLoadedCallback() {
+ public void onResourceTypeLoaded(List<Resource> result) {
+ treeGrid.getTree()
+ .linkNodes(ResourceTreeDatasource.buildNodes(lineage, lockedData));
+
+ TreeNode selectedNode = treeGrid.getTree().findById(selectedNodeId);
+ if (selectedNode != null) {
+ updateSelection();
+
+ } else {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to select Resource [" + selectedResourceId
+ + "] in tree.", Message.Severity.Warning));
+ }
+
+ }
+ });
+
+ }
}
- }
- });
+ });
}
public void setSelectedAutoGroup(final Integer selectedAutoGroupId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 66a25be..2e2f6d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -39,6 +39,7 @@ import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.IntExtractor;
@@ -167,13 +168,8 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
};
- public List<Resource> getResourceLineage(int resourceId) {
- return SerialUtility.prepare(resourceManager.getResourceLineage(resourceId),
- "ResourceService.getResourceLineage");
- }
-
- public List<Resource> getResourceLineageAndSiblings(int resourceId) {
- return SerialUtility.prepare(resourceManager.getResourceLineageAndSiblings(resourceId),
+ public List<ResourceLineageComposite> getResourceLineageAndSiblings(int resourceId) {
+ return SerialUtility.prepare(resourceManager.getResourceLineageAndSiblings(getSessionSubject(), resourceId),
"ResourceService.getResourceLineageAndSiblings");
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index 1ddecc3..2015091 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -87,6 +87,17 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ public ResourceGroup createPrivateResourceGroup(ResourceGroup group, int[] resourceIds) {
+ try {
+ Subject user = getSessionSubject();
+ group = groupManager.createPrivateResourceGroup(user, group);
+ groupManager.setAssignedResources(user, group.getId(), resourceIds, true);
+ return SerialUtility.prepare(group, "ResourceGroupService.createResourceGroup");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
public ResourceGroup createResourceGroup(ResourceGroup group, int[] resourceIds) {
try {
Subject user = getSessionSubject();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index 4e1a53d..37ec2c9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -48,6 +48,7 @@ import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.SubjectCriteria;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.server.PersistenceUtility;
@@ -58,6 +59,7 @@ import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.core.CustomJaasDeploymentServiceMBean;
import org.rhq.enterprise.server.exception.LoginException;
+import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -69,7 +71,6 @@ import org.rhq.enterprise.server.util.CriteriaQueryRunner;
*/
@Stateless
public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRemote {
- @SuppressWarnings("unused")
private final Log log = LogFactory.getLog(SubjectManagerBean.class);
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
@@ -79,6 +80,10 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
private AuthorizationManagerLocal authorizationManager;
@EJB
+ @IgnoreDependency
+ private ResourceGroupManagerLocal resourceGroupManager;
+
+ @EJB
private SystemManagerLocal systemManager;
@EJB
@@ -508,6 +513,25 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
deletePrincipal(subject, doomedSubject);
}
+ // one more thing, delete any owned groups
+ List<ResourceGroup> ownedGroups = doomedSubject.getOwnedGroups();
+ if (!ownedGroups.isEmpty()) {
+ int size = ownedGroups.size();
+ int[] ownedGroupIds = new int[size];
+ for (int i = 0; (i < size); ++i) {
+ ownedGroupIds[i] = ownedGroups.get(i).getId();
+ }
+ try {
+ resourceGroupManager.deleteResourceGroups(subject, ownedGroupIds);
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.error("Error deleting owned group " + ownedGroupIds, t);
+ } else {
+ log.error("Error deleting owned group " + ownedGroupIds + ": " + t.getMessage());
+ }
+ }
+ }
+
deleteSubject(subject, doomedSubject);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
index d675177..1a14a56 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.server.authz;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
@@ -32,6 +33,8 @@ import javax.persistence.Query;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Permission.Target;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.server.RHQConstants;
/**
@@ -117,12 +120,33 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
return true;
}
- Query query = entityManager.createNamedQuery(Subject.QUERY_HAS_GROUP_PERMISSION);
- query.setParameter("subject", subject);
- query.setParameter("permission", permission);
- query.setParameter("groupId", groupId);
- long count = (Long) query.getSingleResult();
- return (count != 0);
+ ResourceGroup group = entityManager.find(ResourceGroup.class, groupId);
+ Subject owner = group.getSubject();
+
+ if (null == owner) {
+ // role-owned group
+ Query query = entityManager.createNamedQuery(Subject.QUERY_HAS_GROUP_PERMISSION);
+ query.setParameter("subject", subject);
+ query.setParameter("permission", permission);
+ query.setParameter("groupId", groupId);
+ long count = (Long) query.getSingleResult();
+ return (count != 0);
+
+ } else {
+ // don't let a user other than the owner do anything with this group
+ if (!subject.equals(owner)) {
+ return false;
+ }
+
+ // subject-owned group, requires perm check against each group member
+ Set<Resource> members = group.getExplicitResources();
+ List<Integer> memberIds = new ArrayList<Integer>(members.size());
+ for (Resource member : members) {
+ memberIds.add(member.getId());
+ }
+
+ return hasResourcePermission(owner, permission, memberIds);
+ }
}
public boolean hasResourcePermission(Subject subject, Permission permission, int resourceId) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 0528b06..bf213c0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -94,6 +94,7 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceHealthComposite;
import org.rhq.core.domain.resource.composite.ResourceIdFlyWeight;
import org.rhq.core.domain.resource.composite.ResourceInstallCount;
+import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.composite.ResourceWithAvailability;
import org.rhq.core.domain.resource.flyweight.FlyweightCache;
@@ -721,27 +722,68 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return resourceLineage;
}
- public List<Resource> getResourceLineageAndSiblings(int resourceId) {
- List<Resource> resourceLineage = getResourceLineage(resourceId);
- List<Resource> result = new LinkedList<Resource>();
+ public List<ResourceLineageComposite> getResourceLineageAndSiblings(Subject subject, int resourceId) {
+ boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
- Resource platform = resourceLineage.get(0);
- result.add(platform);
- for (Resource resource : resourceLineage) {
- if (resource.getParentResource() != null) {
- // This ensures Hibernate actually fetches the parent Resource.
- resource.getParentResource().getId();
- }
- Set<Resource> childResources = resource.getChildResources();
- result.addAll(childResources);
- for (Resource childResource : childResources) {
- // This ensures Hibernate actually fetches the parent Resource.
- childResource.getParentResource().getId();
- Set<Resource> grandchildResources = childResource.getChildResources();
- result.addAll(grandchildResources);
- for (Resource grandchildResource : grandchildResources) {
+ // get the raw resource lineage up to the platform. We'll check the auth below
+ List<Resource> rawResourceLineage = getResourceLineage(resourceId);
+ int depth = rawResourceLineage.size();
+ Resource parent = (depth > 1) ? rawResourceLineage.get(depth - 2) : null;
+
+ // record which of the raw ancestry is locked from view
+ List<ResourceLineageComposite> resourceLineage = new ArrayList<ResourceLineageComposite>(rawResourceLineage
+ .size());
+ for (Resource resource : rawResourceLineage) {
+ resourceLineage.add(new ResourceLineageComposite(resource, !authorizationManager.canViewResource(subject,
+ resource.getId())));
+ }
+
+ // fill out the tree, including only the direct ancestors and all viewable relations
+ List<ResourceLineageComposite> result = new LinkedList<ResourceLineageComposite>();
+
+ for (ResourceLineageComposite ancestor : resourceLineage) {
+ // always include a direct ancestor
+ result.add(ancestor);
+
+ // if the ancestor is not locked, include relevant children. Also, always show viewable
+ // siblings of the target resource.
+ if (!ancestor.isLocked() || ancestor.getResource() == parent) {
+
+ // get children
+ Set<Resource> children = ancestor.getResource().getChildResources();
+ // only add the viewable children
+ List<Resource> viewableChildren = new ArrayList<Resource>(children.size());
+ for (Resource child : children) {
+ boolean isCommitted = (child.getInventoryStatus() == InventoryStatus.COMMITTED);
+ boolean isViewable = (isInventoryManager || authorizationManager.canViewResource(subject, child
+ .getId()));
+ if (isCommitted && isViewable) {
+ // if not a direct ancestor add to the list (direct ancestors already added by default)
+ if (!rawResourceLineage.contains(child)) {
+ child.getParentResource().getId();
+ result.add(new ResourceLineageComposite(child, false));
+ }
+ viewableChildren.add(child);
+ }
+ }
+
+ // get grandchildren
+ for (Resource child : viewableChildren) {
// This ensures Hibernate actually fetches the parent Resource.
- grandchildResource.getParentResource().getId();
+ child.getParentResource().getId();
+ Set<Resource> grandChildren = child.getChildResources();
+ for (Resource grandChild : grandChildren) {
+ boolean isCommitted = (grandChild.getInventoryStatus() == InventoryStatus.COMMITTED);
+ boolean isViewable = (isInventoryManager || authorizationManager.canViewResource(subject,
+ grandChild.getId()));
+ if (isCommitted && isViewable) {
+ // if not a direct ancestor add to the list (direct ancestors already added by default)
+ if (!rawResourceLineage.contains(grandChild)) {
+ grandChild.getParentResource().getId();
+ result.add(new ResourceLineageComposite(grandChild, false));
+ }
+ }
+ }
}
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 78ece78..6f2ae41 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -43,6 +43,7 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceHealthComposite;
import org.rhq.core.domain.resource.composite.ResourceIdFlyWeight;
import org.rhq.core.domain.resource.composite.ResourceInstallCount;
+import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
import org.rhq.core.domain.resource.composite.ResourceWithAvailability;
import org.rhq.core.domain.resource.flyweight.ResourceFlyweight;
import org.rhq.core.domain.resource.group.ResourceGroup;
@@ -156,11 +157,13 @@ public interface ResourceManagerLocal {
/**
* Returns the lineage of a resource plus all the siblings of the resources in the lineage. This is
- * useful for prepopulating all the resources visible in an expanded tree.
+ * useful for prepopulating all the resources visible in an expanded tree. Composites are returned
+ * that indicate whether the resource is viewable or should be locked in the tree.
+ *
* @param resourceId id of resource
- * @return resoure lineage and siblings
+ * @return resource lineage and siblings
*/
- List<Resource> getResourceLineageAndSiblings(int resourceId);
+ List<ResourceLineageComposite> getResourceLineageAndSiblings(Subject subject, int resourceId);
/**
* Looks up the root of a subtree in the inventory. This will generally find the platform on which
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index 0e7500f..f75d32d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -146,6 +146,15 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
}
}
+ public ResourceGroup createPrivateResourceGroup(Subject subject, //
+ @XmlJavaTypeAdapter(ResourceGroupAdapter.class) ResourceGroup group) {
+
+ group.setSubject(subject);
+ group.setRecursive(false);
+
+ return resourceGroupManager.createResourceGroup(subjectManager.getOverlord(), group);
+ }
+
@RequiredPermission(Permission.MANAGE_INVENTORY)
public ResourceGroup createResourceGroup(Subject user, //
@XmlJavaTypeAdapter(ResourceGroupAdapter.class) ResourceGroup group) {
@@ -1017,8 +1026,9 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
*/
public PageList<ResourceGroupComposite> findResourceGroupCompositesByCriteria(Subject subject,
ResourceGroupCriteria criteria) {
- CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- ;
+
+ CriteriaQueryGenerator generator = getCriteriaQueryGenerator(subject, criteria);
+
String replacementSelectList = ""
+ " new org.rhq.core.domain.resource.group.composite.ResourceGroupComposite( "
+ " ( SELECT COUNT(avail) FROM resourcegroup.explicitResources res JOIN res.currentAvailability avail ) AS explicitCount,"
@@ -1028,17 +1038,6 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
+ " resourcegroup ) ";
generator.alterProjection(replacementSelectList);
- if (criteria.isSecurityManagerRequired()
- && !authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SECURITY)) {
- throw new PermissionException("Subject [" + subject.getName()
- + "] requires SecurityManager permission for requested query criteria.");
- }
-
- if (authorizationManager.isInventoryManager(subject) == false) {
- generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.GROUP, null,
- subject.getId());
- }
-
CriteriaQueryRunner<ResourceGroupComposite> queryRunner = new CriteriaQueryRunner<ResourceGroupComposite>(
criteria, generator, entityManager);
PageList<ResourceGroupComposite> results = queryRunner.execute();
@@ -1299,18 +1298,35 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
public void setAssignedResources(Subject subject, int groupId, int[] resourceIds, boolean setType)
throws ResourceGroupDeleteException {
+ ResourceGroup group = entityManager.find(ResourceGroup.class, groupId);
+ if (group.isPrivateGroup()) {
+ List<Integer> ids = new ArrayList<Integer>(resourceIds.length);
+ for (int id : resourceIds) {
+ ids.add(id);
+ }
+ if (!authorizationManager.canViewResources(subject, ids)) {
+ throw new PermissionException("Subject [" + subject.getName()
+ + "] does not have VIEW permission for all specified resources.");
+ }
+ } else {
+ if (!authorizationManager.isInventoryManager(subject)) {
+ throw new PermissionException("Subject [" + subject.getName()
+ + "] is not authorized for [ MANAGE_INVENTORY ]. Required for changing group membership ");
+ }
+ }
+
List<Integer> currentMembers = resourceManager.findExplicitResourceIdsByResourceGroup(groupId);
List<Integer> newMembers = ArrayUtils.wrapInList(resourceIds); // members needing addition
newMembers.removeAll(currentMembers);
if (newMembers.size() > 0) {
- addResourcesToGroup(subject, groupId, ArrayUtils.unwrapCollection(newMembers));
+ addResourcesToGroup(subjectManager.getOverlord(), groupId, ArrayUtils.unwrapCollection(newMembers));
}
List<Integer> extraMembers = new ArrayList<Integer>(currentMembers); // members needing removal
extraMembers.removeAll(ArrayUtils.wrapInList(resourceIds));
if (extraMembers.size() > 0) {
- removeResourcesFromGroup(subject, groupId, ArrayUtils.unwrapCollection(extraMembers));
+ removeResourcesFromGroup(subjectManager.getOverlord(), groupId, ArrayUtils.unwrapCollection(extraMembers));
}
// As a result of the membership change ensure that the group type is set correctly.
@@ -1461,28 +1477,45 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
@SuppressWarnings("unchecked")
public PageList<ResourceGroup> findResourceGroupsByCriteria(Subject subject, ResourceGroupCriteria criteria) {
- CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- ;
+ CriteriaQueryGenerator generator = getCriteriaQueryGenerator(subject, criteria);
+
+ CriteriaQueryRunner<ResourceGroup> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager);
+ PageList<ResourceGroup> result = queryRunner.execute();
+ return result;
+ }
+
+ private CriteriaQueryGenerator getCriteriaQueryGenerator(Subject subject, ResourceGroupCriteria criteria) {
if (criteria.isSecurityManagerRequired()
&& !authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SECURITY)) {
throw new PermissionException("Subject [" + subject.getName()
+ "] requires SecurityManager permission for requested query criteria.");
}
- if (criteria.isInventoryManagerRequired()
- && !authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_INVENTORY)) {
+ boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
+ boolean groupAuthzRequired = (!(criteria.isFilterPrivate() || isInventoryManager));
+
+ if (criteria.isInventoryManagerRequired() && !isInventoryManager) {
throw new PermissionException("Subject [" + subject.getName()
+ "] requires InventoryManager permission for requested query criteria.");
}
- if (authorizationManager.isInventoryManager(subject) == false) {
+ // if we're searching for private groups set the subject filter to the current user's subjectId
+ // setting it here prevents the caller from spoofing a different user. This is why the subject and
+ // private filters are different. The suject filter can specifiy any use and therefore requires
+ // inventory manager.
+ if (criteria.isFilterPrivate()) {
+ criteria.addFilterPrivate(null);
+ criteria.addFilterSubjectId(subject.getId());
+ }
+
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
+ if (groupAuthzRequired) {
generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.GROUP, null,
subject.getId());
}
- CriteriaQueryRunner<ResourceGroup> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager);
- return queryRunner.execute();
+ return generator;
}
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java
index de96dbf..a0481b1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java
@@ -42,6 +42,28 @@ import org.rhq.core.domain.util.PageList;
@Local
public interface ResourceGroupManagerLocal {
+ /**
+ * NOTE: This is only used to support AutoGroups currently but the idea may be expanded in the future.
+ *
+ * Creates a private, "user-owned" (aka "subject-owned") resource group. This group differs from a role-owned
+ * group in that it can not be assigned to a role, instead it is owned by the user that creates it. It comprises
+ * only a set of resources for which the user has, minimally, view permission. Since a user's view permissions
+ * can change, membership and authz checking must be performed as needed when taking any action on the group.
+ * <br/><br/>
+ * A user does not need MANAGE_INVENTORY to create a sub-group because it is private to his view.
+ * <br/><br/>
+ * This call does not populate the group with members, it only creates the group. The group is automatically set
+ * to be non-recursive.
+ * <br/><br/>
+ * All user-owned groups are deleted if the the user is deleted.
+ *
+ * @param user The user for which the group will be created.
+ * @param group The group characteristics. Any membership defined here is ignored. The recursivity setting is
+ * ignored.
+ * @return The new group.
+ */
+ ResourceGroup createPrivateResourceGroup(Subject user, ResourceGroup group);
+
ResourceGroup getResourceGroupById(Subject user, int id, GroupCategory category)
throws ResourceGroupNotFoundException;
@@ -108,7 +130,10 @@ public interface ResourceGroupManagerLocal {
/**
* This method ensures that the explicit group membership is set to the specified resources. Members
* will be added or removed as necessary. Make sure you pass the correct value for the <setType>
- * parameter.
+ * parameter.
+ * <br/><br/>
+ * For global groups requires MANAGE_INVENTORY. For private groups requires VIEW permission on all specified
+ * resources.
*
* @param subject
* @param groupId
commit 400635fb9e3cf30ac7d55d98330e4ad4e5c120b9
Merge: 1d94af7... 64abb7e...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Sep 28 12:45:20 2010 -0400
Merge branch 'master' into master-jay
commit 1d94af7604a60412da8017e721ef0bb36504d8fd
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Sep 28 12:35:44 2010 -0400
AutoGroup/ResourceTree work
- Fix up breadcrumbs for AutoGroup selections and also fix up some path
- issues that were happening when selecting AG resources.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index b59edba..7c895e0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -339,10 +339,13 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
if (viewPath.matches("(Resource|ResourceGroup)/[^/]*")) {
// e.g. "Resource/10001"
if (!currentViewPath.startsWith(viewPath)) {
- // The Resource that was selected is not the same Resource that was previously selected -
- // grab the end portion of the previous history URL and append it to the new history URL,
- // so the same tab is selected for the new Resource.
- String suffix = currentViewPath.replaceFirst("^[^/]*/[^/]*", "");
+ // The Node that was selected is not the same Node that was previously selected - it
+ // may not even be the same node type. For example, the user could have moved from a
+ // resource to an autogroup in the same tree. Try to keep the tab selection sticky as best as
+ // possible while moving from one view to another by grabbing the end portion of the previous
+ // history URL and append it to the new history URL. The suffix is assumed to follow the
+ // ID (numeric) portion of the currentViewPath.
+ String suffix = currentViewPath.replaceFirst("\\D*[^/]*", "");
viewPath += suffix;
}
}
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 6a7cba9..0d16bea 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
@@ -236,7 +236,6 @@ public class ResourceTreeView extends LocatableVLayout {
// get back to this node given the id of the backing group (from the viewpath)
autoGroupNodeMap.put(result.getId(), agNode);
callback.onSuccess(result);
- //renderAutoGroup(result);
}
});
} else {
@@ -302,6 +301,23 @@ public class ResourceTreeView extends LocatableVLayout {
}
}
+ private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
+ if (node instanceof ResourceTreeNode) {
+ Resource nr = ((ResourceTreeNode) node).getResource();
+ String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
+ String icon = "types/" + nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
+
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
+
+ } else if (node instanceof AutoGroupTreeNode) {
+ String name = ((AutoGroupTreeNode) node).getBackingGroupName();
+ String display = node.getName() + " <span class=\"subtitle\">" + name + "</span>";
+ String icon = "types/" + ((AutoGroupTreeNode) node).getResourceType().getCategory() + "_up_16.png";
+
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
+ }
+ }
+
private void showContextMenu(AutoGroupTreeNode agNode) {
getAutoGroupBackingGroup(agNode, new AsyncCallback<ResourceGroup>() {
public void onFailure(Throwable caught) {
@@ -680,23 +696,6 @@ public class ResourceTreeView extends LocatableVLayout {
}
}
- private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
- if (node instanceof ResourceTreeNode) {
-
- Resource nr = ((ResourceTreeNode) node).getResource();
- String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
- String icon = "types/" + nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
-
- } else {
-
- // if (node.getName() != null) {
- // viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
- // }
- }
- }
-
/*private List<Resource> preload(final List<Resource> lineage) {
final ArrayList<Resource> list = new ArrayList<Resource>(lineage);
@@ -730,8 +729,9 @@ public class ResourceTreeView extends LocatableVLayout {
currentViewId = viewPath.getCurrent();
String currentViewIdPath = currentViewId.getPath();
if ("AutoGroup".equals(currentViewIdPath)) {
- ViewId nextViewId = viewPath.getNext();
- Integer autoGroupId = Integer.parseInt(nextViewId.getPath());
+ // Move the currentViewId to the ID portion to play better with other code
+ currentViewId = viewPath.getNext();
+ Integer autoGroupId = Integer.parseInt(currentViewId.getPath());
setSelectedAutoGroup(autoGroupId);
} else {
Integer resourceId = Integer.parseInt(currentViewId.getPath());
13 years, 8 months
[rhq] 5 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 3 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java | 2 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 20c1c7a109ceebd892838e675ce807c169d70acf
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 4 18:03:28 2010 -0400
Initial Manual Add Work
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index d2c971a..ab4ae27 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -72,4 +72,4 @@ public interface ResourceGWTService extends RemoteService {
List<ResourceError> findResourceErrors(int resourceId);
Resource manuallyAddResource(int resourceTypeId, int parentResourceId, Configuration pluginConfiguration);
-}
\ No newline at end of file
+}
commit 214929db2b569587c45f8bb80c0484d61f38de32
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 4 15:06:46 2010 -0400
Disable the experimental browser window logging out of the box
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 8096fcf..7cb28a3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -38,7 +38,8 @@
2. In hosted mode, the windows are not automatically closed,
although you can easily close them manually in the usual way
-->
- <!-- When enabled FireFox is hard to use due to excessive popup window generation
+ <!--
+ -- When enabled FireFox is hard to use due to excessive popup window generation
<set-property name="log_WindowLogger" value="ENABLED" />
-->
commit cc1e9af8efed88fa2a461031956e3baff2a5b2f3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Sep 28 12:35:44 2010 -0400
AutoGroup/ResourceTree work
- Fix up breadcrumbs for AutoGroup selections and also fix up some path
- issues that were happening when selecting AG resources.
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 2f8ac93..923b925 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
@@ -777,7 +777,6 @@ public class ResourceTreeView extends LocatableVLayout {
String autoGroupIdString = currentViewId.getPath();
Integer autoGroupId = Integer.parseInt(autoGroupIdString);
setSelectedAutoGroup(autoGroupId);
-
} else {
String resourceIdString = currentViewId.getPath();
Integer resourceId = Integer.parseInt(resourceIdString);
commit b49eab1b564ded819319c3cbb90d0c7a16069742
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 1 09:57:45 2010 -0400
ResourceTree Authz work
- support for locked nodes
- support for autogroups for non-inventory managers. Now that AGs are
backed by compat groups it's necessary for non-inv-managers
to be able to create and access the private groups that they own. Private
groups (aka subject-owned groups) are new, they are basically groups
that are tagged with the creating subjectId. Those groups can be
created (via a new slsb call) and fetched (via a new ResourceGroupCriteria
filter) w/o inventory manager perms.
- note: i had to move rhq_subject to auth-schema from authz-schema and
slightly change the dbsetup order to make it ok for rhq_resource_group to
reference rhq_subject.
- schema spec bumped to 2.97
- added ResourceLineageComposite to combine Resource and locked/viewable
info.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 473a257..861fe72 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -178,6 +178,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return SerialUtility.prepare(
resourceManager.getResourceLineageAndSiblings(getSessionSubject(), resourceId),
"ResourceService.getResourceLineageAndSiblings");
+
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
commit 4f39c60546b521f109163ff1edc3ddc46b5fc397
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Sep 28 12:35:44 2010 -0400
AutoGroup/ResourceTree work
- Fix up breadcrumbs for AutoGroup selections and also fix up some path
- issues that were happening when selecting AG resources.
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 923b925..2f8ac93 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
@@ -777,6 +777,7 @@ public class ResourceTreeView extends LocatableVLayout {
String autoGroupIdString = currentViewId.getPath();
Integer autoGroupId = Integer.parseInt(autoGroupIdString);
setSelectedAutoGroup(autoGroupId);
+
} else {
String resourceIdString = currentViewId.getPath();
Integer resourceId = Integer.parseInt(resourceIdString);
13 years, 8 months