From 6d0e93c68d3aeaeb4bb6d96ac0460eec40ef786e Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:13:23 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835143 13f79535-47bb-0310-9956-ffa450edef68 --- branches/sca-java-M2/sca/services/idl/pom.xml | 61 --- .../sca-java-M2/sca/services/idl/wsdl/.ruleset | 190 -------- .../sca-java-M2/sca/services/idl/wsdl/LICENSE.txt | 202 --------- .../sca-java-M2/sca/services/idl/wsdl/NOTICE.txt | 14 - branches/sca-java-M2/sca/services/idl/wsdl/pom.xml | 57 --- .../idl/wsdl/InterfaceWSDLIntrospector.java | 48 -- .../idl/wsdl/InterfaceWSDLIntrospectorImpl.java | 103 ----- .../tuscany/idl/wsdl/InterfaceWSDLLoader.java | 155 ------- .../tuscany/idl/wsdl/InvalidFragmentException.java | 39 -- .../tuscany/idl/wsdl/InvalidWSDLException.java | 57 --- .../idl/wsdl/InvalidWSDLLocationException.java | 39 -- .../tuscany/idl/wsdl/MissingWSDLException.java | 39 -- .../idl/wsdl/NotSupportedWSDLException.java | 57 --- .../idl/wsdl/UnresolveableResourceException.java | 39 -- .../tuscany/idl/wsdl/WSDLDefinitionRegistry.java | 89 ---- .../idl/wsdl/WSDLDefinitionRegistryImpl.java | 204 --------- .../org/apache/tuscany/idl/wsdl/WSDLLoader.java | 110 ----- .../tuscany/idl/wsdl/WSDLLoaderException.java | 41 -- .../apache/tuscany/idl/wsdl/WSDLLoaderImpl.java | 143 ------ .../org/apache/tuscany/idl/wsdl/WSDLLocation.java | 60 --- .../org/apache/tuscany/idl/wsdl/WSDLOperation.java | 500 --------------------- .../tuscany/idl/wsdl/WSDLServiceContract.java | 59 --- .../apache/tuscany/idl/wsdl/XMLSchemaRegistry.java | 87 ---- .../tuscany/idl/wsdl/XMLSchemaRegistryImpl.java | 129 ------ .../src/main/resources/META-INF/sca/default.scdl | 50 --- .../src/main/resources/META-INF/sca/idl.wsdl.scdl | 52 --- .../InterfaceWSDLIntrospectorImplTestCase.java | 82 ---- .../idl/wsdl/WSDLDefinitionRegistryTestCase.java | 80 ---- .../tuscany/idl/wsdl/WSDLLoaderImplTestCase.java | 53 --- .../tuscany/idl/wsdl/WSDLOperationTestCase.java | 101 ----- .../idl/wsdl/WrapperStyleOperationTestCase.java | 72 --- .../idl/wsdl/XMLSchemaRegistryImplTestCase.java | 105 ----- .../org/apache/tuscany/idl/wsdl/example.wsdl | 26 -- .../resources/org/apache/tuscany/idl/wsdl/ipo.xsd | 136 ------ .../org/apache/tuscany/idl/wsdl/stockquote.wsdl | 58 --- .../tuscany/idl/wsdl/unwrapped-stockquote.wsdl | 76 ---- 36 files changed, 3413 deletions(-) delete mode 100644 branches/sca-java-M2/sca/services/idl/pom.xml delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/.ruleset delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/LICENSE.txt delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/NOTICE.txt delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/pom.xml delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/MissingWSDLException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl delete mode 100644 branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl (limited to 'branches/sca-java-M2/sca/services/idl') diff --git a/branches/sca-java-M2/sca/services/idl/pom.xml b/branches/sca-java-M2/sca/services/idl/pom.xml deleted file mode 100644 index 10035bfbd3..0000000000 --- a/branches/sca-java-M2/sca/services/idl/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - org.apache.tuscany.sca.services - parent - 1.0-incubator-M2-SNAPSHOT - - 4.0.0 - org.apache.tuscany.sca.services.idl - parent - pom - Tuscany SCA Interface Definition Languages - - - - - apache.snapshots - Apache Snapshot Repository - http://people.apache.org/repo/m2-snapshot-repository - - false - - - true - - - - apache.incubator - Apache Incubator Repository - http://people.apache.org/repo/m2-incubating-repository/ - - true - - - false - - - - - - wsdl - - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/.ruleset b/branches/sca-java-M2/sca/services/idl/wsdl/.ruleset deleted file mode 100644 index 3886f07f2d..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/.ruleset +++ /dev/null @@ -1,190 +0,0 @@ - - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/LICENSE.txt b/branches/sca-java-M2/sca/services/idl/wsdl/LICENSE.txt deleted file mode 100644 index 0084319535..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/LICENSE.txt +++ /dev/null @@ -1,202 +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, serviceDefinition 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/branches/sca-java-M2/sca/services/idl/wsdl/NOTICE.txt b/branches/sca-java-M2/sca/services/idl/wsdl/NOTICE.txt deleted file mode 100644 index d83ebbe236..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/NOTICE.txt +++ /dev/null @@ -1,14 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2006 The Apache Software Foundation - -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/pom.xml b/branches/sca-java-M2/sca/services/idl/wsdl/pom.xml deleted file mode 100644 index 6fb9ea427d..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - org.apache.tuscany.sca.services.idl - parent - 1.0-incubator-M2-SNAPSHOT - - 4.0.0 - wsdl - jar - Apache Tuscany WSDL - Tuscany WSDL Support. - - - - org.apache.tuscany.sca.kernel - tuscany-spi - ${sca.version} - compile - - - org.apache.ws.commons.schema - XmlSchema - - - - wsdl4j - wsdl4j - - - junit - junit - - - org.easymock - easymock - - - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java deleted file mode 100644 index 1b9326acab..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java +++ /dev/null @@ -1,48 +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.idl.wsdl; - -import javax.wsdl.PortType; - -import org.apache.tuscany.spi.idl.InvalidServiceContractException; - -/** - * Introspector for creating WSDLServiceContract definitions from WSDL PortTypes. - * - * @version $Rev$ $Date$ - */ -public interface InterfaceWSDLIntrospector { - - /** - * Introspect a WSDL portType and return a service contract definition. - * - * @param type the portType to inspect - * @return a WSDLServiceContract corresponding to the WSDL portType - */ - WSDLServiceContract introspect(PortType portType) throws InvalidServiceContractException; - - /** - * Introspect a WSDL portType and return a service contract definition. - * - * @param type the portType to inspect - * @param callback the callback portType to inspec - * @return a WSDLServiceContract corresponding to the WSDL portType - */ - WSDLServiceContract introspect(PortType type, PortType callback) throws InvalidServiceContractException; -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java deleted file mode 100644 index bbfb3b3d01..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java +++ /dev/null @@ -1,103 +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.idl.wsdl; - -import java.util.HashMap; -import java.util.Map; - -import javax.wsdl.Operation; -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.annotation.Autowire; -import org.apache.tuscany.spi.idl.InvalidServiceContractException; -import org.apache.tuscany.spi.model.InteractionScope; -import org.osoa.sca.annotations.Constructor; - -/** - * Introspector for creating WSDLServiceContract definitions from WSDL PortTypes. - */ -public class InterfaceWSDLIntrospectorImpl implements InterfaceWSDLIntrospector { - public static final String INPUT_PARTS = "idl:input"; - - private WSDLDefinitionRegistry wsdlDefinitionRegistry; - - /** - * @param wsdlDefinitionRegistry - */ - @Constructor("wsdlDefinitionRegistry") - public InterfaceWSDLIntrospectorImpl(@Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) { - super(); - this.wsdlDefinitionRegistry = wsdlDefinitionRegistry; - } - - // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS spec? - protected Map> introspectOperations(PortType portType) - throws InvalidServiceContractException { - Map> operations = - new HashMap>(); - for (Object op : portType.getOperations()) { - Operation wsdlOp = (Operation) op; - operations.put(wsdlOp.getName(), introspectOperation(wsdlOp)); - } - return operations; - } - - protected org.apache.tuscany.spi.model.Operation introspectOperation(Operation wsdlOp) - throws InvalidServiceContractException { - - WSDLOperation op = new WSDLOperation(wsdlOp, null, wsdlDefinitionRegistry.getSchemaRegistry()); - return op.getOperation(); - } - - /** - * @see org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector#introspect(javax.wsdl.PortType) - */ - public WSDLServiceContract introspect(PortType portType) throws InvalidServiceContractException { - WSDLServiceContract contract = new WSDLServiceContract(); - contract.setPortType(portType); - contract.setInterfaceName(portType.getQName().getLocalPart()); - contract.setOperations(introspectOperations(portType)); - // FIXME: set to Non-conversational for now - contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL); - return contract; - } - - /** - * @see org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector#introspect(javax.wsdl.PortType, javax.wsdl.PortType) - */ - public WSDLServiceContract introspect(PortType portType, PortType callbackPortType) - throws InvalidServiceContractException { - assert portType != null : "PortType cannot be null"; - WSDLServiceContract contract = new WSDLServiceContract(); - // FIXME: set to Non-conversational for now - contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL); - contract.setPortType(portType); - contract.setInterfaceName(portType.getQName().getLocalPart()); - contract.setOperations(introspectOperations(portType)); - if (callbackPortType != null) { - contract.setCallbackPortType(callbackPortType); - contract.setCallbackName(callbackPortType.getQName().getLocalPart()); - contract.setCallbackOperations(introspectOperations(callbackPortType)); - } - return contract; - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java deleted file mode 100644 index cdb74becfd..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java +++ /dev/null @@ -1,155 +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.idl.wsdl; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import javax.wsdl.PortType; -import javax.wsdl.WSDLException; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import static org.osoa.sca.Version.XML_NAMESPACE_1_0; -import org.osoa.sca.annotations.Constructor; - -import org.apache.tuscany.spi.annotation.Autowire; -import org.apache.tuscany.spi.component.CompositeComponent; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.idl.InvalidServiceContractException; -import org.apache.tuscany.spi.loader.InvalidValueException; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.LoaderUtil; -import org.apache.tuscany.spi.loader.MissingResourceException; -import org.apache.tuscany.spi.model.DataType; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * Loads a WSDL interface definition from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class InterfaceWSDLLoader extends LoaderExtension { - public static final QName INTERFACE_WSDL = new QName(XML_NAMESPACE_1_0, "interface.wsdl"); - - private static final String WSDLI = "http://www.w3.org/2006/01/wsdl-instance"; - - private static final String WSDLI_LOCATION = "wsdlLocation"; - - private WSDLDefinitionRegistry wsdlRegistry; - - private InterfaceWSDLIntrospector introspector; - - @Constructor ({ "registry", "wsdlRegistry", "introspector" }) - public InterfaceWSDLLoader(@Autowire LoaderRegistry registry, - @Autowire WSDLDefinitionRegistry wsdlRegistry, - @Autowire InterfaceWSDLIntrospector introspector) { - super(registry); - this.wsdlRegistry = wsdlRegistry; - this.introspector = introspector; - } - - public QName getXMLType() { - return INTERFACE_WSDL; - } - - public WSDLServiceContract load( - CompositeComponent parent, - XMLStreamReader reader, - DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { - assert INTERFACE_WSDL.equals(reader.getName()); - - String interfaceURI = reader.getAttributeValue(null, "interface"); - if (interfaceURI == null) { - throw new InvalidValueException("interface"); - } - - String callbackURI = reader.getAttributeValue(null, "callbackInterface"); - String wsdlLocation = reader.getAttributeValue(WSDLI, WSDLI_LOCATION); - - Map, ModelObject> extensions = new HashMap, ModelObject>(); - while (true) { - int event = reader.next(); - if (event == XMLStreamConstants.START_ELEMENT) { - ModelObject mo = registry.load(parent, reader, deploymentContext); - if (mo != null) { - extensions.put(mo.getClass(), mo); - } - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (reader.getName().equals(INTERFACE_WSDL)) { - break; - } - } - } - // FIXME set the interaction scope - // serviceContract.setInteractionScope(StAXUtil.interactionScope(reader.getAttributeValue(null, "scope"))); - - if (wsdlLocation != null) { - try { - wsdlRegistry.loadDefinition(wsdlLocation, deploymentContext.getClassLoader()); - } catch (IOException e) { - LoaderException le = new LoaderException(e); - le.setIdentifier(wsdlLocation); - throw le; - } catch (WSDLException e) { - LoaderException le = new LoaderException(e); - le.setIdentifier(wsdlLocation); - throw le; - } - } - - PortType portType = getPortType(interfaceURI); - if (portType == null) { - throw new MissingResourceException(interfaceURI); - } - PortType callback = null; - if (callbackURI != null) { - callback = getPortType(callbackURI); - } - try { - WSDLServiceContract contract = introspector.introspect(portType, callback); - DataType dataType = (DataType) extensions.get(DataType.class); - if (dataType != null) { - contract.setDataBinding(dataType.getDataBinding()); - } - contract.getExtensions().putAll(extensions); - return contract; - } catch (InvalidServiceContractException e) { - LoaderException le = new LoaderException(e); - le.setIdentifier(wsdlLocation); - throw le; - } - } - - protected PortType getPortType(String uri) { - // Syntax: #wsdl.interface() - int index = uri.indexOf('#'); - String namespace = uri.substring(0, index); - String name = uri.substring(index + 1); - name = name.substring("wsdl.interface(".length(), name.length() - 1); - QName qname = new QName(namespace, name); - return wsdlRegistry.getPortType(qname); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java deleted file mode 100644 index 55decc9313..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java +++ /dev/null @@ -1,39 +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.idl.wsdl; - -/** - * @version $Rev$ $Date$ - */ -public class InvalidFragmentException extends WSDLLoaderException { - public InvalidFragmentException() { - } - - public InvalidFragmentException(String message) { - super(message); - } - - public InvalidFragmentException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidFragmentException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java deleted file mode 100644 index 17dde17b19..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java +++ /dev/null @@ -1,57 +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.idl.wsdl; - -import org.apache.tuscany.spi.idl.InvalidServiceContractException; - -/** - * An exception to indicate the WSDL definition is invalid - */ -public class InvalidWSDLException extends InvalidServiceContractException { - - /** - * - */ - public InvalidWSDLException() { - } - - /** - * @param message - */ - public InvalidWSDLException(String message) { - super(message); - } - - /** - * @param message - * @param cause - */ - public InvalidWSDLException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param cause - */ - public InvalidWSDLException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java deleted file mode 100644 index 7c5ab0bfc1..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java +++ /dev/null @@ -1,39 +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.idl.wsdl; - -/** - * @version $Rev$ $Date$ - */ -public class InvalidWSDLLocationException extends WSDLLoaderException { - public InvalidWSDLLocationException() { - } - - public InvalidWSDLLocationException(String message) { - super(message); - } - - public InvalidWSDLLocationException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidWSDLLocationException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/MissingWSDLException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/MissingWSDLException.java deleted file mode 100644 index 92a2b2099e..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/MissingWSDLException.java +++ /dev/null @@ -1,39 +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.idl.wsdl; - -/** - * @version $Rev$ $Date$ - */ -public class MissingWSDLException extends WSDLLoaderException { - public MissingWSDLException() { - } - - public MissingWSDLException(String message) { - super(message); - } - - public MissingWSDLException(String message, Throwable cause) { - super(message, cause); - } - - public MissingWSDLException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java deleted file mode 100644 index 0d69d401f8..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java +++ /dev/null @@ -1,57 +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.idl.wsdl; - -import org.apache.tuscany.spi.idl.InvalidServiceContractException; - -/** - * An exception to indicate some WSDL styles that we don't support - */ -public class NotSupportedWSDLException extends InvalidServiceContractException { - - /** - * - */ - public NotSupportedWSDLException() { - } - - /** - * @param message - */ - public NotSupportedWSDLException(String message) { - super(message); - } - - /** - * @param message - * @param cause - */ - public NotSupportedWSDLException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param cause - */ - public NotSupportedWSDLException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java deleted file mode 100644 index 0454569e87..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java +++ /dev/null @@ -1,39 +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.idl.wsdl; - -/** - * @version $Rev$ $Date$ - */ -public class UnresolveableResourceException extends WSDLLoaderException { - public UnresolveableResourceException() { - } - - public UnresolveableResourceException(String message) { - super(message); - } - - public UnresolveableResourceException(String message, Throwable cause) { - super(message, cause); - } - - public UnresolveableResourceException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java deleted file mode 100644 index 0694811f0d..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java +++ /dev/null @@ -1,89 +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.idl.wsdl; - -import java.io.IOException; -import java.net.URL; -import javax.wsdl.Definition; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.xml.namespace.QName; - -/** - * A service for caching WSDLs - * - * @version $Rev$ $Date$ - */ -@Deprecated -public interface WSDLDefinitionRegistry { - /** - * Loads and registers a WSDL Definition. - * - * @param namespace the expected namespace, or null if any namespace should be allowed - * @param location the location to load the definition from - * @return the loaded Definition - * @throws IOException if there was a problem reading the document - * @throws WSDLException if there was a problem parsing the definition - */ - Definition loadDefinition(String namespace, URL location) throws IOException, WSDLException; - - /** - * Load and register a WSDL definition as specified in a WSDL2.0 wsdlLocation attribute. - * - * @param wsdlLocation the value of the wsdlLocation attribute - * @param classLoader application classloader used to support relative locations - * @return the loaded Definition - * @throws IOException if there was a problem reading the document - * @throws WSDLException if there was a problem parsing the definition - */ - Definition loadDefinition(String wsdlLocation, ClassLoader classLoader) throws IOException, WSDLException; - - /** - * Returns the PortType with the supplied qualified name, or null if no such port has been defined. - * - * @param name the qualified name of the WSDL portType - * @return the PortType for the supplied name, or null if none has been defined - */ - PortType getPortType(QName name); - - /** - * Returns the ServiceDefinition with the supplied qualified name, or null if no such service has been defined. - * - * @param name the qualified name of the WSDL service - * @return the ServiceDefinition for the supplied name, or null if none has been defined - */ - Service getService(QName name); - - - /** - * Returns the ExtensionRegistry that is used when parsing WSDL documents during the loadDefinition call. - * - * @return the ExtensionRegistry that is used when parsing WSDL documents. - */ - ExtensionRegistry getExtensionRegistry(); - - /** - * Get the XMLSchemaRegistry - * - * @return - */ - XMLSchemaRegistry getSchemaRegistry(); -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java deleted file mode 100644 index 976a09caca..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java +++ /dev/null @@ -1,204 +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.idl.wsdl; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.wsdl.Definition; -import javax.wsdl.Import; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.annotation.Autowire; - -/** - * The default implementation of the runtime WSDL registry - * - * @version $Rev$ $Date$ - */ -public class WSDLDefinitionRegistryImpl implements WSDLDefinitionRegistry { - private final WSDLFactory wsdlFactory; - - private final ExtensionRegistry registry; - - private final Map definitionsByLocation = new HashMap(); - - private final Map> definitionsByNamespace = new HashMap>(); - - private Monitor monitor; - - private XMLSchemaRegistry schemaRegistry; - - public WSDLDefinitionRegistryImpl() throws WSDLException { - wsdlFactory = WSDLFactory.newInstance(); - registry = wsdlFactory.newPopulatedExtensionRegistry(); - } - - @Autowire - public void setSchemaRegistry(XMLSchemaRegistry schemaRegistry) { - this.schemaRegistry = schemaRegistry; - } - - @org.apache.tuscany.api.annotation.Monitor - public void setMonitor(Monitor monitor) { - this.monitor = monitor; - } - - public ExtensionRegistry getExtensionRegistry() { - return registry; - } - - public Definition loadDefinition(String wsdlLocation, ClassLoader classLoader) throws IOException, WSDLException { - int index = wsdlLocation.indexOf(' '); - if (index == -1) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation); - } - String namespace = wsdlLocation.substring(0, index).trim(); - URL url; - URI uri; - try { - uri = new URI(wsdlLocation.substring(index + 1).trim()); - } catch (URISyntaxException e) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation); - } - if (uri.isAbsolute()) { - url = uri.toURL(); - } else { - url = classLoader.getResource(uri.toString()); - if (url == null) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Resource not found: " + uri); - } - } - return loadDefinition(namespace, url); - } - - public Definition loadDefinition(String namespace, URL location) throws IOException, WSDLException { - Definition definition = definitionsByLocation.get(location); - if (definition != null) { - // return cached copy - return definition; - } - - if (monitor != null) { - monitor.readingWSDL(namespace, location); - } - WSDLReader reader = wsdlFactory.newWSDLReader(); - reader.setFeature("javax.wsdl.verbose", false); - reader.setExtensionRegistry(registry); - - definition = reader.readWSDL(location.toString()); - String definitionNamespace = definition.getTargetNamespace(); - if (namespace != null && !namespace.equals(definitionNamespace)) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != " - + definition.getTargetNamespace()); - } - - // Load inline schemas - getSchemaRegistry().loadSchemas(definition); - for (Object i : definition.getImports().values()) { - Import imp = (Import) i; - Definition imported = imp.getDefinition(); - if (imported != null) { - getSchemaRegistry().loadSchemas(imported); - } - } - - if (monitor != null) { - monitor.cachingDefinition(definitionNamespace, location); - } - definitionsByLocation.put(location, definition); - List definitions = definitionsByNamespace.get(definitionNamespace); - if (definitions == null) { - definitions = new ArrayList(); - definitionsByNamespace.put(definitionNamespace, definitions); - } - definitions.add(definition); - - return definition; - } - - public PortType getPortType(QName name) { - String namespace = name.getNamespaceURI(); - List definitions = definitionsByNamespace.get(namespace); - if (definitions == null) { - return null; - } - for (Definition definition : definitions) { - PortType portType = definition.getPortType(name); - if (portType != null) { - return portType; - } - } - return null; - } - - public Service getService(QName name) { - String namespace = name.getNamespaceURI(); - List definitions = definitionsByNamespace.get(namespace); - if (definitions == null) { - return null; - } - for (Definition definition : definitions) { - Service service = definition.getService(name); - if (service != null) { - return service; - } - } - return null; - } - - public static interface Monitor { - /** - * Monitor event emitted immediately before an attempt is made to read WSDL for the supplied namespace from the - * supplied location. - * - * @param namespace the target namespace expected in the WSDL; may be null - * @param location the location where we will attempt to read the WSDL definition from - */ - void readingWSDL(String namespace, URL location); - - /** - * Monitor event emitted immediately before registering a WSDL definition in the cache. - * - * @param namespace the target namespace for the WSDL - * @param location the location where the WSDL definition was read from - */ - void cachingDefinition(String namespace, URL location); - } - - public XMLSchemaRegistry getSchemaRegistry() { - if (schemaRegistry == null) { - // Default - schemaRegistry = new XMLSchemaRegistryImpl(); - } - return schemaRegistry; - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java deleted file mode 100644 index fb90e839f5..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java +++ /dev/null @@ -1,110 +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.idl.wsdl; - -import java.net.URI; -import java.util.Collection; -import javax.wsdl.Definition; -import javax.wsdl.PortType; -import javax.wsdl.WSDLException; -import javax.xml.namespace.QName; - -/** - * Interface for implementations that allow WSDL definitions to be loaded. Currently we do not have a complete solution - * for handling both WSDL2.0 and WSDL1.1 definitions so the current implementation only deals with loading WSDL1.1. This - * will change in the near future (for example when Woden supports both forms) so all WSDL1.1 specific methods are - * deprecated. - * - * @version $Rev$ $Date$ - */ -public interface WSDLLoader { - /** - * Load a WSDL 1.1 Definition for a namespace from one of specified locations. - * - * @param namespace the namespace whose definition should be loaded - * @param locations a set of possible locations to load from - * @return the loaded Definition - * @throws WSDLException if there was a problem loading the definition - */ - @Deprecated - Definition loadDefinition(String namespace, Collection locations) - throws WSDLException, UnresolveableResourceException; - - /** - * Load a WSDL 1.1 Definition from the specified location - * - * @param location the location to load from - * @return the loaded Definition - * @throws WSDLException if there was a problem loading the definition - */ - @Deprecated - Definition loadDefinition(WSDLLocation location) throws WSDLException; - - /** - * Return the WSDL1.1 PortType for the specified interface IRI. - * - * @param interfaceIRI the WSDL2.0 interface IRI - * @param wsdlLocation the location of the WSDL instance - * @param base a Classloader from which to load - * @return the specified port type - */ - @Deprecated - PortType loadPortType(URI interfaceIRI, String wsdlLocation, ClassLoader base) - throws WSDLLoaderException, WSDLException; - - /** - * Parses a WSDL2.0 wsdlLocation attribute definition and returns a Collection of all locations it contains. - * - * @param wsdlLocation a list of namespace/location pairs as specified by WSDL2.0 - * @param base a ClassLoader to use to resolve relative URLs - * @return a collection of locations parsed from the string - * @throws InvalidWSDLLocationException - */ - Collection getLocations(String wsdlLocation, ClassLoader base) throws InvalidWSDLLocationException; - - /** - * Returns the fully qualified name of a WSDL interface parsed from a IRI as defined by WSDL2.0. The value of the - * IRI defines the namespace, the fragment specifies the interface component; for example - * http://example.org/TicketAgent.wsdl20#wsdl.interface(TicketAgent) - * - * @param interfaceIRI the IRI for the interface - * @return the qualified name of the interface - * @throws UnresolveableResourceException if the URI is relative - * @throws InvalidFragmentException if the fragment is incorrectly formed - */ - QName getInterfaceName(URI interfaceIRI) throws UnresolveableResourceException, InvalidFragmentException; - - /** - * Returns an interface parsed from a wsdl.interface fragment. - * - * @param fragment the fragment value - * @return the interface name - * @throws InvalidFragmentException if the fragment is incorrectly formed - */ - String getInterfaceName(String fragment) throws InvalidFragmentException; - - /** - * Returns a namespace parsed from an IRI. This is the URI with any fragment removed. - * - * @param iri the IRI - * @return a namespace created by stripping fragment information from the URI - * @throws UnresolveableResourceException if the URI is relative - */ - String getNamespace(URI iri) throws UnresolveableResourceException; -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java deleted file mode 100644 index 47a4b8ef1f..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java +++ /dev/null @@ -1,41 +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.idl.wsdl; - -import org.apache.tuscany.api.TuscanyException; - -/** - * @version $Rev$ $Date$ - */ -public abstract class WSDLLoaderException extends TuscanyException { - protected WSDLLoaderException() { - } - - protected WSDLLoaderException(String message) { - super(message); - } - - protected WSDLLoaderException(String message, Throwable cause) { - super(message, cause); - } - - protected WSDLLoaderException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java deleted file mode 100644 index cdf69fa1e8..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java +++ /dev/null @@ -1,143 +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.idl.wsdl; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import javax.wsdl.Definition; -import javax.wsdl.PortType; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; - -/** - * @version $Rev$ $Date$ - */ -public class WSDLLoaderImpl implements WSDLLoader { - private final WSDLFactory wsdlFactory; - - private final ExtensionRegistry registry; - - public WSDLLoaderImpl() throws WSDLException { - wsdlFactory = WSDLFactory.newInstance(); - registry = wsdlFactory.newPopulatedExtensionRegistry(); - } - - public PortType loadPortType(URI interfaceIRI, String wsdlLocation, ClassLoader base) - throws WSDLLoaderException, WSDLException { - Collection locations = getLocations(wsdlLocation, base); - QName interfaceName = getInterfaceName(interfaceIRI); - - Definition definition = loadDefinition(interfaceName.getNamespaceURI(), locations); - return definition.getPortType(interfaceName); - } - - public Definition loadDefinition(String namespace, Collection locations) - throws WSDLException, UnresolveableResourceException { - for (WSDLLocation location : locations) { - if (namespace.equals(location.getNamespace()) && location.getLocation() != null) { - return loadDefinition(location); - } - } - throw new UnresolveableResourceException(namespace); - } - - public Definition loadDefinition(WSDLLocation location) throws WSDLException { - String namespace = location.getNamespace(); - - WSDLReader reader = wsdlFactory.newWSDLReader(); - reader.setFeature("javax.wsdl.verbose", false); - reader.setExtensionRegistry(registry); - - Definition definition = reader.readWSDL(location.getLocation().toString()); - String definitionNamespace = definition.getTargetNamespace(); - if (namespace != null && !namespace.equals(definitionNamespace)) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != " - + definition.getTargetNamespace()); - } - return definition; - } - - public Collection getLocations(String wsdlLocation, ClassLoader base) - throws InvalidWSDLLocationException { - String parts[] = wsdlLocation.split("\\s"); - // check the number of parts is a multiple of two - if ((parts.length & 1) != 0) { - throw new InvalidWSDLLocationException(wsdlLocation); - } - List locations = new ArrayList(parts.length >>> 1); - for (int i = 0; i < parts.length; i += 2) { - URL url; - try { - URI uri = new URI(parts[i + 1]); - if (uri.isAbsolute()) { - url = uri.toURL(); - } else { - url = base.getResource(uri.toString()); - } - } catch (MalformedURLException e) { - throw new InvalidWSDLLocationException(e); - } catch (URISyntaxException e) { - throw new InvalidWSDLLocationException(e); - } - WSDLLocation location = new WSDLLocation(parts[i], url); - locations.add(location); - } - return locations; - } - - public QName getInterfaceName(URI interfaceIRI) throws UnresolveableResourceException, InvalidFragmentException { - String namespace = getNamespace(interfaceIRI); - String interfaceName = getInterfaceName(interfaceIRI.getFragment()); - return new QName(namespace, interfaceName); - } - - public String getInterfaceName(String fragment) throws InvalidFragmentException { - if (fragment == null) { - throw new InvalidFragmentException("missing fragment"); - } - String[] parts = fragment.split("\\s"); - for (String part : parts) { - if (part.startsWith("wsdl.interface(") && part.charAt(part.length() - 1) == ')') { - return part.substring(15, part.length() - 1); - } - } - throw new InvalidFragmentException(fragment); - } - - public String getNamespace(URI iri) throws UnresolveableResourceException { - if (!iri.isAbsolute()) { - UnresolveableResourceException ure = new UnresolveableResourceException("no namespace defined in " + iri); - ure.setIdentifier(iri.toString()); - throw ure; - } - StringBuilder s = new StringBuilder(); - s.append(iri.getScheme()); - s.append(':'); - s.append(iri.getSchemeSpecificPart()); - return s.toString(); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java deleted file mode 100644 index a124294c3a..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.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.idl.wsdl; - -import java.net.URL; - -/** - * A location where the WSDL for a namespace can be found. - * - * @version $Rev$ $Date$ - */ -public class WSDLLocation { - private final String namespace; - private final URL location; - - /** - * Constructor specifying a namespace and where its WSDL can be found. - * - * @param namespace the target namespace - * @param location the location of the WSDL - */ - public WSDLLocation(String namespace, URL location) { - this.namespace = namespace; - this.location = location; - } - - /** - * Returns the target namespace. - * - * @return the target namespace - */ - public String getNamespace() { - return namespace; - } - - /** - * Returns the location where the WSDL definition can be found. - * - * @return the location where the WSDL definition can be found - */ - public URL getLocation() { - return location; - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java deleted file mode 100644 index 75fe1b9964..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java +++ /dev/null @@ -1,500 +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.idl.wsdl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.wsdl.Fault; -import javax.wsdl.Input; -import javax.wsdl.Message; -import javax.wsdl.Operation; -import javax.wsdl.Output; -import javax.wsdl.Part; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.idl.ElementInfo; -import org.apache.tuscany.spi.idl.InvalidServiceContractException; -import org.apache.tuscany.spi.idl.TypeInfo; -import org.apache.tuscany.spi.idl.WrapperInfo; -import org.apache.tuscany.spi.model.DataType; -import org.apache.ws.commons.schema.XmlSchemaComplexType; -import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaObject; -import org.apache.ws.commons.schema.XmlSchemaObjectCollection; -import org.apache.ws.commons.schema.XmlSchemaParticle; -import org.apache.ws.commons.schema.XmlSchemaSequence; -import org.apache.ws.commons.schema.XmlSchemaSimpleType; -import org.apache.ws.commons.schema.XmlSchemaType; - -/** - * Metadata for a WSDL operation - */ -public class WSDLOperation { - private static final String OPERATION_KEY = org.apache.tuscany.spi.model.Operation.class.getName(); - - protected XMLSchemaRegistry schemaRegistry; - - protected Operation operation; - - private String dataBinding; - - protected org.apache.tuscany.spi.model.Operation operationModel; - - protected DataType>> inputType; - - protected DataType outputType; - - protected List> faultTypes; - - /** - * @param operation The WSDL4J operation - * @param dataBinding The default databinding - * @param schemaRegistry The XML Schema registry - */ - public WSDLOperation(Operation operation, String dataBinding, XMLSchemaRegistry schemaRegistry) { - super(); - this.operation = operation; - this.dataBinding = dataBinding; - this.schemaRegistry = schemaRegistry; - this.wrapper = new Wrapper(); - } - - private Wrapper wrapper; - - private Boolean wrapperStyle; - - /** - * Test if the operation qualifies wrapper style as defined by the JAX-WS 2.0 spec - * - * @return true if the operation qualifies wrapper style, otherwise false - */ - public boolean isWrapperStyle() { - if (wrapperStyle == null) { - wrapperStyle = - Boolean.valueOf(wrapper.getInputChildElements() != null - && (operation.getOutput() == null || wrapper.getOutputChildElements() != null)); - } - return wrapperStyle.booleanValue(); - } - - public Wrapper getWrapper() { - if (!isWrapperStyle()) { - throw new IllegalStateException("The operation is not wrapper style."); - } else { - return wrapper; - } - } - - /** - * @return - * @throws InvalidServiceContractException - */ - public DataType>> getInputType() throws InvalidServiceContractException { - if (inputType == null) { - Input input = operation.getInput(); - Message message = (input == null) ? null : input.getMessage(); - inputType = getMessageType(message); - inputType.setDataBinding("idl:input"); - } - return inputType; - } - - /** - * @return - * @throws NotSupportedWSDLException - */ - public DataType getOutputType() throws InvalidServiceContractException { - if (outputType == null) { - Output output = operation.getOutput(); - Message outputMsg = (output == null) ? null : output.getMessage(); - - List outputParts = (outputMsg == null) ? null : outputMsg.getOrderedParts(null); - if (outputParts != null && outputParts.size() > 0) { - if (outputParts.size() > 1) { - // We don't support output with multiple parts - throw new NotSupportedWSDLException("Multi-part output is not supported"); - } - Part part = (Part) outputParts.get(0); - outputType = new WSDLPart(part).getDataType(); - // outputType.setMetadata(WSDLOperation.class.getName(), this); - } - } - return outputType; - } - - /** - * @return - * @throws NotSupportedWSDLException - */ - public List> getFaultTypes() throws InvalidServiceContractException { - if (faultTypes == null) { - Collection faults = operation.getFaults().values(); - faultTypes = new ArrayList>(); - for (Object f : faults) { - Fault fault = (Fault) f; - Message faultMsg = fault.getMessage(); - List faultParts = faultMsg.getOrderedParts(null); - if (faultParts.size() != 1) { - throw new NotSupportedWSDLException("The fault message MUST have a single part"); - } - Part part = (Part) faultParts.get(0); - WSDLPart wsdlPart = new WSDLPart(part); - faultTypes.add(wsdlPart.getDataType()); - } - } - return faultTypes; - } - - private DataType>> getMessageType(Message message) throws InvalidServiceContractException { - List> partTypes = new ArrayList>(); - if (message != null) { - Collection parts = message.getOrderedParts(null); - for (Object p : parts) { - WSDLPart part = new WSDLPart((Part) p); - DataType partType = part.getDataType(); - partTypes.add(partType); - } - } - return new DataType>>(dataBinding, Object[].class, partTypes); - } - - /** - * @return - * @throws NotSupportedWSDLException - */ - public org.apache.tuscany.spi.model.Operation getOperation() throws InvalidServiceContractException { - if (operationModel == null) { - boolean oneway = (operation.getOutput() == null); - operationModel = - new org.apache.tuscany.spi.model.Operation(operation.getName(), getInputType(), - getOutputType(), getFaultTypes(), oneway, dataBinding); - operationModel.setWrapperStyle(isWrapperStyle()); - // operationModel.setMetaData(WSDLOperation.class.getName(), this); - if (isWrapperStyle()) { - operationModel.setWrapper(getWrapper().getWrapperInfo()); - // Register the operation with the types - for (DataType d : wrapper.getUnwrappedInputType().getLogical()) { - d.setMetadata(OPERATION_KEY, operationModel); - } - if (wrapper.getUnwrappedOutputType() != null) { - wrapper.getUnwrappedOutputType().setMetadata(OPERATION_KEY, operationModel); - } - } - } - inputType.setMetadata(OPERATION_KEY, operationModel); - if (outputType != null) { - outputType.setMetadata(OPERATION_KEY, operationModel); - } - return operationModel; - } - - /** - * Metadata for a WSDL part - */ - public class WSDLPart { - private Part part; - - private XmlSchemaElement element; - - private DataType dataType; - - public WSDLPart(Part part) throws InvalidWSDLException { - this.part = part; - QName elementName = part.getElementName(); - if (elementName != null) { - element = schemaRegistry.getElement(elementName); - if (element == null) { - throw new InvalidWSDLException("Element cannot be resolved: " + elementName); - } - } else { - // Create an faked XSD element to host the metadata - element = new XmlSchemaElement(); - element.setName(part.getName()); - element.setQName(new QName(null, part.getName())); - QName typeName = part.getTypeName(); - if (typeName != null) { - XmlSchemaType type = schemaRegistry.getType(typeName); - if (type == null) { - throw new InvalidWSDLException("Type cannot be resolved: " + typeName); - } - element.setSchemaType(type); - element.setSchemaTypeName(type.getQName()); - } - } - dataType = new DataType(dataBinding, Object.class, element.getQName()); - // dataType.setMetadata(WSDLPart.class.getName(), this); - dataType.setMetadata(ElementInfo.class.getName(), getElementInfo(element)); - } - - /** - * @return the element - */ - public XmlSchemaElement getElement() { - return element; - } - - /** - * @return the part - */ - public Part getPart() { - return part; - } - - /** - * @return the dataType - */ - public DataType getDataType() { - return dataType; - } - } - - /** - * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based Web Services (JAX-WS) 2.0 - * specification, section 2.3.1.2 Wrapper Style. - *

