modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java | 35 ++++++++-- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/CreateResourceDelegate.java | 1 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java | 20 +++++ modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 14 ++-- modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java | 2 5 files changed, 59 insertions(+), 13 deletions(-)
New commits: commit c5c7e2519e69b19e1c677f3b825fc327672a0e14 Author: Heiko W. Rupp hwr@redhat.com Date: Mon Apr 30 20:04:20 2012 +0200
BZ 811149 - make protocol required to follow eap6er6 here
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 89c8634..051dc7a 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 @@ -1928,7 +1928,8 @@ <c:simple-property name="max-post-size" required="false" type="integer" readOnly="false" defaultValue="2097152" description="Maximum size in bytes of a POST request that can be parsed by the container. The default value is 2097152."/> <c:simple-property name="max-save-post-size" required="false" type="integer" readOnly="false" defaultValue="4096" description="Maximum size in bytes of a POST request that will be saved during certain authentication schemes. The default value is 4096."/> <c:simple-property name="name" required="false" type="string" readOnly="true" description="A unique name for the connector."/> - <c:simple-property name="protocol" required="false" type="string" readOnly="false" description="The web connector protocol. (e.g. 'HTTP/1.1' or 'AJP' or a name of a class implementing ProtocolHandler and MBeanRegistration )"> + <c:simple-property name="protocol" required="true" type="string" readOnly="false" default="HTTP/1.1" defaultValue="HTTP/1.1" + description="The web connector protocol. (e.g. 'HTTP/1.1' or 'AJP' or a name of a class implementing ProtocolHandler and MBeanRegistration )"> <!-- TODO let the user could enter a custom value here when the UI supports this. --> <c:property-options > <c:option value="HTTP/1.1"/>
commit 16e0954374a0144a952620cce9c0327dad32c550 Author: Heiko W. Rupp hwr@redhat.com Date: Mon Apr 30 19:36:37 2012 +0200
BZ 817540 - don't try to write path objects that are r/o (introduced in eap6er6)
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java index 229cc84..495b9fe 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java @@ -53,6 +53,11 @@ import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
public class ConfigurationWriteDelegate implements ConfigurationFacet {
+ /** A map where this error message has been set must not be written to the AS + * @see #updateHandlePropertyMapSpecial + */ + public static final String LOGICAL_REMOVED = "__logicalRemoved"; + final Log log = LogFactory.getLog(this.getClass());
protected Address address; @@ -63,6 +68,7 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet { private String type; private boolean addNewChildren; private boolean addDeleteModifiedChildren; + protected boolean createChildRequested = false;
/** * Create a new configuration delegate, that reads the attributes for the resource at address. @@ -262,13 +268,18 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet { boolean found=false; for (Property prop2 : pl.getList()) { PropertyMap propMap2 = (PropertyMap) prop2; - String itemName = propMap2.getSimple(namePropLocator).getStringValue(); - if (itemName==null) { - throw new IllegalArgumentException("Map contains no entry with name [" + namePropLocator + "]"); - } - if (itemName.equals(existingName)) { - found=true; - break; + if (LOGICAL_REMOVED.equals(propMap2.getErrorMessage())) { + found = true; // we pretend this still exists on the server, so nothing to update + } else { + String itemName = propMap2.getSimple(namePropLocator).getStringValue(); + if (itemName == null) { + throw new IllegalArgumentException("Map contains no entry with name [" + namePropLocator + + "]"); + } + if (itemName.equals(existingName)) { + found = true; + break; + } } }
@@ -313,6 +324,13 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet {
private void updateHandlePropertyMapSpecial(CompositeOperation cop, PropertyMap prop, PropertyDefinitionMap propDef, Address address, List<String> existingPropNames) { + if (prop==null) + return; + + // Don't try to send this map to the server + if (LOGICAL_REMOVED.equals(prop.getErrorMessage())) + return; + Map<String, Object> results = prepareSimplePropertyMap(prop, propDef); if (prop.get(namePropLocator)==null) { throw new IllegalArgumentException("There is no element in the map with the name " + namePropLocator); @@ -392,6 +410,9 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet { if (property.getStringValue() == null && !propertyDefinition.isRequired()) return;
+ if (propertyDefinition.isReadOnly() && !createChildRequested) + return; + SimpleEntry<String, Object> entry = this.preparePropertySimple(property, propertyDefinition); Operation writeAttribute = new WriteAttribute(address, entry.getKey(), entry.getValue()); cop.addStep(writeAttribute); diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/CreateResourceDelegate.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/CreateResourceDelegate.java index 6a63e2d..a7201a2 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/CreateResourceDelegate.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/CreateResourceDelegate.java @@ -39,6 +39,7 @@ public class CreateResourceDelegate extends ConfigurationWriteDelegate implement
public CreateResourceDelegate(ConfigurationDefinition configDef, ASConnection connection, Address address) { super(configDef, connection, address); + createChildRequested = true; }
@Override diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java index 7495399..bd52a51 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java @@ -19,7 +19,11 @@ package org.rhq.modules.plugins.jbossas7;
import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.Property; +import org.rhq.core.domain.configuration.PropertyList; +import org.rhq.core.domain.configuration.PropertyMap; import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.operation.OperationFacet; import org.rhq.core.pluginapi.operation.OperationResult; @@ -117,4 +121,20 @@ public class StandaloneASComponent extends BaseServerComponent implements Operat return; }
+ @Override + public void updateResourceConfiguration(ConfigurationUpdateReport report) { + // We need to filter the path properties that are marked with the read-only flag + // This is done by setting the logical removed flag on the map to signal + // the write delegate to skip the map + Configuration config = report.getConfiguration(); + PropertyList propertyList = config.getList("*3"); + for (Property property : propertyList.getList()) { + PropertyMap map = (PropertyMap) property; + String ro = map.getSimpleValue("read-only", "false"); + if (Boolean.parseBoolean(ro)) { + map.setErrorMessage(ConfigurationWriteDelegate.LOGICAL_REMOVED); + } + } + super.updateResourceConfiguration(report); + } } 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 9547479..89c8634 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 @@ -801,12 +801,13 @@ <c:list-property name="*3" displayName="Path" required="false" description="The standard paths provided by the system include: jboss.home - the root directory of the JBoss AS distribution; user.home - user's home directory; user.dir - user's current working directory; java.home - java installation directory; jboss.server.base.dir - root directory for an individual server instance; jboss.server.data.dir - directory the server will use for persistent data file storage; jboss.server.log.dir - directory the server will use for log file storage; jboss.server.tmp.dir - directory the server will use for temporary file storage; jboss.domain.servers.dir - directory under which a host controller will create the working area for individual server instances"> <c:map-property name="*" displayName="Entry"> - <c:simple-property name="name" required="true" type="string" readOnly="false" + <c:simple-property name="name" required="true" type="string" readOnly="true" description="The name of the path. Cannot be one of the standard fixed paths provided by the system"/> <c:simple-property name="path" required="true" type="string" readOnly="false" description="The actual filesystem path. Treated as an absolute path, unless the 'relative-to' attribute is specified, in which case the value is treated as relative to that 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."/> + <c:simple-property name="read-only" description="Is this property read-only" default="false" readOnly="true" defaultValue="false" type="boolean"/> </c:map-property> </c:list-property> </c:group> @@ -956,12 +957,13 @@ <c:list-property name="*3" displayName="Path" required="false" description="The standard paths provided by the system include: jboss.home - the root directory of the JBoss AS distribution; user.home - user's home directory; user.dir - user's current working directory; java.home - java installation directory; jboss.server.base.dir - root directory for an individual server instance; jboss.server.data.dir - directory the server will use for persistent data file storage; jboss.server.log.dir - directory the server will use for log file storage; jboss.server.tmp.dir - directory the server will use for temporary file storage; jboss.domain.servers.dir - directory under which a host controller will create the working area for individual server instances"> <c:map-property name="*" displayName="Entry"> - <c:simple-property name="name" required="true" type="string" readOnly="false" + <c:simple-property name="name" required="true" type="string" readOnly="true" description="The name of the path. Cannot be one of the standard fixed paths provided by the system"/> <c:simple-property name="path" required="true" type="string" readOnly="false" description="The actual filesystem path. Treated as an absolute path, unless the 'relative-to' attribute is specified, in which case the value is treated as relative to that 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."/> + <c:simple-property name="read-only" description="Is this property read-only" default="false" readOnly="true" defaultValue="false" type="boolean"/> </c:map-property> </c:list-property> </c:group> @@ -1209,13 +1211,14 @@ <c:group name="children:path:name+" displayName="Path"> <c:list-property name="*3" displayName="Path" required="false" description="The standard paths provided by the system include: jboss.home - the root directory of the JBoss AS distribution; user.home - user's home directory; user.dir - user's current working directory; java.home - java installation directory; jboss.server.base.dir - root directory for an individual server instance; jboss.server.data.dir - directory the server will use for persistent data file storage; jboss.server.log.dir - directory the server will use for log file storage; jboss.server.tmp.dir - directory the server will use for temporary file storage; jboss.domain.servers.dir - directory under which a host controller will create the working area for individual server instances"> - <c:map-property name="*" displayName="Entry"> - <c:simple-property name="name" required="true" type="string" readOnly="false" + <c:map-property name="*:name" displayName="Entry"> + <c:simple-property name="name" required="true" type="string" readOnly="true" description="The name of the path. Cannot be one of the standard fixed paths provided by the system"/> <c:simple-property name="path" required="true" type="string" readOnly="false" description="The actual filesystem path. Treated as an absolute path, unless the 'relative-to' attribute is specified, in which case the value is treated as relative to that 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."/> + <c:simple-property name="read-only" description="Is this property read-only" default="false" readOnly="true" defaultValue="false" type="boolean"/> </c:map-property> </c:list-property> </c:group> diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java index 6e54814..57e381e 100644 --- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java +++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java @@ -119,7 +119,7 @@ public class StandaloneServerComponentTest extends AbstractServerComponentTest { assertEquals(avail, AvailabilityType.UP); }
- @Test(priority = 6, enabled = false) + @Test(priority = 6, enabled = true) public void testSystemPropertiesSettings() throws Exception {
Configuration config = loadResourceConfiguration(getServerResource());
rhq-commits@lists.fedorahosted.org