Permalink
Browse files

AS7-2305 Misc tweaks

AS7-2305 introduce 1.1 version of jaxr subsystem xsd
  • Loading branch information...
1 parent 0dd0bc0 commit e012d07284c359398d670826b4662ec3b0313626 @bstansberry bstansberry committed with kabir Mar 7, 2012
Showing with 320 additions and 163 deletions.
  1. +0 −11 build/src/license/licenses.xml
  2. +1 −2 build/src/main/resources/appclient/configuration/appclient.xml
  3. +1 −1 build/src/main/resources/configuration/subsystems/jaxr.xml
  4. +57 −0 build/src/main/resources/docs/schema/jboss-as-jaxr_1_1.xsd
  5. +3 −1 jaxr/src/main/java/org/jboss/as/jaxr/JAXRConfiguration.java
  6. +8 −4 jaxr/src/main/java/org/jboss/as/jaxr/JAXRConstants.java
  7. +0 −47 jaxr/src/main/java/org/jboss/as/jaxr/extension/AbstractAttributeHandler.java
  8. +2 −2 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRDependencyProcessor.java
  9. +23 −13 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRPropertyAdd.java
  10. +20 −3 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRPropertyRemove.java
  11. +12 −2 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRPropertyWrite.java
  12. +4 −5 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRSubsystemExtension.java
  13. +142 −16 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRSubsystemParser.java
  14. +0 −39 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRSubsystemRemove.java
  15. +3 −1 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRSubsystemRootResource.java
  16. +3 −3 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRWriteAttributeHandler.java
  17. +15 −1 jaxr/src/test/java/org/jboss/as/jaxr/extension/JaxrSubsystemTestCase.java
  18. +2 −3 pom.xml
  19. +23 −1 subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemBaseTest.java
  20. +1 −8 testsuite/domain/src/test/resources/domain-configs/domain-standard.xml
