You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2011/11/15 17:04:05 UTC
svn commit: r1202267 - in /cxf/trunk/rt/ws/rm: ./
src/main/java/org/apache/cxf/ws/rm/blueprint/ src/main/resources/OSGI-INF/
src/main/resources/OSGI-INF/blueprint/
src/main/resources/schemas/configuration/blueprint/
Author: ay
Date: Tue Nov 15 16:04:04 2011
New Revision: 1202267
URL: http://svn.apache.org/viewvc?rev=1202267&view=rev
Log:
[CXF-3913] blueprint for ws-rm
Added:
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java (with props)
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPHandler.java (with props)
cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/
cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/
cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/ws-rm.xml (with props)
cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/
cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/wsrm-manager.xsd (with props)
Modified:
cxf/trunk/rt/ws/rm/pom.xml
Modified: cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/pom.xml?rev=1202267&r1=1202266&r2=1202267&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/pom.xml (original)
+++ cxf/trunk/rt/ws/rm/pom.xml Tue Nov 15 16:04:04 2011
@@ -34,6 +34,14 @@
<dependencies>
<dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<scope>provided</scope>
Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java?rev=1202267&view=auto
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java (added)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java Tue Nov 15 16:04:04 2011
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm.blueprint;
+
+import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.rm.manager.DeliveryAssuranceType;
+import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
+import org.apache.cxf.ws.rm.manager.ObjectFactory;
+import org.apache.cxf.ws.rm.manager.SourcePolicyType;
+import org.osgi.service.blueprint.reflect.Metadata;
+
+/**
+ * This class provides some common functions used by the two BP bean definition parsers
+ * in this package.
+ *
+ */
+public class RMBPBeanDefinitionParser extends AbstractBPBeanDefinitionParser {
+ protected static final String RM_NS = "http://cxf.apache.org/ws/rm/manager";
+
+ private static final Logger LOG = LogUtils.getL7dLogger(RMBPBeanDefinitionParser.class);
+
+ private JAXBContext jaxbContext;
+
+ private Class<?> beanClass;
+
+ public RMBPBeanDefinitionParser(Class<?> beanClass) {
+ this.beanClass = beanClass;
+ }
+
+ protected Metadata parse(Element element, ParserContext context) {
+ MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class);
+
+ bean.setRuntimeClass(beanClass);
+
+ String bus = element.getAttribute("bus");
+ if (StringUtils.isEmpty(bus)) {
+ bus = "cxf";
+ }
+
+ mapElementToJaxbProperty(context, bean, element,
+ new QName(RM_NS, "deliveryAssurance"), "deliveryAssurance", DeliveryAssuranceType.class);
+ mapElementToJaxbProperty(context, bean, element,
+ new QName(RM_NS, "sourcePolicy"), "sourcePolicy", SourcePolicyType.class);
+ mapElementToJaxbProperty(context, bean, element,
+ new QName(RM_NS, "destinationPolicy"), "destinationPolicy", DestinationPolicyType.class);
+ mapElementToJaxbProperty(context, bean, element,
+ new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", "RMAssertion"),
+ "RMAssertion",
+ org.apache.cxf.ws.rmp.v200502.RMAssertion.class);
+ mapElementToJaxbProperty(context, bean, element,
+ new QName("http://docs.oasis-open.org/ws-rx/wsrmp/200702", "RMAssertion"),
+ "RMAssertion",
+ org.apache.cxf.ws.rmp.v200702.RMAssertion.class);
+
+ parseAttributes(element, context, bean);
+ parseChildElements(element, context, bean);
+
+ bean.setId(beanClass.getName() + context.generateId());
+
+ return bean;
+ }
+
+
+
+ @Override
+ protected void mapElement(ParserContext ctx, MutableBeanMetadata bean, Element el, String name) {
+ if ("store".equals(name)) {
+ setFirstChildAsProperty(el, ctx, bean, name);
+ } else if ("addressingNamespace".equals(name)) {
+ bean.addProperty("addressingNamespace", createValue(ctx, el.getTextContent()));
+ }
+ }
+
+ protected void mapElementToJaxbProperty(ParserContext ctx,
+ MutableBeanMetadata bean, Element parent,
+ QName name,
+ String propertyName,
+ Class<?> c) {
+
+ Element data = DOMUtils.getFirstElement(parent);
+
+ try {
+ Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller();
+ MutablePassThroughMetadata value = ctx.createMetadata(MutablePassThroughMetadata.class);
+ value.setObject(unmarshaller.unmarshal(data, c).getValue());
+ bean.addProperty(propertyName, value);
+ } catch (JAXBException e) {
+ LOG.warning("Unable to parse property " + propertyName + " due to " + e);
+ }
+ }
+
+ private synchronized JAXBContext getJAXBContext() throws JAXBException {
+ if (jaxbContext == null) {
+ jaxbContext = JAXBContext.newInstance(PackageUtils.getPackageName(ObjectFactory.class),
+ ObjectFactory.class.getClassLoader());
+ }
+ return jaxbContext;
+ }
+}
Propchange: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java
------------------------------------------------------------------------------
svn:executable = *
Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPHandler.java?rev=1202267&view=auto
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPHandler.java (added)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPHandler.java Tue Nov 15 16:04:04 2011
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.rm.blueprint;
+
+import java.net.URL;
+import java.util.Set;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser;
+import org.apache.cxf.ws.rm.RMManager;
+import org.apache.cxf.ws.rm.feature.RMFeature;
+import org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+
+public class RMBPHandler implements NamespaceHandler {
+
+ public URL getSchemaLocation(String s) {
+ if ("http://cxf.apache.org/ws/rm/manager".equals(s)) {
+ return getClass().getClassLoader().
+ getResource("/schemas/configuration/blueprint/wsrm-manager.xsd");
+ } else if ("http://schemas.xmlsoap.org/ws/2005/02/rm/policy".equals(s)) {
+ return getClass().getClassLoader().
+ getResource("/schemas/configuration/wsrm-policy.xsd");
+ }
+ return null;
+ }
+
+ public Set<Class> getManagedClasses() {
+ return null;
+ }
+
+ public Metadata parse(Element element, ParserContext context) {
+ String s = element.getLocalName();
+ if ("reliableMessaging".equals(s)) {
+ return new RMBPBeanDefinitionParser(RMFeature.class).parse(element, context);
+ } else if ("rmManager".equals(s)) {
+ return new RMBPBeanDefinitionParser(RMManager.class).parse(element, context);
+ } else if ("jdbcStore".equals(s)) {
+ return new SimpleBPBeanDefinitionParser(RMTxStore.class).parse(element, context);
+ }
+
+ return null;
+ }
+
+ public ComponentMetadata decorate(Node node, ComponentMetadata componentMetadata, ParserContext context) {
+ return null;
+ }
+}
Propchange: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPHandler.java
------------------------------------------------------------------------------
svn:executable = *
Added: cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/ws-rm.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/ws-rm.xml?rev=1202267&view=auto
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/ws-rm.xml (added)
+++ cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/ws-rm.xml Tue Nov 15 16:04:04 2011
@@ -0,0 +1,36 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <service interface="org.apache.aries.blueprint.NamespaceHandler">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace">
+ <list>
+ <value>http://cxf.apache.org/ws/rm/manager</value>
+ <value>http://schemas.xmlsoap.org/ws/2005/02/rm/policy</value>
+ </list>
+ </entry>
+ </service-properties>
+ <bean class="org.apache.cxf.ws.rm.blueprint.RMBPHandler"/>
+ </service>
+</blueprint>
\ No newline at end of file
Propchange: cxf/trunk/rt/ws/rm/src/main/resources/OSGI-INF/blueprint/ws-rm.xml
------------------------------------------------------------------------------
svn:executable = *
Added: cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/wsrm-manager.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/wsrm-manager.xsd?rev=1202267&view=auto
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/wsrm-manager.xsd (added)
+++ cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/wsrm-manager.xsd Tue Nov 15 16:04:04 2011
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<xs:schema targetNamespace="http://cxf.apache.org/ws/rm/manager"
+ xmlns:tns="http://cxf.apache.org/ws/rm/manager"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+ xmlns:beans="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cxf-beans="http://cxf.apache.org/configuration/beans"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:annotation>
+ <xs:documentation>
+ This schema defines features and beans to configure the CXF Reliable Messaging components.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:include schemaLocation="../wsrm-manager-types.xsd"/>
+ <xs:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0" schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"/>
+ <xs:import namespace="http://cxf.apache.org/configuration/beans" schemaLocation="http://cxf.apache.org/schemas/configuration/cxf-beans.xsd"/>
+ <xs:import namespace="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" schemaLocation="../wsrm-policy.xsd"/>
+
+ <xs:element name="reliableMessaging">
+ <xs:annotation>
+ <xs:documentation>
+ This feature enables and controls the use of WS-Reliable Messaging.
+ It ensures that the reliable messaging interceptors are added to the interceptor chains,
+ and allows to configure behaviour of the reliable messaging infrastructure
+ that goes beyond what can be described by the attributes in the RMAssertion type.
+ Note that addition of the addressing interceptors is not part of this feature. It should
+ therefore always be used in conjunction with the addressing feature.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:group ref="tns:rmElements"/>
+ <xs:attribute name="id" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="rmManager">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="beans:Tcomponent">
+ <xs:group ref="tns:rmElements"/>
+ <!-- xs:attributeGroup ref="cxf-beans:beanAttributes"/-->
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:group name="rmElements">
+ <xs:sequence>
+ <xs:element ref="wsrmp:RMAssertion" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ The RMAssertion to be used.
+ The parameters of this RMAssertion element supercede those specified
+ in policy attachments.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="tns:deliveryAssurance" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ The delivery assurance to be used by the reliable messaging manager.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="tns:sourcePolicy" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ The source policy to be used by the reliable messaging manager.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="tns:destinationPolicy" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ The destination policy to be used by the reliable messaging manager.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+<!-- <xs:element name="rm10AddressingNamespace" minOccurs="0" type="tns:rm10AddressingNamespace">
+ <xs:annotation>
+ <xs:documentation>
+ The WS-Addressing namespace to be used for WS-ReliableMessaging 1.0.
+ For the client, this determines the addressing namespace used when sending
+ requests to the server. Both client and server will accept either namespace
+ in incoming messages.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element> -->
+ <xs:element name="store" type="xs:anyType" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ The store to use when persisting messages.
+ The child element of this element must be a bean whose bean class implements
+ org.apache.cxf.ws.rm.persistence.RMStore, or a reference to such a bean.
+ By default, messages are only persisted in memory, and thus delivery cannot be
+ guaranteed in the presence of application crashes.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <!--
+ <xs:element ref="beans:property" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ Deprecated.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ -->
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="jdbcStore">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="beans:Tcomponent">
+ <!-- xs:attributeGroup ref="cxf-beans:beanAttributes"/-->
+ <xs:attribute name="driverClassName" type="xs:string" default="org.apache.derby.jdbc.EmbeddedDriver">
+ <xs:annotation>
+ <xs:documentation>
+ The JDBC driver class name.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="url" type="xs:string" default="jdbc:derby:rmdb;create=true">
+ <xs:annotation>
+ <xs:documentation>
+ The connection URL.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="userName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The username.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="password" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The password.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
Propchange: cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/blueprint/wsrm-manager.xsd
------------------------------------------------------------------------------
svn:executable = *