modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 5 - modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java | 20 ++++ modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterComponent.java | 41 ++++++++++ modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 17 +++- 4 files changed, 76 insertions(+), 7 deletions(-)
New commits: commit 92720a0332994653d44f773e4685d0b6ea6384ba Author: Heiko W. Rupp hwr@redhat.com Date: Mon Nov 7 13:09:29 2011 +0100
BZ 736481 - Fix the missing ':' errors.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java index 0ad794c..0aba2d3 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java @@ -429,8 +429,9 @@ public class BaseComponent<T extends ResourceComponent<?>> implements ResourceCo Configuration parameters) throws InterruptedException, Exception {
if (!name.contains(":")) { - OperationResult badName = new OperationResult("Operation name did not contain a ':'"); - badName.setErrorMessage("Operation name did not contain a ':'"); + String simpleResult = "Operation with name [" + name + "] did not contain a ':'"; + OperationResult badName = new OperationResult(simpleResult); + badName.setErrorMessage(simpleResult); return badName; }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java index 67df4d9..f9ff8a3 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java @@ -18,6 +18,8 @@ */ package org.rhq.modules.plugins.jbossas7;
+import java.util.ArrayList; +import java.util.List; import java.util.Map;
import org.apache.commons.logging.Log; @@ -25,6 +27,7 @@ import org.apache.commons.logging.LogFactory;
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.PropertySimple; import org.rhq.core.pluginapi.operation.OperationResult; import org.rhq.modules.plugins.jbossas7.json.ComplexResult; @@ -46,8 +49,19 @@ public class LoggerComponent extends BaseComponent {
Map<String,Property> propertyMap = parameters.getAllProperties(); for (Map.Entry<String,Property> entry : propertyMap.entrySet()) { - PropertySimple ps = (PropertySimple) entry.getValue(); - op.addAdditionalProperty(entry.getKey(),ps.getStringValue()); + if (entry.getValue() instanceof PropertySimple) { + PropertySimple ps = (PropertySimple) entry.getValue(); + op.addAdditionalProperty(entry.getKey(),ps.getStringValue()); + } else if (entry.getValue() instanceof PropertyList) { + PropertyList pl = (PropertyList) entry.getValue(); + List<Property> props = pl.getList(); + List<String> objects = new ArrayList<String>(props.size()); + for (Property p : props) { + PropertySimple ps = (PropertySimple) p; + objects.add(ps.getStringValue()); + } + op.addAdditionalProperty(entry.getKey(),objects); + } }
@@ -59,7 +73,7 @@ public class LoggerComponent extends BaseComponent { } else { OperationResult failure = new OperationResult(); - failure.setErrorMessage(result.getFailureDescription().toString()); + failure.setErrorMessage(result.getFailureDescription()); return failure; }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterComponent.java new file mode 100644 index 0000000..83987e3 --- /dev/null +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterComponent.java @@ -0,0 +1,41 @@ +package org.rhq.modules.plugins.jbossas7; + +import java.util.Map; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.Property; +import org.rhq.core.domain.configuration.PropertySimple; +import org.rhq.core.pluginapi.operation.OperationFacet; +import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.modules.plugins.jbossas7.json.Operation; +import org.rhq.modules.plugins.jbossas7.json.Result; + +/** + * Component class for ModCluster + * @author Heiko W. Rupp + */ +public class ModClusterComponent extends BaseComponent implements OperationFacet { + + @Override + public OperationResult invokeOperation(String name, + Configuration parameters) throws Exception { + + Operation op = new Operation(name,getAddress()); + Result result = getASConnection().execute(op); + + Map<String,Property> propertyMap = parameters.getAllProperties(); + for (Map.Entry<String,Property> entry : propertyMap.entrySet()) { + PropertySimple ps = (PropertySimple) entry.getValue(); + op.addAdditionalProperty(entry.getKey(),ps.getStringValue()); + } + + OperationResult operationResult = new OperationResult(); + if (result.isSuccess()) { + operationResult.setSimpleResult(result.getResult().toString()); + } + else { + operationResult.setErrorMessage(result.getFailureDescription()); + } + return operationResult; + } +} diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index abd6fe3..ffc40bd 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -1304,7 +1304,7 @@
<server name="Logging" discovery="SubsystemDiscovery" - class="BaseComponent" + class="LoggerComponent" singleton="true" >
@@ -1331,9 +1331,15 @@ </c:property-options> </c:simple-property> </parameters> + <results> + <c:simple-property name="operationResult"/> + </results> </operation>
<operation name="remove-root-logger" description="Remove the root logger."> + <results> + <c:simple-property name="operationResult"/> + </results> </operation>
<operation name="set-root-logger" description="Set the root logger."> @@ -1355,6 +1361,9 @@ <c:simple-property name="handler" type="string"/> </c:list-property> </parameters> + <results> + <c:simple-property name="operationResult"/> + </results> </operation>
<resource-configuration> @@ -1842,7 +1851,7 @@ working area for individual server instances</li></ul>"/> </server>
<server name="ModCluster" - class="BaseComponent" + class="ModClusterComponent" discovery="SubsystemDiscovery" description="Mod_cluster support" singleton="true" @@ -1858,6 +1867,10 @@ working area for individual server instances</li></ul>"/> </plugin-configuration>
<operation name="list-proxies" description="Read the list of httpd connected to the nodes."> + <results> + <c:simple-property name="operationResult"/> + </results> + </operation>
<resource-configuration>
rhq-commits@lists.fedorahosted.org