@@ -902,17 +902,6 @@
</licenses>
</dependency>
<dependency>
- <groupId>org.apache.ws.scout</groupId>
- <artifactId>scout</artifactId>
- <licenses>
- <license>
- <name>Apache Software License, Version 2.0</name>
- <url>http://repository.jboss.org/licenses/apache-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- </dependency>
- <dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<licenses>
@@ -131,9 +131,8 @@
</security-domain>
</security-domains>
</subsystem>
- <subsystem xmlns="urn:jboss:domain:jaxr:1.0">
+ <subsystem xmlns="urn:jboss:domain:jaxr:1.1">
<connection-factory jndi-name="java:jboss/jaxr/ConnectionFactory"/>
- <juddi-server publish-url="http://localhost:8080/juddi/publish" query-url="http://localhost:8080/juddi/query"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:1.0">
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
@@ -2,7 +2,7 @@
<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
<config>
<extension-module>org.jboss.as.jaxr</extension-module>
- <subsystem xmlns="urn:jboss:domain:jaxr:1.0">
+ <subsystem xmlns="urn:jboss:domain:jaxr:1.1">
<connection-factory jndi-name="java:jboss/jaxr/ConnectionFactory"/>
</subsystem>
</config>
@@ -0,0 +1,57 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:jboss:domain:jaxr:1.1"
+ xmlns="urn:jboss:domain:jaxr:1.1"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.1">
+
+ <!-- The subsystem root element -->
+ <xs:element name="subsystem" type="subsystemType"/>
+
+ <xs:complexType name="subsystemType">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[
+ The configuration of the JAXR subsystem.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="connection-factory" type="connectionFactoryType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="connectionFactoryType" mixed="false">
+ <xs:attribute name="jndi-name" type="xs:token" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The JNDI name for the ConnectionFactory
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="class" type="xs:token" use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The fully qualified class name of the ConnectionFactory implementation.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:complexType name="propertiesType">
+ <xs:sequence>
+ <xs:element name="property" type="propertyType" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="propertyType">
+ <xs:attribute name="name" use="required"/>
+ <xs:attribute name="value" use="optional"/>
+ </xs:complexType>
+
+</xs:schema>
@@ -68,8 +68,10 @@ public void applyUpdateToConfig(String attributeName, String attributeValue) {
setConnectionFactoryBinding(attributeValue);
} else if (attributeName.equals(ModelConstants.CONNECTION_FACTORY_IMPL)) {
setConnectionFactoryImplementation(attributeValue);
- } else {
+ } else if (attributeValue != null) {
properties.setProperty(attributeName, attributeValue);
+ } else {
+ properties.remove(attributeName);
}
}
}
@@ -71,9 +71,10 @@
// must be first
UNKNOWN(null),
- JAXR_1_0("urn:jboss:domain:jaxr:1.0");
+ JAXR_1_0("urn:jboss:domain:jaxr:1.0"),
+ JAXR_1_1("urn:jboss:domain:jaxr:1.1");
- public static final Namespace CURRENT = JAXR_1_0;
+ public static final Namespace CURRENT = JAXR_1_1;
private final String name;
private static final Map<String, Namespace> MAP;
@@ -106,7 +107,9 @@ public static Namespace forUri(String uri) {
JNDI_NAME("jndi-name"),
CLASS("class"),
NAME("name"),
- VALUE("value");
+ VALUE("value"),
+ PUBLISH_URL("publish-url"), // legacy attribute
+ QUERY_URL("query-url"); // legacy attribute
private final String name;
private static final Map<String, Attribute> MAP;
@@ -143,7 +146,8 @@ public String toString() {
UNKNOWN(null),
CONNECTION_FACTORY("connection-factory"),
PROPERTIES("properties"),
- PROPERTY("property");
+ PROPERTY("property"),
+ JUDDI_SERVER("juddi-server"); // legacy element
private final String name;
private static final Map<String, Element> MAP;
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.as.jaxr.extension;
-
-import org.jboss.as.controller.AbstractAddStepHandler;
-import org.jboss.as.controller.OperationFailedException;
-import org.jboss.dmr.ModelNode;
-
-/**
- * Handler responsible for adding JAXR attributes to the model
- *
- * @author Thomas.Diesler@jboss.com
- * @since 07-Nov-2011
- */
-abstract class AbstractAttributeHandler extends AbstractAddStepHandler {
-
- private final String modelAttribute;
-
- AbstractAttributeHandler(String modelAttribute) {
- this.modelAttribute = modelAttribute;
- }
-
- @Override
- protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException {
- ModelNode attrNode = operation.get(modelAttribute);
- model.get(modelAttribute).set(attrNode);
- }
-}
@@ -41,7 +41,7 @@
*/
public class JAXRDependencyProcessor implements DeploymentUnitProcessor {
- public static ModuleIdentifier APACHE_SCOUT = ModuleIdentifier.create("org.apache.ws.scout");
+ public static ModuleIdentifier APACHE_SCOUT = ModuleIdentifier.create("org.apache.juddi.scout");
public static ModuleIdentifier JBOSS_JAXR = ModuleIdentifier.create("org.jboss.as.jaxr");
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
@@ -62,4 +62,4 @@ private void addDependency(ModuleSpecification moduleSpecification, ModuleLoader
public void undeploy(DeploymentUnit context) {
}
-}
+}
@@ -26,13 +26,19 @@
import java.util.ResourceBundle;
import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.ServiceVerificationHandler;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
+import org.jboss.as.controller.operations.common.PathAddHandler;
import org.jboss.as.jaxr.JAXRConfiguration;
import org.jboss.as.jaxr.ModelConstants;
import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
import org.jboss.dmr.Property;
+import org.jboss.msc.service.ServiceController;
/**
* @author Kurt Stam
@@ -47,16 +53,20 @@ public JAXRPropertyAdd(JAXRConfiguration config) {
@Override
protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException {
- model.get(ModelConstants.VALUE).set(operation.get(ModelConstants.VALUE));
- ModelNode propertyNode = operation.get("address");
- List<Property> properties = propertyNode.asPropertyList();
- for (Property property : properties) {
- if (property.getName().equals(ModelConstants.PROPERTY)) {
- config.applyUpdateToConfig(
- property.getValue().asString(),
- operation.get(ModelConstants.VALUE).asString());
- }
- }
+ JAXRPropertyWrite.VALUE.validateAndSet(operation, model);
+ }
+
+ @Override
+ protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model,
+ ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
+ final String propertyName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
+ config.applyUpdateToConfig(propertyName, JAXRPropertyWrite.VALUE.resolveModelAttribute(context, model).asString());
+ }
+
+ @Override
+ protected void rollbackRuntime(OperationContext context, ModelNode operation, ModelNode model, List<ServiceController<?>> controllers) {
+ final String propertyName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
+ config.applyUpdateToConfig(propertyName, null);
}
static DescriptionProvider DESCRIPTION = new DescriptionProvider() {
@@ -67,9 +77,9 @@ public ModelNode getModelDescription(Locale locale) {
ResourceBundle resbundle = JAXRConfiguration.getResourceBundle(locale);
node.get(ModelDescriptionConstants.OPERATION_NAME).set(ModelDescriptionConstants.ADD);
node.get(ModelDescriptionConstants.DESCRIPTION).set(resbundle.getString("jaxr.property.add"));
- //node.get(ModelConstants.PROPERTY, ModelConstants.VALUE, ModelDescriptionConstants.DESCRIPTION).set(resbundle.getString("jaxr.property.value"));
- //node.get(ModelConstants.PROPERTY, ModelConstants.VALUE, ModelDescriptionConstants.TYPE).set(ModelType.STRING);
- //node.get(ModelConstants.PROPERTY, ModelConstants.VALUE, ModelDescriptionConstants.REQUIRED).set(true);
+ node.get(ModelDescriptionConstants.REQUEST_PROPERTIES, ModelConstants.VALUE, ModelDescriptionConstants.DESCRIPTION).set(resbundle.getString("jaxr.property.value"));
+ node.get(ModelDescriptionConstants.REQUEST_PROPERTIES, ModelConstants.VALUE, ModelDescriptionConstants.TYPE).set(ModelType.STRING);
+ node.get(ModelDescriptionConstants.REQUEST_PROPERTIES, ModelConstants.VALUE, ModelDescriptionConstants.REQUIRED).set(true);
return node;
}
};
@@ -24,6 +24,9 @@
import java.util.Locale;
import org.jboss.as.controller.AbstractRemoveStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.jaxr.JAXRConfiguration;
@@ -33,9 +36,23 @@
* @author Kurt Stam
*/
public class JAXRPropertyRemove extends AbstractRemoveStepHandler {
- static final JAXRPropertyRemove INSTANCE = new JAXRPropertyRemove();
- private JAXRPropertyRemove() {
+ private final JAXRConfiguration config;
+
+ JAXRPropertyRemove(JAXRConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
+ final String propertyName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
+ config.applyUpdateToConfig(propertyName, null);
+ }
+
+ @Override
+ protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
+ final String propertyName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
+ config.applyUpdateToConfig(propertyName, JAXRPropertyWrite.VALUE.resolveModelAttribute(context, model).asString());
}
static DescriptionProvider DESCRIPTION = new DescriptionProvider() {
@@ -45,7 +62,7 @@ public ModelNode getModelDescription(Locale locale) {
ModelNode node = new ModelNode();
node.get(ModelDescriptionConstants.OPERATION_NAME).set(ModelDescriptionConstants.REMOVE);
node.get(ModelDescriptionConstants.DESCRIPTION).set(JAXRConfiguration.getResourceBundle(locale).getString("jaxr.property.remove"));
- //node.get(ModelConstants.PROPERTY).setEmptyObject();
+ node.get(ModelDescriptionConstants.REQUEST_PROPERTIES).setEmptyObject();
return node;
}
};
@@ -24,34 +24,44 @@
import org.jboss.as.controller.AbstractWriteAttributeHandler;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.SimpleAttributeDefinition;
+import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.jaxr.JAXRConfiguration;
import org.jboss.as.jaxr.ModelConstants;
import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
/**
+ * Handles write-attribute operation for a JAXR property resource.
+ *
* @author Kurt Stam
* @since 25-Oct-2011
*/
public class JAXRPropertyWrite extends AbstractWriteAttributeHandler<Void> {
+ static final SimpleAttributeDefinition VALUE = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.VALUE, ModelType.STRING, false)
+ .setAllowExpression(true).build();
+
private final JAXRConfiguration config;
public JAXRPropertyWrite(JAXRConfiguration config) {
+ super(VALUE);
this.config = config;
}
@Override
protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder handbackHolder) throws OperationFailedException {
- String propName = operation.get(ModelDescriptionConstants.OP_ADDR).asObject().get(ModelConstants.PROPERTY).asString();
+ final String propName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
String propValue = resolvedValue.asString();
applyUpdateToConfig(config, propName, propValue);
return false;
}
@Override
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, Void handback) throws OperationFailedException {
- String propName = operation.get(ModelDescriptionConstants.OP_ADDR).asObject().get(ModelConstants.PROPERTY).asString();
+ final String propName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
String propValue = valueToRestore.asString();
applyUpdateToConfig(config, propName, propValue);
}
@@ -62,19 +62,20 @@
@Override
public void initializeParsers(ExtensionParsingContext context) {
- context.setSubsystemXmlMapping(JAXRConstants.SUBSYSTEM_NAME, Namespace.CURRENT.getUriString(), parser);
+ context.setSubsystemXmlMapping(JAXRConstants.SUBSYSTEM_NAME, Namespace.JAXR_1_1.getUriString(), parser);
+ context.setSubsystemXmlMapping(JAXRConstants.SUBSYSTEM_NAME, Namespace.JAXR_1_0.getUriString(), parser);
}
@Override
public void initialize(ExtensionContext context) {
- SubsystemRegistration subsystem = context.registerSubsystem(JAXRConstants.SUBSYSTEM_NAME, 1, 0);
+ SubsystemRegistration subsystem = context.registerSubsystem(JAXRConstants.SUBSYSTEM_NAME, 1, 1);
ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new JAXRSubsystemRootResource(config));
registration.registerOperationHandler(DESCRIBE, SubsystemDescribeHandler.INSTANCE, SubsystemDescribeHandler.INSTANCE, false, OperationEntry.EntryType.PRIVATE);
// JAXR Properties
ManagementResourceRegistration properties = registration.registerSubModel(PathElement.pathElement(ModelConstants.PROPERTY), PROPERTY_DESCRIPTION);
properties.registerOperationHandler(ModelDescriptionConstants.ADD, new JAXRPropertyAdd(config), JAXRPropertyAdd.DESCRIPTION, false);
- properties.registerOperationHandler(ModelDescriptionConstants.REMOVE, JAXRPropertyRemove.INSTANCE, JAXRPropertyRemove.DESCRIPTION, false);
+ properties.registerOperationHandler(ModelDescriptionConstants.REMOVE, new JAXRPropertyRemove(config), JAXRPropertyRemove.DESCRIPTION, false);
properties.registerReadWriteAttribute(ModelConstants.VALUE, null, new JAXRPropertyWrite(config), Storage.CONFIGURATION);
subsystem.registerXMLElementWriter(JAXRSubsystemWriter.INSTANCE);
@@ -107,8 +108,6 @@ public ModelNode getModelDescription(Locale locale) {
node.get(ATTRIBUTES, ModelConstants.VALUE, ModelDescriptionConstants.DESCRIPTION).set(resbundle.getString("jaxr.property.value"));
node.get(ATTRIBUTES, ModelConstants.VALUE, ModelDescriptionConstants.TYPE).set(ModelType.STRING);
node.get(ATTRIBUTES, ModelConstants.VALUE, ModelDescriptionConstants.REQUIRED).set(true);
- node.get(ATTRIBUTES, ModelConstants.VALUE, ModelDescriptionConstants.ACCESS_TYPE).set(AccessType.READ_WRITE.toString());
- //node.get(ATTRIBUTES, ModelConstants.VALUE, ModelDescriptionConstants.RESTART_REQUIRED).set("all-services");
return node;
}
};
Oops, something went wrong.

0 comments on commit e012d07

Please sign in to comment.