modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
| 6
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
| 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
| 17
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
| 140 ++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java
| 69 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
| 5
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 375 +++++++++-
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
| 78 ++
8 files changed, 599 insertions(+), 93 deletions(-)
New commits:
commit 461ef8d5b0b2ec61584dd72b1aae39eef031ec3f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed May 25 12:00:20 2011 +0200
Support for the logging subsystem and make deployments available for standalone mode
too.
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 5c0a499..d86b365 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -135,7 +135,7 @@ public class ASConnection {
else {
outcome="- no response from server -";
}
- System.out.println("==> " + outcome);
+// System.out.println("==> " + outcome);
return operationResult;
}
else {
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 cbc2893..f35720e 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
@@ -281,8 +281,11 @@ public class BaseComponent implements ResourceComponent,
MeasurementFacet, Confi
}
else {
- propertySimple = new
PropertySimple(key,entry.findValue(key).getValueAsText());
- map.put(propertySimple);
+ JsonNode value = entry.findValue(key);
+ if (value!=null){
+ propertySimple = new PropertySimple(key,
value.getValueAsText());
+ map.put(propertySimple);
+ }
}
}
@@ -367,9 +370,9 @@ public class BaseComponent implements ResourceComponent,
MeasurementFacet, Confi
return ret;
}
+
PropertySimple putProperty(JsonNode value, PropertyDefinition def) {
String name = def.getName();
- PropertySimpleType type = ((PropertyDefinitionSimple) def).getType();
PropertySimple ps;
if (value==null) {
@@ -380,6 +383,7 @@ public class BaseComponent implements ResourceComponent,
MeasurementFacet, Confi
else
return new PropertySimple(name,null);
}
+ PropertySimpleType type = ((PropertyDefinitionSimple) def).getType();
switch (type) {
case BOOLEAN:
@@ -572,7 +576,12 @@ public class BaseComponent implements ResourceComponent,
MeasurementFacet, Confi
resourceKey = addressToPath(serverGroupAddress);
}
else {
- resourceKey = addressToPath(step1.getAddress());
+
+ List<PROPERTY_VALUE> address = step1.getAddress();
+ Operation step3 = new Operation("deploy",address);
+ cop.addStep(step3);
+
+ resourceKey = addressToPath(address);
}
JsonNode result = connection.executeRaw(cop);
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
new file mode 100644
index 0000000..f0d5e89
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/LoggerComponent.java
@@ -0,0 +1,69 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tools.ant.taskdefs.Sleep;
+
+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.OperationResult;
+import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
+
+/**
+ * Component class that deals with the Logging subsystem
+ * @author Heiko W. Rupp
+ */
+public class LoggerComponent extends BaseComponent {
+
+ private final Log log = LogFactory.getLog(LoggerComponent.class);
+
+ @Override
+ public OperationResult invokeOperation(String name,
+ Configuration parameters) throws
InterruptedException, Exception {
+
+ Operation op = new Operation(name,pathToAddress(getPath()));
+
+ 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());
+ }
+
+
+ ASConnection conn = getASConnection();
+ ComplexResult result = conn.executeComplex(op);
+
+ if (result.isSuccess()) {
+ return new OperationResult("ok");
+ }
+ else {
+ OperationResult failure = new OperationResult();
+ failure.setErrorMessage(result.getFailureDescription().toString());
+ return failure;
+ }
+
+
+ }
+}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
index a50ea45..a3ab676 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
@@ -134,8 +134,11 @@ public class SubsystemDiscovery implements
ResourceDiscoveryComponent<BaseCompon
if (path==null||path.isEmpty())
resKey = newPath;
- else
+ else {
+ if (path.startsWith(","))
+ path = path.substring(1);
resKey = path + "," +childType + "="
+ val;
+ }
PropertySimple pathProp = new
PropertySimple("path",resKey);
config2.put(pathProp);
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 d7055a3..75484c8 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
@@ -162,24 +162,6 @@
<c:simple-property name="jvm"
required="false"/>
</resource-configuration>
- <service name="Deployment"
- class="BaseComponent"
- discovery="SubsystemDiscovery"
- createDeletePolicy="both"
- creationDataType="content">
- <plugin-configuration>
- <c:simple-property name="path"
default="deployment" readOnly="true"/>
- </plugin-configuration>
-
- <content name="file" category="deployable"
isCreationType="true" description="Deployments on this server
group">
- <configuration>
- <c:group name="deployment"
displayName="Deployment Options">
- <c:simple-property name="runtimeName"
required="true"/>
- </c:group>
- </configuration>
- </content>
-
- </service>
</server>
<server name="Host"
description="Host involved in this domain"
@@ -375,6 +357,7 @@
<c:simple-property name="journal-type" />
</resource-configuration>
+ <!-- this is no child resource TODO
<service name="Acceptor"
discovery="SubsystemDiscovery"
@@ -392,7 +375,6 @@
<c:simple-property name="path" readOnly="true"
default="connector"/>
</plugin-configuration>
</service>
-<!-- this is no child resource
<service name="HQueue"
discovery="SubsystemDiscovery"
class="BaseComponent"
@@ -512,9 +494,9 @@
<metric property="bytesSent"
measurementType="trendsup"/>
<metric property="bytesReceived"
measurementType="trendsup"/>
- <metric property="processingTime"
measurementType="trendsup"/>
+ <metric property="processingTime"
measurementType="trendsup" units="milliseconds"/>
<metric property="errorCount"
measurementType="trendsup" displayType="summary"/>
- <metric property="maxTime" />
+ <metric property="maxTime" units="milliseconds"/>
<metric property="requestCount"
measurementType="trendsup" displayType="summary"/>
<resource-configuration>
@@ -819,6 +801,305 @@
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="subsystem=logging"/>
</plugin-configuration>
+
+ <operation name="change-root-log-level" description="Change the
root logger level.">
+ <parameters>
+ <c:simple-property name="level" required="true"
type="string" readOnly="false"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded.">
+ <c:property-options>
+ <c:option value="FATAL"/>
+ <c:option value="ERROR"/>
+ <c:option value="WARN"/>
+ <c:option value="INFO"/>
+ <c:option value="DEBUG"/>
+ <c:option value="TRACE"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ </operation>
+
+ <operation name="remove-root-logger" description="Remove the
root logger.">
+ </operation>
+
+ <operation name="set-root-logger" description="Set the root
logger.">
+ <parameters>
+ <c:simple-property name="level" required="true"
type="string" readOnly="false"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded.">
+ <c:property-options>
+ <c:option value="FATAL"/>
+ <c:option value="ERROR"/>
+ <c:option value="WARN"/>
+ <c:option value="INFO"/>
+ <c:option value="DEBUG"/>
+ <c:option value="TRACE"/>
+ </c:property-options>
+ </c:simple-property>
+
+ <c:list-property name="handlers" required="true"
readOnly="false"
+ description="The Handlers associated with this
Logger.">
+ <c:simple-property name="handler"
type="string"/>
+ </c:list-property>
+ </parameters>
+ </operation>
+
+ <resource-configuration>
+ <c:map-property name="root-logger" description="The root
logger for this log context.">
+ <c:simple-property name="level" readOnly="true"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded." />
+ <c:list-property name="handlers"
readOnly="true">
+ <c:simple-property name="handler"
readOnly="true" description="The Handlers associated with this
Logger."/>
+ </c:list-property>
+ </c:map-property>
+ </resource-configuration>
+
+
+ <service name="ConsoleHandler"
+ discovery="SubsystemDiscovery"
+ class="LoggerComponent"
+ >
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="console-handler"/>
+ </plugin-configuration>
+
+ <operation name="change-log-level" description="Change the
logging level for a handler.">
+ <parameters>
+ <c:simple-property name="level"
required="true" type="string" readOnly="false"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded.">
+ <c:property-options>
+ <c:option value="FATAL"/>
+ <c:option value="ERROR"/>
+ <c:option value="WARN"/>
+ <c:option value="INFO"/>
+ <c:option value="DEBUG"/>
+ <c:option value="TRACE"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ </operation>
+
+ <operation name="disable" description="Disable a logging
handler.">
+ </operation>
+
+ <operation name="enable" description="Enable a logging
handler.">
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="name" required="false"
type="string" readOnly="true" description="The handler's
name."/>
+ <c:simple-property name="level" required="false"
type="string" readOnly="true"
+ description="The log level specifying which
message levels will be logged by this. Message levels lower than this value will be
discarded. "/>
+ <c:simple-property name="encoding"
required="false" type="string" readOnly="true"
+ description="The character encoding used by this
Handler."/>
+ <c:simple-property name="filter" required="false"
type="string" readOnly="true" description="Defines a simple
filter type."/>
+ <c:simple-property name="formatter"
required="false" type="string" readOnly="true"
description="Defines a formatter."/>
+ <c:simple-property name="autoflush"
required="false" type="boolean" readOnly="true"
description="Automatically flush after each write."/>
+ <c:simple-property name="target" required="false"
type="string" readOnly="true"
+ description="Defines the target of the console
handler. The value can either be SYSTEM_OUT or SYSTEM_ERR.">
+ <c:property-options>
+ <c:option value="SYSTEM_OUT"/>
+ <c:option value="SYSTEM_ERR"/>
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+ </service>
+
+ <service name="FileHandler"
+ discovery="SubsystemDiscovery"
+ class="LoggerComponent"
+ >
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="file-handler"/>
+ </plugin-configuration>
+
+ <operation name="change-log-level" description="Change the
logging level for a handler.">
+ <parameters>
+ <c:simple-property name="level"
required="true" type="string" readOnly="false"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded.">
+ <c:property-options>
+ <c:option value="FATAL"/>
+ <c:option value="ERROR"/>
+ <c:option value="WARN"/>
+ <c:option value="INFO"/>
+ <c:option value="DEBUG"/>
+ <c:option value="TRACE"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ </operation>
+
+ <operation name="disable" description="Disable a logging
handler.">
+ </operation>
+
+ <operation name="enable" description="Enable a logging
handler.">
+ </operation>
+
+ <operation name="change-file" description="Change the file
for a handler.">
+ <parameters>
+ <c:simple-property name="path" required="true"
type="string" readOnly="false" description="The filesystem
path."/>
+ <c:simple-property name="relative-to"
required="false" type="string" readOnly="false"
+ description="The name of another previously
named path, or of one of the standard paths provided by the system.
+ If 'relative-to' is provided, the value of
the 'path' attribute is treated as relative to the path specified by this
attribute.
+ The standard paths provided by the system
include:<ul><li>jboss.home - the root directory of the JBoss
AS
+
distribution</li><li>user.home - user's home
directory</li><li>user.dir - user's current
+ working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir -
+ root directory for an individual server
instance</li><li>jboss.server.data.dir - directory the server
will
+ use for persistent data file
storage</li><li>jboss.server.log.dir - directory the server
will use for
+ log file
storage</li><li>jboss.server.tmp.dir - directory the server
will use for temporary file
+
storage</li><li>jboss.domain.servers.dir - directory under
which a host controller will create the
+ working area for individual server
instances</li></ul>"/>
+ </parameters>
+ </operation>
+ <resource-configuration>
+ <c:simple-property name="name" required="false"
type="string" readOnly="true" description="The handler's
name."/>
+ <c:simple-property name="level" required="false"
type="string" readOnly="true"
+ description="The log level specifying which
message levels will be logged by this. Message levels lower than this value will be
discarded. "/>
+ <c:simple-property name="encoding"
required="false" type="string" readOnly="true"
+ description="The character encoding used by this
Handler."/>
+ <c:simple-property name="filter" required="false"
type="string" readOnly="true" description="Defines a simple
filter type."/>
+ <c:simple-property name="formatter"
required="false" type="string" readOnly="true"
description="Defines a formatter."/>
+ <c:simple-property name="autoflush"
required="false" type="boolean" readOnly="true"
description="Automatically flush after each write."/>
+ <c:simple-property name="target" required="false"
type="string" readOnly="true"
+ description="Defines the target of the console
handler. The value can either be SYSTEM_OUT or SYSTEM_ERR.">
+ <c:property-options>
+ <c:option value="SYSTEM_OUT"/>
+ <c:option value="SYSTEM_ERR"/>
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+ </service>
+ <service name="PeriodicRotatingFileHandler"
+ discovery="SubsystemDiscovery"
+ class="LoggerComponent"
+ >
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="periodic-rotating-file-handler"/>
+ </plugin-configuration>
+
+ <operation name="change-log-level" description="Change the
logging level for a handler.">
+ <parameters>
+ <c:simple-property name="level"
required="true" type="string" readOnly="false"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded.">
+ <c:property-options>
+ <c:option value="FATAL"/>
+ <c:option value="ERROR"/>
+ <c:option value="WARN"/>
+ <c:option value="INFO"/>
+ <c:option value="DEBUG"/>
+ <c:option value="TRACE"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ </operation>
+
+ <operation name="disable" description="Disable a logging
handler.">
+ </operation>
+
+ <operation name="enable" description="Enable a logging
handler.">
+ </operation>
+
+ <operation name="change-file" description="Change the file
for a handler.">
+ <parameters>
+ <c:simple-property name="path" required="true"
type="string" readOnly="false" description="The filesystem
path."/>
+ <c:simple-property name="relative-to"
required="false" type="string" readOnly="false"
+ description="The name of another previously
named path, or of one of the standard paths provided by the system.
+ If 'relative-to' is provided, the value of
the 'path' attribute is treated as relative to the path specified by this
attribute.
+ The standard paths provided by the system
include:<ul><li>jboss.home - the root directory of the JBoss
AS
+
distribution</li><li>user.home - user's home
directory</li><li>user.dir - user's current
+ working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir -
+ root directory for an individual server
instance</li><li>jboss.server.data.dir - directory the server
will
+ use for persistent data file
storage</li><li>jboss.server.log.dir - directory the server
will use for
+ log file
storage</li><li>jboss.server.tmp.dir - directory the server
will use for temporary file
+
storage</li><li>jboss.domain.servers.dir - directory under
which a host controller will create the
+ working area for individual server
instances</li></ul>"/>
+ </parameters>
+ </operation>
+ <resource-configuration>
+ <c:simple-property name="name" required="false"
type="string" readOnly="true" description="The handler's
name."/>
+ <c:simple-property name="level" required="false"
type="string" readOnly="true" description="The log level
specifying which message levels will be logged by this.
+ Message levels lower than this value will be discarded. "/>
+ <c:simple-property name="encoding"
required="false" type="string" readOnly="true"
description="The character encoding used by this Handler."/>
+ <c:simple-property name="filter" required="false"
type="string" readOnly="true" description="Defines a simple
filter type."/>
+ <c:simple-property name="formatter"
required="false" type="string" readOnly="true"
description="Defines a formatter."/>
+ <c:simple-property name="autoflush"
required="false" type="boolean" readOnly="true"
description="Automatically flush after each write."/>
+ <c:simple-property name="append" required="false"
type="boolean" readOnly="true" description="Specify whether to
append to the target file."/>
+ <c:map-property name="file" description="null"
>
+ <c:simple-property name="relative-to"
required="false" type="string" readOnly="true"
description="The name of another previously named path, or of one of the standard
paths
+ provided by the system. If 'relative-to' is provided, the
value of the 'path' attribute is treated as relative to the path
+ specified by this attribute. The standard paths provided by the
system include:<ul><li>jboss.home - the root directory
+ of the JBoss AS
distribution</li><li>user.home - user's home
directory</li><li>user.dir - user's current working
+ directory</li><li>java.home - java
installation directory</li><li>jboss.server.base.dir - root
directory for an
+ individual server
instance</li><li>jboss.server.data.dir - directory the server
will use for persistent data file
+ storage</li><li>jboss.server.log.dir -
directory the server will use for log file
storage</li><li>jboss.server.tmp.dir -
+ directory the server will use for temporary file
storage</li><li>jboss.domain.servers.dir - directory under
which a host controller
+ will create the working area for individual server
instances</li></ul>"/>
+ <c:simple-property name="path"
required="false" type="string" readOnly="true"
description="The filesystem path."/>
+ </c:map-property>
+ <c:simple-property name="suffix" required="false"
type="string" readOnly="true" description="Set the suffix string.
The string is in a format which
+ can be understood by java.text.SimpleDateFormat. The period of the
rotation is automatically calculated based on the suffix."/>
+ </resource-configuration>
+ </service>
+ <service name="SizeRotatingFileHandler"
+ discovery="SubsystemDiscovery"
+ class="LoggerComponent"
+ >
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="size-rotating-file-handler"/>
+ </plugin-configuration>
+
+ <operation name="change-log-level" description="Change the
logging level for a handler.">
+ <parameters>
+ <c:simple-property name="level"
required="true" type="string" readOnly="false"
+ description="The log level specifying which
message levels will be logged by this logger. Message levels lower than this value will be
discarded.">
+ <c:property-options>
+ <c:option value="FATAL"/>
+ <c:option value="ERROR"/>
+ <c:option value="WARN"/>
+ <c:option value="INFO"/>
+ <c:option value="DEBUG"/>
+ <c:option value="TRACE"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ </operation>
+
+ <operation name="disable" description="Disable a logging
handler.">
+ </operation>
+
+ <operation name="enable" description="Enable a logging
handler.">
+ </operation>
+
+ <operation name="change-file" description="Change the file
for a handler.">
+ <parameters>
+ <c:simple-property name="path" required="true"
type="string" readOnly="false" description="The filesystem
path."/>
+ <c:simple-property name="relative-to"
required="false" type="string" readOnly="false"
+ description="The name of another previously
named path, or of one of the standard paths provided by the system.
+ If 'relative-to' is provided, the value of
the 'path' attribute is treated as relative to the path specified by this
attribute.
+ The standard paths provided by the system
include:<ul><li>jboss.home - the root directory of the JBoss
AS
+
distribution</li><li>user.home - user's home
directory</li><li>user.dir - user's current
+ working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir -
+ root directory for an individual server
instance</li><li>jboss.server.data.dir - directory the server
will
+ use for persistent data file
storage</li><li>jboss.server.log.dir - directory the server
will use for
+ log file
storage</li><li>jboss.server.tmp.dir - directory the server
will use for temporary file
+
storage</li><li>jboss.domain.servers.dir - directory under
which a host controller will create the
+ working area for individual server
instances</li></ul>"/>
+ </parameters>
+ </operation>
+ <resource-configuration>
+ <c:simple-property name="name" required="false"
type="string" readOnly="true" description="The handler's
name."/>
+ <c:simple-property name="level" required="false"
type="string" readOnly="true" description="The log level
specifying which message levels will be logged by this. Message levels lower than this
value will be discarded. "/>
+ <c:simple-property name="encoding"
required="false" type="string" readOnly="true"
description="The character encoding used by this Handler."/>
+ <c:simple-property name="filter" required="false"
type="string" readOnly="true" description="Defines a simple
filter type."/>
+ <c:simple-property name="formatter"
required="false" type="string" readOnly="true"
description="Defines a formatter."/>
+ <c:simple-property name="autoflush"
required="false" type="boolean" readOnly="true"
description="Automatically flush after each write."/>
+ <c:simple-property name="append" required="false"
type="boolean" readOnly="true" description="Specify whether to
append to the target file."/>
+ <c:map-property name="file" description="null"
>
+ <c:simple-property name="relative-to"
required="false" type="string" readOnly="true"
description="The name of another previously named path, or of one of the standard
paths provided by the system. If 'relative-to' is provided, the value of the
'path' attribute is treated as relative to the path specified by this attribute.
The standard paths provided by the system
include:<ul><li>jboss.home - the root directory of the JBoss
AS distribution</li><li>user.home - user's home
directory</li><li>user.dir - user's current working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir - root directory for
an individual server instance</li><li>jboss.server.data.dir -
directory the server will use for persistent data file
storage</li><li>jboss.server.log.dir - directory the server
will use for log file storage</li><li>jboss.server.tmp.dir -
directory the server will use for temporary file
storage</li><li>jboss.domain.servers.dir - directory under
which a host controller will create the working area for individual server
instances</li></ul>"/>
+ <c:simple-property name="path"
required="false" type="string" readOnly="true"
description="The filesystem path."/>
+ </c:map-property>
+ <c:simple-property name="rotate-size"
required="false" description="The size at which to rotate the log
file." type="long" units="bytes"/>
+ <c:simple-property name="max-backup-index"
required="false" description="The maximum number of backups to keep."
type="integer" />
+ </resource-configuration>
+ </service>
+
</server>
<server name="Security"
@@ -965,6 +1246,32 @@
<c:simple-property name="webservice-secure-port"
type="integer" readOnly="true"
description="The non-secure port that will be used
for rewriting the SOAP address. If absent the port will be identified by querying the list
of installed connectors."/>
</resource-configuration>
+
+ <service name="Endpoint"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ >
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="endpoint"/>
+ </plugin-configuration>
+
+ <metric property="average-processing-time"
description="Average endpoint processing time." displayType="summary"
units="milliseconds"/>
+ <metric property="min-processing-time" description="Minimal
endpoint processing time." units="milliseconds"/>
+ <metric property="max-processing-time" description="Maximal
endpoint processing time." units="milliseconds"/>
+ <metric property="total-processing-time" description="Total
endpoint processing time." measurementType="trendsup"
units="milliseconds"/>
+ <metric property="request-count" description="Count of
requests the endpoint processed." displayType="summary"
measurementType="trendsup"/>
+ <metric property="response-count" description="Count of
responses the endpoint generated." measurementType="trendsup"/>
+ <metric property="fault-count" description="Count of faults
the endpoint generated." displayType="summary"
measurementType="trendsup"/>
+
+ <resource-configuration>
+ <c:simple-property name="name" required="true"
type="string" readOnly="true" description="Webservice endpoint
name."/>
+ <c:simple-property name="context" required="true"
type="string" readOnly="true" description="Webservice endpoint
context."/>
+ <c:simple-property name="class" required="false"
type="string" readOnly="true" description="Webservice endpoint
class."/>
+ <c:simple-property name="type" required="false"
type="string" readOnly="true" description="Webservice endpoint
type."/>
+ <c:simple-property name="wsdl-url"
required="false" type="string" readOnly="true"
description="Webservice endpoint WSDL URL."/>
+ </resource-configuration>
+
+ </service>
</server>
<service name="NetworkInterface"
@@ -1018,4 +1325,30 @@
</service>
+ <service name="Deployment"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ createDeletePolicy="both"
+ creationDataType="content">
+
+
+ <runs-inside>
+ <parent-resource-type name="ServerGroup"
plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7-Standalone"
plugin="jboss-as-7"/>
+ </runs-inside>
+ <plugin-configuration>
+ <c:simple-property name="path" default="deployment"
readOnly="true"/>
+ </plugin-configuration>
+
+ <content name="file" category="deployable"
isCreationType="true" description="Deployments on this server
group">
+ <configuration>
+ <c:group name="deployment" displayName="Deployment
Options">
+ <c:simple-property name="runtimeName"
required="true"/>
+ </c:group>
+ </configuration>
+ </content>
+
+ </service>
+
+
</plugin>
commit dd328eac2660aa3b2d4f0d95aa6f031d08ed09cf
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed May 25 11:34:19 2011 +0200
Changes and optimizations to operations handling and description elements.
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
index 6d4a0e2..8011628 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Domain2Descriptor.java
@@ -23,14 +23,20 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.omg.CosNaming._BindingIteratorImplBase;
+
import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
import org.rhq.modules.plugins.jbossas7.json.Operation;
import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
/**
- * Generate properties from a domain dump
+ * Generate properties, metrics and operation templates for the
+ * plugin descriptor from a domain dump (server can run in domain
+ * or standalone mode).
+ *
* @author Heiko W. Rupp
*/
+@SuppressWarnings("unchecked")
public class Domain2Descriptor {
public static void main(String[] args) throws Exception {
@@ -48,15 +54,15 @@ public class Domain2Descriptor {
private void run(String[] args) {
- Mode mode = null;
+ D2DMode mode = null;
int pos = 0;
if (args[0].startsWith("-")) {
if (args[0].equals("-m"))
- mode = Domain2Descriptor.Mode.METRICS;
+ mode = D2DMode.METRICS;
else if (args[0].equals("-p"))
- mode = Domain2Descriptor.Mode.PROPERTIES;
+ mode = D2DMode.PROPERTIES;
else if (args[0].equals("-o"))
- mode = Domain2Descriptor.Mode.OPERATION;
+ mode = D2DMode.OPERATION;
else {
usage();
return;
@@ -75,12 +81,12 @@ public class Domain2Descriptor {
Operation op = new Operation("read-resource-description",address);
op.addAdditionalProperty("recursive","true");
- if (mode==Domain2Descriptor.Mode.OPERATION)
+ if (mode== D2DMode.OPERATION)
op.addAdditionalProperty("operations",true);
- if (mode == Domain2Descriptor.Mode.METRICS)
+ if (mode == D2DMode.METRICS)
op.addAdditionalProperty("include-runtime",true);
- ComplexResult res = (ComplexResult) conn.execute(op,true);
+ ComplexResult res = conn.executeComplex(op);
if (!res.isSuccess()) {
System.err.println("Failure: " + res.getFailureDescription());
return;
@@ -88,39 +94,44 @@ public class Domain2Descriptor {
Map<String,Object> resMap = res.getResult();
- if (mode==Domain2Descriptor.Mode.OPERATION) {
- Map<String,Object> operationsMap = (Map<String, Object>)
resMap.get("operations");
- for (Map.Entry<String,Object> entry : operationsMap.entrySet()) {
+ String what;
+ if (mode== D2DMode.OPERATION)
+ what="operations";
+ else
+ what="attributes";
+
+ Map<String,Object> attributesMap;
+ if (childType!=null) {
+ Map childMap = (Map) resMap.get("children");
+ Map <String,Object> typeMap = (Map<String, Object>)
childMap.get(childType);
+ Map descriptionMap = (Map) typeMap.get("model-description");
+ if (descriptionMap==null) {
+ System.err.println("No model description found");
+ return;
+ }
+ Map starMap = (Map) descriptionMap.get("*");
+ attributesMap = (Map<String, Object>) starMap.get(what);
+ }
+ else {
+ attributesMap = (Map<String, Object>) resMap.get(what);
+ }
+
+ if (mode==D2DMode.OPERATION) {
+ for (Map.Entry<String,Object> entry : attributesMap.entrySet()) {
if (entry.getKey().startsWith("read-"))
continue;
if (entry.getKey().equals("write-attribute"))
continue;
- createOperation((Map<String,Object>)entry.getValue());
+ createOperation(entry.getKey(),
(Map<String,Object>)entry.getValue());
}
-
- } else {
- Map<String,Object> attributesMap;
- if (childType!=null) {
- Map childMap = (Map) resMap.get("children");
- Map <String,Object> typeMap = (Map<String, Object>)
childMap.get(childType);
- Map descriptionMap = (Map) typeMap.get("model-description");
- if (descriptionMap==null) {
- System.err.println("No model description found");
- return;
- }
- Map starMap = (Map) descriptionMap.get("*");
- attributesMap = (Map<String, Object>)
starMap.get("attributes");
- }
- else {
- attributesMap = (Map<String, Object>)
resMap.get("attributes");
- }
-
- createProperties(mode, attributesMap, 0);
}
+ else
+ createProperties(mode, attributesMap, 0);
+// }
}
- private void createProperties(Mode mode, Map<String, Object> attributesMap, int
indent) {
+ private void createProperties(D2DMode mode, Map<String, Object> attributesMap,
int indent) {
if (attributesMap==null)
return;
@@ -161,16 +172,13 @@ public class Domain2Descriptor {
}
- if (ptype== Type.LIST && mode!=Domain2Descriptor.Mode.METRICS) {
+ if (ptype== Type.LIST && mode!= D2DMode.METRICS) {
StringBuilder sb = new StringBuilder("<c:list-property
name=\"");
sb.append(entryName);
sb.append("\"");
- if (props.containsKey("description")) {
- sb.append(" description=\"");
- sb.append(props.get("description"));
- sb.append("\"");
- }
+ String description = (String) props.get("description");
+ appendDescription(sb,description);
sb.append(" >\n");
if (!props.containsKey("attributes"))
sb.append(" <c:simple-property
name=\"").append(entryName).append("\" />\n");
@@ -192,7 +200,7 @@ public class Domain2Descriptor {
}
String accessType = getAccessType(props);
- if (mode==Domain2Descriptor.Mode.METRICS) {
+ if (mode== D2DMode.METRICS) {
if (!accessType.equals("metric"))
continue;
@@ -204,11 +212,7 @@ public class Domain2Descriptor {
sb.append(" dataType=\"trait\"");
String description = (String) props.get("description");
- if (description!=null) {
- if (sb.length()+description.length() > 120)
- sb.append("\n ");
- sb.append("
description=\"").append(description).append('"');
- }
+ appendDescription(sb,description);
sb.append("/>");
System.out.println(sb.toString());
@@ -224,32 +228,27 @@ public class Domain2Descriptor {
}
}
- private void createOperation(Map<String,Object> operationMap) {
+ private void createOperation(String name, Map<String, Object> operationMap) {
StringBuilder builder = new StringBuilder("<operation
name=\"");
- String name = (String) operationMap.get("operation-name");
builder.append(name).append('"');
String description = (String) operationMap.get("description");
- if (description!=null && !description.isEmpty()) {
- builder.append("
description=\"").append(description).append('"');
- }
+ appendDescription(builder, description);
builder.append(">\n");
-
-
- if (!((Map)operationMap.get("request-properties")).isEmpty()) {
- Map<String,Object> map = (Map<String, Object>)
operationMap.get("request-properties");
+ Map<String,Object> reqMap = (Map<String, Object>)
operationMap.get("request-properties");
+ if (reqMap!=null && !reqMap.isEmpty()) {
builder.append(" <parameters>\n");
- generatePropertiesForMap(builder, map, true);
+ generatePropertiesForMap(builder, reqMap, true);
builder.append(" </parameters>\n");
}
- if (!((Map)operationMap.get("reply-properties")).isEmpty()){
- Map<String,Object> map = (Map<String, Object>)
operationMap.get("reply-properties"); // TODO not sure -- perhaps for the java
code?
+ Map replyMap = (Map) operationMap.get("reply-properties");
+ if (replyMap!=null && !replyMap.isEmpty()){
builder.append(" <results>\n");
- generatePropertiesForMap(builder, map, true);
+ generatePropertiesForMap(builder, replyMap, true);
builder.append(" </results>\n");
}
@@ -258,6 +257,21 @@ public class Domain2Descriptor {
System.out.println(builder.toString());
}
+ private void appendDescription(StringBuilder builder, String description) {
+ if (description!=null && !description.isEmpty()) {
+ if (builder.length()>120)
+ builder.append("\n ");
+ builder.append(" description=\"");
+
+ description = description.replace("<","<");
+ description = description.replace(">",">");
+ description =
description.replace("\"","\\\"");
+
+ builder.append(description);
+ builder.append('"');
+ }
+ }
+
private void generatePropertiesForMap(StringBuilder builder, Map<String,
Object> map, boolean forceReadWrite) {
for (Map.Entry<String,Object> entry : map.entrySet()) {
@@ -334,11 +348,7 @@ public class Domain2Descriptor {
}
String description = (String) props.get("description");
- if (description!=null) {
- if (sb.length()+description.length() > 120)
- sb.append("\n ");
- sb.append("
description=\"").append(description).append('"');
- }
+ appendDescription(sb,description);
sb.append("/>");
return sb;
}
@@ -350,6 +360,9 @@ public class Domain2Descriptor {
private Type getTypeFromProps(Map<String, Object> props) {
Map<String,String> tMap = (Map<String, String>)
props.get("type");
+ if (tMap==null)
+ return Type.OBJECT;
+
String type = tMap.get("TYPE_MODEL_VALUE");
Type ret = Type.valueOf(type);
@@ -391,6 +404,7 @@ public class Domain2Descriptor {
System.out.println(" path is of kind 'key=value[,key=value]+");
System.out.println(" -p create properties (default)");
System.out.println(" -m create metrics");
+ System.out.println(" -o create operations");
}
public enum Type {
@@ -405,7 +419,7 @@ public class Domain2Descriptor {
;
}
- private enum Mode {
+ private enum D2DMode {
METRICS,
PROPERTIES,
OPERATION
commit 895f8fd65dd46327a171ecb96d498baecc2afffc
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed May 25 11:23:09 2011 +0200
Add a test for AS7-853
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index 1ef3761..57ec4f3 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -153,6 +153,81 @@ public class UploadAndDeployTest {
}
+ // Test for AS7-853
+ @Test(timeOut = 60*1000L, enabled = true)
+ public void testUploadIndividualSteps2() throws Exception {
+
+ String bytes_value = prepare();
+
+ System.out.println("sha: " + bytes_value);
+
+ System.out.println();
+ ASConnection connection = new ASConnection(DC_HOST, DC_HTTP_PORT);
+
+ List<PROPERTY_VALUE> deploymentsAddress = new
ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation op = new Operation("add",deploymentsAddress);
+ List<Object> content = new ArrayList<Object>(1);
+ Map<String,Object> contentValues = new HashMap<String,Object>();
+ contentValues.put("hash",new
PROPERTY_VALUE("BYTES_VALUE",bytes_value));
+ content.add(contentValues);
+ op.addAdditionalProperty("content",content);
+ op.addAdditionalProperty("name", TEST_WAR); // this needs to be unique
per upload
+ op.addAdditionalProperty("runtime-name", TEST_WAR);
+ System.out.flush();
+ JsonNode ret = connection.executeRaw(op);
+ op = null;
+ System.out.println("Add to /deploy done " + ret);
+ System.out.flush();
+
+ assert ret.toString().contains("success") : ret;
+
+
+ List<PROPERTY_VALUE> serverGroupAddress = new
ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group",
"main-server-group"));
+ serverGroupAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+
+ Operation attach = new
Operation("add",serverGroupAddress,"enabled",true);
+ System.out.flush();
+ ret = connection.executeRaw(attach);
+ System.out.println("Add to server group done: " + ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " +
ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") :
"add to sg was no success " + ret.getTextValue();
+
+
+ Result depRes;// = connection.execute(deploy);
+
+ Thread.sleep(500);
+
+ Operation undeploy = new Operation("undeploy",serverGroupAddress);
+ depRes = connection.execute(undeploy);
+
+ assert depRes.isSuccess() : "Undeploy went wrong: " +
depRes.getFailureDescription();
+ undeploy = null;
+
+ // Now tear down stuff again
+
+ Operation unattach = new Operation("remove",serverGroupAddress);
+ ret = connection.executeRaw(unattach);
+
+ assert ret.has("outcome") : "Ret not valid " +
ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") :
"remove from sg was no success " + ret.getTextValue();
+
+
+ // remove from domain
+
+ Operation remove = new Operation("remove",deploymentsAddress);
+ ret = connection.executeRaw(remove);
+
+ assert ret.has("outcome") : "Ret not valid " +
ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") :
"remove from domain was no success " + ret.getTextValue();
+
+ System.out.flush();
+
+ }
+
@Test(timeOut = 60*1000L, enabled = true)
public void testUploadComposite() throws Exception {
commit 3dbd7b89c98c52007fecc64c79a403de1170f68c
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue May 24 15:26:53 2011 +0200
Add a comment that tests need to run against domain mode.
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index f2a4d54..1ef3761 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -36,7 +36,8 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
/**
* Test uploading and deploying to the domain
- * To use it, domain server must be up and running locally and
+ * To use it, a server in <b>domain mode</b> must be up and have it's
+ * <b>DomainController</b> running <b>locally</b> and
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
commit 506c0dbaf78a349cebeb34f99b96befb57ec1c07
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri May 20 11:56:14 2011 +0200
Prevent NPE on container shutdown.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
index 64a6ff7..b0b37ec 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
@@ -103,7 +103,7 @@ public class EventContextImpl implements EventContext {
public SigarProxy getSigar() {
return getEventManager().getSigar();
}
-
+
private void registerEventPollerInternal(final EventPoller poller, int
pollingInterval,
final String sourceLocation) {
EventDefinition eventDefinition =
EventUtility.getEventDefinition(poller.getEventType(), this.resource.getResourceType());
@@ -124,6 +124,8 @@ public class EventContextImpl implements EventContext {
EventDefinition eventDefinition = EventUtility.getEventDefinition(eventType,
this.resource.getResourceType());
if (eventDefinition == null)
throw new IllegalArgumentException("Unknown event type - no
EventDefinition exists with name '" + eventType + "'.");
- getEventManager().unregisterEventPoller(this.resource, eventType,
sourceLocation);
+ EventManager eventManager = getEventManager();
+ if (eventManager!=null)
+ eventManager.unregisterEventPoller(this.resource, eventType,
sourceLocation);
}
}