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 | 14 +++ modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml | 38 ++-------- 5 files changed, 25 insertions(+), 30 deletions(-)
New commits: commit 417fbb59817edf64a93d3cca00f2c51926379ab2 Author: Rémy Maucherat rmaucher@redhat.com Date: Tue Mar 26 14:51:55 2013 +0100
Fix some roles operations. Fix some attributes (not valid across all versions).
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 23a20e1..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 @@ -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); report.getResourceConfiguration().remove(TomcatGroupComponent.CONFIG_ROLES); objectName = String.format("Users:type=Group,groupname="%s",database=UserDatabase", name); operation = "createGroup"; @@ -56,6 +60,8 @@ 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); @@ -70,6 +76,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 37bc478..97f410a 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 @@ -233,7 +233,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 @@ -508,10 +510,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." /> @@ -523,7 +521,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" @@ -533,13 +532,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." /> @@ -551,18 +544,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" @@ -864,10 +845,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)." @@ -875,7 +852,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"
rhq-commits@lists.fedorahosted.org