- * A WSDL operation qualifies for wrapper style mapping only if the following criteria are met: - *

    - *
  • (i) The operation’s input and output messages (if present) each contain only a single part - *
  • (ii) The input message part refers to a global element declaration whose localname is equal to the operation - * name - *
  • (iii) The output message part refers to a global element declaration - *
  • (iv) The elements referred to by the input and output message parts (henceforth referred to as wrapper - * elements) are both complex types defined using the xsd:sequence compositor - *
  • (v) The wrapper elements only contain child elements, they must not contain other structures such as - * wildcards (element or attribute), xsd:choice, substitution groups (element references are not permitted) or - * attributes; furthermore, they must not be nillable. - *
- */ - public class Wrapper { - private XmlSchemaElement inputWrapperElement; - - private XmlSchemaElement outputWrapperElement; - - private List inputElements; - - private List outputElements; - - private DataType>> unwrappedInputType; - - private DataType unwrappedOutputType; - - private transient WrapperInfo wrapperInfo; - - private List getChildElements(XmlSchemaElement element) { - if (element == null) { - return null; - } - XmlSchemaType type = element.getSchemaType(); - if (!(type instanceof XmlSchemaComplexType)) { - // Has to be a complexType - return null; - } - XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; - if (complexType.getAttributes().getCount() != 0 || complexType.getAnyAttribute() != null) { - // No attributes - return null; - } - XmlSchemaParticle particle = complexType.getParticle(); - if (particle == null) { - // No particle - return Collections.emptyList(); - } - if (!(particle instanceof XmlSchemaSequence)) { - return null; - } - XmlSchemaSequence sequence = (XmlSchemaSequence) complexType.getParticle(); - XmlSchemaObjectCollection items = sequence.getItems(); - List childElements = new ArrayList(); - for (int i = 0; i < items.getCount(); i++) { - XmlSchemaObject schemaObject = items.getItem(i); - if (!(schemaObject instanceof XmlSchemaElement)) { - return null; - } - XmlSchemaElement childElement = (XmlSchemaElement) schemaObject; - if (childElement.getName() == null || childElement.getRefName() != null || childElement.isNillable()) { - return null; - } - // TODO: Do we support maxOccurs >1 ? - if (childElement.getMaxOccurs() > 1) { - return null; - } - childElements.add(childElement); - } - return childElements; - } - - /** - * Return a list of child XSD elements under the wrapped request element - * - * @return a list of child XSD elements or null if if the request element is not wrapped - */ - public List getInputChildElements() { - if (inputElements != null) { - return inputElements; - } - Input input = operation.getInput(); - if (input != null) { - Message inputMsg = input.getMessage(); - Collection parts = inputMsg.getParts().values(); - if (parts.size() != 1) { - return null; - } - Part part = (Part) parts.iterator().next(); - QName elementName = part.getElementName(); - if (elementName == null) { - return null; - } - if (!operation.getName().equals(elementName.getLocalPart())) { - return null; - } - inputWrapperElement = schemaRegistry.getElement(elementName); - if (inputWrapperElement == null) { - return null; - } - inputElements = getChildElements(inputWrapperElement); - return inputElements; - } else { - return null; - } - } - - /** - * Return a list of child XSD elements under the wrapped response element - * - * @return a list of child XSD elements or null if if the response element is not wrapped - */ - public List getOutputChildElements() { - if (outputElements != null) { - return outputElements; - } - Output output = operation.getOutput(); - if (output != null) { - Message outputMsg = output.getMessage(); - Collection parts = outputMsg.getParts().values(); - if (parts.size() != 1) { - return null; - } - Part part = (Part) parts.iterator().next(); - QName elementName = part.getElementName(); - if (elementName == null) { - return null; - } - outputWrapperElement = schemaRegistry.getElement(elementName); - if (outputWrapperElement == null) { - return null; - } - outputElements = getChildElements(outputWrapperElement); - // FIXME: Do we support multiple child elements for the response? - return outputElements; - } else { - return null; - } - } - - /** - * @return the inputWrapperElement - */ - public XmlSchemaElement getInputWrapperElement() { - return inputWrapperElement; - } - - /** - * @return the outputWrapperElement - */ - public XmlSchemaElement getOutputWrapperElement() { - return outputWrapperElement; - } - - public DataType>> getUnwrappedInputType() { - if (unwrappedInputType == null) { - List> childTypes = new ArrayList>(); - for (XmlSchemaElement element : getInputChildElements()) { - DataType type = new DataType(dataBinding, Object.class, element.getQName()); - type.setMetadata(ElementInfo.class.getName(), getElementInfo(element)); - childTypes.add(type); - } - unwrappedInputType = - new DataType>>("idl:unwrapped.input", Object[].class, childTypes); - } - return unwrappedInputType; - } - - public DataType getUnwrappedOutputType() throws InvalidServiceContractException { - if (unwrappedOutputType == null) { - List elements = getOutputChildElements(); - if (elements != null && elements.size() > 0) { - if (elements.size() > 1) { - // We don't support output with multiple parts - throw new NotSupportedWSDLException("Multi-part output is not supported"); - } - XmlSchemaElement element = elements.get(0); - unwrappedOutputType = new DataType(dataBinding, Object.class, element.getQName()); - unwrappedOutputType.setMetadata(ElementInfo.class.getName(), getElementInfo(element)); - } - } - return unwrappedOutputType; - } - - public WrapperInfo getWrapperInfo() throws InvalidServiceContractException { - if (wrapperInfo == null) { - ElementInfo in = getElementInfo(getInputWrapperElement()); - ElementInfo out = getElementInfo(getOutputWrapperElement()); - List inChildren = new ArrayList(); - for (XmlSchemaElement e : getInputChildElements()) { - inChildren.add(getElementInfo(e)); - } - List outChildren = new ArrayList(); - if (out != null) { - for (XmlSchemaElement e : getOutputChildElements()) { - outChildren.add(getElementInfo(e)); - } - } - wrapperInfo = - new WrapperInfo(in, out, inChildren, outChildren, getUnwrappedInputType(), getUnwrappedOutputType()); - } - return wrapperInfo; - } - } - - private static ElementInfo getElementInfo(XmlSchemaElement element) { - if (element == null) { - return null; - } - return new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType())); - } - - private static TypeInfo getTypeInfo(XmlSchemaType type) { - if (type == null) { - return null; - } - XmlSchemaType baseType = (XmlSchemaType) type.getBaseSchemaType(); - QName name = type.getQName(); - boolean simple = (type instanceof XmlSchemaSimpleType); - if (baseType == null) { - return new TypeInfo(name, simple, null); - } else { - return new TypeInfo(name, simple, getTypeInfo(baseType)); - } - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java deleted file mode 100644 index 868ad0f3b4..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java +++ /dev/null @@ -1,59 +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.idl.wsdl; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * Represents a service contract specified by a WSDL - * - * @version $Rev$ $Date$ - */ -public class WSDLServiceContract extends ServiceContract { - private PortType portType; - private PortType callbackPortType; - - /** - * - */ - public WSDLServiceContract() { - super(); - this.remotable = true; // WSDL interface is always remotable by the SCA spec - } - - - public PortType getPortType() { - return portType; - } - - public void setPortType(PortType portType) { - this.portType = portType; - } - - public PortType getCallbackPortType() { - return callbackPortType; - } - - public void setCallbackPortType(PortType callbackPortType) { - this.callbackPortType = callbackPortType; - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java deleted file mode 100644 index 681e08be4d..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java +++ /dev/null @@ -1,87 +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.idl.wsdl; - -import java.io.IOException; -import java.net.URL; -import java.util.List; - -import javax.wsdl.Definition; -import javax.xml.namespace.QName; - -import org.apache.ws.commons.schema.XmlSchema; -import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaException; -import org.apache.ws.commons.schema.XmlSchemaType; - -/** - * A service for caching XML Schemas - * - * @version $Rev$ $Date$ - */ -public interface XMLSchemaRegistry { - /** - * Load all inline schemas from the WSDL definition - * - * @param definition The WSDL defintion whose types element contains a list of schemas - * @return A list of inline schemas - */ - List loadSchemas(Definition definition); - - /** - * Loads and registers a XML schema. - * - * @param namespace the expected namespace, or null if any namespace should be allowed - * @param location the location to load the schema from - * @return the loaded Definition - * @throws IOException if there was a problem reading the document - * @throws XmlSchemaException if there was a problem parsing the schema - */ - XmlSchema loadSchema(String namespace, URL location) throws IOException, XmlSchemaException; - - /** - * Load and register a XML schema as specified in a XSD schemaLocation attribute. - * - * @param schemaLocation the value of the schemaLocation attribute - * @param classLoader application classloader used to support relative locations - * @return the loaded schema - * @throws IOException if there was a problem reading the document - * @throws XmlSchemaException if there was a problem parsing the schema - */ - XmlSchema loadSchema(String schemaLocation, ClassLoader classLoader) throws IOException, XmlSchemaException; - - /** - * Returns the XSD Element with the supplied qualified name, or null if no such element has been defined. - * - * @param name the qualified name of the XSD element - * @return the XSD element for the supplied name, or null if none has been defined - */ - XmlSchemaElement getElement(QName name); - - /** - * Returns the XmlSchemaType with the supplied qualified name, or null if no such type has been defined. - * - * @param name the qualified name of the XSD type - * @return the XSD type for the supplied name, or null if none has been defined - */ - XmlSchemaType getType(QName name); - - - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java deleted file mode 100644 index 08600e4b7e..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java +++ /dev/null @@ -1,129 +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.idl.wsdl; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.wsdl.Definition; -import javax.wsdl.Types; -import javax.wsdl.extensions.schema.Schema; -import javax.xml.namespace.QName; - -import org.apache.ws.commons.schema.XmlSchema; -import org.apache.ws.commons.schema.XmlSchemaCollection; -import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaException; -import org.apache.ws.commons.schema.XmlSchemaType; -import org.osoa.sca.annotations.Service; -import org.w3c.dom.Element; - -/** - * Default implementation of XMLSchemaRegistry - */ -@Service(XMLSchemaRegistry.class) -public class XMLSchemaRegistryImpl implements XMLSchemaRegistry { - private final XmlSchemaCollection collection; - - /** - * @param collection - */ - public XMLSchemaRegistryImpl(XmlSchemaCollection collection) { - super(); - this.collection = collection; - } - - public XMLSchemaRegistryImpl() { - super(); - this.collection = new XmlSchemaCollection(); - } - - public XmlSchemaElement getElement(QName name) { - return collection.getElementByQName(name); - } - - public XmlSchemaType getType(QName name) { - return collection.getTypeByQName(name); - } - - public List loadSchemas(Definition definition) { - Types types = definition.getTypes(); - if (types == null) { - return Collections.emptyList(); - } - List schemas = new ArrayList(); - for (Object ext : types.getExtensibilityElements()) { - if (ext instanceof Schema) { - Element element = ((Schema) ext).getElement(); - XmlSchema s = collection.read(element, element.getBaseURI()); - schemas.add(s); - } - } - return schemas; - } - - public XmlSchema loadSchema(String namespace, URL location) throws IOException, XmlSchemaException { - XmlSchema schema; - XmlSchema[] schemaList = collection.getXmlSchema(location.toExternalForm()); - if (schemaList != null && schemaList.length > 0) { - schema = schemaList[0]; - } else { - InputStream is = location.openStream(); - schema = collection.read(new InputStreamReader(is), null); - is.close(); - } - if (namespace != null && schema != null && !namespace.equals(schema.getTargetNamespace())) { - throw new XmlSchemaException(namespace + " != " + schema.getTargetNamespace()); - } - return schema; - } - - public XmlSchema loadSchema(String schemaLocation, ClassLoader classLoader) throws IOException, XmlSchemaException { - int index = schemaLocation.indexOf(' '); - if (index == -1) { - throw new XmlSchemaException("Invalid schemaLocation: " + schemaLocation); - } - String namespace = schemaLocation.substring(0, index).trim(); - URL url; - URI uri; - try { - uri = new URI(schemaLocation.substring(index + 1).trim()); - } catch (URISyntaxException e) { - throw new XmlSchemaException("Invalid schemaLocation: " + schemaLocation); - } - if (uri.isAbsolute()) { - url = uri.toURL(); - } else { - url = classLoader.getResource(uri.toString()); - if (url == null) { - throw new XmlSchemaException("Resource cannot be resolved: schemaLocation: " + schemaLocation); - } - } - return loadSchema(namespace, url); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl deleted file mode 100644 index 142df15171..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - org.apache.tuscany.sca.services.idl - wsdl - 1.0-incubator-M2-SNAPSHOT - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl b/branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl deleted file mode 100644 index 28b3458bf1..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - org.apache.tuscany.sca.services.idl - wsdl - 1.0-incubator-M2-SNAPSHOT - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java deleted file mode 100644 index 8f263607e0..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java +++ /dev/null @@ -1,82 +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.idl.wsdl; - -import java.net.URL; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Definition; -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.spi.idl.InvalidServiceContractException; -import org.apache.tuscany.spi.model.DataType; -import org.apache.tuscany.spi.model.Operation; - -/** - * Test case for InterfaceWSDLIntrospectorImpl - */ -public class InterfaceWSDLIntrospectorImplTestCase extends TestCase { - private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - - private WSDLDefinitionRegistryImpl registry; - private PortType portType; - - /** - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - registry = new WSDLDefinitionRegistryImpl(); - registry.setSchemaRegistry(new XMLSchemaRegistryImpl()); - URL url = getClass().getResource("stockquote.wsdl"); - Definition definition = registry.loadDefinition(null, url); - portType = definition.getPortType(PORTTYPE_NAME); - } - - public final void testIntrospectPortType() throws InvalidServiceContractException { - InterfaceWSDLIntrospector introspector = new InterfaceWSDLIntrospectorImpl(registry); - WSDLServiceContract contract = introspector.introspect(portType); - Assert.assertEquals(contract.getInterfaceName(), "StockQuotePortType"); - Map> operations = contract.getOperations(); - Assert.assertEquals(1, operations.size()); - Operation operation = operations.get("getLastTradePrice"); - Assert.assertNotNull(operation); - DataType>> inputType = operation.getInputType(); - Assert.assertEquals(1, inputType.getLogical().size()); - DataType returnType = operation.getOutputType(); - Assert.assertNotNull(returnType); - Assert.assertEquals(0, operation.getFaultTypes().size()); - Assert.assertEquals(1, operation.getWrapper().getInputChildElements().size()); - Assert.assertEquals(1, operation.getWrapper().getOutputChildElements().size()); - } - - public final void testIntrospectPortTypePortType() throws InvalidServiceContractException { - InterfaceWSDLIntrospector introspector = new InterfaceWSDLIntrospectorImpl(registry); - WSDLServiceContract contract = introspector.introspect(portType, portType); - Assert.assertEquals("StockQuotePortType", contract.getInterfaceName()); - Assert.assertEquals("StockQuotePortType", contract.getCallbackName()); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java deleted file mode 100644 index a7d7457f76..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java +++ /dev/null @@ -1,80 +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.idl.wsdl; - -import java.io.IOException; -import java.net.URL; -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.xml.namespace.QName; - -import junit.framework.TestCase; -import junit.framework.Assert; - -/** - * Verifies the default WSDL registry implementation - * - * @version $Rev$ $Date$ - */ -public class WSDLDefinitionRegistryTestCase extends TestCase { - private static final String NS = "http://www.example.org"; - private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { - public void readingWSDL(String namespace, URL location) { - } - - public void cachingDefinition(String namespace, URL location) { - } - }; - private WSDLDefinitionRegistryImpl wsdlRegistry; - private ClassLoader cl; - private URL exampleWsdl; - - - public void testLoadFromAbsoluteWSDLLocation() { - try { - Definition def = wsdlRegistry.loadDefinition(NS + ' ' + exampleWsdl, cl); - Assert.assertNotNull(def.getPortType(new QName(NS, "HelloWorld"))); - } catch (IOException e) { - Assert.fail(e.getMessage()); - } catch (WSDLException e) { - Assert.fail(e.getMessage()); - } - } - - public void testLoadFromRelativeWSDLLocation() { - try { - Definition def = wsdlRegistry.loadDefinition(NS + " org/apache/tuscany/idl/wsdl/example.wsdl", cl); - Assert.assertNotNull(def.getPortType(new QName(NS, "HelloWorld"))); - } catch (IOException e) { - Assert.fail(e.getMessage()); - } catch (WSDLException e) { - Assert.fail(e.getMessage()); - } - } - - protected void setUp() throws Exception { - super.setUp(); - wsdlRegistry = new WSDLDefinitionRegistryImpl(); - wsdlRegistry.setSchemaRegistry(new XMLSchemaRegistryImpl()); - wsdlRegistry.setMonitor(NULL_MONITOR); - exampleWsdl = getClass().getResource("example.wsdl"); - cl = getClass().getClassLoader(); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java deleted file mode 100644 index c05cf9770f..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java +++ /dev/null @@ -1,53 +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.idl.wsdl; - -import java.net.URI; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class WSDLLoaderImplTestCase extends TestCase { - private WSDLLoaderImpl loader; - private URI exampleURI; - private QName exampleName; - - public void testGetNamespace() throws UnresolveableResourceException { - assertEquals("http://example.org/TicketAgent.wsdl20", loader.getNamespace(exampleURI)); - } - - public void testGetInterfaceNameFromFragment() throws UnresolveableResourceException, InvalidFragmentException { - assertEquals("TicketAgent", loader.getInterfaceName("wsdl.interface(TicketAgent)")); - } - - public void testGetInterfaceNameFromURI() throws UnresolveableResourceException, InvalidFragmentException { - assertEquals(exampleName, loader.getInterfaceName(exampleURI)); - } - - protected void setUp() throws Exception { - super.setUp(); - loader = new WSDLLoaderImpl(); - exampleURI = URI.create("http://example.org/TicketAgent.wsdl20#wsdl.interface(TicketAgent)"); - exampleName = new QName("http://example.org/TicketAgent.wsdl20", "TicketAgent"); - } -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java deleted file mode 100644 index b77e88d408..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java +++ /dev/null @@ -1,101 +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.idl.wsdl; - -import java.net.URL; -import java.util.List; - -import javax.wsdl.Definition; -import javax.wsdl.Operation; -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.spi.idl.ElementInfo; -import org.apache.tuscany.spi.model.DataType; - -/** - * Test case for WSDLOperation - */ -public class WSDLOperationTestCase extends TestCase { - private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - - private WSDLDefinitionRegistryImpl registry; - - /** - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - registry = new WSDLDefinitionRegistryImpl(); - registry.setSchemaRegistry(new XMLSchemaRegistryImpl()); - } - - public final void testWrappedOperation() throws Exception { - URL url = getClass().getResource("stockquote.wsdl"); - Definition definition = registry.loadDefinition(null, url); - PortType portType = definition.getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice", null, null); - - WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry()); - - DataType>> inputType = op.getInputType(); - Assert.assertEquals(1, inputType.getLogical().size()); - Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), inputType.getLogical() - .get(0).getLogical()); - - DataType outputType = op.getOutputType(); - Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"), outputType - .getLogical()); - Assert.assertTrue(op.isWrapperStyle()); - - DataType>> unwrappedInputType = op.getWrapper().getUnwrappedInputType(); - List> childTypes = unwrappedInputType.getLogical(); - Assert.assertEquals(1, childTypes.size()); - DataType childType = childTypes.get(0); - Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical()); - ElementInfo element = (ElementInfo) childType.getMetadata(ElementInfo.class.getName()); - Assert.assertNotNull(element); - - childType = op.getWrapper().getUnwrappedOutputType(); - Assert.assertEquals(new QName(null, "price"), childType.getLogical()); - element = (ElementInfo) childType.getMetadata(ElementInfo.class.getName()); - Assert.assertNotNull(element); - } - - public final void testUnwrappedOperation() throws Exception { - URL url = getClass().getResource("unwrapped-stockquote.wsdl"); - Definition definition = registry.loadDefinition(null, url); - PortType portType = definition.getPortType(PORTTYPE_NAME); - - Operation operation = portType.getOperation("getLastTradePrice1", null, null); - WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry()); - Assert.assertFalse(op.isWrapperStyle()); - Assert.assertEquals(1, op.getInputType().getLogical().size()); - - operation = portType.getOperation("getLastTradePrice2", null, null); - op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry()); - Assert.assertFalse(op.isWrapperStyle()); - Assert.assertEquals(2, op.getInputType().getLogical().size()); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java deleted file mode 100644 index 748c790297..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java +++ /dev/null @@ -1,72 +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.idl.wsdl; - -import java.net.URL; - -import javax.wsdl.Definition; -import javax.wsdl.Operation; -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import junit.framework.Assert; -import junit.framework.TestCase; - -/** - * Test case for WSDLOperation - */ -public class WrapperStyleOperationTestCase extends TestCase { - private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - - private WSDLDefinitionRegistryImpl registry; - - /** - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - registry = new WSDLDefinitionRegistryImpl(); - registry.setSchemaRegistry(new XMLSchemaRegistryImpl()); - } - - public final void testWrappedOperation() throws Exception { - URL url = getClass().getResource("stockquote.wsdl"); - Definition definition = registry.loadDefinition(null, url); - PortType portType = definition.getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice", null, null); - WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry()); - Assert.assertTrue(op.isWrapperStyle()); - Assert.assertEquals(1, op.getWrapper().getInputChildElements().size()); - Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size()); - } - - public final void testUnwrappedOperation() throws Exception { - URL url = getClass().getResource("unwrapped-stockquote.wsdl"); - Definition definition = registry.loadDefinition(null, url); - PortType portType = definition.getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice1", null, null); - WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry()); - Assert.assertFalse(op.isWrapperStyle()); - operation = portType.getOperation("getLastTradePrice2", null, null); - op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry()); - Assert.assertFalse(op.isWrapperStyle()); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java deleted file mode 100644 index 60433d3bc1..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java +++ /dev/null @@ -1,105 +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.idl.wsdl; - -import java.io.IOException; -import java.net.URL; -import java.util.List; - -import javax.wsdl.Definition; -import javax.xml.namespace.QName; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.ws.commons.schema.XmlSchema; -import org.apache.ws.commons.schema.XmlSchemaComplexType; -import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaException; -import org.apache.ws.commons.schema.XmlSchemaObjectCollection; -import org.apache.ws.commons.schema.XmlSchemaSequence; -import org.apache.ws.commons.schema.XmlSchemaType; - -/** - * Verifies the default XSD registry implementation - * - * @version $Rev$ $Date$ - */ -public class XMLSchemaRegistryImplTestCase extends TestCase { - private static final QName PO_ELEMENT_NAME = new QName("http://www.example.com/IPO", "purchaseOrder"); - private static final QName PO_TYPE_NAME = new QName("http://www.example.com/IPO", "PurchaseOrderType"); - - private static final String NS = "http://example.com/stockquote.xsd"; - private static final QName GET_LAST_TRADE_PRICE_ELEMENT_NAME = new QName(NS, "getLastTradePrice"); - - private XMLSchemaRegistryImpl xsdRegistry; - - private WSDLDefinitionRegistryImpl wsdlRegistry; - - private ClassLoader cl; - - private URL wsdl; - - public void testLoadFromAbsoluteWSDLLocation() { - try { - Definition definition = wsdlRegistry.loadDefinition(null, wsdl); - List schemas = xsdRegistry.loadSchemas(definition); - Assert.assertTrue(schemas.size() == 1); - XmlSchema schema = schemas.get(0); - XmlSchemaElement element = schema.getElementByName(GET_LAST_TRADE_PRICE_ELEMENT_NAME); - Assert.assertNotNull(element); - XmlSchemaType type = element.getSchemaType(); - XmlSchemaComplexType complexType = (XmlSchemaComplexType) type; - XmlSchemaSequence sequence = (XmlSchemaSequence) complexType.getParticle(); - XmlSchemaObjectCollection items = sequence.getItems(); - Assert.assertTrue(items.getItem(0) instanceof XmlSchemaElement); - } catch (Exception e) { - Assert.fail(e.getMessage()); - } - } - - public void testSchemaLocation() throws IOException { - String schemaLocation = "http://www.example.com/IPO org/apache/tuscany/idl/wsdl/ipo.xsd"; - XmlSchema schema = xsdRegistry.loadSchema(schemaLocation, cl); - Assert.assertNotNull(schema); - Assert.assertNotNull(schema.getElementByName(PO_ELEMENT_NAME)); - Assert.assertNotNull(xsdRegistry.getElement(PO_ELEMENT_NAME)); - Assert.assertNotNull(schema.getTypeByName(PO_TYPE_NAME)); - Assert.assertNotNull(xsdRegistry.getType(PO_TYPE_NAME)); - - - schemaLocation = "http://www.example.com/IPO1 org/apache/tuscany/idl/wsdl/ipo.xsd"; - try { - schema = xsdRegistry.loadSchema(schemaLocation, cl); - Assert.fail(""); - } catch (XmlSchemaException e) { - Assert.assertTrue(e.getMessage().contains("http://www.example.com/IPO1 !=")); - } - } - - protected void setUp() throws Exception { - super.setUp(); - xsdRegistry = new XMLSchemaRegistryImpl(); - wsdlRegistry = new WSDLDefinitionRegistryImpl(); - wsdlRegistry.setSchemaRegistry(xsdRegistry); - wsdl = getClass().getResource("stockquote.wsdl"); - cl = getClass().getClassLoader(); - } - -} diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl deleted file mode 100644 index 5e8e5dad0d..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd deleted file mode 100644 index 241ec15d36..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - International Purchase order schema for Example.com - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl deleted file mode 100644 index 78e6bfe785..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl b/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl deleted file mode 100644 index c74c0c9b64..0000000000 --- a/branches/sca-java-M2/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3