summaryrefslogtreecommitdiffstats
path: root/sandbox/sebastien/java/sca-node/modules/implementation-bpel
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/sebastien/java/sca-node/modules/implementation-bpel')
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/DISCLAIMER8
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/LICENSE251
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/NOTICE17
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/pom.xml98
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java41
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java66
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java114
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java53
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java524
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java144
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java538
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java162
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessException.java42
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java67
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java128
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java113
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory18
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties34
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java59
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java117
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl82
24 files changed, 2780 insertions, 0 deletions
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/DISCLAIMER b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/LICENSE b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/LICENSE
new file mode 100644
index 0000000000..baba9ca048
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/LICENSE
@@ -0,0 +1,251 @@
+
+ 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.
+
+===============================================================================================================
+
+Apache Tuscany SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+=================================================================================================================
+
+This module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/NOTICE b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/NOTICE
new file mode 100644
index 0000000000..a2f696be26
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/NOTICE
@@ -0,0 +1,17 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+Copyright (c) 2006, Sun Microsystems, Inc.
+All rights reserved.
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/pom.xml b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/pom.xml
new file mode 100644
index 0000000000..9b20867827
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/pom.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <name>Apache Tuscany SCA BPEL Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.bpel</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.implementation.bpel*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java
new file mode 100644
index 0000000000..c47888de17
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+/**
+ * A factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELFactory {
+
+ /**
+ * Creates a new BPEL implementation.
+ *
+ * @return
+ */
+ BPELImplementation createBPELImplementation();
+
+ /**
+ * Creates a new BPEL Process Definition
+ * @return
+ */
+ BPELProcessDefinition createBPELProcessDefinition();
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java
new file mode 100644
index 0000000000..53e160dd1c
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing the BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELImplementation extends Implementation {
+
+ /**
+ * Get the BPEL process Name
+ */
+ QName getProcess();
+
+ /**
+ * Set the BPEL process Name
+ * @param processName process QName
+ */
+ void setProcess(QName processName);
+
+ /**
+ * Get the BPEL process definition
+ * @return
+ */
+ BPELProcessDefinition getProcessDefinition();
+
+ /**
+ * Set the BPEL process definition
+ * @param processDefinition
+ */
+ void setProcessDefinition(BPELProcessDefinition processDefinition);
+
+ /**
+ * Returns the componentType for this Spring implementation
+ */
+ public ComponentType getComponentType();
+
+ /**
+ * Sets the componentType for this Spring implementation
+ * @parma componentType the component type to set
+ */
+ public void setComponentType(ComponentType componentType);
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java
new file mode 100644
index 0000000000..61656e2533
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import java.util.List;
+import java.util.Collection;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkElement;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELImportElement;
+
+
+
+/**
+ * The BPEL process definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELProcessDefinition extends Base {
+
+ /**
+ * Get the BPEL process Name
+ */
+ QName getName();
+
+ /**
+ * Set the BPEL process Name
+ * @param processName process QName
+ */
+ void setName(QName name);
+
+ /**
+ * Get BPEL process URI
+ * @return URI for the process
+ */
+ URI getURI();
+
+ /**
+ * Set the BPEL process URI
+ * @param uri for the process
+ */
+ void setURI(URI uri);
+
+ /**
+ * Get the URL for the process location
+ * @return
+ */
+ URL getLocation();
+
+ /**
+ * Set the URL for the process location
+ * @param url
+ */
+ void setLocation(URL location);
+
+ /**
+ * Return the list of PartnerLinks for this process
+ */
+ List<BPELPartnerLinkElement> getPartnerLinks();
+
+ /**
+ * Return the list of imports for this process
+ */
+ List<BPELImportElement> getImports();
+
+ /**
+ * Set the associated collection of port types
+ * @param thePortTypes
+ */
+ public void setPortTypes( Collection<PortType> thePortTypes ) ;
+
+ /**
+ * Return the collection of associated port types
+ * @return
+ */
+ public Collection<PortType> getPortTypes() ;
+
+ /**
+ * Set the associated collection of WSDL interfaces
+ * @param theInterfaces
+ */
+ public void setInterfaces( Collection<WSDLInterface> theInterfaces ) ;
+
+ /**
+ * Return the collection of associated WSDL interfaces
+ * @return
+ */
+ public Collection<WSDLInterface> getInterfaces() ;
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
new file mode 100644
index 0000000000..d574f6e422
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationImpl;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELProcessDefinitionImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * A default factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultBPELFactory implements BPELFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private WSDLFactory wsdlFactory;
+
+ public DefaultBPELFactory(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ }
+
+ public BPELImplementation createBPELImplementation() {
+ return new BPELImplementationImpl(assemblyFactory, wsdlFactory);
+ }
+
+ public BPELProcessDefinition createBPELProcessDefinition() {
+ return new BPELProcessDefinitionImpl();
+ }
+
+
+
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
new file mode 100644
index 0000000000..0079272521
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
@@ -0,0 +1,524 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELImportElement;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkElement;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkTypeElement;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.BPELPartnerLinkTypeExt;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * BPEL document processor responsible for reading a BPEL file and producing necessary model info about it
+ *
+ * TODO: The namespaces for WS-BPEL include 2 versions - only the earlier BPEL 1.1 versions are
+ * supported at present - the BPEL 2.0 namespaces also need support. This will require inspection
+ * of both BPEL process files and of WSDL files for their BPEL namespaces
+ * @version $Rev$ $Date$
+ */
+public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements URLArtifactProcessor<BPELProcessDefinition> {
+ public final static QName BPEL_PROCESS_DEFINITION = new QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/", "process");
+ public final static QName BPEL_EXECUTABLE_DEFINITION = new QName("http://docs.oasis-open.org/wsbpel/2.0/process/executable", "process");
+ private static final String SCA_BPEL_NS = "http://docs.oasis-open.org/ns/opencsa/sca-bpel/200801";
+ private static final String BPEL_NS = "http://schemas.xmlsoap.org/ws/2004/03/business-process/";
+ private static final String BPEL_PLINK_NS = "http://schemas.xmlsoap.org/ws/2004/03/partner-link/";
+ private static final QName PROCESS_ELEMENT = new QName(BPEL_NS, "process");
+ private static final QName PARTNERLINK_ELEMENT = new QName(BPEL_NS, "partnerLink");
+ private static final QName ONEVENT_ELEMENT = new QName(BPEL_NS, "onEvent");
+ private static final QName RECEIVE_ELEMENT = new QName(BPEL_NS, "receive");
+ private static final QName ONMESSAGE_ELEMENT = new QName(BPEL_NS, "onMessage");
+ private static final QName INVOKE_ELEMENT = new QName(BPEL_NS, "invoke");
+ private static final QName IMPORT_ELEMENT = new QName(BPEL_NS, "import");
+ private static final String LINKTYPE_NAME = "partnerLinkType";
+ private static final QName LINKTYPE_ELEMENT = new QName(BPEL_PLINK_NS, LINKTYPE_NAME);
+
+ public final static String NAME_ELEMENT = "name";
+
+ private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ private final BPELFactory factory;
+ private WSDLFactory WSDLfactory;
+ private Monitor monitor;
+
+ public BPELDocumentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.factory = modelFactories.getFactory(BPELFactory.class);
+ this.WSDLfactory = modelFactories.getFactory(WSDLFactory.class);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+
+ public String getArtifactType() {
+ return "*.bpel";
+ }
+
+ public Class<BPELProcessDefinition> getModelType() {
+ return BPELProcessDefinition.class;
+ }
+
+ public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ BPELProcessDefinition processDefinition = null;
+ try {
+ //for now we are just using process name
+ //and relying on componentType file for service definition
+ //so it's OK to set resolved for now
+ processDefinition = indexRead2(artifactURL);
+ processDefinition.setURI(artifactURI);
+ processDefinition.setUnresolved(false);
+ } catch (Exception e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", artifactURL, ce);
+ //throw ce;
+ }
+
+ return processDefinition;
+ }
+
+ /**
+ * Resolve the BPEL process
+ * - one of the things that needs doing is to pin down the WSDLs that are being used by
+ * the process, in particular the partnerLinkType and the related PortType definitions
+ */
+ public void resolve(BPELProcessDefinition model, ModelResolver resolver)
+ throws ContributionResolveException {
+ // FIXME - serious resolving needs to happen here
+
+ // Step 1 is to resolve the WSDL files referenced from this BPEL process
+ // - one complexity here is that the WSDL definitions hold BPEL extension elements for
+ // the partnerLinkType declarations - and these must be used in later steps
+ //
+ // Step 2 is to take all the partnerLink definitions and establish the PortType being
+ // used, by tracing through the related partnerLinkType declarations - the PortType is
+ // effectively a definition of the interface used by the partnerLink.
+ // - another consideration here is that each partnerLink can involve 2 interfaces, one
+ // for the forward calls to the process, the other for calls from the process - depending
+ // on whether the partnerLink is a reference or a service, one of these interfaces is a
+ // callback interface.
+
+ List<BPELImportElement> theImports = model.getImports();
+ for ( BPELImportElement theImport : theImports ) {
+ // Deal with WSDL imports
+ if ( theImport.getImportType().equals("http://schemas.xmlsoap.org/wsdl/") ) {
+ String WSDLLocation = theImport.getLocation();
+ String WSDLNamespace = theImport.getNamespace();
+
+ // Resolve the WSDL definition
+ WSDLDefinition proxy = WSDLfactory.createWSDLDefinition();
+ proxy.setUnresolved(true);
+ proxy.setNamespace(WSDLNamespace);
+ if ( WSDLLocation != null ) proxy.setLocation(URI.create(WSDLLocation));
+ WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy);
+ if (resolved != null && !resolved.isUnresolved()) {
+ theImport.setWSDLDefinition( resolved );
+ } else {
+ error("CannotResolveWSDLReference", resolver, WSDLLocation, WSDLNamespace);
+ //throw new ContributionResolveException("BPELDocumentProcessor:resolve -" +
+ //" unable to resolve WSDL referenced by BPEL import" +
+ //"WSDL location: " + WSDLLocation + " WSDLNamespace: " +
+ //WSDLNamespace );
+ return;
+ } // end if
+ } // end if
+ } // end for
+
+ // Fetch the sets of partner links, port types and interfaces
+ List<BPELPartnerLinkTypeElement> thePLinkTypes = getPartnerLinkTypes( theImports );
+ Collection<WSDLInterface> theInterfaces = (Collection<WSDLInterface>)new ArrayList<WSDLInterface>();
+ Collection<PortType> thePortTypes = getAllPortTypes( theImports, theInterfaces, resolver );
+
+ // Store the Port Types and the Interfaces for later calculation of the component type...
+ model.setPortTypes(thePortTypes);
+ model.setInterfaces(theInterfaces);
+
+ // Now, for each partnerLink in the BPEL process, find the related partnerLinkType
+ // element
+ List<BPELPartnerLinkElement> thePartnerLinks = model.getPartnerLinks();
+ for ( BPELPartnerLinkElement thePartnerLink : thePartnerLinks ) {
+ QName partnerLinkType = thePartnerLink.getPartnerLinkType();
+ BPELPartnerLinkTypeElement pLinkType =
+ findPartnerLinkType( partnerLinkType, thePLinkTypes );
+ if( pLinkType == null ) {
+ error("PartnerLinkNoMatchingType", thePartnerLink, thePartnerLink.getName());
+ //throw new ContributionResolveException( "PartnerLink "
+ //+ thePartnerLink.getName() + " has no matching partner link type");
+ } else
+ thePartnerLink.setPartnerLinkType(pLinkType);
+ } // end for
+
+ } // end resolve
+
+ /*
+ * Retrieve all the Partner Link types defined in the imported WSDL files
+ */
+ private List<BPELPartnerLinkTypeElement> getPartnerLinkTypes( List<BPELImportElement> theImports )
+ throws ContributionResolveException {
+
+ List<BPELPartnerLinkTypeElement> thePLinks =
+ new ArrayList<BPELPartnerLinkTypeElement>();
+
+ // We must find the partner link type elements from amongst the imported WSDLs
+ for ( BPELImportElement theImport : theImports ){
+ WSDLDefinition theWSDL = theImport.getWSDLDefinition();
+ Definition WSDLDefinition = theWSDL.getDefinition();
+ // The BPEL partnerLinkType elements are extension elements within the WSDL
+ List<ExtensibilityElement> extensibilityElements = WSDLDefinition.getExtensibilityElements();
+
+ for ( ExtensibilityElement theElement : extensibilityElements ) {
+ QName elementType = theElement.getElementType();
+ if ( elementType.equals( LINKTYPE_ELEMENT ) ) {
+ BPELPartnerLinkTypeExt pLinkExt = (BPELPartnerLinkTypeExt)theElement;
+ // Fetch the name of the partnerLinkType
+ String name = pLinkExt.getName();
+ QName qName = new QName( WSDLDefinition.getTargetNamespace(), name );
+ BPELPartnerLinkTypeElement pLinkElement = new BPELPartnerLinkTypeElement( qName );
+
+ // The partnerLinkType must have one and may have 2 role child elements
+ int count = 0;
+ for( int i = 0; i < 2; i++ ) {
+ if(pLinkExt.getRoleName(i) == null ) continue;
+ PortType pType = WSDLDefinition.getPortType(pLinkExt.getRolePortType(i));
+ if ( count == 0 ) {
+ pLinkElement.setRole1(pLinkExt.getRoleName(i),
+ pLinkExt.getRolePortType(i),
+ pType );
+ count++;
+ } else if (count == 1) {
+ pLinkElement.setRole2(pLinkExt.getRoleName(i),
+ pLinkExt.getRolePortType(i),
+ pType );
+ count++;
+ } else {
+ break;
+ } // end if
+ } // end for
+ if( count == 0 ) {
+ error("PartnerLinkTypeNoRoles", theElement, pLinkElement.getName());
+ throw new ContributionResolveException( "partnerLinkType " +
+ pLinkElement.getName() +" has no Roles defined" );
+ } else
+ thePLinks.add( pLinkElement );
+ } // end if
+
+ } // end for
+ } // end for
+ return thePLinks;
+ } // end getPartnerLinkTypes
+
+ protected Collection<PortType> getAllPortTypes( List<BPELImportElement> theImports,
+ Collection<WSDLInterface> theInterfaces,
+ ModelResolver resolver)
+ throws ContributionResolveException {
+
+ Collection<PortType> thePortTypes = (Collection<PortType>)new ArrayList<PortType>();
+ for ( BPELImportElement theImport : theImports ){
+ WSDLDefinition theWSDL = theImport.getWSDLDefinition();
+ Definition wsdlDefinition = theWSDL.getDefinition();
+
+ Collection<PortType> portTypes = (Collection<PortType>)wsdlDefinition.getPortTypes().values();
+ thePortTypes.addAll( portTypes );
+
+ // Create WSDLInterface elements for each PortType found
+ for( PortType portType : portTypes ) {
+ WSDLObject<PortType> wsdlPortType = theWSDL.getWSDLObject(PortType.class, portType.getQName() );
+ WSDLInterface wsdlInterface;
+ if (wsdlPortType != null) {
+ // Introspect the WSDL portType and add the resulting
+ // WSDLInterface to the resolver
+ try {
+ theWSDL.setDefinition( wsdlPortType.getDefinition() );
+ wsdlInterface = WSDLfactory.createWSDLInterface(wsdlPortType.getElement(),
+ theWSDL, resolver);
+ wsdlInterface.setWsdlDefinition(theWSDL);
+ } catch (InvalidInterfaceException e) {
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error("ContributionResolveException", resolver, ce);
+ throw ce;
+ } // end try
+ resolver.addModel(wsdlInterface);
+ theInterfaces.add(wsdlInterface);
+ } // end if
+ } // end for
+
+ //-----------------------
+
+ } // end for
+
+ return thePortTypes;
+ } // end getAllPortTypes
+
+ /**
+ * Returns a QName from a string.
+ * @param definition - a WSDL Definition
+ * @param value - the String from which to form the QName in the form "pref:localName"
+ * @return
+ */
+ protected QName getQNameValue(Definition definition, String value) {
+ if (value != null && definition != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = definition.getNamespace(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ } // end getQNameValue
+
+
+ /*
+ * Method which finds a partnerLinkType definition within the WSDLs imported by the BPEL
+ * process.
+ * @param partnerLinkTypeName - the name of the partnerLinkType
+ * @param theImports a list of the WSDL import declarations
+ * @returns a BPELPartnerLinkTypeElement for the partnerLinkType or null if it cannot be
+ * found
+ */
+ private BPELPartnerLinkTypeElement findPartnerLinkType( QName partnerLinkTypeName,
+ List<BPELPartnerLinkTypeElement> thePLinkTypes) {
+ // We must find the partner link type element from amongst the imported WSDLs
+ for ( BPELPartnerLinkTypeElement thePLinkType : thePLinkTypes ){
+ if( thePLinkType.getName().equals(partnerLinkTypeName) ) return thePLinkType;
+ } // end for
+ return null;
+ } // end findPartnerLinkType
+
+
+
+ protected BPELProcessDefinition indexRead2(URL doc) throws Exception {
+ BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition();
+ processDefinition.setUnresolved(true);
+ processDefinition.setLocation(doc);
+
+ InputStream is = doc.openStream();
+ XMLStreamReader reader = null;
+ try {
+ reader = inputFactory.createXMLStreamReader(is);
+ /*
+ * The principle here is to look for partnerLink elements, which form either services
+ * or references. A partnerLink can be EITHER - the algorithm for deciding is:
+ * 1) Explicit marking with sca:reference or sca:service attribute
+ * 2) "first use" of the partnerLink by specific BPEL activity elements:
+ * <onEvent../>, <receive../> or <pick../> elements imply a service
+ * <invoke../> implies a reference
+ */
+ // TODO - need to handle <scope../> elements as kind of "nested" processes
+ // - and scopes introduce the possibility of partnerLinks with the same name at
+ // different levels of scope.... (yuk!!)
+ boolean completed = false;
+ while (!completed) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ //System.out.println("BPEL TypeLoader - found element with name: " + qname.toString());
+ if (BPEL_PROCESS_DEFINITION.equals(qname) ||
+ BPEL_EXECUTABLE_DEFINITION.equals(qname)) {
+ QName processName = new QName(getString(reader, org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE),
+ getString(reader, NAME_ELEMENT));
+ processDefinition.setName(processName);
+ } else if (PARTNERLINK_ELEMENT.equals(qname)) {
+ processDefinition.getPartnerLinks().add(processPartnerLinkElement( reader ));
+ } else if (ONEVENT_ELEMENT.equals(qname) ||
+ RECEIVE_ELEMENT.equals(qname) ||
+ ONMESSAGE_ELEMENT.equals(qname) ) {
+ processPartnerLinkAsService( reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks() );
+ } else if (INVOKE_ELEMENT.equals(qname)) {
+ processPartnerLinkAsReference( reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks() );
+ } else if (IMPORT_ELEMENT.equals(qname)) {
+ processDefinition.getImports().add( processImportElement( reader ) );
+ } // end if
+ break;
+ case END_ELEMENT:
+ if (PROCESS_ELEMENT.equals(reader.getName())) {
+ //System.out.println("BPEL TypeLoader - finished read of process file");
+ completed = true;
+ break;
+ } // end if
+ } // end switch
+ } // end while
+ } finally {
+ if(reader != null) reader.close();
+ is.close();
+ } // end try
+
+ return processDefinition;
+ } // end indexRead2
+
+ /*
+ * Processes a partnerLink element from the BPEL process and creates a
+ * BPELPartnerLink object
+ */
+ private BPELPartnerLinkElement processPartnerLinkElement( XMLStreamReader reader )
+ throws ContributionReadException {
+ BPELPartnerLinkElement partnerLink = new BPELPartnerLinkElement(
+ reader.getAttributeValue(null, "name"),
+ getQNameValue(reader, reader.getAttributeValue(null, "partnerLinkType") ),
+ reader.getAttributeValue(null, "myRole"),
+ reader.getAttributeValue(null, "partnerRole"));
+ // See if there are any SCA extension attributes
+ String scaService = reader.getAttributeValue( SCA_BPEL_NS, "service");
+ String scaReference = reader.getAttributeValue( SCA_BPEL_NS, "reference");
+ if( (scaService != null) && (scaReference != null) ) {
+ // It is incorrect to set both service & reference attributes
+ error("PartnerLinkHasBothAttr", partnerLink, reader.getAttributeValue(null, "name"));
+ throw new ContributionReadException( "BPEL PartnerLink "
+ + reader.getAttributeValue(null, "name") +
+ " has both sca:reference and sca:service attributes set" );
+ }
+ // Set the SCA type and the related name, if present
+ if( scaService != null ) partnerLink.setAsService( scaService );
+ else if ( scaReference != null ) partnerLink.setAsReference( scaReference );
+ return partnerLink;
+ } // end processPartnerLinkElement
+
+ /*
+ * Processes an <import../> element from the BPEL process and creates a
+ * BPELImportElement object
+ */
+ private BPELImportElement processImportElement( XMLStreamReader reader ) {
+ return ( new BPELImportElement( reader.getAttributeValue(null, "location"),
+ reader.getAttributeValue(null, "importType"),
+ reader.getAttributeValue(null, "namespace") ));
+ } // end processImportElement
+
+ /*
+ * Mark a named partnerLink as a Service, unless it is already marked as a Reference
+ */
+ private void processPartnerLinkAsService( String partnerLinkName,
+ List<BPELPartnerLinkElement> partnerLinks ) {
+ BPELPartnerLinkElement partnerLink = findPartnerLinkByName( partnerLinks, partnerLinkName );
+ if( partnerLink == null ) {
+ warning("ReferencePartnerLinkNotInList", partnerLinkName, partnerLinkName);
+ } else {
+ // Set the type of the partnerLink to "service" if not already set...
+ if( !partnerLink.isSCATyped() ) partnerLink.setAsService( partnerLinkName );
+ } // endif
+ } // end processPartnerLinkAsReference
+
+ /*
+ * Mark a named partnerLink as a Reference, unless it is already marked as a Service
+ */
+ private void processPartnerLinkAsReference( String partnerLinkName,
+ List<BPELPartnerLinkElement> partnerLinks ) {
+ BPELPartnerLinkElement partnerLink = findPartnerLinkByName( partnerLinks, partnerLinkName );
+ if( partnerLink == null ) {
+ warning("ReferencePartnerLinkNotInList", partnerLinkName, partnerLinkName);
+ } else {
+ // Set the type of the partnerLink to "service" if not already set...
+ if( !partnerLink.isSCATyped() ) partnerLink.setAsReference( partnerLinkName );
+ } // endif
+ } // end processPartnerLinkAsReference
+
+ /*
+ * Finds a PartnerLink by name from a List of PartnerLinks
+ *
+ * returns null if there is no partnerLink with a matching name
+ * - returns the PartnerLink with a matching name
+ */
+ private BPELPartnerLinkElement findPartnerLinkByName( List<BPELPartnerLinkElement> partnerLinks,
+ String partnerLinkName ) {
+ // Scan the list looking for a partner link with the supplied name
+ Iterator<BPELPartnerLinkElement> it = partnerLinks.iterator();
+ while( it.hasNext() ) {
+ BPELPartnerLinkElement thePartnerLink = it.next();
+ if( thePartnerLink.getName().equals(partnerLinkName) ) return thePartnerLink;
+ }
+ return null;
+ } // end method findPartnerLinkByName
+
+
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
new file mode 100644
index 0000000000..96d8a12a36
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * The model representing a BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationImpl extends ImplementationImpl implements BPELImplementation {
+
+ private QName _processName;
+ private BPELProcessDefinition _processDefinition;
+ private ComponentType componentType;
+
+ /**
+ * Constructs a new BPEL implementation.
+ */
+ public BPELImplementationImpl(AssemblyFactory assemblyFactory,
+ WSDLFactory wsdlFactory) {
+
+ }
+
+ public QName getProcess() {
+ return _processName;
+ }
+
+ public void setProcess(QName processName) {
+ _processName = processName;
+ }
+
+ public BPELProcessDefinition getProcessDefinition() {
+ return this._processDefinition;
+ }
+
+ public void setProcessDefinition(BPELProcessDefinition processDefinition) {
+ this._processDefinition = processDefinition;
+ }
+
+ @Override
+ public String getURI() {
+ // The sample BPEL implementation does not have a URI
+ return null;
+ }
+
+ @Override
+ public void setURI(String uri) {
+ // The sample BPEL implementation does not have a URI
+ }
+
+ @Override
+ public ConstrainingType getConstrainingType() {
+ // The sample BPEL implementation does not support constrainingTypes
+ return null;
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ // The sample BPEL implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ /*
+ * Returns the componentType for this BPEL process implementation
+ */
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ /*
+ * Sets the componentType for this BPEL process implementation
+ */
+ public void setComponentType(ComponentType componentType) {
+ this.componentType = componentType;
+ }
+
+ @Override
+ /**
+ * Returns a List of the services for this BPEL process implementation
+ */
+ public List<Service> getServices() {
+ return componentType.getServices();
+ }
+
+ @Override
+ /**
+ * Returns a List of the references for this BPEL process implementation
+ */
+ public List<Reference> getReferences() {
+ return componentType.getReferences();
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(this.getProcess()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BPELImplementation) {
+ if (getProcess() != null) {
+ return getProcess().equals(((BPELImplementation)obj).getProcess());
+ } else {
+ return ((BPELImplementation)obj).getProcess() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
new file mode 100644
index 0000000000..e047ae3cc7
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
@@ -0,0 +1,538 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkElement;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Implements a StAX artifact processor for BPEL implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.bpel>
+ * elements in SCA assembly XML composite files and populating the BPEL
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<BPELImplementation> {
+ private static final String PROCESS = "process";
+ private static final String IMPLEMENTATION_BPEL = "implementation.bpel";
+ private static final QName IMPLEMENTATION_BPEL_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_BPEL);
+
+ private AssemblyFactory assemblyFactory;
+ private BPELFactory bpelFactory;
+ private WSDLFactory wsdlFactory;
+ private Monitor monitor;
+
+ public BPELImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ this.bpelFactory = new DefaultBPELFactory(modelFactories);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public QName getArtifactType() {
+ // Returns the QName of the XML element processed by this processor
+ return IMPLEMENTATION_BPEL_QNAME;
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return BPELImplementation.class;
+ }
+
+ public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPLEMENTATION_BPEL_QNAME.equals(reader.getName());
+
+ // Read an <implementation.bpel> element
+ BPELImplementation implementation = null;
+
+ // Read the process attribute.
+ QName process = getAttributeValueNS(reader, PROCESS);
+ if (process == null) {
+ return implementation;
+ }
+
+ // Create and initialize the BPEL implementation model
+ implementation = bpelFactory.createBPELImplementation();
+ implementation.setProcess(process);
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+
+ if( impl != null && impl.isUnresolved())
+ {
+ BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(impl, resolver);
+ if(processDefinition.isUnresolved()) {
+ error("BPELProcessNotFound", impl, processDefinition.getName());
+ //throw new ContributionResolveException("Can't find BPEL Process : " + processDefinition.getName());
+ } else {
+ impl.setProcessDefinition(processDefinition);
+
+ // Get the component type from the process definition
+ generateComponentType( impl );
+
+ //resolve component type
+ mergeComponentType(resolver, impl);
+
+ //set current implementation resolved
+ impl.setUnresolved(false);
+ }
+ }
+
+ } // end resolve
+
+ /*
+ * Write out the XML representation of the BPEL implementation
+ * <implementation.bpel process="..." />
+ *
+ * One complexity here is that the value of the process attribute is a QName
+ * In this implementation, the QName is written out in XML Namespaces recommendation format,
+ * as described in the documentation of the getAttributeValueNS method:
+ *
+ * ie: {http://example.com/somenamespace}SomeName
+ *
+ * This may well NOT be the format in which the attribute was originally read from the
+ * composite file.
+ */
+ public void write( BPELImplementation bpelImplementation,
+ XMLStreamWriter writer ) throws ContributionWriteException, XMLStreamException {
+ //FIXME Deal with policy processing...
+ // Write <implementation.bpel process="..."/>
+ // policyProcessor.writePolicyPrefixes(bpelImplementation, writer);
+ writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_BPEL);
+ // policyProcessor.writePolicyAttributes(bpelImplementation, writer);
+
+ if (bpelImplementation.getProcess() != null) {
+ writer.writeAttribute(PROCESS, bpelImplementation.getProcess().toString() );
+ }
+
+ writer.writeEndElement();
+
+ } // end write
+
+ private BPELProcessDefinition resolveBPELProcessDefinition(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ QName processName = impl.getProcess();
+ BPELProcessDefinition processDefinition = this.bpelFactory.createBPELProcessDefinition();
+ processDefinition.setName(processName);
+ processDefinition.setUnresolved(true);
+
+ return resolver.resolveModel(BPELProcessDefinition.class, processDefinition);
+ } // end resolveBPELProcessDefinition
+
+ // Calculates the component type of the supplied implementation and attaches it to the
+ // implementation
+ private void generateComponentType(BPELImplementation impl )
+ throws ContributionResolveException {
+ // Create a ComponentType and mark it unresolved
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ impl.setComponentType(componentType);
+
+ // Each partner link in the process represents either a service or a reference
+ // - or both, in the sense of involving a callback
+ BPELProcessDefinition theProcess = impl.getProcessDefinition();
+ List<BPELPartnerLinkElement> partnerLinks = theProcess.getPartnerLinks();
+
+ for( BPELPartnerLinkElement pLink : partnerLinks ) {
+ // check that the partner link has been designated as service or reference in SCA terms
+ if ( pLink.isSCATyped() ) {
+ String SCAName = pLink.getSCAName();
+ if( pLink.querySCAType().equals("reference") ) {
+ componentType.getReferences().add(
+ generateReference( SCAName,
+ pLink.getMyRolePortType(),
+ pLink.getPartnerRolePortType(),
+ theProcess.getInterfaces() )
+ );
+ } else {
+ componentType.getServices().add(
+ generateService( SCAName,
+ pLink.getMyRolePortType(),
+ pLink.getPartnerRolePortType(),
+ theProcess.getInterfaces() )
+ );
+ } // end if
+ } // end if
+ } // end for
+
+
+ } // end getComponentType
+
+ /**
+ * Create an SCA reference for a partnerLink
+ * @param name - name of the reference
+ * @param myRolePT - partner link type of myRole
+ * @param partnerRolePT - partner link type of partnerRole
+ * @param theInterfaces - list of WSDL interfaces associated with the BPEL process
+ * @return
+ */
+ private Reference generateReference( String name, PortType myRolePT,
+ PortType partnerRolePT, Collection<WSDLInterface> theInterfaces )
+ throws ContributionResolveException {
+ Reference reference = assemblyFactory.createReference();
+ WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+
+ // Establish whether there is just a call interface or a call + callback interface
+ PortType callPT = null;
+ PortType callbackPT = null;
+ if( myRolePT != null ) {
+ callPT = myRolePT;
+ // If the 2 port types are not the same one, there is a callback...
+ if( partnerRolePT != null ) {
+ if( !myRolePT.getQName().equals(partnerRolePT.getQName()) ){
+ callbackPT = partnerRolePT;
+ } // end if
+ } // end if
+ } else if ( partnerRolePT != null ) {
+ callPT = partnerRolePT;
+ } // end if
+ // No interfaces mean an error - throw an exception
+ if( callPT == null && callbackPT == null ) {
+ error("MyRolePartnerRoleNull", theInterfaces);
+ throw new ContributionResolveException("Error: myRole and partnerRole port types are both null");
+ } // end if
+
+ // Set the name of the reference to the supplied name and the multiplicity of the reference
+ // to 1..1
+ // TODO: support other multiplicities
+ reference.setName(name);
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+
+ if ( callPT != null ) {
+ // Set the call interface and, if present, the callback interface
+ WSDLInterface callInterface = null;
+ for( WSDLInterface anInterface : theInterfaces ) {
+ if( anInterface.getPortType().getQName().equals(callPT.getQName())) callInterface = anInterface;
+ } // end for
+ // Throw an exception if no interface is found
+ if( callInterface == null ) {
+ error("NoInterfaceForPortType", theInterfaces, callPT.getQName().toString());
+ throw new ContributionResolveException("Interface not found for port type " +
+ callPT.getQName().toString() );
+ } else
+ reference.getInterfaceContract().setInterface(callInterface);
+ }
+
+ // There is a callback if the partner role is not null and if the partner role port type
+ // is not the same as the port type for my role
+ if ( callbackPT != null ) {
+ WSDLInterface callbackInterface = null;
+ for( WSDLInterface anInterface : theInterfaces ) {
+ if( anInterface.getPortType().getQName().equals(callbackPT.getQName())) callbackInterface = anInterface;
+ } // end for
+ // Throw an exception if no interface is found
+ if( callbackInterface == null ) {
+ error("NoInterfaceForPortType", theInterfaces, callbackPT.getQName().toString());
+ throw new ContributionResolveException("Interface not found for port type " +
+ callbackPT.getQName().toString() );
+ } else
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ } // end if
+
+ return reference;
+ } // end generateReference
+
+ /**
+ * Create an SCA service for a partnerLink
+ * @param name - name of the reference
+ * @param myRolePT - partner link type of myRole
+ * @param partnerRolePT - partner link type of partnerRole
+ * @param theInterfaces - list of WSDL interfaces associated with the BPEL process
+ * @return
+ */
+ private Service generateService( String name, PortType myRolePT,
+ PortType partnerRolePT, Collection<WSDLInterface> theInterfaces )
+ throws ContributionResolveException {
+ Service service = assemblyFactory.createService();
+ WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ // Set the name of the service to the supplied name
+ service.setName(name);
+
+ // Establish whether there is just a call interface or a call + callback interface
+ PortType callPT = null;
+ PortType callbackPT = null;
+ if( myRolePT != null ) {
+ callPT = myRolePT;
+ // If the 2 port types are not the same one, there is a callback...
+ if( partnerRolePT != null ) {
+ if( !myRolePT.getQName().equals(partnerRolePT.getQName()) ){
+ callbackPT = partnerRolePT;
+ } // end if
+ } // end if
+ } else if ( partnerRolePT != null ) {
+ callPT = partnerRolePT;
+ } // end if
+ // No interfaces mean an error - throw an exception
+ if( callPT == null && callbackPT == null ) {
+ error("MyRolePartnerRoleNull", theInterfaces);
+ throw new ContributionResolveException("Error: myRole and partnerRole port types are both null");
+ } // end if
+
+ if ( callPT != null ) {
+ // Set the call interface and, if present, the callback interface
+ WSDLInterface callInterface = null;
+ for( WSDLInterface anInterface : theInterfaces ) {
+ if( anInterface.getPortType().getQName().equals(callPT.getQName())) callInterface = anInterface;
+ } // end for
+ // Throw an exception if no interface is found
+ if( callInterface == null ) {
+ error("NoInterfaceForPortType", theInterfaces, callPT.getQName().toString());
+ throw new ContributionResolveException("Interface not found for port type " +
+ callPT.getQName().toString() );
+ } else
+ service.getInterfaceContract().setInterface(callInterface);
+ } // end if
+
+ // There is a callback if the partner role is not null and if the partner role port type
+ // is not the same as the port type for my role
+ if ( callbackPT != null ) {
+ WSDLInterface callbackInterface = null;
+ for( WSDLInterface anInterface : theInterfaces ) {
+ if( anInterface.getPortType().getQName().equals(callbackPT.getQName())) callbackInterface = anInterface;
+ } // end for
+ // Throw an exception if no interface is found
+ if( callbackInterface == null ) {
+ error("NoInterfaceForPortType", theInterfaces, callbackPT.getQName().toString());
+ throw new ContributionResolveException("Interface not found for port type " +
+ callbackPT.getQName().toString() );
+ } else
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ } // end if
+
+ return service;
+ } // end generateService
+
+ /**
+ * Merge the componentType from introspection and from external file
+ *
+ * Note the setting of the DataBinding for both Services and References to DOM, since this is
+ * the data format expected by the ODE BPEL implementation code.
+ *
+ * @param resolver
+ * @param impl
+ */
+ private void mergeComponentType(ModelResolver resolver, BPELImplementation impl) {
+ // Load the component type from a component type file, if any
+ ComponentType componentType = getComponentType(resolver, impl);
+ if (componentType != null && !componentType.isUnresolved()) {
+
+ // References...
+ Map<String, Reference> refMap = new HashMap<String, Reference>();
+ for (Reference reference : componentType.getReferences()) {
+ reference.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ refMap.put(reference.getName(), reference);
+ } // end for
+
+ // For the present, overwrite anything arising from the component type sidefile if
+ // equivalent services are defined in the implementation.
+ // TODO - a more careful merge must be done, using the implementation introspection data
+ // as the master but adding any additional and non-conflicting information from the
+ // sidefile
+ for (Reference ref : impl.getReferences()) {
+ ref.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ refMap.put(ref.getName(), ref);
+ } // end for
+
+ impl.getReferences().clear();
+ impl.getReferences().addAll(refMap.values());
+
+ // Services.....
+ Map<String, Service> serviceMap = new HashMap<String, Service>();
+ for (Service service : componentType.getServices()) {
+ service.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ serviceMap.put(service.getName(), service);
+ } // end for
+
+ // For the present, overwrite anything arising from the component type sidefile if
+ // equivalent services are defined in the implementation.
+ // TODO - a more careful merge must be done, using the implementation introspection data
+ // as the master but adding any additional and non-conflicting information from the
+ // sidefile
+ for (Service svc : impl.getServices()) {
+ svc.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ serviceMap.put(svc.getName(), svc);
+ } // end for
+
+ impl.getServices().clear();
+ impl.getServices().addAll(serviceMap.values());
+
+ // Properties
+ Map<String, Property> propMap = new HashMap<String, Property>();
+ for (Property property : componentType.getProperties()) {
+ propMap.put(property.getName(), property);
+ } // end for
+
+ // A simple overwrite of any equivalent properties from the component type sidefile
+ for (Property prop : impl.getProperties()) {
+ propMap.put(prop.getName(), prop);
+ }
+ }
+ }
+
+
+ /**
+ * Find the componentType side file based on the BPEL implementation artifact
+ * @param resolver
+ * @param impl
+ * @return
+ */
+ private ComponentType getComponentType(ModelResolver resolver, BPELImplementation impl) {
+ String bpelProcessURI = impl.getProcessDefinition().getURI().toString();
+
+ // Get the component type definition contained in the componentType file, if any
+ String componentTypeURI = bpelProcessURI.replace(".bpel", ".componentType");
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(componentTypeURI);
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+ return componentType;
+ }
+ return null;
+ } // end getComponentType
+
+ /**
+ * Returns a QName from its string representation in a named attribute of an XML element
+ * supplied in an XMLStreamReader
+ *
+ * QName attributes of an XML element (such as BPEL process) is presented in one of
+ * two alternative formats:
+ * 1) In the form of a local name with a prefix, with the prefix referencing a namespace
+ * URI declaration elsewhere in the composite (typically on the composite element)
+ *
+ * ie: nms:SomeName
+ * xmlns:nms="http://example.com/somenamespace"
+ *
+ * 2) In the XML Namespaces recommendation format (see http://jclark.com/xml/xmlns.htm )
+ * where the namespace URI and the local name are encoded into a single string, with the
+ * namespace URI enclosed between a pair of braces {...}
+ *
+ * ie: {http://example.com/somenamespace}SomeName
+ */
+ private QName getAttributeValueNS(XMLStreamReader reader, String attribute) {
+ String fullValue = reader.getAttributeValue(null, attribute);
+ if (fullValue == null) {
+ error("AttributeProcessMissing", reader);
+ return null;
+ }
+
+ // Deal with the attribute in the XML Namespaces recommendation format
+ // - trim off any leading/trailing spaces and check that the first character is '{'
+ if( fullValue.trim().charAt(0) == '{' ) {
+ try {
+ // Attempt conversion to a QName object
+ QName theProcess = QName.valueOf( fullValue );
+ return theProcess;
+ } catch ( IllegalArgumentException e ) {
+ // This exception happens if the attribute begins with '{' but doesn't conform
+ // to the XML Namespaces recommendation format
+ error("AttributeWithoutNamespace", reader, attribute, fullValue);
+ return null;
+ //throw new BPELProcessException("Attribute " + attribute + " with value " + fullValue +
+ //" in your composite should be of the form {namespaceURI}localname");
+ }
+ } // endif
+
+ // Deal with the attribute in the local name + prefix format
+ if (fullValue.indexOf(":") < 0) {
+ error("AttributeWithoutPrefix", reader, attribute, fullValue);
+ return null;
+ //throw new BPELProcessException("Attribute " + attribute + " with value " + fullValue +
+ //" in your composite should be prefixed (process=\"prefix:name\").");
+ }
+ String prefix = fullValue.substring(0, fullValue.indexOf(":"));
+ String name = fullValue.substring(fullValue.indexOf(":") + 1);
+ String nsUri = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (nsUri == null) {
+ error("AttributeUnrecognizedNamespace", reader, attribute, fullValue);
+ return null;
+ //throw new BPELProcessException("Attribute " + attribute + " with value " + fullValue +
+ //" in your composite has an unrecognized namespace prefix.");
+ }
+ return new QName(nsUri, name, prefix);
+ }
+
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java
new file mode 100644
index 0000000000..83e70ec959
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELImportElement;
+import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkElement;
+
+/**
+ * The BPEL process definition implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELProcessDefinitionImpl implements BPELProcessDefinition {
+ private QName name;
+ private URI uri;
+ private URL location;
+ private boolean unresolved;
+ private List<BPELPartnerLinkElement> partnerLinks = new ArrayList<BPELPartnerLinkElement>();
+ private List<BPELImportElement> imports = new ArrayList<BPELImportElement>();
+ private Collection<PortType> thePortTypes = null;
+ private Collection<WSDLInterface> theInterfaces = null;
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public URI getURI() {
+ return uri;
+ }
+
+ public void setURI(URI uri) {
+ this.uri = uri;
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public void setLocation(URL location) {
+ this.location = location;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ /**
+ * Return the list of PartnerLinks for this process
+ * @return List<BPELPartnerLinkElement> the list of Partner Links
+ */
+ public List<BPELPartnerLinkElement> getPartnerLinks() {
+ return partnerLinks;
+ }
+
+ /**
+ * Return the list of imports for this process
+ * @return List<BPELImportElement> the list of Import elements
+ */
+ public List<BPELImportElement> getImports() {
+ return imports;
+ }
+
+ public void setPortTypes( Collection<PortType> thePortTypes ) {
+ this.thePortTypes = thePortTypes;
+ }
+
+ public Collection<PortType> getPortTypes() {
+ return thePortTypes;
+ }
+
+ /**
+ * Set the associated collection of WSDL interfaces
+ * @param theInterfaces
+ */
+ public void setInterfaces( Collection<WSDLInterface> theInterfaces ) {
+ this.theInterfaces = theInterfaces;
+ } // end setInterfaces
+
+ /**
+ * Return the collection of associated WSDL interfaces
+ * @return
+ */
+ public Collection<WSDLInterface> getInterfaces() {
+ return theInterfaces;
+ } // end getInterfaces
+
+ public void compile() {
+ /*
+ String bpelFile = reader.getAttributeValue(null, "file"); // FIXME:
+
+ // Resolving the BPEL file and compiling it
+ URL bpelURL = getClass().getClassLoader().getResource(bpelFile);
+ if (bpelURL == null)
+ throw new ODEProcessException("Couldn't find referenced bpel file " + bpelFile);
+ BpelC bpelc = BpelC.newBpelCompiler();
+ ByteArrayOutputStream compiledProcess = new ByteArrayOutputStream();
+ bpelc.setOutputStream(compiledProcess);
+ try {
+ bpelc.compile(new File(bpelURL.getFile()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ */
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BPELProcessDefinition) {
+ if (getName() != null) {
+ return getName().equals(((BPELProcessDefinition)obj).getName());
+ } else {
+ return ((BPELProcessDefinition)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessException.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessException.java
new file mode 100644
index 0000000000..9b9f62a0be
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessException.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+/**
+ * Thrown when a process can't be compiled properly or when its descriptors
+ * are invalid.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELProcessException extends RuntimeException {
+ private static final long serialVersionUID = 1047893235216756186L;
+
+ public BPELProcessException(String message) {
+ super(message);
+ }
+
+ public BPELProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BPELProcessException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java
new file mode 100644
index 0000000000..75a46f9bc3
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.xml;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+
+/**
+ * Represents an <import.../> element in a BPEL process
+ * - this has attributes:
+ * location
+ * importType
+ * namespace
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImportElement {
+
+ private String location;
+ private String importType;
+ private String namespace;
+ private WSDLDefinition theWSDL = null;
+
+ public BPELImportElement( String location,
+ String importType,
+ String namespace ) {
+ this.location = location;
+ this.importType = importType;
+ this.namespace = namespace;
+ }
+
+ public String getImportType() {
+ return importType;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setWSDLDefinition( WSDLDefinition theDefinition) {
+ theWSDL = theDefinition;
+ }
+
+ public WSDLDefinition getWSDLDefinition() {
+ return theWSDL;
+ }
+
+} // end class BPELImportElement
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java
new file mode 100644
index 0000000000..62078f8061
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.xml;
+
+import javax.xml.namespace.QName;
+
+import javax.wsdl.PortType;
+
+/**
+ * Represents a <partnerLink.../> element in a BPEL process
+ * - this has attributes:
+ * name
+ * partnerLinkType
+ * myRole
+ * partnerRole
+ * - plus zero or more property elements as children
+ *
+ * The partnerlink may also be given an SCA Type - either of service or of reference - this must
+ * generally be calculated and set on the partnerLink by inspecting the BPEL process
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELPartnerLinkElement {
+
+ private String REFERENCE_TYPE = "reference";
+ private String SERVICE_TYPE = "service";
+ private String name;
+ private QName partnerLinkType;
+ private BPELPartnerLinkTypeElement pLinkType = null;
+ private String myRole;
+ private String partnerRole;
+ private String scaName; // Holds the SCA reference or service name
+ private String scaType = null; // Holds the SCA type = null | service | reference
+
+ public BPELPartnerLinkElement(String name,
+ QName partnerLinkType,
+ String myRole,
+ String partnerRole ) {
+ this.name = name;
+ this.partnerLinkType = partnerLinkType;
+ this.myRole = myRole;
+ this.partnerRole = partnerRole;
+
+ scaName = null;
+ }
+
+ public QName getPartnerLinkType() {
+ return partnerLinkType;
+ }
+
+ public void setPartnerLinkType( BPELPartnerLinkTypeElement pLinkType ) {
+ this.pLinkType = pLinkType;
+ }
+
+
+ public PortType getMyRolePortType() {
+ return getRolePortType( myRole );
+ }
+
+ public PortType getPartnerRolePortType() {
+ return getRolePortType( partnerRole );
+ }
+
+ private PortType getRolePortType( String theRole ) {
+ if( theRole == null ) return null;
+ if ( theRole.equals( pLinkType.getRole1Name() ) ) {
+ return pLinkType.getRole1pType();
+ } else if ( theRole.equals( pLinkType.getRole2Name() ) ) {
+ return pLinkType.getRole2pType();
+ } // end if
+ return null;
+ } // end getRolePortType
+
+ public String getName() {
+ return name;
+ }
+
+ public String getMyRole() {
+ return myRole;
+ }
+
+ public String getPartnerRole() {
+ return partnerRole;
+ }
+
+ public void setSCAName( String name ) {
+ scaName = name;
+ }
+
+ public String getSCAName() {
+ return scaName;
+ }
+
+ public boolean isSCATyped() {
+ return ( !(scaType == null) );
+ }
+
+ public void setAsReference( String name ) {
+ scaType = REFERENCE_TYPE;
+ scaName = name;
+ }
+
+ public void setAsService( String name ) {
+ scaType = SERVICE_TYPE;
+ scaName = name;
+ }
+
+ public String querySCAType() {
+ return scaType;
+ }
+
+} // end class BPELPartnerLinkElement
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java
new file mode 100644
index 0000000000..e013215f5e
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */package org.apache.tuscany.sca.implementation.bpel.xml;
+
+ import javax.xml.namespace.QName;
+
+ import javax.wsdl.extensions.ExtensibilityElement;
+ import javax.wsdl.PortType;
+
+/**
+ * Represents a <partnerLinkType.../> element related to a BPEL process
+ * - this has attributes:
+ * name
+ * Role1 name
+ * Role1 portType
+ * Role2 name
+ * Role2 portType
+ *
+ * - in the XML the 2 roles are child elements of the partnerLinkType element, but there
+ * seems little point in reflecting this back into this model - it is simpler to include
+ * both roles within the representation of the partnerLinkType itself
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELPartnerLinkTypeElement implements ExtensibilityElement {
+
+ private QName name;
+ private String Role1name = null;
+ private QName Role1porttype = null;
+ private PortType Role1pType = null;
+ private String Role2name = null;
+ private QName Role2porttype = null;
+ private PortType Role2pType = null;
+
+
+ private QName elementType = null;
+ private Boolean required = false;
+
+ public BPELPartnerLinkTypeElement( QName name ) {
+ this.name = name;
+ }
+
+ public QName getName(){
+ return name;
+ }
+
+ public void setRole1( String name, QName portType, PortType pType ) {
+ Role1name = name;
+ Role1porttype = portType;
+ Role1pType = pType;
+ }
+
+ public void setRole2( String name, QName portType, PortType pType ) {
+ Role2name = name;
+ Role2porttype = portType;
+ Role2pType = pType;
+ }
+
+ public String getRole1Name() {
+ return Role1name;
+ }
+ public String getRole2Name() {
+ return Role2name;
+ }
+
+ public QName getRole1PortType() {
+ return Role1porttype;
+ }
+
+ public QName getRole2PortType() {
+ return Role2porttype;
+ }
+
+ public PortType getRole1pType() {
+ return Role1pType;
+ }
+
+ public PortType getRole2pType() {
+ return Role2pType;
+ }
+
+ public QName getElementType() {
+ return elementType;
+ }
+
+ public Boolean getRequired() {
+ return required;
+ }
+
+ public void setElementType(QName elementType) {
+ this.elementType = elementType;
+ }
+
+ public void setRequired(java.lang.Boolean required) {
+ this.required = required;
+ }
+
+} // end BPELPartnerLinkType
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..4763c69768
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation \ No newline at end of file
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..066fdc864b
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;type=.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition \ No newline at end of file
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
new file mode 100644
index 0000000000..53ffd1b72a
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
@@ -0,0 +1,18 @@
+# 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.
+
+org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties
new file mode 100644
index 0000000000..b6d8bdc0f1
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties
@@ -0,0 +1,34 @@
+#
+#
+# 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.
+#
+#
+CannotResolveWSDLReference = BPELDocumentProcessor:resolve - unable to resolve WSDL referenced by BPEL import WSDL location: {0} WSDLNamespace: {1}
+ContributionReadException = ContributionReadException occured due to :
+PartnerLinkNoMatchingType = PartnerLink {0} has no matching partner link type
+PartnerLinkTypeNoRoles = PartnerLinkType {0} has no Roles defined
+ContributionResolveException = ContributionResolveException occured due to :
+PartnerLinkHasBothAttr = BPEL PartnerLink {0} has both sca:reference and sca:service attributes set
+ReferencePartnerLinkNotInList = BPEL TypeLoader - element references partnerLink {0} not in the list
+MyRolePartnerRoleNull = Error: myRole and partnerRole port types are both null
+NoInterfaceForPortType = Interface not found for port type {0}
+AttributeProcessMissing = Attribute 'process' is missing.
+AttributeWithoutNamespace = Attribute {0} with value {1} in your composite should be of the form {namespaceURI}localname
+AttributeWithoutPrefix = Attribute {0} with value {1} in your composite should be prefixed (process=\"prefix:name\").
+AttributeUnrecognizedNamespace = Attribute {0} with value {1} in your composite has un unrecognized namespace prefix.
+BPELProcessNotFound = Can't find BPEL Process : {0} \ No newline at end of file
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
new file mode 100644
index 0000000000..76644e5209
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BPELDocumentProcessorTestCase extends TestCase {
+
+ protected static final String BPEL_PROCESS_FILE = "helloworld/helloworld.bpel";
+
+ private URLArtifactProcessor<Object> documentProcessor;
+
+ @Override
+ protected void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
+ }
+
+ public void testLoadBPELProcessDefinition() throws Exception {
+ URI processURI = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE).toURI();
+ URL processLocation = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE);
+ BPELProcessDefinition bpelProcessDefinition = (BPELProcessDefinition)documentProcessor.read(null, processURI, processLocation);
+
+ assertNotNull(bpelProcessDefinition);
+ assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), bpelProcessDefinition.getName());
+ assertEquals(processLocation, bpelProcessDefinition.getLocation());
+ }
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
new file mode 100644
index 0000000000..14500f6e14
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationProcessorTestCase extends TestCase {
+
+ protected static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_NS, "implementation.bpel");
+
+ private static final String COMPOSITE =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
+ + " <component name=\"BPELHelloWorldComponent\">"
+ + " <implementation.bpel process=\"hns:HelloWorld\" />"
+ + " </component>"
+ + "</composite>";
+
+ private static final String COMPOSITE_INVALID =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
+ + " <component name=\"BPELHelloWorldComponent\">"
+ + " <implementation.bpel/>"
+ + " </component>"
+ + "</composite>";
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private Monitor monitor;
+
+ @Override
+ protected void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ }
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+ }
+
+ /**
+ * Test parsing valid composite definition. Valid composite populated with correct values expected.
+ * @throws Exception
+ */
+ public void testLoadValidComposite() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));
+
+ Composite composite = (Composite)staxProcessor.read(reader);
+ BPELImplementation implementation = (BPELImplementation)composite.getComponents().get(0).getImplementation();
+
+ assertNotNull(implementation);
+ assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), implementation.getProcess());
+ }
+
+ /**
+ * Test parsing invalid composite definition. Exception should be thrown
+ * @throws Exception
+ */
+ public void testLoadInvalidComposite() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID));
+ /*try {
+ staxProcessor.read(reader);
+ fail("InvalidException should have been thrown");
+ } catch(Exception e) {
+ assertTrue(true);
+ }*/
+ staxProcessor.read(reader);
+ Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("AttributeProcessMissing", problem.getMessageId());
+ }
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..8cf91adc2c
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel
@@ -0,0 +1,66 @@
+<!--
+ ~ 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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="helloMessage" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="helloMessage" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"/>
+ </sequence>
+</process>
diff --git a/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..1d71727b2d
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<wsdl:definitions name="helloworld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file