From fdaae3ffaa2f06063d0afe27b38aa05af398835f Mon Sep 17 00:00:00 2001 From: rsivaram Date: Thu, 16 Oct 2008 13:50:40 +0000 Subject: Event prototype: subset modules and change version to 1.4-EVENT-SNAPSHOT git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@705244 13f79535-47bb-0310-9956-ffa450edef68 --- .../event/modules/binding-ws-axis2-policy/LICENSE | 205 --------------------- .../event/modules/binding-ws-axis2-policy/NOTICE | 6 - .../event/modules/binding-ws-axis2-policy/pom.xml | 149 --------------- .../token/Axis2TokenAuthenticationPolicy.java | 56 ------ .../Axis2TokenAuthenticationPolicyProcessor.java | 112 ----------- ...s2TokenAuthenticationPolicyProviderFactory.java | 75 -------- ...enAuthenticationReferencePolicyInterceptor.java | 100 ---------- ...TokenAuthenticationReferencePolicyProvider.java | 90 --------- ...okenAuthenticationServicePolicyInterceptor.java | 94 ---------- ...s2TokenAuthenticationServicePolicyProvider.java | 88 --------- .../configuration/Axis2ConfigParamPolicy.java | 54 ------ .../Axis2ConfigParamPolicyHandler.java | 79 -------- .../Axis2ConfigParamPolicyProcessor.java | 157 ---------------- .../Axis2ConfigParamPolicyProviderFactory.java | 99 ---------- .../ws/axis2/policy/header/Axis2HeaderPolicy.java | 56 ------ .../policy/header/Axis2HeaderPolicyProcessor.java | 114 ------------ .../header/Axis2HeaderPolicyProviderFactory.java | 75 -------- .../axis2/policy/header/Axis2HeaderPolicyUtil.java | 50 ----- .../Axis2HeaderReferencePolicyInterceptor.java | 88 --------- .../header/Axis2HeaderReferencePolicyProvider.java | 90 --------- .../Axis2HeaderServicePolicyInterceptor.java | 77 -------- .../header/Axis2HeaderServicePolicyProvider.java | 88 --------- .../ws/axis2/policy/header/Axis2SOAPHeader.java | 60 ------ .../axis2/policy/header/Axis2SOAPHeaderString.java | 60 ------ ...ca.contribution.processor.StAXArtifactProcessor | 21 --- ...ache.tuscany.sca.provider.PolicyProviderFactory | 20 -- .../policy/configuration/PolicyReadTestCase.java | 60 ------ .../axis2/policy/configuration/mock_policies.xml | 36 ---- 28 files changed, 2259 deletions(-) delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/LICENSE delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/NOTICE delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/pom.xml delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java delete mode 100644 sandbox/event/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml (limited to 'sandbox/event/modules/binding-ws-axis2-policy') diff --git a/sandbox/event/modules/binding-ws-axis2-policy/LICENSE b/sandbox/event/modules/binding-ws-axis2-policy/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - diff --git a/sandbox/event/modules/binding-ws-axis2-policy/NOTICE b/sandbox/event/modules/binding-ws-axis2-policy/NOTICE deleted file mode 100644 index fdfa0e9faa..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/event/modules/binding-ws-axis2-policy/pom.xml b/sandbox/event/modules/binding-ws-axis2-policy/pom.xml deleted file mode 100644 index 643a00030c..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-modules - 1.4-SNAPSHOT - ../pom.xml - - tuscany-binding-ws-axis2-policy - Apache Tuscany Policy Model for Axis2 WS binding - - - - org.apache.tuscany.sca - tuscany-contribution - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-assembly-xml - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-policy-security - 1.4-SNAPSHOT - - - - org.apache.ws.commons.axiom - axiom-api - - - xerces - xercesImpl - - - javax.mail - mail - - - commons-logging - commons-logging - - - xml-apis - xml-apis - - - 1.2.7 - - - - org.apache.ws.commons.axiom - axiom-impl - 1.2.7 - - - - org.apache.axis2 - axis2-kernel - 1.4.1 - - - backport-util-concurrent - backport-util-concurrent - - - xalan - xalan - - - xerces - xercesImpl - - - - - - backport-util-concurrent - backport-util-concurrent - 3.1 - test - - - - org.apache.neethi - neethi - 2.0.4 - - - wsdl4j - wsdl4j - - - org.codehaus.woodstox - wstx-asl - - - - - - org.apache.tuscany.sca - tuscany-contribution-impl - 1.4-SNAPSHOT - test - - - - - - - org.apache.felix - maven-bundle-plugin - - - - ${tuscany.version} - org.apache.tuscany.sca.binding.ws.axis2.policy - ${pom.name} - org.apache.tuscany.sca.binding.ws.axis2.policy* - - - - - - - diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java deleted file mode 100644 index 8fecb84bb4..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.policy.Policy; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationPolicy implements Policy { - public static final QName AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "axis2TokenAuthentication"); - public static final String AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME = "tokenName"; - - private QName tokenName; - - public QName getTokenName() { - return tokenName; - } - - public void setTokenName(QName tokenName) { - this.tokenName = tokenName; - } - - public QName getSchemaName() { - return AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java deleted file mode 100644 index e8a7872858..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.monitor.Monitor; - -/** - * - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor { - - public QName getArtifactType() { - return Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME; - } - - public Axis2TokenAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - } - - - public Axis2TokenAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - Axis2TokenAuthenticationPolicy policy = new Axis2TokenAuthenticationPolicy(); - int event = reader.getEventType(); - QName name = null; - - while (reader.hasNext()) { - event = reader.getEventType(); - switch (event) { - case START_ELEMENT : { - name = reader.getName(); - if ( name.equals(getArtifactType()) ) { - policy.setTokenName(getQName(reader, Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME)); - } - break; - } - } - - if ( event == END_ELEMENT ) { - if ( getArtifactType().equals(reader.getName()) ) { - break; - } - } - - //Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - - return policy; - } - - public void write(Axis2TokenAuthenticationPolicy policy, XMLStreamWriter writer) - throws ContributionWriteException, XMLStreamException { - String prefix = "tuscany"; - writer.writeStartElement(prefix, - getArtifactType().getLocalPart(), - getArtifactType().getNamespaceURI()); - writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS); - - if ( policy.getTokenName() != null ) { - writer.writeStartElement(prefix, - Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME, - getArtifactType().getNamespaceURI()); - writer.writeCharacters(policy.getTokenName().toString()); - writer.writeEndElement(); - } - - writer.writeEndElement(); - } - - public Class getModelType() { - return Axis2TokenAuthenticationPolicy.class; - } - - public void resolve(Axis2TokenAuthenticationPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java deleted file mode 100644 index cef881af30..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.provider.PolicyProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationPolicyProviderFactory implements PolicyProviderFactory { - private ExtensionPointRegistry registry; - - public Axis2TokenAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) { - super(); - this.registry = registry; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { - return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - return new Axis2TokenAuthenticationReferencePolicyProvider(component, reference, binding); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { - return new Axis2TokenAuthenticationServicePolicyProvider(component, service, binding); - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java deleted file mode 100644 index c6cd96e647..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - -import java.util.logging.ConsoleHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.OMText; -import org.apache.axiom.om.impl.llom.util.AXIOMUtil; -import org.apache.axiom.soap.SOAPFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.Policy; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationReferencePolicyInterceptor implements Interceptor { - - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2TokenAuthenticationPolicy policy; - - public Axis2TokenAuthenticationReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - this.operation = operation; - this.policySet = policySet; - this.context = context; - init(); - } - - private void init() { - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof Axis2TokenAuthenticationPolicy){ - policy = (Axis2TokenAuthenticationPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - // could call out here to some 3rd party system to get credentials - - if ( policy.getTokenName() != null){ - // create Axis representation of header - Axis2SOAPHeaderString header = new Axis2SOAPHeaderString(); - header.setHeaderName(policy.getTokenName()); - header.setHeaderString("SomeWSAuthorizationToken"); - - // add header to Tuscany message - msg.getHeaders().add(header); - } - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java deleted file mode 100644 index 147fd1f42a..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationReferencePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentReference reference; - private Binding binding; - - public Axis2TokenAuthenticationReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - super(); - this.component = component; - this.reference = reference; - this.binding = binding; - } - - private PolicySet findPolicySet() { - if (binding instanceof PolicySetAttachPoint) { - List policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - return null; - } - - private String getContext() { - return "component.reference: " + component.getURI() - + "#" - + reference.getName() - + "(" - + binding.getClass().getName() - + ")"; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(); - return ps == null ? null : new Axis2TokenAuthenticationReferencePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.REFERENCE_POLICY; - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java deleted file mode 100644 index 43505a8d33..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - - -import java.security.Principal; - -import javax.security.auth.Subject; - -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyUtil; -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeader; -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.SecurityUtil; -import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationServicePolicyInterceptor implements Interceptor { - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2TokenAuthenticationPolicy policy; - - public Axis2TokenAuthenticationServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - this.operation = operation; - this.policySet = policySet; - this.context = context; - init(); - } - - private void init() { - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof Axis2TokenAuthenticationPolicy){ - policy = (Axis2TokenAuthenticationPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - - Axis2SOAPHeaderString header = (Axis2SOAPHeaderString)Axis2HeaderPolicyUtil.getHeader(msg, policy.getTokenName()); - - if (header != null) { - System.out.println("Token: " + header.getHeaderString()); - - // call out here to some 3rd party system to do whatever you - // need to turn header credentials into an authenticated principal - - Subject subject = SecurityUtil.getSubject(msg); - Principal principal = new TokenPrincipal(header.getHeaderString()); - subject.getPrincipals().add(principal); - } - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java deleted file mode 100644 index e3e2a4b9a0..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.authentication.token; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2TokenAuthenticationServicePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentService service; - private Binding binding; - - public Axis2TokenAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) { - super(); - this.component = component; - this.service = service; - this.binding = binding; - } - - private PolicySet findPolicySet() { - if (binding instanceof PolicySetAttachPoint) { - List policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - return null; - } - - private String getContext() { - return "component.service: " + component.getURI() - + "#" - + service.getName() - + "(" - + binding.getClass().getName() - + ")"; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(); - return ps == null ? null : new Axis2TokenAuthenticationServicePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.SERVICE_POLICY; - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java deleted file mode 100644 index 8d08a3f78e..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.configuration; - -import java.util.Hashtable; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMElement; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.policy.Policy; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicy implements Policy { - public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "wsConfigParam"); - private Map paramElements = new Hashtable(); - - public Map getParamElements() { - return paramElements; - } - - public QName getSchemaName() { - return NAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java deleted file mode 100644 index 5ac4e3f5fd..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.configuration; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.Parameter; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.util.PolicyHandler; - - -/** - * Policy handler to handle PolicySet that contain Axis2ConfigParamPolicy instances - * - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicyHandler implements PolicyHandler { - private PolicySet applicablePolicySet = null; - - public void setUp(Object... context) { - Axis2ConfigParamPolicy axis2ConfigParamPolicy = null; - Parameter configParam = null; - for ( Object contextObject : context ) { - if ( contextObject instanceof ConfigurationContext ) { - ConfigurationContext configContext = (ConfigurationContext)contextObject; - for ( Object policy : applicablePolicySet.getPolicies() ) { - if ( policy instanceof Axis2ConfigParamPolicy ) { - axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy; - for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) { - configParam = new Parameter(paramName, - axis2ConfigParamPolicy.getParamElements().get(paramName).getFirstElement()); - configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName)); - try { - configContext.getAxisConfiguration().addParameter(configParam); - } catch ( AxisFault e ) { - throw new RuntimeException(e); - } - } - } - } - } - } - } - - public void cleanUp(Object... context) { - } - - public void beforeInvoke(Object... context) { - } - - public void afterInvoke(Object... context) { - - } - - public PolicySet getApplicablePolicySet() { - return applicablePolicySet; - } - - public void setApplicablePolicySet(PolicySet applicablePolicySet) { - this.applicablePolicySet = applicablePolicySet; - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java deleted file mode 100644 index 6478fbedad..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.configuration; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.monitor.Monitor; - -/** - * - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicyProcessor implements StAXArtifactProcessor { - public static final QName AXIS2_CONFIG_PARAM_POLICY_QNAME = Axis2ConfigParamPolicy.NAME; - public static final String PARAMETER = "parameter"; - public QName getArtifactType() { - return AXIS2_CONFIG_PARAM_POLICY_QNAME; - } - - public Axis2ConfigParamPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - } - - public Axis2ConfigParamPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - Axis2ConfigParamPolicy policy = new Axis2ConfigParamPolicy(); - int event = reader.getEventType(); - QName name = null; - OMElement parameterElement = null; - String paramName = null; - while (reader.hasNext()) { - event = reader.getEventType(); - switch (event) { - case START_ELEMENT : { - name = reader.getName(); - if ( PARAMETER.equals(name.getLocalPart()) ) { - paramName = reader.getAttributeValue(null, Constants.NAME); - parameterElement = loadElement(reader); - policy.getParamElements().put(paramName, parameterElement); - } - break; - } - } - - if ( event == END_ELEMENT ) { - if ( AXIS2_CONFIG_PARAM_POLICY_QNAME.equals(reader.getName()) ) { - break; - } - } - - //Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - - return policy; - } - - public void write(Axis2ConfigParamPolicy arg0, XMLStreamWriter arg1) throws ContributionWriteException, - XMLStreamException { - } - - public Class getModelType() { - return Axis2ConfigParamPolicy.class; - } - - public void resolve(Axis2ConfigParamPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - - private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException { - OMFactory fac = OMAbstractFactory.getOMFactory(); - OMElement head = fac.createOMElement(reader.getName()); - OMElement current = head; - while (true) { - switch (reader.next()) { - case XMLStreamConstants.START_ELEMENT: - //since the axis2 code checks against a no namespace we need to generate accordingly - QName name = new QName(reader.getName().getLocalPart()); - OMElement child = fac.createOMElement(name, current); - - int count = reader.getNamespaceCount(); - for (int i = 0; i < count; i++) { - String prefix = reader.getNamespacePrefix(i); - String ns = reader.getNamespaceURI(i); - child.declareNamespace(ns, prefix); - } - - if(!"".equals(name.getNamespaceURI())) { - child.declareNamespace(name.getNamespaceURI(), name.getPrefix()); - } - - // add the attributes for this element - count = reader.getAttributeCount(); - for (int i = 0; i < count; i++) { - String ns = reader.getAttributeNamespace(i); - String prefix = reader.getAttributePrefix(i); - String qname = reader.getAttributeLocalName(i); - String value = reader.getAttributeValue(i); - - if (ns != null) { - child.addAttribute(qname, value, fac.createOMNamespace(ns, prefix)); - child.declareNamespace(ns, prefix); - } else { - child.addAttribute(qname, value, null); - } - } - current = child; - break; - case XMLStreamConstants.CDATA: - fac.createOMText(current, reader.getText()); - break; - case XMLStreamConstants.CHARACTERS: - fac.createOMText(current, reader.getText()); - break; - case XMLStreamConstants.END_ELEMENT: - if ( current == head ) { - return head; - } else { - current = (OMElement)current.getParent(); - } - } - } - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java deleted file mode 100644 index 21261359cb..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.configuration; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.Parameter; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.provider.PolicyProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.osoa.sca.ServiceRuntimeException; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicyProviderFactory implements PolicyProviderFactory { - - public Axis2ConfigParamPolicyProviderFactory(ExtensionPointRegistry registry) { - super(); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { - return null; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - return null; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { - return null; - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - return Axis2ConfigParamPolicy.class; - } - - // FIXME: [rfeng] I think this should be refactored into the binding.ws axis2 code - public void setUp(ConfigurationContext configContext, PolicySet ps) { - Axis2ConfigParamPolicy axis2ConfigParamPolicy = null; - Parameter configParam = null; - for (Object policy : ps.getPolicies()) { - if (policy instanceof Axis2ConfigParamPolicy) { - axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy; - for (String paramName : axis2ConfigParamPolicy.getParamElements().keySet()) { - configParam = - new Parameter(paramName, axis2ConfigParamPolicy.getParamElements().get(paramName) - .getFirstElement()); - configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName)); - try { - configContext.getAxisConfiguration().addParameter(configParam); - } catch (AxisFault e) { - throw new ServiceRuntimeException(e); - } - } - } - } - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java deleted file mode 100644 index 244e501901..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.policy.Policy; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicy implements Policy { - public static final QName AXIS2_HEADER_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "axis2Header"); - public static final String AXIS2_HEADER_NAME = "headerName"; - - private QName headerName; - - public QName getHeaderName() { - return headerName; - } - - public void setHeaderName(QName headerName) { - this.headerName = headerName; - } - - public QName getSchemaName() { - return AXIS2_HEADER_POLICY_QNAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java deleted file mode 100644 index 3466b9def7..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import java.util.logging.Level; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.monitor.Monitor; - -/** - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor { - - public QName getArtifactType() { - return Axis2HeaderPolicy.AXIS2_HEADER_POLICY_QNAME; - } - - public Axis2HeaderPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - } - - - public Axis2HeaderPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - Axis2HeaderPolicy policy = new Axis2HeaderPolicy(); - int event = reader.getEventType(); - QName name = null; - - while (reader.hasNext()) { - event = reader.getEventType(); - switch (event) { - case START_ELEMENT : { - name = reader.getName(); - if ( name.equals(getArtifactType()) ) { - policy.setHeaderName(getQName(reader, Axis2HeaderPolicy.AXIS2_HEADER_NAME)); - } - break; - } - } - - if ( event == END_ELEMENT ) { - if ( getArtifactType().equals(reader.getName()) ) { - break; - } - } - - //Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - - return policy; - } - - public void write(Axis2HeaderPolicy policy, XMLStreamWriter writer) - throws ContributionWriteException, XMLStreamException { - String prefix = "tuscany"; - writer.writeStartElement(prefix, - getArtifactType().getLocalPart(), - getArtifactType().getNamespaceURI()); - writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS); - - if ( policy.getHeaderName() != null ) { - writer.writeStartElement(prefix, - Axis2HeaderPolicy.AXIS2_HEADER_NAME, - getArtifactType().getNamespaceURI()); - writer.writeCharacters(policy.getHeaderName().toString()); - writer.writeEndElement(); - } - - writer.writeEndElement(); - } - - public Class getModelType() { - return Axis2HeaderPolicy.class; - } - - public void resolve(Axis2HeaderPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java deleted file mode 100644 index 71833df382..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.provider.PolicyProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicyProviderFactory implements PolicyProviderFactory { - private ExtensionPointRegistry registry; - - public Axis2HeaderPolicyProviderFactory(ExtensionPointRegistry registry) { - super(); - this.registry = registry; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { - return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - return new Axis2HeaderReferencePolicyProvider(component, reference, binding); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { - return new Axis2HeaderServicePolicyProvider(component, service, binding); - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java deleted file mode 100644 index 98d011a8fc..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.invocation.Message; - - -/** - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicyUtil { - - public static Axis2SOAPHeader getHeader(Message msg, QName headerName){ - - Axis2SOAPHeader axis2Header = null; - - for (Object header : msg.getHeaders()){ - if (header instanceof Axis2SOAPHeader){ - Axis2SOAPHeader tmpHeader = (Axis2SOAPHeader)header; - - if (tmpHeader.getHeaderName().equals(headerName)){ - axis2Header = tmpHeader; - break; - } - } - } - - return axis2Header; - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java deleted file mode 100644 index 1b3315bb76..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import java.util.logging.ConsoleHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.OMText; -import org.apache.axiom.om.impl.llom.util.AXIOMUtil; -import org.apache.axiom.soap.SOAPFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.Policy; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderReferencePolicyInterceptor implements Interceptor { - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2HeaderPolicy policy; - - public Axis2HeaderReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - this.operation = operation; - this.policySet = policySet; - this.context = context; - init(); - } - - private void init() { - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof Axis2HeaderPolicy){ - policy = (Axis2HeaderPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - // TODO - not yet implemented - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java deleted file mode 100644 index 0af5a09d8d..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2HeaderReferencePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentReference reference; - private Binding binding; - - public Axis2HeaderReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - super(); - this.component = component; - this.reference = reference; - this.binding = binding; - } - - private PolicySet findPolicySet() { - if (binding instanceof PolicySetAttachPoint) { - List policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2HeaderPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - return null; - } - - private String getContext() { - return "component.reference: " + component.getURI() - + "#" - + reference.getName() - + "(" - + binding.getClass().getName() - + ")"; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(); - return ps == null ? null : new Axis2HeaderReferencePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.REFERENCE_POLICY; - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java deleted file mode 100644 index a758ca5261..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMElement; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderServicePolicyInterceptor implements Interceptor { - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2HeaderPolicy policy; - - public Axis2HeaderServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - this.operation = operation; - this.policySet = policySet; - this.context = context; - init(); - } - - private void init() { - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof Axis2HeaderPolicy){ - policy = (Axis2HeaderPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - // TODO - not yet implemented - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java deleted file mode 100644 index 126073beb7..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2HeaderServicePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentService service; - private Binding binding; - - public Axis2HeaderServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) { - super(); - this.component = component; - this.service = service; - this.binding = binding; - } - - private PolicySet findPolicySet() { - if (binding instanceof PolicySetAttachPoint) { - List policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2HeaderPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - return null; - } - - private String getContext() { - return "component.service: " + component.getURI() - + "#" - + service.getName() - + "(" - + binding.getClass().getName() - + ")"; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(); - return ps == null ? null : new Axis2HeaderServicePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.SERVICE_POLICY; - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java deleted file mode 100644 index 7a1f26bf04..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.OMText; -import org.apache.axiom.soap.SOAPFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.policy.Policy; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2SOAPHeader { - - private QName headerName; - - public QName getHeaderName() { - return headerName; - } - - public void setHeaderName(QName headerName) { - this.headerName = headerName; - } - - public OMElement getAsSOAPHeaderBlock(OMFactory factory) { - OMNamespace ns1 = factory.createOMNamespace(headerName.getNamespaceURI(), - headerName.getPrefix()); - OMElement header = ((SOAPFactory)factory).createSOAPHeaderBlock(headerName.getLocalPart(),ns1); - return header; - } - - public void setAsSOAPHeaderBlock(OMElement header) { - headerName = header.getQName(); - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java b/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java deleted file mode 100644 index 0eefeac87b..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.header; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.OMText; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.policy.Policy; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2SOAPHeaderString extends Axis2SOAPHeader { - - private String headerString; - - public String getHeaderString() { - return headerString; - } - - public void setHeaderString(String headerString) { - this.headerString = headerString; - } - - public OMElement getAsSOAPHeaderBlock(OMFactory factory) { - OMElement header = super.getAsSOAPHeaderBlock(factory); - OMText headerText = factory.createOMText(header, headerString); - header.addChild(headerText); - return header; - } - - public void setAsSOAPHeaderBlock(OMElement header) { - super.setAsSOAPHeaderBlock(header); - headerString = header.getText(); - } -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 96782b74bf..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,21 +0,0 @@ -# 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. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wsConfigParam,model=org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy -org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#axis2TokenAuthentication,model=org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy -org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#axis2Header,model=org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory deleted file mode 100644 index ced48cf236..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -# Implementation class for the policy extension -org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy -org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyProviderFactory;model=org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy \ No newline at end of file diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java b/sandbox/event/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java deleted file mode 100644 index cf14e54b5f..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.tuscany.sca.binding.ws.axis2.policy.configuration; - - -import java.io.InputStream; -import java.net.URL; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; - -import junit.framework.TestCase; - -/** - * - * Test the reading of ws config params policy. - * - * @version $Rev$ $Date$ - */ -public class PolicyReadTestCase extends TestCase { - - public void testPolicyReading() throws Exception { - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); - - URL url = getClass().getResource("mock_policies.xml"); - - InputStream urlStream = url.openStream(); - XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream); - - Axis2ConfigParamPolicy policy = (Axis2ConfigParamPolicy)staxProcessor.read(reader); - assertEquals(policy.getParamElements().size(), 2); - } - -} diff --git a/sandbox/event/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml b/sandbox/event/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml deleted file mode 100644 index 77f750cd0d..0000000000 --- a/sandbox/event/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Timestamp Signature - org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties - - - - - Timestamp Signature - TuscanyWsUser - org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties - org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler" + - DirectReference - - - \ No newline at end of file -- cgit v1.2.3