Add a webapp sample using a BPEL component

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@783348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
antelder 2009-06-10 13:10:19 +00:00
parent d45729714c
commit da0bdf78b5
7 changed files with 419 additions and 0 deletions
java/sca/samples/webapps/helloworld-bpel

View file

@ -0,0 +1,129 @@
<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>helloworld-bpel</artifactId>
<packaging>war</packaging>
<name>Apache Tuscany SCA Sample Helloworld BPEL</name>
<properties>
<tuscany.version>2.0-SNAPSHOT</tuscany.version>
<jetty.version>6.1.4</jetty.version>
</properties>
<dependencies>
<!-- TUSCANY DEPENDENCIES -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>${tuscany.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-web-runtime</artifactId>
<version>${tuscany.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-bpel-runtime</artifactId>
<version>${tuscany.version}</version>
<scope>runtime</scope>
</dependency>
<!-- JUNIT DEPENDENCY FOR TESTING -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-management</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.ode</groupId>
<artifactId>ode-dao-jpa-ojpa-derby</artifactId>
<version>1.1.1</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<includes>**/*</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,28 @@
/*
* 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 sample;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface HelloworldService {
String hello(String name);
}

View file

@ -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:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
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="myVar" messageType="test:HelloMessage"/>
<variable name="tmpVar" type="xsd:string"/>
</variables>
<sequence>
<receive
name="start"
partnerLink="helloPartnerLink"
portType="test:HelloPortType"
operation="hello"
variable="myVar"
createInstance="yes"/>
<assign name="assign1">
<copy>
<from variable="myVar" part="TestPart"/>
<to variable="tmpVar"/>
</copy>
<copy>
<from>concat($tmpVar,' World')</from>
<to variable="myVar" part="TestPart"/>
</copy>
</assign>
<reply name="end"
partnerLink="helloPartnerLink"
portType="test:HelloPortType"
operation="hello"
variable="myVar"/>
</sequence>
</process>

View file

@ -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
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>

View file

@ -0,0 +1,37 @@
<?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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
targetNamespace="http://sample"
name="helloworld-bpel">
<component name="WebComponent">
<implementation.web web-uri=""/>
<reference name="service" target="HelloworldComponent">
<interface.java interface="sample.HelloworldService"/>
</reference>
</component>
<component name="HelloworldComponent">
<implementation.bpel process="hns:HelloWorld"/>
</component>
</composite>

View file

@ -0,0 +1,41 @@
<?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.
-->
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<display-name>helloworld-bpel</display-name>
<filter>
<filter-name>tuscany.helloworld-bpel</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>tuscany.helloworld-bpel</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>hello.jsp</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -0,0 +1,36 @@
<%--
* 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.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %>
<sca:reference name="service" type="sample.HelloworldService" />
<html>
<body >
<h2>helloworld-bpel</h2>
Calling HelloworldService sayHello("world") returns:
<p>
<%= service.hello("world") %>
</body>
</html>