summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo')
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/LICENSE.txt202
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/README.txt35
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/pom.xml46
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java106
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java45
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java264
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/resources/system.fragment25
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java59
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java82
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java141
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl76
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl78
-rw-r--r--sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl106
13 files changed, 1265 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/README.txt b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the 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.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/pom.xml b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/pom.xml
new file mode 100644
index 0000000000..635711f294
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.
+ -->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.databinding</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>incubating-M1</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <name>Tuscany Data Binding based on SDO</name>
+ <description>Data Binding based on SDO.</description>
+ <version>incubating-M1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java
new file mode 100644
index 0000000000..519d256036
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java
@@ -0,0 +1,106 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * 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.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import commonj.sdo.helper.XSDHelper;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.config.SidefileLoadException;
+import org.apache.tuscany.core.loader.LoaderContext;
+import org.apache.tuscany.core.loader.StAXUtil;
+import org.apache.tuscany.core.loader.assembly.AbstractLoader;
+import org.apache.tuscany.core.loader.assembly.AssemblyConstants;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyObject;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Loader that handles &lt;import.sdo&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("MODULE")
+public class ImportSDOLoader extends AbstractLoader {
+ public static final QName IMPORT_SDO = new QName(AssemblyConstants.SCA_NAMESPACE, "import.sdo");
+
+ public QName getXMLType() {
+ return IMPORT_SDO;
+ }
+
+ public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
+ assert IMPORT_SDO.equals(reader.getName());
+ importFactory(reader, loaderContext);
+ importWSDLOrXSD(reader, loaderContext);
+ StAXUtil.skipToEndElement(reader);
+ return null;
+ }
+
+ private void importFactory(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException {
+ String factoryName = reader.getAttributeValue(null, "factory");
+ if (factoryName != null) {
+ ResourceLoader resourceLoader = loaderContext.getResourceLoader();
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try {
+ // set TCCL as SDO needs it
+ Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
+ Class<?> factoryClass = resourceLoader.loadClass(factoryName);
+ SDOUtil.registerStaticTypes(factoryClass);
+ } catch (ClassNotFoundException e) {
+ throw new ConfigurationLoadException(e.getMessage(), e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private void importWSDLOrXSD(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException {
+ String location = reader.getAttributeValue(null, "wsdlLocation");
+ if (location == null)
+ location = reader.getAttributeValue(null, "schemaLocation");
+ if (location != null) {
+ ResourceLoader resourceLoader = loaderContext.getResourceLoader();
+ URL wsdlURL = resourceLoader.getResource(location);
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try {
+// Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
+ InputStream xsdInputStream = wsdlURL.openStream();
+ try {
+ AssemblyContext context = registry.getContext();
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(context.getTypeHelper());
+ xsdHelper.define(xsdInputStream, null);
+ } finally {
+ xsdInputStream.close();
+ }
+ } catch (IOException e) {
+ SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
+ sfe.setResourceURI(location);
+ throw sfe;
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java
new file mode 100644
index 0000000000..0f0cc13fd8
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * 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.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.CopyHelper;
+import org.apache.tuscany.core.builder.ObjectFactory;
+import org.apache.tuscany.core.injection.ObjectCreationException;
+
+/**
+ * Creates new instances of an SDO
+ *
+ * @version $Rev$ $Date$
+ */
+public class SDOObjectFactory implements ObjectFactory<DataObject> {
+
+ private DataObject dataObject;
+
+ public SDOObjectFactory(DataObject dataObject) {
+ this.dataObject = dataObject;
+ }
+
+ public DataObject getInstance() throws ObjectCreationException {
+ return CopyHelper.INSTANCE.copy(dataObject);
+ }
+
+ public void releaseInstance(DataObject instance) {
+ }
+
+}
+
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java
new file mode 100644
index 0000000000..d732676c76
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java
@@ -0,0 +1,264 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.core.wire.InvocationRuntimeException;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.ServiceRuntimeException;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * Utility methods to convert between XML byte arrays, SDO DataObjects, and Java objects.
+ *
+ * Most of these methods rely on the schemas having been registered with XSDHelper.define
+ */
+public final class SDOXMLHelper {
+
+ private SDOXMLHelper() {
+ // utility class, never contructed
+ }
+
+ /**
+ * Deserialize an XML byte array into Java Objects
+ *
+ * @param xmlBytes
+ * the byte array containing the XML
+ * @param isWrapped
+ *
+ * @return the array of deserialized Java objects
+ * @deprecated TUSCANY-333 use the method that takes a ClassLoader
+ */
+ public static Object[] toObjects(TypeHelper typeHelper, byte[] xmlBytes, boolean isWrapped) {
+ DataObject dataObject = toDataObject(typeHelper, xmlBytes);
+ return toObjects(dataObject, isWrapped);
+ }
+
+ /**
+ * Convert a typed DataObject to Java objects
+ *
+ * @param dataObject
+ * @param isWrapped
+ * @return the array of Objects from the DataObject
+ */
+ public static Object[] toObjects(DataObject dataObject, boolean isWrapped) {
+ if (isWrapped) {
+ List ips = dataObject.getInstanceProperties();
+ Object[] os = new Object[ips.size()];
+ for (int i = 0; i < ips.size(); i++) {
+ os[i] = dataObject.get((Property) ips.get(i));
+ }
+ return os;
+ } else {
+ Object object = dataObject;
+ Type type = dataObject.getType();
+ if (type.isSequenced()) {
+ object = dataObject.getSequence().getValue(0);
+ }
+ return new Object[] { object };
+ }
+ }
+
+ /**
+ * Serializes objects to an XML byte array
+ *
+ * @param os
+ * @param typeNS
+ * @param typeName
+ * @return a byte array containing the XML
+ * @deprecated TUSCANY-333 use the method that takes a ClassLoader
+ */
+ public static byte[] toXMLBytes(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
+ DataObject dataObject = toDataObject(typeHelper, os, elementQName, isWrapped);
+ return toXMLbytes(typeHelper, dataObject, elementQName);
+ }
+
+ /**
+ * Convert a DataObject to an XML byte array
+ *
+ * @param dataObject
+ * @param typeNS
+ * @param typeName
+ * @return a byte array containing the XML bytes
+ * @deprecated TUSCANY-333 use the method that takes a ClassLoader
+ */
+ public static byte[] toXMLbytes(TypeHelper typeHelper, DataObject dataObject, QName elementQName) {
+ try {
+
+ ByteArrayOutputStream pos = new ByteArrayOutputStream();
+ XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
+ xmlHelper.save(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart(), pos);
+ pos.close();
+
+ return pos.toByteArray();
+
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Deserialize an XML byte array into a DataObject
+ *
+ * @param xmlBytes
+ * @return a DataObject
+ * @deprecated TUSCANY-333 use the method that takes a ClassLoader
+ */
+ public static DataObject toDataObject(TypeHelper typeHelper, byte[] xmlBytes) {
+ try {
+
+ XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
+ XMLDocument document = xmlHelper.load(new ByteArrayInputStream(xmlBytes));
+
+ return document.getRootObject();
+
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Convert objects to typed DataObject
+ *
+ * @param typeNS
+ * @param typeName
+ * @param os
+ * @return the DataObject
+ * @deprecated TUSCANY-333 use the method that takes a ClassLoader
+ */
+ public static DataObject toDataObject(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+
+ Property property = xsdHelper.getGlobalProperty(elementQName.getNamespaceURI(), elementQName.getLocalPart(), true);
+ if (null == property) {
+ throw new InvocationRuntimeException("Type '" + elementQName.toString() + "' not found in registered SDO types.");
+ }
+ if (isWrapped) {
+ DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
+ DataObject dataObject = dataFactory.create(property.getType());
+ List ips = dataObject.getInstanceProperties();
+ for (int i = 0; i < ips.size(); i++) {
+ dataObject.set(i, os[i]);
+ }
+ return dataObject;
+ } else {
+ Object value = os[0];
+ Type type = property.getType();
+ if (!type.isDataType()) {
+ return (DataObject) value;
+ } else {
+ return SDOUtil.createDataTypeWrapper(type, value);
+ }
+ }
+ }
+
+// ---
+
+ public static DataObject toDataObject(ClassLoader classLoader, TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+
+ return toDataObject(typeHelper, os, elementQName, isWrapped);
+
+ } finally {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+
+ public static DataObject toDataObject(ClassLoader classLoader, TypeHelper typeHelper, byte[] xmlBytes) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+
+ return toDataObject(typeHelper, xmlBytes);
+
+ } finally {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+
+ public static byte[] toXMLbytes(ClassLoader classLoader, TypeHelper typeHelper, DataObject dataObject, QName elementQName) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+
+ return toXMLbytes(typeHelper, dataObject, elementQName);
+
+ } finally {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+
+ public static byte[] toXMLBytes(ClassLoader classLoader, TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+
+ return toXMLBytes(typeHelper, os, elementQName, isWrapped);
+
+ } finally {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+
+ public static Object[] toObjects(ClassLoader classLoader, TypeHelper typeHelper, byte[] xmlBytes, boolean isWrapped) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+
+ return toObjects(typeHelper, xmlBytes, isWrapped);
+
+ } finally {
+ if (tccl != classLoader) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/resources/system.fragment
new file mode 100644
index 0000000000..a963af3e2e
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/main/resources/system.fragment
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <component name="org.apache.tuscany.databinding.sdo.ImportSDOLoader">
+ <tuscany:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+</moduleFragment>
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java
new file mode 100644
index 0000000000..31815a97b4
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * 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.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOLoaderTestCase extends LoaderTestSupport {
+ private ImportSDOLoader loader;
+
+ public void testMinimal() throws XMLStreamException, ConfigurationLoadException {
+ String xml = "<import.sdo xmlns='http://www.osoa.org/xmlns/sca/0.9'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertNull(loader.load(reader, null));
+ }
+
+ public void testFactory() throws XMLStreamException, ConfigurationLoadException {
+ String xml = "<import.sdo xmlns='http://www.osoa.org/xmlns/sca/0.9' factory='org.apache.tuscany.databinding.sdo.ImportSDOLoaderTestCase$MockFactory'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertFalse(inited);
+ assertNull(loader.load(reader, loaderContext));
+ assertTrue(inited);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ loader = new ImportSDOLoader();
+ }
+
+ private static boolean inited = false;
+
+ public static class MockFactory {
+ public static Object INSTANCE;
+
+ static {
+ ImportSDOLoaderTestCase.inited = true;
+ }
+ }
+}
+
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java
new file mode 100644
index 0000000000..821a7220dd
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java
@@ -0,0 +1,82 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * 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.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import java.io.StringReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
+import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
+import org.apache.tuscany.core.loader.LoaderContext;
+import org.apache.tuscany.core.loader.assembly.*;
+import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl;
+
+/**
+ * Base class for loader tests with common fixture elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class LoaderTestSupport extends TestCase {
+ protected SystemAssemblyFactory assemblyFactory;
+ protected ResourceLoader resourceLoader;
+ protected LoaderContext loaderContext;
+ protected AssemblyContext modelContext;
+ protected XMLInputFactory xmlFactory;
+ protected StAXLoaderRegistryImpl registry;
+
+ protected static final StAXLoaderRegistryImpl.Monitor NULL_MONITOR = new StAXLoaderRegistryImpl.Monitor() {
+ public void registeringLoader(QName xmlType) {
+ }
+
+ public void unregisteringLoader(QName xmlType) {
+ }
+
+ public void elementLoad(QName xmlType) {
+ }
+ };
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ assemblyFactory = new SystemAssemblyFactoryImpl();
+ resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader());
+ loaderContext = new LoaderContext(resourceLoader);
+ modelContext = new AssemblyContextImpl(assemblyFactory, null, resourceLoader);
+ xmlFactory = XMLInputFactory.newInstance();
+ registry = new StAXLoaderRegistryImpl();
+ registry.setMonitor(org.apache.tuscany.databinding.sdo.LoaderTestSupport.NULL_MONITOR);
+ }
+
+ protected XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+ protected void registerLoader(AbstractLoader<?> loader) {
+ loader.setFactory(assemblyFactory);
+ loader.setRegistry(registry);
+ loader.start();
+ }
+}
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java
new file mode 100644
index 0000000000..b72fa93046
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java
@@ -0,0 +1,141 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * 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.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+
+public class SDOXMLHelperTestCase extends TestCase {
+
+ private TypeHelper typeHelper;
+
+ public static final QName GREETING_QN = new QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings");
+
+ private static final String GREETING_NAME = "petra";
+
+ private static final String GREETING_XML = "<helloworldaxis:in0>petra</helloworldaxis:in0>";
+
+ private DataObject greetingDOB;
+
+ private byte[] greetingXML;
+
+ private ClassLoader appCL;
+
+ public static final QName DOCLIT_QN = new QName("http://www.example.org/creditscore/doclit/", "getCreditScoreRequest");
+
+ // private static final Object[] CUSTOMER = { "111-22-3333", "John", "Smith" };
+
+ private DataObject nonWrappedDOB;
+
+ public void testXMLBytes1() {
+ byte[] xmlBytes = SDOXMLHelper.toXMLbytes(appCL, typeHelper, greetingDOB, GREETING_QN);
+ assertNotNull(xmlBytes);
+ assertTrue(new String(xmlBytes).contains("<helloworldaxis:in0>petra</helloworldaxis:in0>"));
+ }
+
+ public void testXMLBytes2() {
+ byte[] xmlBytes = SDOXMLHelper.toXMLBytes(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
+ assertNotNull(xmlBytes);
+ assertTrue(new String(xmlBytes).contains(GREETING_XML));
+ }
+
+ // TODO: nonwrapped doesn't work
+ // public void testXMLBytes3() {
+ // byte[] xmlBytes = SDOXMLHelper.toXMLBytes(typeHelper, CUSTOMER, DOCLIT_QN, false);
+ // assertNotNull(xmlBytes);
+ // assertTrue(new String(xmlBytes).contains(DOC_LIT_XML));
+ // }
+
+ public void testToDataObject1() {
+ DataObject dataObject = SDOXMLHelper.toDataObject(appCL, typeHelper, greetingXML);
+ assertNotNull(dataObject);
+ assertEquals(GREETING_NAME, dataObject.getString(0));
+ }
+
+ public void testToDataObject2() {
+ DataObject dataObject = SDOXMLHelper.toDataObject(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
+ assertNotNull(dataObject);
+ assertEquals(GREETING_NAME, dataObject.getString(0));
+ }
+
+ // TODO: nonwrapped doesn't work
+ // public void testToDataObject3() {
+ // DataObject dataObject = SDOXMLHelper.toDataObject(typeHelper, CUSTOMER, DOCLIT_QN, false);
+ // assertNotNull(dataObject);
+ // assertEquals(CUSTOMER[0], dataObject.getString(0));
+ // assertEquals(CUSTOMER[1], dataObject.getString(1));
+ // assertEquals(CUSTOMER[2], dataObject.getString(2));
+ // }
+
+ public void testToObjects1() {
+ Object[] os = SDOXMLHelper.toObjects(appCL, typeHelper, greetingXML, true);
+ assertNotNull(os);
+ assertEquals(1, os.length);
+ assertEquals(GREETING_NAME, os[0]);
+ }
+
+ public void testToObjects2() {
+ Object[] os = SDOXMLHelper.toObjects(greetingDOB, true);
+ assertNotNull(os);
+ assertEquals(1, os.length);
+ assertEquals(GREETING_NAME, os[0]);
+ }
+
+ public void testToObjects3() {
+ Object[] os = SDOXMLHelper.toObjects(nonWrappedDOB, false);
+ assertNotNull(os);
+ // assertEquals(3, os.length); TODO: non-wrapped doesn't seem to work
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ DataObjectUtil.initRuntime();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ appCL = getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(appCL);
+ typeHelper = SDOUtil.createTypeHelper();
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+ URL url = getClass().getResource("helloworld.wsdl");
+ xsdHelper.define(url.openStream(), null);
+ url = getClass().getResource("CreditScoreDocLit.wsdl");
+ xsdHelper.define(url.openStream(), null);
+ greetingDOB = SDOXMLHelper.toDataObject(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
+ greetingXML = SDOXMLHelper.toXMLBytes(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
+
+ DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
+ nonWrappedDOB = dataFactory.create("http://www.example.org/creditscore/doclit/", "Customer");
+ nonWrappedDOB.setString(0, "111-22-3333");
+ nonWrappedDOB.setString(1, "John");
+ nonWrappedDOB.setString(2, "Smith");
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+ }
+}
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl
new file mode 100644
index 0000000000..09d1a58589
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
+ targetNamespace="http://www.example.org/creditscore/doclit/">
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="ssn" type="xsd:string" />
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
+ <xsd:complexType name="CreditReport">
+ <xsd:sequence>
+ <xsd:element name="score" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse"
+ name="getCreditScoreResponse" />
+ </wsdl:message>
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScoreRequest"
+ name="getCreditScoreRequest" />
+ </wsdl:message>
+ <wsdl:portType name="CreditScoreDocLit">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <soap:operation
+ soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
+ <wsdl:input>
+ <soap:body parts="getCreditScoreRequest" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body parts="getCreditScoreResponse" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditScore">
+ <wsdl:port binding="tns:CreditScoreDocLitSOAP"
+ name="CreditScoreDocLitSOAP">
+ <soap:address location="http://www.example.org/" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl
new file mode 100644
index 0000000000..3952c74809
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/creditscore/doclitwrapped/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
+ targetNamespace="http://www.example.org/creditscore/doclitwrapped/">
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.example.org/creditscore/doclitwrapped/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getCreditScoreResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="score" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getCreditScore">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ssn" type="xsd:string" />
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse"
+ name="getCreditScoreResponse" />
+ </wsdl:message>
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScore"
+ name="getCreditScoreRequest" />
+ </wsdl:message>
+ <wsdl:portType name="CreditScoreDocLitWrapped">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditScoreDocLitWrappedSOAP" type="tns:CreditScoreDocLitWrapped">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <soap:operation
+ soapAction="http://www.example.org/creditscore/doclitwrapped/getCreditScore" />
+ <wsdl:input>
+ <soap:body parts="getCreditScoreRequest" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body parts="getCreditScoreResponse" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditScore">
+ <wsdl:port binding="tns:CreditScoreDocLitWrappedSOAP"
+ name="CreditScoreDocLitWrappedSOAP">
+ <soap:address location="http://localhost:8080/CreditScoreService/services/CreditScoreDocLitWrappedSOAP"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl
new file mode 100644
index 0000000000..e9312949d3
--- /dev/null
+++ b/sca-java-1.x/tags/java-M1-20060518/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <!-- Tuscany SCA Service -->
+<!--
+ <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+-->
+ <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+
+ <!-- Axis Web Service -->
+ <!--
+ <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc/services/helloworld"/>
+ -->
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>