modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java
| 19 +
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java
| 96 +++-------
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
| 75 +++++--
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java
| 30 ++-
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
| 9
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
| 1
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
| 1
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
| 1
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
| 17 +
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
| 47 +++-
modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
| 74 +++----
11 files changed, 225 insertions(+), 145 deletions(-)
New commits:
commit 082871996f26e5e2523487001661e751b2cafe13
Merge: 55c4c4d 8f9bf82
Author: Larry O'Leary <loleary(a)redhat.com>
Date: Fri Jun 28 18:38:44 2013 -0500
Merge remote-tracking branch 'origin/bug/953482' into hotfix/jon3.1.2
commit 8f9bf82c37f8961765cb2dd2ca82415e4a1360a3
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Mon Apr 15 17:07:28 2013 +0200
[BZ 865460] Cannot add a Group to tomcat's UserDatabase
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
index 0a95069..ead4956 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
@@ -51,6 +51,7 @@ public class TomcatUserDatabaseComponent extends
MBeanResourceComponent<TomcatSe
if (TomcatGroupComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
name =
report.getResourceConfiguration().getSimple("groupname").getStringValue();
newRoles =
report.getResourceConfiguration().getSimple(TomcatGroupComponent.CONFIG_ROLES);
+
report.getResourceConfiguration().remove(TomcatGroupComponent.CONFIG_ROLES);
objectName =
String.format("Users:type=Group,groupname=\"%s\",database=UserDatabase",
name);
operation = "createGroup";
} else if (TomcatRoleComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName))
{
commit a84b665d222b62bd57b1c89272042cb916b4acd2
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Mon Apr 15 16:28:19 2013 +0200
[BZ 921194] Additional corrections by lfuka.
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 e6e87b3..826a9e9 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
@@ -727,7 +727,9 @@
<c:simple-property
name="name"
type="string"
- readOnly="true" />
+ readOnly="true"
+ default="Default Tomcat Connector name"
+ description="Connector name."/>
<c:simple-property
name="port"
type="string"
@@ -741,8 +743,8 @@
<c:simple-property
name="connector"
type="string"
- description="Connector protocol connector. Note: Only available on
Tomcat 7."
- required="false"
+ description="Connector protocol connector."
+ default="Default connector"
readOnly="true" />
<c:simple-property
name="address"
commit e28f32bd290cac7a8e2e6f8d8cbdbf25ffd3540c
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Wed Apr 10 15:26:38 2013 +0200
[BZ 921261] WebModule is reported as DOWN or UNAVAILABLE ... from
da0179ab26a0c3e3a50238e9997147864e5a759b
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 8dbb251..e6e87b3 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
@@ -741,7 +741,8 @@
<c:simple-property
name="connector"
type="string"
- description="Connector protocol connector."
+ description="Connector protocol connector. Note: Only available on
Tomcat 7."
+ required="false"
readOnly="true" />
<c:simple-property
name="address"
commit 5e887799e09133d17eb0344fc960c207670a9928
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Wed Apr 10 15:22:52 2013 +0200
[BZ 921261] WebModule is reported as DOWN or UNAVAILABLE ... from
00e594847fe67da46f8976df58b5d2324d6ebb48
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
index 495d920..0a51c45 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
@@ -154,6 +154,15 @@ public class TomcatWarComponent extends
MBeanResourceComponent<TomcatVHostCompon
} catch (Exception e) {
// if not active an exception may be thrown
state = WarMBeanState.STOPPED;
+ // try "state" for Tomcat 5.5
+ try {
+ int stateInt = (Integer)
this.webModuleMBean.getAttribute("state").refresh();
+ if (stateInt == 1) {
+ state = WarMBeanState.STARTED;
+ }
+ } catch (Exception ex) {
+ // Ignore
+ }
}
availability = (state.equals(WarMBeanState.STARTED)) ? AvailabilityType.UP :
AvailabilityType.DOWN;
@@ -361,7 +370,23 @@ public class TomcatWarComponent extends
MBeanResourceComponent<TomcatVHostCompon
mbeanOperation.invoke(paramValues);
if (!WarOperation.DESTROY.equals(operation)) {
- String state = (String)
this.webModuleMBean.getAttribute("stateName").refresh();
+ String state = null;
+ try {
+ // check to see if the mbean is truly active
+ state = (String)
this.webModuleMBean.getAttribute("stateName").refresh();
+ } catch (Exception e) {
+ // if not active an exception may be thrown
+ state = WarMBeanState.STOPPED;
+ // try "state" for Tomcat 5.5
+ try {
+ int stateInt = (Integer)
this.webModuleMBean.getAttribute("state").refresh();
+ if (stateInt == 1) {
+ state = WarMBeanState.STARTED;
+ }
+ } catch (Exception ex) {
+ // Ignore
+ }
+ }
String expectedState = getExpectedPostExecutionState(operation);
if (!state.equals(expectedState)) {
throw new Exception("Failed to " + name + " webapp (value
of the 'state' attribute of MBean '"
commit 9056a575064fdc8e25776079386d04a2442114cc
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Wed Apr 10 15:17:22 2013 +0200
[BZ 921194] Connectors are not properly discovered and therefore are unavailable..
from 00e594847fe67da46f8976df58b5d2324d6ebb48.
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
index 7a65a73..32566d5 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
@@ -132,12 +132,14 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
if (connectorON != null) {
EmsBean connectorBean = connection.getBean(connectorON);
EmsAttribute executorNameAttrib =
connectorBean.getAttribute("executorName");
- Object executorNameValue = executorNameAttrib.getValue();
- if (executorNameValue != null) {
- String executorName = executorNameValue.toString();
- if (!executorName.isEmpty() &&
!executorName.equalsIgnoreCase("Internal")) {
- pluginConfiguration.put(new PropertySimple(
- TomcatConnectorComponent.PLUGIN_CONFIG_SHARED_EXECUTOR,
executorName));
+ if (executorNameAttrib != null) {
+ Object executorNameValue = executorNameAttrib.getValue();
+ if (executorNameValue != null) {
+ String executorName = executorNameValue.toString();
+ if (!executorName.isEmpty() &&
!executorName.equalsIgnoreCase("Internal")) {
+ pluginConfiguration.put(new PropertySimple(
+ TomcatConnectorComponent.PLUGIN_CONFIG_SHARED_EXECUTOR,
executorName));
+ }
}
}
}
commit 9691fff8d4b34f438213381b24a55e89c940b5f8
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Wed Apr 10 15:13:02 2013 +0200
Fix BZ 865460 from 417fbb59817edf64a93d3cca00f2c51926379ab2
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
index 1d667a7..ba68ce9 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
@@ -185,6 +185,7 @@ public class TomcatGroupComponent extends
MBeanResourceComponent<TomcatUserDatab
nameProperty = new PropertySimple(CONFIG_GROUP_NAME, name.substring(1,
name.length() - 1));
opConfig.put(nameProperty);
resourceContext.getParentResourceComponent().invokeOperation("removeGroup",
opConfig);
+ resourceContext.getParentResourceComponent().save();
}
}
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
index 92e2610..051965c 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
@@ -50,6 +50,7 @@ public class TomcatRoleComponent extends
MBeanResourceComponent<TomcatUserDataba
nameProperty = new PropertySimple(CONFIG_ROLE_NAME, name);
opConfig.put(nameProperty);
resourceContext.getParentResourceComponent().invokeOperation("removeRole",
opConfig);
+ resourceContext.getParentResourceComponent().save();
}
@Override
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
index 24936cd..7eb8aa5 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
@@ -206,6 +206,7 @@ public class TomcatUserComponent extends
MBeanResourceComponent<TomcatUserDataba
nameProperty = new PropertySimple(CONFIG_USERNAME, name.substring(1,
name.length() - 1));
opConfig.put(nameProperty);
resourceContext.getParentResourceComponent().invokeOperation("removeUser",
opConfig);
+ resourceContext.getParentResourceComponent().save();
}
}
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
index bb13097..0a95069 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
@@ -26,6 +26,7 @@ package org.jboss.on.plugins.tomcat;
import org.jboss.on.plugins.tomcat.helper.CreateResourceHelper;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.resource.CreateResourceStatus;
import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
import org.rhq.core.pluginapi.inventory.CreateResourceReport;
@@ -45,8 +46,11 @@ public class TomcatUserDatabaseComponent extends
MBeanResourceComponent<TomcatSe
String objectName = null;
String operation = null;
try {
+ PropertySimple newGroups = null;
+ PropertySimple newRoles = null;
if (TomcatGroupComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
name =
report.getResourceConfiguration().getSimple("groupname").getStringValue();
+ newRoles =
report.getResourceConfiguration().getSimple(TomcatGroupComponent.CONFIG_ROLES);
objectName =
String.format("Users:type=Group,groupname=\"%s\",database=UserDatabase",
name);
operation = "createGroup";
} else if (TomcatRoleComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName))
{
@@ -55,6 +59,10 @@ public class TomcatUserDatabaseComponent extends
MBeanResourceComponent<TomcatSe
operation = "createRole";
} else if (TomcatUserComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName))
{
name =
report.getResourceConfiguration().getSimple("username").getStringValue();
+ newRoles =
report.getResourceConfiguration().getSimple(TomcatUserComponent.CONFIG_ROLES);
+ newGroups =
report.getResourceConfiguration().getSimple(TomcatUserComponent.CONFIG_GROUPS);
+
report.getResourceConfiguration().remove(TomcatUserComponent.CONFIG_ROLES);
+
report.getResourceConfiguration().remove(TomcatUserComponent.CONFIG_GROUPS);
objectName =
String.format("Users:type=User,username=\"%s\",database=UserDatabase",
name);
operation = "createUser";
} else {
@@ -67,6 +75,14 @@ public class TomcatUserDatabaseComponent extends
MBeanResourceComponent<TomcatSe
CreateResourceHelper.setResourceName(report, name);
this.invokeOperation(operation, report.getResourceConfiguration());
+ if (TomcatGroupComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
+ report.getResourceConfiguration().put(newRoles);
+ // FIXME: Add newRoles to the group
+ } else if (TomcatUserComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName))
{
+ report.getResourceConfiguration().put(newGroups);
+ report.getResourceConfiguration().put(newRoles);
+ // FIXME: Add newRoles and newGroups to the user
+ }
// If all went well, persist the changes to the Tomcat user Database
save();
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 5ad9092..8dbb251 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
@@ -226,7 +226,9 @@
name="Tomcat Virtual Host"
discovery="TomcatVHostDiscoveryComponent"
class="TomcatVHostComponent"
- description="A virtual host in the web container">
+ description="A virtual host in the web container"
+ createDeletePolicy="both"
+ creationDataType="configuration">
<plugin-configuration>
<c:group
@@ -501,10 +503,6 @@
type="integer"
description="Maximum size of the static resource cache in
kilobytes. If not specified, the default value is 10240 (10 megabytes)." />
<c:simple-property
- name="caseSensitive"
- type="boolean"
- description="If the value of this flag is true, all case
sensitivity checks will be disabled. If not specified, the default value of the flag is
true. NOTE: This flag MUST NOT be set to false on the Windows platform (or any other OS
which does not have a case sensitive filesystem), as it will disable case sensitivity
checks, allowing JSP source code disclosure, among other security problems." />
- <c:simple-property
name="cookies"
type="boolean"
description="Set to true if you want cookies to be used for
session identifier communication if supported by the client (this is the default). Set to
false if you want to disable the use of cookies for session identifier communication, and
rely only on URL rewriting by the application." />
@@ -516,7 +514,8 @@
<c:simple-property
name="configFile"
type="string"
- description="The location of the context.xml resource or
file" />
+ description="The location of the context.xml resource or file
Note: Does not exist in Tomcat 7 (return type changed to URL)"
+ required="false" />
<c:simple-property
name="crossContext"
type="boolean"
@@ -526,13 +525,7 @@
readOnly="true"
required="true"
description="The docBase set for this application" />
- <!-- Although it claims to be writable, update failed in my V5 and
V6 test, so read only for now. -->
- <c:simple-property
- name="eventProvider"
- type="boolean"
- description="Event provider support for this managed
object?"
- readOnly="true" />
- <c:simple-property
+ <c:simple-property
name="privileged"
type="boolean"
description="Set to true to allow this context to use container
servlets, like the manager servlet. Use of the privileged attribute will change the
context's parent class loader to be the Server class loader rather than the Shared
class loader. Note that in a default installation, the Common class loader is used for
both the Server and the Shared class loaders." />
@@ -544,18 +537,6 @@
name="saveConfig"
type="boolean"
description="Write the configuration as needed on
startup?" />
- <!-- Although it claims to be writable, update failed in my V5 and
V6 test, so read only for now. -->
- <c:simple-property
- name="stateManageable"
- type="boolean"
- description="State management support for this managed
object?"
- readOnly="true" />
- <!-- Although it claims to be writable, update failed in my V5 and
V6 test, so read only for now. -->
- <c:simple-property
- name="statisticsProvider"
- type="boolean"
- description="Performance statistics support for this managed
object?"
- readOnly="true" />
<c:simple-property
name="swallowOutput"
type="boolean"
@@ -857,10 +838,6 @@
type="boolean"
description="A boolean value which can be used to enable or
disable the TRACE HTTP method. If not specified, this attribute is set to false."
/>
<c:simple-property
- name="bufferSize"
- type="integer"
- description="HTTP: The size (in bytes) of the buffer to be
provided for input streams created by this connector. By default, buffers of 2048 bytes
will be provided. AJP: The size of the output buffer to use. If less than or equal to
zero, then output buffering is disabled. The default value is -1 (i.e. buffering
disabled)" />
- <c:simple-property
name="connectionTimeout"
type="integer"
description="HTTP: The number of milliseconds this Connector will
wait, after accepting a connection, for the request URI line to be presented. The default
value is 60000 (i.e. 60 seconds). AJP: The number of milliseconds this Connector will
wait, after accepting a connection, for the request URI line to be presented. The default
value is infinite (i.e. no timeout)."
@@ -868,7 +845,8 @@
<c:simple-property
name="emptySessionPath"
type="boolean"
- description="If set to true, all paths for session cookies will be
set to /. This can be useful for portlet specification implementations, but will greatly
affect performance if many applications are accessed on a given server by the client. If
not specified, this attribute is set to false." />
+ description="If set to true, all paths for session cookies will be
set to /. This can be useful for portlet specification implementations, but will greatly
affect performance if many applications are accessed on a given server by the client. If
not specified, this attribute is set to false. Note: Does not exist in Tomcat 7"
+ required="false" />
<c:simple-property
name="enableLookups"
type="boolean"
commit cb5d7c3772e9eefbe6b126ce81cbd1ca00241123
Author: jfclere <jfclere(a)neo2.gva.redhat.com>
Date: Wed Apr 10 14:33:38 2013 +0200
fix for BZ: 707349 from e7d48240474fba87f1a3c4118de4618fd2c8b32d.
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java
index 1bb12db..e335d10 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java
@@ -43,16 +43,27 @@ public class TomcatCacheDiscoveryComponent extends
MBeanResourceDiscoveryCompone
@Override
public Set<DiscoveredResourceDetails>
discoverResources(ResourceDiscoveryContext<TomcatWarComponent> discoveryContext) {
+ String objectNameTemplate = "";
+ Set<DiscoveredResourceDetails> resources;
+
Configuration defaultPluginConfig =
discoveryContext.getDefaultPluginConfiguration();
- String objectNameTemplate =
defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue();
String host =
discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_VHOST,
null);
String path =
discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_CONTEXT_ROOT,
null);
+
+ objectNameTemplate =
defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue();
objectNameTemplate = objectNameTemplate.replace("%host%", host);
objectNameTemplate = objectNameTemplate.replace("%path%", path);
defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME,
objectNameTemplate));
- Set<DiscoveredResourceDetails> resources =
super.performDiscovery(defaultPluginConfig, discoveryContext.getParentResourceComponent(),
discoveryContext.getResourceType());
+ resources = super.performDiscovery(defaultPluginConfig,
discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType());
+ if (resources.size() == 0) {
+ objectNameTemplate = getCacheObjectName();
+ objectNameTemplate = objectNameTemplate.replace("%host%", host);
+ objectNameTemplate = objectNameTemplate.replace("%path%", path);
+ defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME,
objectNameTemplate));
+ resources = super.performDiscovery(defaultPluginConfig,
discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType());
+ }
// returns only one resource.
for (DiscoveredResourceDetails detail : resources) {
Configuration pluginConfiguration = detail.getPluginConfiguration();
@@ -63,4 +74,8 @@ public class TomcatCacheDiscoveryComponent extends
MBeanResourceDiscoveryCompone
}
return resources;
}
+
+ private String getCacheObjectName() {
+ return "Catalina:type=Cache,host=%host%,context=%path%";
+ }
}
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java
index 4013376..ab35743 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java
@@ -71,10 +71,18 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
*/
public static final String PLUGIN_CONFIG_ADDRESS = "address";
/**
+ * Plugin property name for the connector type the connector is bound to.
+ */
+ public static final String PLUGIN_CONFIG_CONNECTOR = "connector";
+ /**
* Plugin property name for the protocol handler. This prefix is used in the
associated GlobalRequestProcessor object name.
*/
public static final String PLUGIN_CONFIG_HANDLER = "handler";
/**
+ * Plugin property name for the name.
+ */
+ public static final String PLUGIN_CONFIG_NAME = "name";
+ /**
* Plugin property name for the port the connector is listening on.
*/
public static final String PLUGIN_CONFIG_PORT = "port";
@@ -110,8 +118,8 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
@Override
public void start(ResourceContext<TomcatServerComponent<?>> context) {
if
(UNKNOWN.equals(context.getPluginConfiguration().getSimple(PLUGIN_CONFIG_HANDLER).getStringValue()))
{
- throw new InvalidPluginConfigurationException(
- "The connector is not listening for requests on the configured port.
This is most likely due to the configured port being in use at Tomcat startup. In some
cases (AJP connectors) Tomcat will assign an open port. This happens most often when there
are multiple Tomcat servers running on the same platform. Check your Tomcat configuration
for conflicts: "
+ throw new InvalidPluginConfigurationException(
+ "The connector is not listening for requests on the configured port. This
is most likely due to the configured port being in use at Tomcat startup. In some cases
(AJP connectors) Tomcat will assign an open port. This happens most often when there are
multiple Tomcat servers running on the same platform. Check your Tomcat configuration for
conflicts: "
+ context.getResourceKey());
}
@@ -123,12 +131,12 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
getEmsConnection(); // reload the EMS connection
for (MeasurementScheduleRequest request : requests) {
- String name = request.getName();
- name = switchConnectorThreadpoolName(name);
- name = getAttributeName(name);
+ String req = request.getName();
+ req = switchConnectorThreadpoolName(req);
+ req = getAttributeName(req);
- String beanName = name.substring(0, name.lastIndexOf(':'));
- String attributeName = name.substring(name.lastIndexOf(':') + 1);
+ String beanName = req.substring(0, req.lastIndexOf(':'));
+ String attributeName = req.substring(req.lastIndexOf(':') + 1);
try {
// Bean is cached by EMS, so no problem with getting the bean from the
connection on each call
@@ -145,7 +153,7 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
report.addData(new MeasurementDataNumeric(request,
value.doubleValue()));
} catch (Exception e) {
- log.error("Failed to obtain measurement [" + name +
"]", e);
+ log.error("Failed to obtain measurement [" + req +
"]", e);
}
}
}
@@ -158,46 +166,46 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
*
* See BZ 795531.
*
- * @param name the metric property name that may need to be switched if it is a
threadpool metric
+ * @param property the metric property name that may need to be switched if it is a
threadpool metric
* @return the name for the metric property, switched to use the shared executor name
if appropriate
*/
- private String switchConnectorThreadpoolName(String name) {
+ private String switchConnectorThreadpoolName(String property) {
Configuration pluginConfiguration =
getResourceContext().getPluginConfiguration();
String sharedExecutorName =
pluginConfiguration.getSimpleValue(PLUGIN_CONFIG_SHARED_EXECUTOR, "");
if (sharedExecutorName == null || sharedExecutorName.trim().isEmpty()) {
- return name; // there is nothing special to do if the connector isn't
using a shared executor for its threadpool
+ return property; // there is nothing special to do if the connector isn't
using a shared executor for its threadpool
}
- // 1) Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadsBusy
+ // 1) Catalina:type=ThreadPool,name=%name%:currentThreadsBusy
// will be replaced with:
// Catalina:type=Executor,name=<name of shared executor>:activeCount
//
- // 2) Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount
+ // 2) Catalina:type=ThreadPool,name=%name%:currentThreadCount
// will be replaced with:
// Catalina:type=Executor,name=<name of shared executor>:poolSize
//
- // 3) Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads
+ // 3) Catalina:type=ThreadPool,name=%name%:maxThreads
// will be replaced with
// Catalina:type=Executor,name=<name of shared executor>:maxThreads
- final String NON_SHARED_THREADS_ACTIVE =
"Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadsBusy";
- final String NON_SHARED_THREADS_ALLOCATED =
"Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount";
- final String NON_SHARED_THREADS_MAX =
"Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads";
+ final String NON_SHARED_THREADS_ACTIVE =
"Catalina:type=ThreadPool,name=%name%:currentThreadsBusy";
+ final String NON_SHARED_THREADS_ALLOCATED =
"Catalina:type=ThreadPool,name=%name%:currentThreadCount";
+ final String NON_SHARED_THREADS_MAX =
"Catalina:type=ThreadPool,name=%name%:maxThreads";
final String SHARED_THREADS_ACTIVE =
"Catalina:type=Executor,name=XXX:activeCount";
final String SHARED_THREADS_ALLOCATED =
"Catalina:type=Executor,name=XXX:poolSize";
final String SHARED_THREADS_MAX =
"Catalina:type=Executor,name=XXX:maxThreads";
- if (name.equals(NON_SHARED_THREADS_ACTIVE)) {
- name = SHARED_THREADS_ACTIVE;
- } else if (name.equals(NON_SHARED_THREADS_ALLOCATED)) {
- name = SHARED_THREADS_ALLOCATED;
- } else if (name.equals(NON_SHARED_THREADS_MAX)) {
- name = SHARED_THREADS_MAX;
+ if (property.equals(NON_SHARED_THREADS_ACTIVE)) {
+ property = SHARED_THREADS_ACTIVE;
+ } else if (property.equals(NON_SHARED_THREADS_ALLOCATED)) {
+ property = SHARED_THREADS_ALLOCATED;
+ } else if (property.equals(NON_SHARED_THREADS_MAX)) {
+ property = SHARED_THREADS_MAX;
} else {
- return name; // this isn't one of the names we need to switch, immediate
return the original name as-is
+ return property; // this isn't one of the names we need to switch,
immediate return the original name as-is
}
- name = name.replace("XXX", sharedExecutorName);
- return name;
+ property = property.replace("XXX", sharedExecutorName);
+ return property;
}
/**
@@ -218,42 +226,15 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
}
private String getGlobalRequestProcessorName() {
- String name =
"Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%";
-
- return replaceGlobalRequestProcessorNameProps(name);
+ return
replaceGlobalRequestProcessorNameProps("Catalina:type=GlobalRequestProcessor,name=%name%");
}
- private String replaceGlobalRequestProcessorNameProps(String name) {
- String result = name;
+ private String replaceGlobalRequestProcessorNameProps(String property) {
Configuration pluginConfiguration =
getResourceContext().getPluginConfiguration();
- String port =
pluginConfiguration.getSimple(PLUGIN_CONFIG_PORT).getStringValue();
- String handler =
pluginConfiguration.getSimple(PLUGIN_CONFIG_HANDLER).getStringValue();
- String address = pluginConfiguration.getSimpleValue(PLUGIN_CONFIG_ADDRESS,
"");
-
- if (!"".equals(address)) {
- StringBuilder sb = new StringBuilder("-");
- sb.append(address);
- // if it's a host name, add the IP portion that Tomcat expects
- if (!address.contains(".")) {
- String ip;
-
- try {
- ip = InetAddress.getByName(address).getHostAddress();
- sb.append("%2F");
- sb.append(ip);
- address = sb.toString();
- } catch (UnknownHostException e) {
- log.debug("Failed to resolve host [" + address + "].
Can not get objectName for property: " + name);
- }
- } else {
- address = sb.toString();
- }
- }
+ String name =
pluginConfiguration.getSimple(PLUGIN_CONFIG_NAME).getStringValue();
- result = result.replace("%port%", port);
- result = result.replace("%address%", address);
- result = result.replace("%handler%", handler);
+ String result = property.replace("%name%", name);
return result;
}
@@ -272,7 +253,6 @@ public class TomcatConnectorComponent extends
MBeanResourceComponent<TomcatServe
}
}
if ((null == protocol) || protocol.toUpperCase().contains("AJP")) {
- // remove HTTP only properties
for (PropertyDefinition propDef :
configDef.getPropertiesInGroup("HTTP")) {
report.getConfiguration().remove(propDef.getName());
}
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
index 1591a5e..7a65a73 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java
@@ -99,7 +99,6 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
// Set handler plugin config and update resource name
String handler = (null != configInfo) ? configInfo.getHandler() :
TomcatConnectorComponent.UNKNOWN;
-
resource.setResourceName(resource.getResourceName().replace("{handler}",
handler));
// It is unusual but possible that there is a GlobalRequestProcessor object
representing a configured AJP
// connector but with a different port. If the configured AJP connector port
is in use, Tomcat increments
@@ -115,6 +114,16 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
if ((null != address) && !"".equals(address.trim())) {
pluginConfiguration.put(new
PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_ADDRESS, address));
}
+ // Set connector if it is in use
+ String connector = (null != configInfo) ? configInfo.getConnector() : null;
+ if ((null != connector) && !"".equals(connector.trim())) {
+ pluginConfiguration.put(new
PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_CONNECTOR, connector));
+ }
+
+ // Set the global request processor name (Tomcat 7 added quotes around the
name value)
+ String name = (null != configInfo) ? configInfo.getName() : null;
+
resource.setResourceName(resource.getResourceName().replace("{name}", name));
+ pluginConfiguration.put(new
PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_NAME, name));
// Let's try to auto-discover if this Connector is using a shared
executor for its thread pool.
// If it is, let's set the plugin config property automatically so we can
collect the proper metrics.
@@ -122,15 +131,13 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
String connectorON =
pluginConfiguration.getSimpleValue(TomcatConnectorComponent.OBJECT_NAME_PROP, null);
if (connectorON != null) {
EmsBean connectorBean = connection.getBean(connectorON);
- EmsAttribute executorNameAttrib =
connectorBean.getAttribute("executorName"); // older tomcat versions won't
have this attrib
- if (executorNameAttrib != null) {
- Object executorNameValue = executorNameAttrib.getValue();
- if (executorNameValue != null) {
- String executorName = executorNameValue.toString();
- if (!executorName.isEmpty() &&
!executorName.equalsIgnoreCase("Internal")) {
- pluginConfiguration.put(new PropertySimple(
- TomcatConnectorComponent.PLUGIN_CONFIG_SHARED_EXECUTOR,
executorName));
- }
+ EmsAttribute executorNameAttrib =
connectorBean.getAttribute("executorName");
+ Object executorNameValue = executorNameAttrib.getValue();
+ if (executorNameValue != null) {
+ String executorName = executorNameValue.toString();
+ if (!executorName.isEmpty() &&
!executorName.equalsIgnoreCase("Internal")) {
+ pluginConfiguration.put(new PropertySimple(
+ TomcatConnectorComponent.PLUGIN_CONFIG_SHARED_EXECUTOR,
executorName));
}
}
}
@@ -145,10 +152,11 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
}
private static class ConfigInfo {
- private String name;
- private String address;
- private String handler;
- private String port;
+ private String name = "";
+ private String address = "";
+ private String handler = "";
+ private String connector = "";
+ private String port = "";
private Exception exception;
public ConfigInfo(EmsBean bean) {
@@ -159,30 +167,53 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
* 1) handler-port
* 2) handler-ipaddress-port
* 3) handler-host%2Fipaddress-port
+ * 4) "handler-connector-port"
+ * 5) "handler-connector-ipaddress-port"
*
* Option 2 or 3 occurs when the <address> is explicitly defined in the
<connector> element.
* Option 3 occurs when the address is an alias. The alias is resolved and
appended to the alias separated
* by '/' (encoded a slash comes through as %2F). Note that the host
may have itself contain dashes '-'.
+ * Option 4 and 5 are Tomcat 7
*/
try {
- int firstDash = name.indexOf('-');
- int lastDash = name.lastIndexOf('-');
- handler = name.substring(0, firstDash);
- port = name.substring(lastDash + 1);
- // validate that the port is a valid int
- Integer.valueOf(port);
-
- // Check to see if an address portion exists
- if (firstDash != lastDash) {
- // For option 3 keep the alias and we'll resolve as needed
- String rawAddress = name.substring(firstDash + 1, lastDash);
- int delim = rawAddress.indexOf("%2F");
- address = (-1 == delim) ? rawAddress : rawAddress.substring(0,
delim);
+ // Check to see if this is TC7
+ if (name.startsWith("\"")) {
+ int firstDash = name.indexOf('-');
+ int lastDash = name.lastIndexOf('-');
+ handler = name.substring(1, firstDash);
+ port = name.substring(lastDash + 1, name.length() - 1);
+ // validate that the port is a valid int
+ Integer.valueOf(port);
+ String middle = name.substring(firstDash + 1, lastDash);
+
+ if (middle.indexOf('-') != -1) {
+ connector = middle.substring(0, middle.indexOf('-'));
+ address = middle.substring(middle.indexOf('-') + 1);
+ } else {
+ connector = middle;
+ }
+ } else {
+ int firstDash = name.indexOf('-');
+ int lastDash = name.lastIndexOf('-');
+ handler = name.substring(0, firstDash);
+ port = name.substring(lastDash + 1);
+ // validate that the port is a valid int
+ Integer.valueOf(port);
+
+ // Check to see if an address portion exists
+ if (firstDash != lastDash) {
+ // For option 3 keep the alias and we'll resolve as needed
+ String rawAddress = name.substring(firstDash + 1, lastDash);
+ int delim = rawAddress.indexOf("%2F");
+ address = (-1 == delim) ? rawAddress : rawAddress.substring(0, delim);
+ }
}
} catch (Exception e) {
+ name = null;
port = null;
address = null;
+ connector = null;
handler = null;
exception = e;
}
@@ -196,6 +227,10 @@ public class TomcatConnectorDiscoveryComponent extends
MBeanResourceDiscoveryCom
return address;
}
+ public String getConnector() {
+ return connector;
+ }
+
public String getHandler() {
return handler;
}
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java
index 4749544..5a9b0b4 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java
@@ -35,22 +35,30 @@ import org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent;
public class TomcatDatasourceDiscoveryComponent extends
MBeanResourceDiscoveryComponent<TomcatWarComponent> {
@Override
- public Set<DiscoveredResourceDetails> discoverResources(
- ResourceDiscoveryContext<TomcatWarComponent> discoveryContext) {
+ public Set<DiscoveredResourceDetails>
discoverResources(ResourceDiscoveryContext<TomcatWarComponent> discoveryContext) {
+
+ String objectNameTemplate = "";
+ Set<DiscoveredResourceDetails> resources;
Configuration defaultPluginConfig =
discoveryContext.getDefaultPluginConfiguration();
- String objectNameTemplate =
defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue();
- String host =
discoveryContext.getParentResourceContext().getPluginConfiguration()
- .getSimpleValue(TomcatWarComponent.PROPERTY_VHOST, null);
- String path =
discoveryContext.getParentResourceContext().getPluginConfiguration()
- .getSimpleValue(TomcatWarComponent.PROPERTY_CONTEXT_ROOT, null);
+ String host =
discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_VHOST,
null);
+ String path =
discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_CONTEXT_ROOT,
null);
+
+ objectNameTemplate =
defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue();
objectNameTemplate = objectNameTemplate.replace("%host%", host);
objectNameTemplate = objectNameTemplate.replace("%path%", path);
defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME,
objectNameTemplate));
- Set<DiscoveredResourceDetails> resources =
super.performDiscovery(defaultPluginConfig,
- discoveryContext.getParentResourceComponent(),
discoveryContext.getResourceType());
+ resources = super.performDiscovery(defaultPluginConfig,
discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType());
+ if (resources.size() == 0) {
+ objectNameTemplate = getDatasourceObjectName();
+ objectNameTemplate = objectNameTemplate.replace("%host%", host);
+ objectNameTemplate = objectNameTemplate.replace("%path%", path);
+ defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME,
objectNameTemplate));
+ resources = super.performDiscovery(defaultPluginConfig,
discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType());
+ }
+ // returns only one resource.
for (DiscoveredResourceDetails detail : resources) {
Configuration pluginConfiguration = detail.getPluginConfiguration();
pluginConfiguration.put(new
PropertySimple(TomcatDatasourceComponent.PROPERTY_HOST, host));
@@ -60,4 +68,8 @@ public class TomcatDatasourceDiscoveryComponent extends
MBeanResourceDiscoveryCo
}
return resources;
}
+
+ private String getDatasourceObjectName() {
+ return
"Catalina:type=DataSource,context=%path%,host=%host%,class=javax.sql.DataSource,name=%name%";
+ }
}
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
index 542f212..0537e7e 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
@@ -55,7 +55,7 @@ import org.rhq.core.system.SystemInfo;
import org.rhq.plugins.jmx.JMXDiscoveryComponent;
/**
- * Discovers JBoss EWS and Apache Tomcat5, Tomcat6 server instances.
+ * Discovers JBoss EWS and Apache Tomcat5, Tomcat6, Tomcat7 server instances.
*
* @author Jay Shaughnessy
*/
@@ -106,6 +106,7 @@ public class TomcatDiscoveryComponent implements
ResourceDiscoveryComponent, Man
/**
* EWS RPM Install path substrings used to identify EWS tomcat version
*/
+ public static final String EWS_TOMCAT_7 = "tomcat7";
public static final String EWS_TOMCAT_6 = "tomcat6";
public static final String EWS_TOMCAT_5 = "tomcat5";
@@ -242,7 +243,7 @@ public class TomcatDiscoveryComponent implements
ResourceDiscoveryComponent, Man
if (catalinaHome == null && isWindows(context)) {
log.debug("catalina.home not found. Checking to see if this is an EWS
installation.");
- // On Windows EWS uses the tomcat5.exe and tomcat6.exe executables to start
tomcat. They currently do
+ // On Windows EWS uses the tomcat5.exe, tomcat6.exe or Tomcat7.exe
executables to start tomcat. They currently do
// not provide the command line args that we get with the normal start up
scripts that are used to
// determine catalina.home. See
https://bugzilla.redhat.com/show_bug.cgi?id=580931 for more information.
//
@@ -353,8 +354,8 @@ public class TomcatDiscoveryComponent implements
ResourceDiscoveryComponent, Man
return null;
}
- //EWS supports tomcat 5 or 6 and starts them using the tomcat5.exe or
- //tomcat6.exe. The catalina homes we want for them are stored inside
+ //EWS supports tomcat 5, 6 or 7 and starts them using the tomcat5.exe,
+ //tomcat6.exe or Tomcat7.exe. The catalina homes we want for them are stored
inside
//$EWS_HOME/share/tomcat-<version>, where version differs.
//EWS 1.0.1 uses tomcat 6.0.24, while EWS 1.0.2 uses tomcat 6.0.32
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
index 96ae3a3..495d920 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
@@ -146,17 +146,17 @@ public class TomcatWarComponent extends
MBeanResourceComponent<TomcatVHostCompon
}
if (null != this.webModuleMBean) {
- int state;
+ String state;
try {
// check to see if the mbean is truly active
- state = (Integer)
this.webModuleMBean.getAttribute("state").refresh();
+ state = (String)
this.webModuleMBean.getAttribute("stateName").refresh();
} catch (Exception e) {
// if not active an exception may be thrown
state = WarMBeanState.STOPPED;
}
- availability = (WarMBeanState.STARTED == state) ? AvailabilityType.UP :
AvailabilityType.DOWN;
+ availability = (state.equals(WarMBeanState.STARTED)) ? AvailabilityType.UP :
AvailabilityType.DOWN;
if (AvailabilityType.DOWN == availability) {
// if availability is down then ensure we use a new mbean on the next
try, in case we have
@@ -361,19 +361,19 @@ public class TomcatWarComponent extends
MBeanResourceComponent<TomcatVHostCompon
mbeanOperation.invoke(paramValues);
if (!WarOperation.DESTROY.equals(operation)) {
- int state = (Integer)
this.webModuleMBean.getAttribute("state").refresh();
- int expectedState = getExpectedPostExecutionState(operation);
- if (state != expectedState) {
+ String state = (String)
this.webModuleMBean.getAttribute("stateName").refresh();
+ String expectedState = getExpectedPostExecutionState(operation);
+ if (!state.equals(expectedState)) {
throw new Exception("Failed to " + name + " webapp (value
of the 'state' attribute of MBean '"
- + this.webModuleMBean.getBeanName() + "' is " + state +
", not " + expectedState + ").");
+ + this.webModuleMBean.getBeanName() + "' is \"" +
state + "\", not \"" + expectedState + "\").");
}
}
return new OperationResult();
}
- private static int getExpectedPostExecutionState(WarOperation operation) {
- int expectedState;
+ private static String getExpectedPostExecutionState(WarOperation operation) {
+ String expectedState;
switch (operation) {
case START:
case RELOAD: {
@@ -446,8 +446,8 @@ public class TomcatWarComponent extends
MBeanResourceComponent<TomcatVHostCompon
}
private interface WarMBeanState {
- int STOPPED = 0;
- int STARTED = 1;
+ String STOPPED = "STOPPED";
+ String STARTED = "STARTED";
}
private List<EmsBean> getVHosts() {
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 9d082d4..5ad9092 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
@@ -4,7 +4,7 @@
name="Tomcat"
displayName="Tomcat Server"
package="org.jboss.on.plugins.tomcat"
- description="Supports management and monitoring of JBoss EWS or Apache Tomcat5,
Tomcat6"
+ description="Supports management and monitoring of JBoss EWS or Apache Tomcat5,
Tomcat6, Tomcat7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
@@ -154,13 +154,13 @@
query="process|basename|match=^java.*,arg|org.apache.catalina.startup.Bootstrap|match=.*"
/>
<!--
- On windows EWS uses the tomcat5.exe and tomcat6.exe executables for starting
tomcat. Unlike the normal
+ On windows EWS uses the tomcat5.exe, tomcat6.exe and tomcat7.exe executables for
starting tomcat. Unlike the normal
start up scripts, these do specify the command line args for determining
catalina.home. See
https://bugzilla.redhat.com/show_bug.cgi?id=580931 for more details.
-->
<process-scan
name="WindowsEWSTomcat"
- query="process|basename|match=^tomcat(5|6)\.exe"/>
+ query="process|basename|match=^(T|t)omcat(5|6|7)\.exe"/>
<operation
name="start"
@@ -744,6 +744,10 @@
readOnly="true"
default="Catalina:type=Connector,port=%port%" />
<c:simple-property
+ name="name"
+ type="string"
+ readOnly="true" />
+ <c:simple-property
name="port"
type="string"
description="Port on which this connector is configured to
listen."
@@ -752,7 +756,12 @@
name="handler"
type="string"
description="Connector protocol handler."
- readOnly="true" />
+ readOnly="true" />
+ <c:simple-property
+ name="connector"
+ type="string"
+ description="Connector protocol connector."
+ readOnly="true" />
<c:simple-property
name="address"
type="string"
@@ -772,7 +781,7 @@
hiddenByDefault="true">
<c:simple-property
name="nameTemplate"
- default="{handler}-{port}" />
+ default="{name}" />
<c:simple-property
name="descriptionTemplate"
default="A Tomcat connector" />
@@ -800,42 +809,42 @@
description="Resumes this connector" />
<metric
-
property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:maxTime"
+
property="Catalina:type=GlobalRequestProcessor,name=%name%:maxTime"
displayName="Maximum Request Time"
description="Maximum time it took to process a request."
units="milliseconds"
category="performance" />
<metric
-
property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:requestCount"
+
property="Catalina:type=GlobalRequestProcessor,name=%name%:requestCount"
displayName="Request count"
description="Total number of requests processed since last
restart."
category="utilization"
measurementType="trendsup" />
<metric
-
property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:errorCount"
+
property="Catalina:type=GlobalRequestProcessor,name=%name%:errorCount"
displayName="Error count"
description="Number of errors while processing since last
restart."
category="utilization"
measurementType="trendsup" />
<metric
-
property="Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadsBusy"
+ property="Catalina:type=ThreadPool,name=%name%:currentThreadsBusy"
displayName="Threadpool Threads Active"
description="Number of current busy threads."
category="utilization"
displayType="summary" />
<metric
-
property="Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount"
+ property="Catalina:type=ThreadPool,name=%name%:currentThreadCount"
displayName="Threadpool Threads Allocated"
description="Number of current threads."
category="utilization"
displayType="summary" />
<metric
-
property="Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads"
+ property="Catalina:type=ThreadPool,name=%name%:maxThreads"
displayName="Threadpool Max Threads"
description="Maximum number of threads that can be allocated for the
ThreadPool."
category="utilization"
@@ -1263,4 +1272,4 @@
</server>
-</plugin>
+</plugin>
\ No newline at end of file