Repository: cxf Updated Branches: refs/heads/master a1157adaf -> e0a449ec7
Add WS-MakeConnection 1.1 basic policy handling; fix WS-I RSP policy handling. Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e0a449ec Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e0a449ec Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e0a449ec Branch: refs/heads/master Commit: e0a449ec78e933b8edbb5cc78d028a2cc6111cb2 Parents: a1157ad Author: dsosnoski <[email protected]> Authored: Fri Jun 27 12:52:07 2014 +1200 Committer: dsosnoski <[email protected]> Committed: Fri Jun 27 12:55:54 2014 +1200 ---------------------------------------------------------------------- rt/ws/rm/pom.xml | 8 +++ rt/ws/rm/src/main/build-resources/catalog.cat | 1 + .../cxf/ws/rm/policy/MC11AssertionBuilder.java | 64 ++++++++++++++++++++ .../cxf/ws/rm/policy/MC11PolicyLoader.java | 64 ++++++++++++++++++++ .../rm/policy/RMPolicyInterceptorProvider.java | 9 ++- .../cxf/ws/rm/policy/RSPPolicyLoader.java | 63 +++++++++++++++++++ .../resources/META-INF/cxf/bus-extensions.txt | 3 +- .../main/resources/schemas/wsdl/wsmc-1.1.xjb | 36 +++++++++++ .../main/resources/schemas/wsdl/wsmc-1.1.xsd | 37 +++++++++++ 9 files changed, 281 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/pom.xml ---------------------------------------------------------------------- diff --git a/rt/ws/rm/pom.xml b/rt/ws/rm/pom.xml index ca33bf8..70d122d 100644 --- a/rt/ws/rm/pom.xml +++ b/rt/ws/rm/pom.xml @@ -171,6 +171,14 @@ </deleteDirs> </xsdOption> <xsdOption> + <xsd>${basedir}/src/main/resources/schemas/wsdl/wsmc-1.1.xsd</xsd> + <bindingFile>${basedir}/src/main/resources/schemas/wsdl/wsmc-1.1.xjb</bindingFile> + <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog> + <deleteDirs> + <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/ws/addressing</deleteDir> + </deleteDirs> + </xsdOption> + <xsdOption> <xsd>${basedir}/src/main/resources/schemas/configuration/wsrm-manager-types.xsd</xsd> <bindingFile>${basedir}/src/main/resources/schemas/configuration/wsrm-policy.xjb</bindingFile> <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog> http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/build-resources/catalog.cat ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/build-resources/catalog.cat b/rt/ws/rm/src/main/build-resources/catalog.cat index 19d8362..9ac8f34 100644 --- a/rt/ws/rm/src/main/build-resources/catalog.cat +++ b/rt/ws/rm/src/main/build-resources/catalog.cat @@ -23,6 +23,7 @@ SYSTEM "http://schemas.xmlsoap.org/ws/2004/08/addressing" "../../../../../../cor SYSTEM "http://www.w3.org/2006/03/addressing/ws-addr.xsd" "../../../../../../core/src/main/resources/schemas/wsdl/ws-addr.xsd" SYSTEM "http://docs.oasis-open.org/ws-rx/wsrm/200702" "../resources/schemas/wsdl/wsrm-1.1.xsd" +SYSTEM "http://docs.oasis-open.org/ws-rx/wsmc/200702" "../resources/schemas/wsdl/wsmc-1.1.xsd" SYSTEM "http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd" "../resources/schemas/configuration/wsrm-policy.xsd" SYSTEM "http://docs.oasis-open.org/ws-rx/wsrmp/200702" "../resources/schemas/configuration/wsrmp-1.1-schema-200702.xsd" http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11AssertionBuilder.java ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11AssertionBuilder.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11AssertionBuilder.java new file mode 100644 index 0000000..37a5982 --- /dev/null +++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11AssertionBuilder.java @@ -0,0 +1,64 @@ +/** + * 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.policy; + +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; + +import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder; + +/** + * Builds a WS-MakeConnection MCSupported assertion. + */ +public class MC11AssertionBuilder implements AssertionBuilder<Element> { + + public static final String MCSUPPORTED_NAME = "MCSupported"; + public static final String WSMC_NAMESPACE = "http://docs.oasis-open.org/ws-rx/wsmc/200702"; + public static final QName MCSUPPORTED_QNAME = new QName(WSMC_NAMESPACE, MCSUPPORTED_NAME); + + public static final QName[] KNOWN_ELEMENTS = { + MCSUPPORTED_QNAME + }; + + /** + * @see org.apache.neethi.builders.AssertionBuilder#getKnownElements() + */ + public QName[] getKnownElements() { + return KNOWN_ELEMENTS; + } + + /** + * @see org.apache.neethi.builders.AssertionBuilder#build(org.w3c.dom.Element, + * org.apache.neethi.AssertionBuilderFactory) + */ + public Assertion build(Element elem, AssertionBuilderFactory factory) throws IllegalArgumentException { + Assertion assertion = null; + if (WSMC_NAMESPACE.equals(elem.getNamespaceURI()) && MCSUPPORTED_NAME.equals(elem.getLocalName())) { + boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem); + assertion = new PrimitiveAssertion(MCSUPPORTED_QNAME, optional); + } + return assertion; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11PolicyLoader.java ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11PolicyLoader.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11PolicyLoader.java new file mode 100644 index 0000000..b134ce1 --- /dev/null +++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/MC11PolicyLoader.java @@ -0,0 +1,64 @@ +/** + * 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.policy; + +import org.apache.cxf.Bus; +import org.apache.cxf.common.injection.NoJSR250Annotations; +import org.apache.cxf.ws.policy.AssertionBuilderLoader; +import org.apache.cxf.ws.policy.AssertionBuilderRegistry; +import org.apache.cxf.ws.policy.PolicyInterceptorProviderLoader; +import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry; + +/** + * Policy loader for WS-MakeConnection MCSupported assertion. This provides the hooks for Neethi to handle the + * assertion. + */ +@NoJSR250Annotations +public final class MC11PolicyLoader implements PolicyInterceptorProviderLoader, AssertionBuilderLoader { + Bus bus; + + public MC11PolicyLoader(Bus b) { + bus = b; + registerBuilders(); + try { + registerProviders(); + } catch (Throwable t) { + // We'll ignore this as the policy framework will then not find the providers and error out at + // that point. If nothing uses WS-MakeConnection no warnings/errors will display + } + } + + public void registerBuilders() { + AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class); + if (reg == null) { + return; + } + reg.registerBuilder(new MC11AssertionBuilder()); + } + + public void registerProviders() { + //interceptor provider for the policy + PolicyInterceptorProviderRegistry reg = bus.getExtension(PolicyInterceptorProviderRegistry.class); + if (reg == null) { + return; + } + reg.register(new RMPolicyInterceptorProvider(bus)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java index 76bfae4..45e0a0a 100644 --- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java +++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java @@ -25,6 +25,8 @@ import javax.xml.namespace.QName; import org.apache.cxf.Bus; import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider; +import org.apache.cxf.ws.rm.RM10Constants; +import org.apache.cxf.ws.rm.RM11Constants; import org.apache.cxf.ws.rm.RMCaptureOutInterceptor; import org.apache.cxf.ws.rm.RMDeliveryInterceptor; import org.apache.cxf.ws.rm.RMInInterceptor; @@ -45,9 +47,10 @@ public class RMPolicyInterceptorProvider extends AbstractPolicyInterceptorProvid static { Collection<QName> types = new ArrayList<QName>(); - types.add(new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", "RMAssertion")); - types.add(new QName("http://docs.oasis-open.org/ws-rx/wsrmp/200702", "RMAssertion")); - types.add(new QName("http://ws-i.org/profiles/rsp/1.0/", "Conformant")); + types.add(RM10Constants.WSRMP_RMASSERTION_QNAME); + types.add(RM11Constants.WSRMP_RMASSERTION_QNAME); + types.add(MC11AssertionBuilder.MCSUPPORTED_QNAME); + types.add(RSPAssertionBuilder.CONFORMANT_QNAME); ASSERTION_TYPES = types; } http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPPolicyLoader.java ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPPolicyLoader.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPPolicyLoader.java new file mode 100644 index 0000000..c9d4578 --- /dev/null +++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPPolicyLoader.java @@ -0,0 +1,63 @@ +/** + * 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.policy; + +import org.apache.cxf.Bus; +import org.apache.cxf.common.injection.NoJSR250Annotations; +import org.apache.cxf.ws.policy.AssertionBuilderLoader; +import org.apache.cxf.ws.policy.AssertionBuilderRegistry; +import org.apache.cxf.ws.policy.PolicyInterceptorProviderLoader; +import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry; + +/** + * Policy loader for WS-I RSP assertion. This provides the hooks for Neethi to handle the assertion. + */ +@NoJSR250Annotations +public final class RSPPolicyLoader implements PolicyInterceptorProviderLoader, AssertionBuilderLoader { + Bus bus; + + public RSPPolicyLoader(Bus b) { + bus = b; + registerBuilders(); + try { + registerProviders(); + } catch (Throwable t) { + // We'll ignore this as the policy framework will then not find the providers and error out at + // that point. If nothing uses WS-I RSP no warnings/errors will display + } + } + + public void registerBuilders() { + AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class); + if (reg == null) { + return; + } + reg.registerBuilder(new RSPAssertionBuilder()); + } + + public void registerProviders() { + //interceptor provider for the policy + PolicyInterceptorProviderRegistry reg = bus.getExtension(PolicyInterceptorProviderRegistry.class); + if (reg == null) { + return; + } + reg.register(new RMPolicyInterceptorProvider(bus)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt b/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt index b2a2198..44e050f 100644 --- a/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt +++ b/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt @@ -3,4 +3,5 @@ org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider::true:true org.apache.cxf.ws.rm.policy.RM10AssertionBuilder::true:true org.apache.cxf.ws.rm.policy.RM12AssertionBuilder::true:true org.apache.cxf.ws.rm.policy.WSRMP12PolicyLoader::true:true - +org.apache.cxf.ws.rm.policy.MC11PolicyLoader::true:true +org.apache.cxf.ws.rm.policy.RSPPolicyLoader::true:true http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xjb ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xjb b/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xjb new file mode 100644 index 0000000..9dbbea4 --- /dev/null +++ b/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xjb @@ -0,0 +1,36 @@ +<?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. +--> +<jaxb:bindings version="1.0" + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" + jaxb:extensionBindingPrefixes="xjc"> + <jaxb:bindings schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd" node="/xs:schema"> + <jaxb:schemaBindings> + <jaxb:package name="org.apache.cxf.ws.addressing"/> + </jaxb:schemaBindings> + </jaxb:bindings> + <jaxb:bindings schemaLocation="wsmc-1.1.xsd" node="/xs:schema"> + <jaxb:schemaBindings> + <jaxb:package name="org.apache.cxf.ws.mc.v200702"/> + </jaxb:schemaBindings> + <jaxb:globalBindings generateIsSetMethod="true"/> + </jaxb:bindings> +</jaxb:bindings> http://git-wip-us.apache.org/repos/asf/cxf/blob/e0a449ec/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xsd ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xsd b/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xsd new file mode 100644 index 0000000..92a830c --- /dev/null +++ b/rt/ws/rm/src/main/resources/schemas/wsdl/wsmc-1.1.xsd @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright(C) OASIS(R) 1993-2008. All Rights Reserved. + OASIS trademark, IPR and other policies apply. --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsmc="http://docs.oasis-open.org/ws-rx/wsmc/200702" targetNamespace="http://docs.oasis-open.org/ws-rx/wsmc/200702" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd"/> + <!-- Protocol Elements --> + <xs:complexType name="MessagePendingType"> + <xs:sequence> + <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="pending" type="xs:boolean"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:complexType> + <xs:element name="MessagePending" type="wsmc:MessagePendingType"/> + <xs:element name="Address"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:anyURI"> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + <xs:complexType name="MakeConnectionType"> + <xs:sequence> + <xs:element ref="wsmc:Address" minOccurs="0" maxOccurs="1"/> + <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:complexType> + <xs:element name="MakeConnection" type="wsmc:MakeConnectionType"/> + <xs:element name="UnsupportedElement"> + <xs:simpleType> + <xs:restriction base="xs:QName"/> + </xs:simpleType> + </xs:element> +</xs:schema>
