summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Negrea <snegrea@redhat.com>2012-09-04 18:12:42 (GMT)
committerStefan Negrea <snegrea@redhat.com>2012-09-04 18:13:54 (GMT)
commit14941af29769ddfd5ecbc6193762a4f15ecd4b88 (patch)
tree12225d6eb231855fc6ee008dbbb7fae9506f4f02
parent0d0f22bd7f7e224945ac5daafb1ab025c461965c (diff)
downloadrhq-14941af29769ddfd5ecbc6193762a4f15ecd4b88.zip
rhq-14941af29769ddfd5ecbc6193762a4f15ecd4b88.tar.gz
rhq-14941af29769ddfd5ecbc6193762a4f15ecd4b88.tar.xz
[BZ 852891] Add plugin side validation for all the resources that have special rules for connectors and discovery-group-name. The AS7 server does not consistently validate the configuration at resource creation time.
-rw-r--r--modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
index dad90bc..2f1b7e3 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
@@ -44,7 +44,8 @@ public class HornetQComponent extends TemplatedSubResourcesComponent {
}
ResourceType resourceType = report.getResourceType();
- if (resourceType.getName().equals("Connection-Factory")) {
+ if (resourceType.getName().equals("Connection-Factory")
+ || resourceType.getName().equals("Pooled Connection Factory")) {
// we need to check that a connector XOR a discovery-group-name is given
int found = 0;
PropertyMap connector = resourceConfiguration.getMap("connector:collapsed");
@@ -61,7 +62,28 @@ public class HornetQComponent extends TemplatedSubResourcesComponent {
if (found == 0 || found == 2) {
String errorMessage = "You need to provide either a connector name OR a discovery-group-name. You provided ";
- errorMessage += (found == 0) ? "none" : "both";
+ errorMessage += (found == 0) ? "none." : "both.";
+ report.setErrorMessage(errorMessage);
+ report.setStatus(CreateResourceStatus.FAILURE);
+ return report;
+ }
+ } else if (resourceType.getName().equals("Bridge") || resourceType.getName().equals("Cluster Connection")) {
+ // we need to check that static-connector XOR a discovery-group-name is given
+ int found = 0;
+
+ PropertyList staticConnectors = resourceConfiguration.getList("static-connectors:nullable");
+ if (staticConnectors != null && !staticConnectors.getList().isEmpty()) {
+ found++;
+ }
+
+ String discoveryGroup = resourceConfiguration.getSimpleValue("discovery-group-name", "");
+ if (!discoveryGroup.isEmpty()) {
+ found++;
+ }
+
+ if (found == 0 || found == 2) {
+ String errorMessage = "You need to provide either static-connectors OR a discovery-group-name. You provided ";
+ errorMessage += (found == 0) ? "none." : "both.";
report.setErrorMessage(errorMessage);
report.setStatus(CreateResourceStatus.FAILURE);
return report;