diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-21 07:55:20 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-21 07:55:20 +0000 |
commit | 36436b71b9977d6b5940cb6285d5335708ef9bfa (patch) | |
tree | b218a104f180c67690a6ae2ad097cd9306a8f203 /sca-java-1.x/tags/java-stable-20060304/samples/helloworld | |
parent | d5be76c0b31df9b5d203295b146b13d2205243de (diff) |
Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@882851 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/tags/java-stable-20060304/samples/helloworld')
82 files changed, 5534 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/pom.xml new file mode 100644 index 0000000000..8894f87edd --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/pom.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworld</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample HelloWorld</name> + <description>Sample classic helloworld</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-java</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-js</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/readme.htm new file mode 100644 index 0000000000..de8fb48140 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/readme.htm @@ -0,0 +1,112 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html><head>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany HelloWorld</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+
+<body>
+
+<h2>Tuscany Hello World Sample</h2>
+
+<h3>Overview</h3>
+
+<p>The Tuscany helloworld sample shows using the Tuscany SCA
+ runtime in a J2SE environment loading a component that
+ implements the classic introductory hello world example. </p>
+
+
+<h3>Setup</h3>The jars for a <a href="http://wiki.apache.org/ws/Tuscany/J2SESetup" target="_blank">J2SE setup</a> not requiring web
+services are required including the sample's own jar <span style="font-weight: bold;">helloworld-SNAPSHOT.jar</span>.
+
+
+<ol>
+</ol>
+
+<h3>Running</h3>
+
+Using JDK 1.5 java command with the previous jars run the class org.apache.tuscany.samples.helloworld.HelloWorldClient
+<br>
+
+<h3>Results</h3>
+
+<p>The sample when run should simply display to the standard
+ output:<br>
+
+ <code>Hello World</code></p>
+
+
+<h3>Code Overview</h3>
+
+The source files are physically organized as shown below:
+<pre>sca.module<br>org<br>+-apache<br> +-tuscany<br> +-samples<br> +-helloworld<br> HelloWorldClient.java<br>
+ HelloWorldService.java<br> HelloWorldServiceComponentImpl.java<br><br><br></pre>
+
+<p> </p>
+
+<table style="text-align: left; width: 879px; height: 154px;" border="0" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td style="vertical-align: top;">sca.module</td>
+
+ <td>Defines the SCA module and component. Defines for the
+ HelloWorldServiceComponent component the Java class that
+ implements that component</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldService.java</td>
+
+ <td>Defines the Java interface implemented by the component.</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldServiceComponentImpl.java</td>
+
+ <td>Implements the SCA component. Uses the SCA service
+ annotation tag on the class to show what SCA interface is being
+ implemented.</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldClient.java</td>
+
+ <td>Creates a Tuscany runtime and starts it.
+ Obtains the module context which was defined by the
+ sca.module file. From the module context locates the
+ HelloWorldServiceComponent and then calls the getGreetings
+ method to invoke the component.</td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+<br>
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..0dca894fde --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworld; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component + * and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Start the runtime + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + String value = helloworldService.getGreetings("World"); + + System.out.println(value); + + // Stop the runtime + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..312b46ed41 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworld; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..6aa0fa611e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldServiceComponentImpl.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceComponentImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/resources/sca.module new file mode 100644 index 0000000000..f5f26e5994 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/main/resources/sca.module @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 BEA Sytems Inc.
+ Copyright (c) 2005 International Business Machines
+
+ 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="sampleHelloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworld.HelloWorldServiceComponentImpl"/>
+ </component> +
+</module>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/test/java/org/apache/tuscany/samples/helloworld/HelloWorldServiceComponentTestCase.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/test/java/org/apache/tuscany/samples/helloworld/HelloWorldServiceComponentTestCase.java new file mode 100644 index 0000000000..2681ce02bc --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworld/src/test/java/org/apache/tuscany/samples/helloworld/HelloWorldServiceComponentTestCase.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * + */ +public class HelloWorldServiceComponentTestCase extends TestCase { + public boolean verbose = true; + + public void testGeetings() throws Exception { + + if (verbose) + System.out.println("starting test.."); + System.out.flush(); + + + TuscanyRuntime tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + assertNotNull(moduleContext); + System.out.println("module context name '" + + moduleContext.getName() + "'"); + System.out.println("module context uri '" + moduleContext.getURI() + + "'"); + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + assertNotNull(helloworldService); + + + String value = helloworldService + .getGreetings("World"); + + if (verbose) + System.out.println("Value = '" + value + "'"); + + assertEquals("Hello World", value); + + tuscany.stop(); + + } + + public final static void main(String[] args) throws Exception { + HelloWorldServiceComponentTestCase hwc = new HelloWorldServiceComponentTestCase(); + hwc.setVerbose(true); + hwc.testGeetings(); + + } + + public boolean isVerbose() { + return verbose; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/axiscmds.bat b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/axiscmds.bat new file mode 100644 index 0000000000..554d9f4d07 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/axiscmds.bat @@ -0,0 +1,2 @@ +wsdl2java -s -S true -o wsdl2javaOut helloworld.wsdl
+java2wsdl -o helloworld.wsdl -l http://localhost:8080/axis/services/helloworld -y WRAPPED org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/helloworld.wsdl b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/helloworld.wsdl new file mode 100644 index 0000000000..6f18227b06 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/helloworld.wsdl @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <wsdlsoap:address location="http://localhost:8080/axis/services/helloworld"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/orig-java-to-create-wsdl/org/apache/tuscany/samples/helloworldaxis/HelloWorldService.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/orig-java-to-create-wsdl/org/apache/tuscany/samples/helloworldaxis/HelloWorldService.java new file mode 100644 index 0000000000..e5ac65c462 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/orig-java-to-create-wsdl/org/apache/tuscany/samples/helloworldaxis/HelloWorldService.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * + */ + +public interface HelloWorldService{ + public static final String DEFAULT_NAME= "World"; + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/orig-java-to-create-wsdl/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/orig-java-to-create-wsdl/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..7ed491112f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/orig-java-to-create-wsdl/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImpl.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + + +/** + * + */ +public class HelloWorldServiceImpl implements HelloWorldService { + public final static String greetings = "Hello "; + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return greetings + name ; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/pom.xml new file mode 100644 index 0000000000..831c7b269e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldaxis</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample HelloWorld Axis</name> + <description>Sample classic helloworld Axis to test with Tuscany SCA</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-java</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-binding-axis</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/readme.htm new file mode 100644 index 0000000000..4969bbf20e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/readme.htm @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html><head>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany Hello World Axis</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+
+<body>
+
+<h2>Tuscany Hello World Axis</h2>
+
+<h3>Overview</h3>
+
+<p>The Tuscany hello world axis sample is not an SCA application.
+ This sample is a simple Apache Axis service. Starting from
+ a Java source using Axis's
+ java2wsdl to create a document literal WSDL. And then using
+ that WSDL in wsdl2java to create all the Axis service and client
+ artifacts. Details on this can be found reviewing the Axis
+ documentation.</p>
+
+<p>The original Java code to generate is simply:</p>
+
+<table style="text-align: left; width: 100%; height: 262px;" border="1" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td style="width: 100%;">
+ <p>package org.apache.tuscany.samples.helloworldaxis;<br>
+
+ <br>
+
+ /**<br>
+
+ * <br>
+
+ */<br>
+
+ <br>
+
+ public interface HelloWorldService{<br>
+
+ public static final String DEFAULT_NAME=
+ "World";<br>
+
+ public String getGreetings(String name);<br>
+
+ <br>
+
+ }<br>
+
+ </p>
+
+ </td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+<p></p>
+
+<p>The purpose for it's inclusion in the samples is to
+ demonstrate the interoperability of Tuscany's web service
+ binding with another SOAP implementation.</p>
+
+<h3>Setup</h3>
+
+The following jars are required from the Maven repository in
+the classpath to run the sample client
+<pre style="margin-left: 40px;">helloworldaxis-SNAPSHOT.jar<br>axis-1.2.1.jar<br>axis-jaxrpc-1.2.1.jar
+ <br>axis-saaj-1.2.1.jar<br>axis-wsdl4j-1.5.1.jar<br>commons-discovery-0.2.jar<br>commons-logging-1.0.4.jar<br><br>
+</pre>
+
+See <a href="../helloworldws/readme.htm" target="_blank">helloworldws</a> and <a
+ href="../helloworldaxissvc/readme.htm" target="_blank">helloworldaxissvc</a> samples for the server side service
+setup instructions.<br>
+
+<h3>Running.<br></h3>Using JDK 1.5 java command with the previous jars run the class
+org.apache.tuscany.samples.helloworldaxis.HelloWorldAxisClient<br>Optional arguments: <br> <br>
+
+<div style="margin-left: 40px;"> Run against sample Tuscany SCA service: <span style="font-style: italic;">(default no arguments)</span>
+ <br> <code>http://localhost:8080/helloworldws-SNAPSHOT/services/HelloWorldService
+ World</code><br> Run against sample Axis Service:<br> <code>
+ http://localhost:8080/helloworldaxissvc-SNAPSHOT/services/helloworld World</code><br></div>
+
+<h3>Results</h3>
+
+<p>The sample when run should simply display to the standard
+ output:<br>
+
+ <code>Hello World</code></p>
+
+
+<h3>Code Overview</h3>
+
+More detailed information about Axis web services can be found on the
+Apache Axis website.<br>
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldAxisClient.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldAxisClient.java new file mode 100644 index 0000000000..735f6804b5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldAxisClient.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +import java.net.URL; +import javax.xml.rpc.ServiceException; + +public class HelloWorldAxisClient { + + final static String urlstrAxisService = "http://localhost:8080/tuscany-samples-helloworldaxissvc/services/helloworld"; + final static String urlstrTuscanyService = "http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"; + + public String getGreetings(String urlstr, String name) throws Exception { + URL url = new URL(urlstr); + + HelloWorldServiceImpl helloworld = (new HelloWorldServiceImplServiceLocator()) + .gethelloworld(url); + + return helloworld.getGreetings(name); + } + + /** + * @param args either <name> or <service url> <name> + * @throws ServiceException + */ + public static void main(String[] args) throws Exception { + + String urlstr = args.length > 1 ? args[0] + : urlstrTuscanyService; + + String name = args.length < 1 ? "World" : (args.length > 1 ? args[1] + : args[0]); + + System.out.println((new HelloWorldAxisClient()).getGreetings(urlstr, + name)); + + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..3ad4376c6c --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImpl.java @@ -0,0 +1,21 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +public interface HelloWorldServiceImpl extends java.rmi.Remote { + public java.lang.String getGreetings(java.lang.String in0) throws java.rmi.RemoteException; +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplService.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplService.java new file mode 100644 index 0000000000..fd84ab2449 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplService.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +public interface HelloWorldServiceImplService extends javax.xml.rpc.Service { + public java.lang.String gethelloworldAddress(); + + public org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl gethelloworld() throws javax.xml.rpc.ServiceException; + + public org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl gethelloworld(java.net.URL portAddress) throws javax.xml.rpc.ServiceException; +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplServiceLocator.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplServiceLocator.java new file mode 100644 index 0000000000..9d4be5e7e6 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplServiceLocator.java @@ -0,0 +1,148 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +public class HelloWorldServiceImplServiceLocator extends org.apache.axis.client.Service implements org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplService { + + public HelloWorldServiceImplServiceLocator() { + } + + + public HelloWorldServiceImplServiceLocator(org.apache.axis.EngineConfiguration config) { + super(config); + } + + public HelloWorldServiceImplServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException { + super(wsdlLoc, sName); + } + + // Use to get a proxy class for helloworld + private java.lang.String helloworld_address = "http://localhost:8080/axis/services/helloworld"; + + public java.lang.String gethelloworldAddress() { + return helloworld_address; + } + + // The WSDD service name defaults to the port name. + private java.lang.String helloworldWSDDServiceName = "helloworld"; + + public java.lang.String gethelloworldWSDDServiceName() { + return helloworldWSDDServiceName; + } + + public void sethelloworldWSDDServiceName(java.lang.String name) { + helloworldWSDDServiceName = name; + } + + public org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl gethelloworld() throws javax.xml.rpc.ServiceException { + java.net.URL endpoint; + try { + endpoint = new java.net.URL(helloworld_address); + } + catch (java.net.MalformedURLException e) { + throw new javax.xml.rpc.ServiceException(e); + } + return gethelloworld(endpoint); + } + + public org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl gethelloworld(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { + try { + org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingStub _stub = new org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingStub(portAddress, this); + _stub.setPortName(gethelloworldWSDDServiceName()); + return _stub; + } + catch (org.apache.axis.AxisFault e) { + return null; + } + } + + public void sethelloworldEndpointAddress(java.lang.String address) { + helloworld_address = address; + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + try { + if (org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl.class.isAssignableFrom(serviceEndpointInterface)) { + org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingStub _stub = new org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingStub(new java.net.URL(helloworld_address), this); + _stub.setPortName(gethelloworldWSDDServiceName()); + return _stub; + } + } + catch (java.lang.Throwable t) { + throw new javax.xml.rpc.ServiceException(t); + } + throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + if (portName == null) { + return getPort(serviceEndpointInterface); + } + java.lang.String inputPortName = portName.getLocalPart(); + if ("helloworld".equals(inputPortName)) { + return gethelloworld(); + } else { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ((org.apache.axis.client.Stub) _stub).setPortName(portName); + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() { + return new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "HelloWorldServiceImplService"); + } + + private java.util.HashSet ports = null; + + public java.util.Iterator getPorts() { + if (ports == null) { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "helloworld")); + } + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + + if ("helloworld".equals(portName)) { + sethelloworldEndpointAddress(address); + } else { // Unknown Port Name + throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + setEndpointAddress(portName.getLocalPart(), address); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingImpl.java new file mode 100644 index 0000000000..f3b00e2ea5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingImpl.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +public class HelloworldSoapBindingImpl implements org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl { + public java.lang.String getGreetings(java.lang.String in0) throws java.rmi.RemoteException { + return "Hello " + in0; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingSkeleton.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingSkeleton.java new file mode 100644 index 0000000000..276cf5cf0e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingSkeleton.java @@ -0,0 +1,69 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +public class HelloworldSoapBindingSkeleton implements org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl, org.apache.axis.wsdl.Skeleton { + private org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl impl; + private static java.util.Map _myOperations = new java.util.Hashtable(); + private static java.util.Collection _myOperationsList = new java.util.ArrayList(); + + /** + * Returns List of OperationDesc objects with this name + */ + public static java.util.List getOperationDescByName(java.lang.String methodName) { + return (java.util.List) _myOperations.get(methodName); + } + + /** + * Returns Collection of OperationDescs + */ + public static java.util.Collection getOperationDescs() { + return _myOperationsList; + } + + static { + org.apache.axis.description.OperationDesc _oper; + org.apache.axis.description.FaultDesc _fault; + org.apache.axis.description.ParameterDesc [] _params; + _params = new org.apache.axis.description.ParameterDesc []{ + new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false), + }; + _oper = new org.apache.axis.description.OperationDesc("getGreetings", _params, new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetingsReturn")); + _oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); + _oper.setElementQName(new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings")); + _oper.setSoapAction(""); + _myOperationsList.add(_oper); + if (_myOperations.get("getGreetings") == null) { + _myOperations.put("getGreetings", new java.util.ArrayList()); + } + ((java.util.List) _myOperations.get("getGreetings")).add(_oper); + } + + public HelloworldSoapBindingSkeleton() { + this.impl = new org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingImpl(); + } + + public HelloworldSoapBindingSkeleton(org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl impl) { + this.impl = impl; + } + + public java.lang.String getGreetings(java.lang.String in0) throws java.rmi.RemoteException { + java.lang.String ret = impl.getGreetings(in0); + return ret; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingStub.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingStub.java new file mode 100644 index 0000000000..7fd9622c7e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloworldSoapBindingStub.java @@ -0,0 +1,133 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldaxis; + +public class HelloworldSoapBindingStub extends org.apache.axis.client.Stub implements org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl { + private java.util.Vector cachedSerClasses = new java.util.Vector(); + private java.util.Vector cachedSerQNames = new java.util.Vector(); + private java.util.Vector cachedSerFactories = new java.util.Vector(); + private java.util.Vector cachedDeserFactories = new java.util.Vector(); + + static org.apache.axis.description.OperationDesc [] _operations; + + static { + _operations = new org.apache.axis.description.OperationDesc[1]; + _initOperationDesc1(); + } + + private static void _initOperationDesc1() { + org.apache.axis.description.OperationDesc oper; + org.apache.axis.description.ParameterDesc param; + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getGreetings"); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); + oper.setReturnClass(java.lang.String.class); + oper.setReturnQName(new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetingsReturn")); + oper.setStyle(org.apache.axis.constants.Style.WRAPPED); + oper.setUse(org.apache.axis.constants.Use.LITERAL); + _operations[0] = oper; + + } + + public HelloworldSoapBindingStub() throws org.apache.axis.AxisFault { + this(null); + } + + public HelloworldSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + this(service); + super.cachedEndpoint = endpointURL; + } + + public HelloworldSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + if (service == null) { + super.service = new org.apache.axis.client.Service(); + } else { + super.service = service; + } + ((org.apache.axis.client.Service) super.service).setTypeMappingVersion("1.2"); + } + + protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException { + try { + org.apache.axis.client.Call _call = super._createCall(); + if (super.maintainSessionSet) { + _call.setMaintainSession(super.maintainSession); + } + if (super.cachedUsername != null) { + _call.setUsername(super.cachedUsername); + } + if (super.cachedPassword != null) { + _call.setPassword(super.cachedPassword); + } + if (super.cachedEndpoint != null) { + _call.setTargetEndpointAddress(super.cachedEndpoint); + } + if (super.cachedTimeout != null) { + _call.setTimeout(super.cachedTimeout); + } + if (super.cachedPortName != null) { + _call.setPortName(super.cachedPortName); + } + java.util.Enumeration keys = super.cachedProperties.keys(); + while (keys.hasMoreElements()) { + java.lang.String key = (java.lang.String) keys.nextElement(); + _call.setProperty(key, super.cachedProperties.get(key)); + } + return _call; + } + catch (java.lang.Throwable _t) { + throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t); + } + } + + public java.lang.String getGreetings(java.lang.String in0) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setEncodingStyle(null); + _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); + _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings")); + + setRequestHeaders(_call); + setAttachments(_call); + try { + java.lang.Object _resp = _call.invoke(new java.lang.Object[]{in0}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException) _resp; + } else { + extractAttachments(_call); + try { + return (java.lang.String) _resp; + } catch (java.lang.Exception _exception) { + return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class); + } + } + } catch (org.apache.axis.AxisFault axisFaultException) { + throw axisFaultException; + } + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/deploy.wsdd b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/deploy.wsdd new file mode 100644 index 0000000000..dd837f016b --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/deploy.wsdd @@ -0,0 +1,41 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+ <!-- Use this file to deploy some handlers/chains and services -->
+ <!-- Two ways to do this: -->
+ <!-- java org.apache.axis.client.AdminClient deploy.wsdd -->
+ <!-- after the axis server is running -->
+ <!-- or -->
+ <!-- java org.apache.axis.utils.Admin client|server deploy.wsdd -->
+ <!-- from the same directory that the Axis engine runs -->
+
+<deployment
+ xmlns="http://xml.apache.org/axis/wsdd/"
+ xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+
+ <!-- Services from HelloWorldServiceImplService WSDL service -->
+
+ <service name="helloworld" provider="java:RPC" style="wrapped" use="literal">
+ <parameter name="wsdlTargetNamespace" value="http://helloworldaxis.samples.tuscany.apache.org"/>
+ <parameter name="wsdlServiceElement" value="HelloWorldServiceImplService"/>
+ <parameter name="schemaQualified" value="http://helloworldaxis.samples.tuscany.apache.org"/>
+ <parameter name="wsdlServicePort" value="helloworld"/>
+ <parameter name="className" value="org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingSkeleton"/>
+ <parameter name="wsdlPortType" value="HelloWorldServiceImpl"/>
+ <parameter name="typeMappingVersion" value="1.2"/>
+ <parameter name="allowedMethods" value="*"/>
+
+ </service>
+</deployment>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/undeploy.wsdd b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/undeploy.wsdd new file mode 100644 index 0000000000..eeecfa17c4 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis/src/main/java/org/apache/tuscany/samples/helloworldaxis/undeploy.wsdd @@ -0,0 +1,30 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+ <!-- Use this file to undeploy some handlers/chains and services -->
+ <!-- Two ways to do this: -->
+ <!-- java org.apache.axis.client.AdminClient undeploy.wsdd -->
+ <!-- after the axis server is running -->
+ <!-- or -->
+ <!-- java org.apache.axis.utils.Admin client|server undeploy.wsdd -->
+ <!-- from the same directory that the Axis engine runs -->
+
+<undeployment
+ xmlns="http://xml.apache.org/axis/wsdd/">
+
+ <!-- Services from HelloWorldServiceImplService WSDL service -->
+
+ <service name="helloworld"/>
+</undeployment>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/build.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/build.xml new file mode 100644 index 0000000000..2d9badbf87 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/build.xml @@ -0,0 +1,127 @@ +<project xmlns:xalan="http://xml.apache.org/xslt" default="jar.all" basedir="."> + <!--Auto generated ant build file--> + <property environment="env" /> + <!-- property name="axis2.home" value="${env.AXIS2_HOME}"/ --> + <property name="axis2.home" value="C:\Apache\axis2-std-0.94-bin" /> + <property name="axis2.class.path" value="" /> + <property name="name" value="HelloWorldServiceImplService" /> + <property name="src" value="${basedir}\src\main\java" /> + <property name="test" value="${basedir}\src\test\java" /> + <property name="build" value="${basedir}\target" /> + <property name="classes" value="${build}\classes" /> + <property name="lib" value="${build}\lib" /> + <property name="resources" value="${basedir}\src\main\resources" /> + <property value="" name="jars.ok" /> + <path id="axis2.class.path"> + <pathelement path="${java.class.path}" /> + <pathelement path="${axis2.class.path}" /> + <fileset dir="${axis2.home}"> + <include name="lib/*.jar" /> + </fileset> + </path> + <target name="init"> + <mkdir dir="${build}" /> + <mkdir dir="${classes}" /> + <mkdir dir="${lib}" /> + </target> + <target depends="init" name="pre.compile.test"> + <!--Test the classpath for the availability of necesary classes--> + <available classpathref="axis2.class.path" property="stax.available" classname="javax.xml.stream.XMLStreamReader" /> + <available classpathref="axis2.class.path" property="axis2.available" classname="org.apache.axis2.engine.AxisEngine" /> + <condition property="jars.ok"> + <and> + <isset property="stax.available" /> + <isset property="axis2.available" /> + </and> + </condition> + <!--Print out the availabilities--> + <echo message="Stax Availability= ${stax.available}" /> + <echo message="Axis2 Availability= ${axis2.available}" /> + </target> + <target depends="pre.compile.test" name="compile.all" if="jars.ok"> + <javac debug="on" destdir="${classes}" srcdir="${src}"> + <classpath refid="axis2.class.path" /> + </javac> + </target> + <target depends="pre.compile.test" name="compile.test" if="jars.ok"> + <javac debug="on" destdir="${classes}"> + <src path="${src}" /> + <src path="${test}" /> + <classpath refid="axis2.class.path" /> + </javac> + </target> + <target depends="pre.compile.test" name="echo.classpath.problem" unless="jars.ok"> + <echo message="The class path is not set right! Please make sure the following classes are in the classpath 1. XmlBeans 2. Stax 3. Axis2 " /> + </target> + <target depends="jar.server, jar.client" name="jar.all" /> + <target depends="compile.all,echo.classpath.problem" name="jar.server" if="jars.ok"> + <copy toDir="${classes}/META-INF"> + <fileset dir="${resources}"> + <include name="*.xml" /> + <include name="*.wsdl" /> + </fileset> + </copy> + <jar destfile="${lib}/${name}.aar"> + <fileset excludes="**/Test.class" dir="${classes}" /> + </jar> + </target> + <target if="jars.ok" depends="compile.test" name="jar.client"> + <jar destfile="${lib}/${name}-test-client.jar"> + <fileset dir="${classes}"> + <exclude name="**/META-INF/*.*" /> + <exclude name="**/lib/*.*" /> + <exclude name="**/*MessageReceiver.class" /> + <exclude name="**/*Skeleton.class" /> + </fileset> + <fileset dir="${resources}"> + <exclude name="**/*.wsdl" /> + <exclude name="**/*.xml" /> + </fileset> + </jar> + </target> + <target if="jars.ok" name="make.repo" depends="jar.server"> + <mkdir dir="${build}/repo/" /> + <mkdir dir="${build}/repo/services" /> + <copy file="${build}/lib/${name}.aar" toDir="${build}/repo/services/" /> + </target> + + <target if="jars.ok" name="check.server" depends="jar.server"> + <echo message="Checking if the HTTP server has beem started"/> + <waitfor maxwait="30" maxwaitunit="second" checkevery="10" timeoutproperty="server.notstarted"> + <http url="http://localhost:8080" /> + </waitfor> + <condition property="server.alreadystarted"> + <not> + <istrue value="${server.notstarted}" /> + </not> + </condition> + <echo message="HTTP server status: ${server.alreadystarted}"/> + </target> + + <target if="jars.ok" name="start.server" depends="check.server, make.repo" unless="server.alreadystarted"> + <java fork="true" spawn="true" classname="org.apache.axis2.transport.http.SimpleHTTPServer"> + <arg value="${build}/repo" /> + <classpath refid="axis2.class.path" /> + </java> + </target> + <target depends="compile.test" name="run.test" if="jars.ok"> + <property refid="axis2.class.path" name="axis2.class.path" /> + <path id="test.class.path"> + <pathelement location="${lib}/${name}-test-client.jar" /> + <pathelement path="${axis2.class.path}" /> + </path> + <mkdir dir="${build}/test-reports/" /> + <junit haltonfailure="yes" printsummary="yes"> + <classpath refid="test.class.path" /> + <formatter type="plain" /> + <batchtest fork="yes" toDir="${build}/test-reports/"> + <fileset dir="${test}"> + <include name="**/*Test*.java" /> + </fileset> + </batchtest> + </junit> + </target> + <target name="clean"> + <delete dir="${build}" /> + </target> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/pom.xml new file mode 100644 index 0000000000..cdb6171241 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/pom.xml @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldaxis2</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample HelloWorld Axis2</name> + <description> + Sample classic helloworld Axis2 to test with Tuscany SCA + </description> + <version>SNAPSHOT</version> + + <!-- start new Axis2 stuff --> + <dependencies> + <dependency> + <groupId>axis2</groupId> + <artifactId>axis2-core</artifactId> + <version>0.94</version> + </dependency> + <dependency> + <groupId>axis2</groupId> + <artifactId>axis2-adb</artifactId> + <version>0.94</version> + </dependency> + <dependency> + <groupId>axis2</groupId> + <artifactId>axis2-doom</artifactId> + <version>0.94</version> + </dependency> + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-activation</artifactId> + <version>1.0.2-rc4</version> + </dependency> + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-javamail</artifactId> + <version>1.3.1-rc5</version> + </dependency> + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-jms</artifactId> + <version>1.1-rc4</version> + </dependency> + + <dependency> + <groupId>axis2</groupId> + <artifactId>addressing</artifactId> + <version>0.94</version> + <type>mar</type> + </dependency> + <!-- external JARs --> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.0.4</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>3.0</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.12</version> + </dependency> + <dependency> + <groupId>woodstox</groupId> + <artifactId>wstx-asl</artifactId> + <version>2.8.2</version> + </dependency> + <dependency> + <groupId>stax</groupId> + <artifactId>stax-api</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>axis</groupId> + <artifactId>axis-wsdl4j</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>ws-commons</groupId> + <artifactId>ws-policy</artifactId> + <version>SNAPSHOT</version> + </dependency> + + <!-- + <dependency> + <groupId>wss4j</groupId> + <artifactId>wss4j</artifactId> + <version>SNAPSHOT</version> + </dependency> + <dependency> + <groupId>xml-security</groupId> + <artifactId>xmlsec</artifactId> + <version>1.2.1}</version> + </dependency> + <dependency> + <groupId>bouncycastle</groupId> + <artifactId>bcprov</artifactId> + <version>jdk13-128</version> + </dependency> + <dependency> + <groupId>opensaml</groupId> + <artifactId>opensaml</artifactId> + <version>1.0.1</version> + </dependency> + --> + <dependency> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + <version>1.3.02</version> + </dependency> + <dependency> + <groupId>jaxen</groupId> + <artifactId>jaxen</artifactId> + <version>1.1-beta-7</version> + </dependency> + <dependency> + <groupId>backport-util-concurrent</groupId> + <artifactId>backport-util-concurrent</artifactId> + <version>2.0_01_pd</version> + </dependency> + <!--for java2wsdl generation we use JAM , so there should be a dependency on the annogen jar or--> + <!--XML Beans--> + <dependency> + <groupId>annogen</groupId> + <artifactId>annogen</artifactId> + <version>0.1.0</version> + </dependency> + <dependency> + <groupId>xmlbeans</groupId> + <artifactId>xbean</artifactId> + <version>2.1.0</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.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <configuration> + <tasks> + <ant antfile="${basedir}/build.xml" + inheritRefs="true"> + <target name="start.server" /> + </ant> + <waitfor maxwait="60" + maxwaitunit="second" checkevery="30"> + <http + url="http://localhost:8080" /> + </waitfor> + + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + --> + +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetings.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetings.java new file mode 100644 index 0000000000..a7c332f9e7 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetings.java @@ -0,0 +1,94 @@ +/** + * GetGreetings.java This file was auto-generated from WSDL by the Apache Axis2 + * version: #axisVersion# #today# + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * GetGreetings bean class + */ +public class GetGreetings implements org.apache.axis2.databinding.ADBBean { + public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", + "getGreetings", "ns1"); + + /** field for In0 */ + private java.lang.String localIn0; + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getIn0() { + return localIn0; + } + + /** + * Auto generated setter method + * + * @param param In0 + */ + public void setIn0(java.lang.String param) { + this.localIn0 = param; + } + + /** + * databinding method to get an XML representation of this object + */ + public javax.xml.stream.XMLStreamReader getPullParser( + javax.xml.namespace.QName qName) { + java.util.ArrayList elementList = new java.util.ArrayList(); + java.util.ArrayList attribList = new java.util.ArrayList(); + + elementList.add(new javax.xml.namespace.QName( + "http://helloworldaxis.samples.tuscany.apache.org", "in0")); + elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + localIn0)); + + return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(qName, + elementList.toArray(), attribList.toArray()); + } + + /** + * static method to create the object Note - This is not complete + */ + public static GetGreetings parse(javax.xml.stream.XMLStreamReader reader) + throws java.lang.Exception { + GetGreetings object = new GetGreetings(); + + try { + int event = reader.getEventType(); + int count = 0; + int argumentCount = 1; + boolean done = false; + + //event better be a START_ELEMENT. if not we should go up to the start element here + while (!reader.isStartElement()) { + event = reader.next(); + } + + while (!done) { + if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event) { + if ("in0".equals(reader.getLocalName())) { + String content = reader.getElementText(); + object.setIn0(org.apache.axis2.databinding.utils.ConverterUtil.convertTostring( + content)); + count++; + } + } + + if (argumentCount == count) { + done = true; + } + + if (!done) { + event = reader.next(); + } + } + } catch (javax.xml.stream.XMLStreamException e) { + throw new java.lang.Exception(e); + } + + return object; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetingsResponse.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetingsResponse.java new file mode 100644 index 0000000000..8cee6c1e93 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetingsResponse.java @@ -0,0 +1,96 @@ +/** + * GetGreetingsResponse.java This file was auto-generated from WSDL by the + * Apache Axis2 version: #axisVersion# #today# + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * GetGreetingsResponse bean class + */ +public class GetGreetingsResponse + implements org.apache.axis2.databinding.ADBBean { + public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", + "getGreetingsResponse", "ns1"); + + /** field for GetGreetingsReturn */ + private java.lang.String localGetGreetingsReturn; + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getGetGreetingsReturn() { + return localGetGreetingsReturn; + } + + /** + * Auto generated setter method + * + * @param param GetGreetingsReturn + */ + public void setGetGreetingsReturn(java.lang.String param) { + this.localGetGreetingsReturn = param; + } + + /** + * databinding method to get an XML representation of this object + */ + public javax.xml.stream.XMLStreamReader getPullParser( + javax.xml.namespace.QName qName) { + java.util.ArrayList elementList = new java.util.ArrayList(); + java.util.ArrayList attribList = new java.util.ArrayList(); + + elementList.add(new javax.xml.namespace.QName( + "http://helloworldaxis.samples.tuscany.apache.org", + "getGreetingsReturn")); + elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + localGetGreetingsReturn)); + + return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(qName, + elementList.toArray(), attribList.toArray()); + } + + /** + * static method to create the object Note - This is not complete + */ + public static GetGreetingsResponse parse( + javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { + GetGreetingsResponse object = new GetGreetingsResponse(); + + try { + int event = reader.getEventType(); + int count = 0; + int argumentCount = 1; + boolean done = false; + + //event better be a START_ELEMENT. if not we should go up to the start element here + while (!reader.isStartElement()) { + event = reader.next(); + } + + while (!done) { + if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event) { + if ("getGreetingsReturn".equals(reader.getLocalName())) { + String content = reader.getElementText(); + object.setGetGreetingsReturn(org.apache.axis2.databinding.utils.ConverterUtil.convertTostring( + content)); + count++; + } + } + + if (argumentCount == count) { + done = true; + } + + if (!done) { + event = reader.next(); + } + } + } catch (javax.xml.stream.XMLStreamException e) { + throw new java.lang.Exception(e); + } + + return object; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplCallbackHandler.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplCallbackHandler.java new file mode 100644 index 0000000000..ee30587946 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplCallbackHandler.java @@ -0,0 +1,39 @@ +/** + * HelloWorldServiceImplCallbackHandler.java This file was auto-generated from + * WSDL by the Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * HelloWorldServiceImplCallbackHandler Callback class + */ +public abstract class HelloWorldServiceImplCallbackHandler { + private Object clientData; + + /** + * User can pass in any object that needs to be accessed once the + * NonBlocking Web service call is finished and appropreate method of + * this CallBack is called. + * + * @param clientData Object mechanism by which the user can pass in user + * data that will be avilable at the time this callback is called. + */ + public HelloWorldServiceImplCallbackHandler(Object clientData) { + this.clientData = clientData; + } + + /** + * auto generated Axis2 call back method for getGreetings method + */ + public void receiveResultgetGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param9) { + //Fill here with the code to handle the response + } + + /** + * auto generated Axis2 Error handler + */ + public void receiveErrorgetGreetings(java.lang.Exception e) { + //Fill here with the code to handle the exception + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplMessageReceiver.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplMessageReceiver.java new file mode 100644 index 0000000000..90e9af80b2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplMessageReceiver.java @@ -0,0 +1,146 @@ +/** + * HelloWorldServiceImplMessageReceiver.java This file was auto-generated from + * WSDL by the Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * HelloWorldServiceImplMessageReceiver message receiver + */ +public class HelloWorldServiceImplMessageReceiver + extends org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver { + public void invokeBusinessLogic( + org.apache.axis2.context.MessageContext msgContext, + org.apache.axis2.context.MessageContext newMsgContext) + throws org.apache.axis2.AxisFault { + try { + // get the implementation class for the Web Service + Object obj = getTheImplementationObject(msgContext); + + //Inject the Message Context if it is asked for + org.apache.axis2.engine.DependencyManager.configureBusinessLogicProvider(obj, + msgContext, newMsgContext); + + HelloWorldServiceImplSkeleton skel = (HelloWorldServiceImplSkeleton) obj; + + //Out Envelop + org.apache.axis2.soap.SOAPEnvelope envelope = null; + + //Find the axisOperation that has been set by the Dispatch phase. + org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext() + .getAxisOperation(); + + if (op == null) { + throw new org.apache.axis2.AxisFault( + "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); + } + + String methodName; + + if ((op.getName() != null) & + ((methodName = op.getName().getLocalPart()) != null)) { + if ("getGreetings".equals(methodName)) { + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param5 = + null; + + //doc style + param5 = skel.getGreetings((org.apache.tuscany.samples.helloworldaxis.GetGreetings) fromOM( + msgContext.getEnvelope().getBody() + .getFirstElement(), + org.apache.tuscany.samples.helloworldaxis.GetGreetings.class)); + + envelope = toEnvelope(getSOAPFactory(msgContext), param5); + } + + newMsgContext.setEnvelope(envelope); + } + } catch (Exception e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + // + private org.apache.axis2.om.OMElement toOM( + org.apache.tuscany.samples.helloworldaxis.GetGreetings param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder(org.apache.axis2.om.OMAbstractFactory.getOMFactory(), + param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME)); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ((org.apache.axis2.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link + + return documentElement; + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( + org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetings param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME), + factory); + + return builder.getEnvelope(); + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.om.OMElement toOM( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder(org.apache.axis2.om.OMAbstractFactory.getOMFactory(), + param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME)); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ((org.apache.axis2.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link + + return documentElement; + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( + org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME), + factory); + + return builder.getEnvelope(); + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private java.lang.Object fromOM(org.apache.axis2.om.OMElement param, + java.lang.Class type) { + Object obj; + + try { + java.lang.reflect.Method parseMethod = type.getMethod("parse", + new Class[] { javax.xml.stream.XMLStreamReader.class }); + obj = null; + + if (parseMethod != null) { + obj = parseMethod.invoke(null, + new Object[] { param.getXMLStreamReaderWithoutCaching() }); + } else { + //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here + } + } catch (Exception e) { + throw new RuntimeException(e); + } + + return obj; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplSkeleton.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplSkeleton.java new file mode 100644 index 0000000000..7796e08873 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplSkeleton.java @@ -0,0 +1,24 @@ +/** + * HelloWorldServiceImplSkeleton.java This file was auto-generated from WSDL by + * the Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * HelloWorldServiceImplSkeleton java skeleton for the axisService + */ +public class HelloWorldServiceImplSkeleton +{ + /** + * Auto generated method signature + * + * @param greetings + */ + public org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse getGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetings greetings ) + { + GetGreetingsResponse response = new GetGreetingsResponse(); + response.setGetGreetingsReturn( "Greeting: " + greetings.getIn0() ); + return response; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplStub.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplStub.java new file mode 100644 index 0000000000..440a5aa36f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplStub.java @@ -0,0 +1,269 @@ +/** + * HelloWorldServiceImplStub.java This file was auto-generated from WSDL by the + * Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/* + * HelloWorldServiceImplStub java implementation + */ +public class HelloWorldServiceImplStub + extends org.apache.axis2.client.Stub +{ + //default axis home being null forces the system to pick up the mars from the axis2 library + public static final String AXIS2_HOME = null; + + protected static org.apache.axis2.description.AxisOperation[] _operations; + + static + { + //creating the Service + _service = new org.apache.axis2.description.AxisService( "HelloWorldServiceImpl" ); + + //creating the operations + org.apache.axis2.description.AxisOperation __operation; + _operations = new org.apache.axis2.description.OutInAxisOperation[1]; + + __operation = new org.apache.axis2.description.OutInAxisOperation(); + __operation.setName( new javax.xml.namespace.QName( "http://helloworldaxis.samples.tuscany.apache.org", + "getGreetings" ) ); + _operations[0] = __operation; + _service.addOperation( __operation ); + } + + public HelloWorldServiceImplStub( org.apache.axis2.context.ConfigurationContext configurationContext, + String targetEndpoint ) + throws java.lang.Exception + { + _serviceClient = new org.apache.axis2.client.ServiceClient( configurationContext, _service ); + _serviceClient.getOptions().setTo( new org.apache.axis2.addressing.EndpointReference( targetEndpoint ) ); + } + + /** + * Default Constructor + */ + public HelloWorldServiceImplStub() + throws java.lang.Exception + { + this( "http://localhost:8080/axis2/services/HelloWorldServiceImplService" ); + } + + /** + * Constructor taking the traget endpoint + */ + public HelloWorldServiceImplStub( String targetEndpoint ) + throws java.lang.Exception + { + this( new org.apache.axis2.context.ConfigurationContextFactory() + .createConfigurationContextFromFileSystem( AXIS2_HOME ), targetEndpoint ); + } + + /** + * Auto generated method signature + * + * @param param10 + * + * @see org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl#getGreetings + */ + public org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse getGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetings param10 ) + throws java.rmi.RemoteException + { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient( _operations[0] + .getName() ); + _operationClient.getOptions().setSoapAction( "" ); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); + + // create SOAP envelope with that payload + org.apache.axis2.soap.SOAPEnvelope env = null; + + //Style is Doc. + env = toEnvelope( getFactory( _options.getSoapVersionURI() ), param10 ); + + // create message context with that soap envelope + org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); + _messageContext.setEnvelope( env ); + + // add the message contxt to the operation client + _operationClient.addMessageContext( _messageContext ); + + //set the options hierarchy + _options.setParent( _operationClient.getOptions() ); + _operationClient.setOptions( _options ); + + //execute the operation client + _operationClient.execute( true ); + + org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient + .getMessageContext( org.apache.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ); + org.apache.axis2.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); + + java.lang.Object object = fromOM( getElement( _returnEnv, "doc" ), + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.class ); + + return (org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse) object; + } + + /** + * Auto generated method signature for Asynchronous Invocations + * + * @param param10 + * + * @see org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl#startgetGreetings + */ + public void startgetGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetings param10, + final org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplCallbackHandler callback ) + throws java.rmi.RemoteException + { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient( _operations[0] + .getName() ); + _operationClient.getOptions().setSoapAction( "" ); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); + + // create SOAP envelope with that payload + org.apache.axis2.soap.SOAPEnvelope env; + + //Style is Doc. + env = toEnvelope( getFactory( _options.getSoapVersionURI() ), param10 ); + + // create message context with that soap envelope + org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); + _messageContext.setEnvelope( env ); + + // add the message contxt to the operation client + _operationClient.addMessageContext( _messageContext ); + + //set the options hierarchy + _options.setParent( _operationClient.getOptions() ); + _operationClient.setOptions( _options ); + + _operationClient.setCallback( new org.apache.axis2.client.async.Callback() + { + public void onComplete( org.apache.axis2.client.async.AsyncResult result ) + { + java.lang.Object object = fromOM( getElement( result.getResponseEnvelope(), "doc" ), + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.class ); + callback + .receiveResultgetGreetings( (org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse) object ); + } + + public void onError( java.lang.Exception e ) + { + callback.receiveErrorgetGreetings( e ); + } + } ); + + //execute the operation client + _operationClient.execute( true ); + } + + //http://localhost:8080/axis2/services/HelloWorldServiceImplService + private org.apache.axis2.om.OMElement toOM( org.apache.tuscany.samples.helloworldaxis.GetGreetings param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder( + org.apache.axis2.om.OMAbstractFactory + .getOMFactory(), + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME ) ); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ( (org.apache.axis2.om.impl.OMNodeEx) documentElement ).setParent( null ); // remove the parent link + + return documentElement; + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetings param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder( + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME ), + factory ); + + return builder.getEnvelope(); + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.om.OMElement toOM( org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder( + org.apache.axis2.om.OMAbstractFactory + .getOMFactory(), + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME ) ); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ( (org.apache.axis2.om.impl.OMNodeEx) documentElement ).setParent( null ); // remove the parent link + + return documentElement; + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( + org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder( + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME ), + factory ); + + return builder.getEnvelope(); + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private java.lang.Object fromOM( org.apache.axis2.om.OMElement param, java.lang.Class type ) + { + Object obj; + + try + { + java.lang.reflect.Method parseMethod = type + .getMethod( "parse", new Class[] { javax.xml.stream.XMLStreamReader.class } ); + obj = null; + + if ( parseMethod != null ) + { + obj = parseMethod.invoke( null, new Object[] { param.getXMLStreamReaderWithoutCaching() } ); + } + else + { + //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here + } + } + catch ( Exception e ) + { + throw new RuntimeException( e ); + } + + return obj; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/helloworld.wsdl b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..79bd6e45a0 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/helloworld.wsdl @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <wsdlsoap:address location="http://localhost:8080/axis2/services/HelloWorldServiceImplService"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/services.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/services.xml new file mode 100644 index 0000000000..18d83e759e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/services.xml @@ -0,0 +1,7 @@ +<service xmlns:xalan="http://xml.apache.org/xslt" name="HelloWorldServiceImplService"> + <messageReceivers> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplMessageReceiver"/> + </messageReceivers> + <parameter locked="false" name="ServiceClass">org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplSkeleton</parameter> + <!--All public methods of the service class are exposed by default--> +</service> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/META-INF/MANIFEST.MF b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5e9495128c --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplTest.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplTest.java new file mode 100644 index 0000000000..149c3d2390 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplTest.java @@ -0,0 +1,63 @@ +/** + * HelloWorldServiceImplTest.java This file was auto-generated from WSDL by the + * Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + + +/* + * HelloWorldServiceImplTest Junit test case +*/ +public class HelloWorldServiceImplTest extends junit.framework.TestCase { + +//FIXME we don't want to run this test as part of the main build, AXIS2 is not necessarily set up to run it + /** + * Auto generated test method + */ + public void testgetGreetings() throws java.lang.Exception { +// org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub stub = +// new org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub("http://localhost:8080/axis2/services/HelloWorldServiceImplService"); //the default implementation should point to the right endpoint +// +// org.apache.tuscany.samples.helloworldaxis.GetGreetings param14 = (org.apache.tuscany.samples.helloworldaxis.GetGreetings) getTestObject(org.apache.tuscany.samples.helloworldaxis.GetGreetings.class); +// param14.setIn0("Hello, World!"); +// +// // todo Fill in the param14 here +// assertNotNull(stub.getGreetings(param14)); + } + + /** + * Auto generated test method + */ + public void testStartgetGreetings() throws java.lang.Exception { +// org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub stub = +// new org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub("http://localhost:8080/axis2/services/HelloWorldServiceImplService"); +// org.apache.tuscany.samples.helloworldaxis.GetGreetings param14 = (org.apache.tuscany.samples.helloworldaxis.GetGreetings) getTestObject(org.apache.tuscany.samples.helloworldaxis.GetGreetings.class); +// param14.setIn0("Hello, World!"); +// +// // todo Fill in the param14 here +// stub.startgetGreetings(param14, new tempCallbackN1000C()); + } + + //Create an ADBBean and provide it as the test object + public org.apache.axis2.databinding.ADBBean getTestObject( + java.lang.Class type) throws Exception { + return (org.apache.axis2.databinding.ADBBean) type.newInstance(); + } + + private class tempCallbackN1000C + extends org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplCallbackHandler { + public tempCallbackN1000C() { + super(null); + } + + public void receiveResultgetGreetings( + org.apache.axis2.client.async.AsyncResult result) { + assertNotNull(result.getResponseEnvelope().getBody() + .getFirstElement()); + } + + public void receiveErrorgetGreetings(java.lang.Exception e) { + fail(); + } + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/pom.xml new file mode 100644 index 0000000000..6a1f53146f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/pom.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldaxissvc</artifactId> + <packaging>war</packaging> + <name>Tuscany sample HelloWorld Axis Service</name> + <description>Sample classic helloworld Axis to test with Tuscany SCA</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworldaxis</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/readme.htm new file mode 100644 index 0000000000..dba269fad2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/readme.htm @@ -0,0 +1,53 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html><head>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany Hello World Axis Service Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+<body>
+
+<h2>Tuscany Hello World Axis Service Sample</h2>
+
+<h3>Overview</h3>
+
+<p>The Tuscany hello world Axis service sample uses the code
+generated in the <a href="../helloworldaxis/readme.htm" target="_blank">hello world Axis sample</a>. This
+project just includes a standard J2EE web.xml and uses Maven's war
+plugin to build a J2EE war that can be deployed into a web server.
+ Note that the configuring of the web application
+server for Tuscany makes the Axis services available to all deployed web
+applications, so it's not required to add Axis jars specifically to
+this web application. </p>
+
+
+<h3>Setup</h3>Set up your server as described in the <a href="http://wiki.apache.org/ws/Tuscany/TomcatIntegration" target="_blank">Tomcat Setup</a>. If you are not configuring with the acceptance test the server, you will need to add <span style="font-weight: bold;">helloworldws-SNAPSHOT.war</span> to your tomcat's webapp directory.<br><br>Review Axis documentation on configuring and deploying web services.
+<ol>
+
+</ol>
+
+<h3>Running</h3>
+
+This service can be invoked by either the Tuscany SCA <a target="_blank" href="../helloworldwsclient/readme.htm">helloworldwsclient</a> sample or <a href="../helloworldaxis/readme.htm" target="_blank">hello
+world Axis sample's</a> client sample.
+<h3>Understanding the code</h3>
+
+Review Axis documentation on developing web services.
+<br>
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/main/webapp/WEB-INF/server-config.wsdd b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/main/webapp/WEB-INF/server-config.wsdd new file mode 100644 index 0000000000..da9ce10bb2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/main/webapp/WEB-INF/server-config.wsdd @@ -0,0 +1,48 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- Use this file to deploy some handlers/chains and services -->
+<!-- Two ways to do this: -->
+<!-- java org.apache.axis.client.AdminClient deploy.wsdd -->
+<!-- after the axis server is running -->
+<!-- or -->
+<!-- java org.apache.axis.utils.Admin client|server deploy.wsdd -->
+<!-- from the same directory that the Axis engine runs -->
+
+<deployment
+ xmlns="http://xml.apache.org/axis/wsdd/"
+ xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
+ xmlns:handler="http://xml.apache.org/axis/wsdd/providers/handler">
+
+ <handler type="java:org.apache.axis.handlers.http.URLMapper" name="URLMapper"/>
+ <!-- Services from HelloWorldServiceImplService WSDL service -->
+
+ <service name="helloworld" provider="java:RPC" style="wrapped" use="literal">
+ <parameter name="wsdlTargetNamespace" value="http://helloworldaxis.samples.tuscany.apache.org"/>
+ <parameter name="wsdlServiceElement" value="HelloWorldServiceImplService"/>
+ <parameter name="schemaQualified" value="http://helloworldaxis.samples.tuscany.apache.org"/>
+ <parameter name="wsdlServicePort" value="helloworld"/>
+ <parameter name="className" value="org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingSkeleton"/>
+ <parameter name="wsdlPortType" value="HelloWorldServiceImpl"/>
+ <parameter name="typeMappingVersion" value="1.2"/>
+ <parameter name="allowedMethods" value="*"/>
+ </service>
+
+ <transport name="http">
+ <requestFlow>
+ <handler type="URLMapper"/>
+ </requestFlow>
+ </transport>
+</deployment>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..2a66793fc1 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web +Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> + +<web-app> + <display-name>Tuscany sample Apache-Axis HelloWorld</display-name> + + <listener> + <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class> + </listener> + + <servlet> + <servlet-name>AxisServlet</servlet-name> + <display-name>Apache-Axis Servlet</display-name> + <servlet-class> + org.apache.axis.transport.http.AxisServlet + </servlet-class> + </servlet> + + <servlet> + <servlet-name>AdminServlet</servlet-name> + <display-name>Axis Admin Servlet</display-name> + <servlet-class> + org.apache.axis.transport.http.AdminServlet + </servlet-class> + <load-on-startup>100</load-on-startup> + </servlet> + + <servlet> + <servlet-name>SOAPMonitorService</servlet-name> + <display-name>SOAPMonitorService</display-name> + <servlet-class> + org.apache.axis.monitor.SOAPMonitorService + </servlet-class> + <init-param> + <param-name>SOAPMonitorPort</param-name> + <param-value>5001</param-value> + </init-param> + <load-on-startup>100</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>/servlet/AxisServlet</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>*.jws</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>/services/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>SOAPMonitorService</servlet-name> + <url-pattern>/SOAPMonitor</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AdminServlet</servlet-name> + <url-pattern>/servlet/AdminServlet</url-pattern> + </servlet-mapping> + + <session-config> + <!-- Default to 5 minute session timeouts --> + <session-timeout>5</session-timeout> + </session-config> + + <mime-mapping> + <extension>wsdl</extension> + <mime-type>text/xml</mime-type> + </mime-mapping> + + <mime-mapping> + <extension>xsd</extension> + <mime-type>text/xml</mime-type> + </mime-mapping> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>HelloWorldWeb.jsp</welcome-file> + </welcome-file-list> + +</web-app> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/webapp/WEB-INF/server-config.wsdd b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/webapp/WEB-INF/server-config.wsdd new file mode 100644 index 0000000000..da9ce10bb2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/webapp/WEB-INF/server-config.wsdd @@ -0,0 +1,48 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- Use this file to deploy some handlers/chains and services -->
+<!-- Two ways to do this: -->
+<!-- java org.apache.axis.client.AdminClient deploy.wsdd -->
+<!-- after the axis server is running -->
+<!-- or -->
+<!-- java org.apache.axis.utils.Admin client|server deploy.wsdd -->
+<!-- from the same directory that the Axis engine runs -->
+
+<deployment
+ xmlns="http://xml.apache.org/axis/wsdd/"
+ xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
+ xmlns:handler="http://xml.apache.org/axis/wsdd/providers/handler">
+
+ <handler type="java:org.apache.axis.handlers.http.URLMapper" name="URLMapper"/>
+ <!-- Services from HelloWorldServiceImplService WSDL service -->
+
+ <service name="helloworld" provider="java:RPC" style="wrapped" use="literal">
+ <parameter name="wsdlTargetNamespace" value="http://helloworldaxis.samples.tuscany.apache.org"/>
+ <parameter name="wsdlServiceElement" value="HelloWorldServiceImplService"/>
+ <parameter name="schemaQualified" value="http://helloworldaxis.samples.tuscany.apache.org"/>
+ <parameter name="wsdlServicePort" value="helloworld"/>
+ <parameter name="className" value="org.apache.tuscany.samples.helloworldaxis.HelloworldSoapBindingSkeleton"/>
+ <parameter name="wsdlPortType" value="HelloWorldServiceImpl"/>
+ <parameter name="typeMappingVersion" value="1.2"/>
+ <parameter name="allowedMethods" value="*"/>
+ </service>
+
+ <transport name="http">
+ <requestFlow>
+ <handler type="URLMapper"/>
+ </requestFlow>
+ </transport>
+</deployment>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..2a66793fc1 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxissvc/src/webapp/WEB-INF/web.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web +Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> + +<web-app> + <display-name>Tuscany sample Apache-Axis HelloWorld</display-name> + + <listener> + <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class> + </listener> + + <servlet> + <servlet-name>AxisServlet</servlet-name> + <display-name>Apache-Axis Servlet</display-name> + <servlet-class> + org.apache.axis.transport.http.AxisServlet + </servlet-class> + </servlet> + + <servlet> + <servlet-name>AdminServlet</servlet-name> + <display-name>Axis Admin Servlet</display-name> + <servlet-class> + org.apache.axis.transport.http.AdminServlet + </servlet-class> + <load-on-startup>100</load-on-startup> + </servlet> + + <servlet> + <servlet-name>SOAPMonitorService</servlet-name> + <display-name>SOAPMonitorService</display-name> + <servlet-class> + org.apache.axis.monitor.SOAPMonitorService + </servlet-class> + <init-param> + <param-name>SOAPMonitorPort</param-name> + <param-value>5001</param-value> + </init-param> + <load-on-startup>100</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>/servlet/AxisServlet</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>*.jws</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>/services/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>SOAPMonitorService</servlet-name> + <url-pattern>/SOAPMonitor</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AdminServlet</servlet-name> + <url-pattern>/servlet/AdminServlet</url-pattern> + </servlet-mapping> + + <session-config> + <!-- Default to 5 minute session timeouts --> + <session-timeout>5</session-timeout> + </session-config> + + <mime-mapping> + <extension>wsdl</extension> + <mime-type>text/xml</mime-type> + </mime-mapping> + + <mime-mapping> + <extension>xsd</extension> + <mime-type>text/xml</mime-type> + </mime-mapping> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>HelloWorldWeb.jsp</welcome-file> + </welcome-file-list> + +</web-app> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/pom.xml new file mode 100644 index 0000000000..724274c25d --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldjs</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample HelloWorld - JavaScript</name> + <description>Sample classic helloworld</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-js</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>rhino</groupId> + <artifactId>js</artifactId> + <version>1.6R2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/readme.htm new file mode 100644 index 0000000000..0480aea82c --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/readme.htm @@ -0,0 +1,117 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<html><head> + + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + <meta http-equiv="Content-Style-Type" content="text/css"> + <title>Tuscany HelloWorld</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head> + +<body> + +<h2>Tuscany Hello World Sample - JavaScript</h2> + +<h3>Overview</h3> + +<p>The Tuscany helloworld sample shows using the Tuscany SCA + runtime in a J2SE environment loading a JavaScript component that + implements the classic introductory hello world example. </p> + + +<h3>Setup</h3>The jars for a <a href="http://wiki.apache.org/ws/Tuscany/J2SESetup" target="_blank">J2SE setup</a> not requiring web +services are required including the sample's own jar <span style="font-weight: bold;">helloworldjs-SNAPSHOT.jar</span>. + + +<ol> +</ol> + +<h3>Running</h3> + +Using JDK 1.5 java command with the previous jars run the class org.apache.tuscany.samples.helloworldjs.HelloWorldClient +<br> + +<h3>Results</h3> + +<p>The sample when run should simply display to the standard + output:<br> + + <code>jsHello World</code></p> + + +<h3>Code Overview</h3> + +The source files are physically organized as shown below: +<pre>sca.module<br>org<br>+-apache<br> +-tuscany<br> +-samples<br> +-helloworldjs<br> HelloWorldClient.java<br> HelloWorldService.java<br> HelloWorldServiceComponentImpl.js<br> HelloWorldServiceComponentImpl.componentType<br><br><br></pre> + +<p> </p> + +<table style="text-align: left; width: 879px; height: 154px;" border="0" cellpadding="2" cellspacing="2"> + + <tbody> + + <tr> + + <td style="vertical-align: top;">sca.module</td> + + <td>Defines the SCA module and component. Defines for the + HelloWorldServiceComponent component the Java class that + implements that component</td> + + </tr> + + <tr> + + <td style="vertical-align: top;">HelloWorldService.java</td> + + <td>Defines the Java interface implemented by the component.</td> + + </tr> + + <tr> + + <td style="vertical-align: top;">HelloWorldServiceComponentImpl.js</td> + + <td>JavaScript implementation of the SCA component.</td> + + </tr> + + <tr> + + <td style="vertical-align: top;">HelloWorldServiceComponentImpl.componentType</td> + + <td>The SCA componentType side file defining the service interface implemented by the JavaScript component.</td> + + </tr> + + <tr> + + <td style="vertical-align: top;">HelloWorldClient.java</td> + + <td>Creates a Tuscany runtime and starts it. + Obtains the module context which was defined by the + sca.module file. From the module context locates the + HelloWorldServiceComponent and then calls the getGreetings + method to invoke the component.</td> + + </tr> + + </tbody> +</table> + +<br> + +</body></html> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/java/org/apache/tuscany/samples/helloworldjs/HelloWorldClient.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/java/org/apache/tuscany/samples/helloworldjs/HelloWorldClient.java new file mode 100644 index 0000000000..b4ea3e6abb --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/java/org/apache/tuscany/samples/helloworldjs/HelloWorldClient.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldjs; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component + * and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Start the runtime + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + HelloWorldServiceComponent helloworldService = (HelloWorldServiceComponent) moduleContext.locateService("HelloWorldServiceComponent"); + + String value = helloworldService.getGreetings("World"); + + System.out.println(value); + + // Stop the runtime + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/java/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponent.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/java/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..4de4948561 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/java/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponent.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldjs; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldServiceComponent { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.componentType b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.componentType new file mode 100644 index 0000000000..dab815733e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.componentType @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="ASCII"?> + +<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <service name="HelloWorldService"> + <interface.java interface="org.apache.tuscany.samples.helloworldjs.HelloWorldServiceComponent"/> + </service> + +</componentType>
\ No newline at end of file diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.js b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.js new file mode 100644 index 0000000000..b3104f78a5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.js @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function getGreetings(name) { + return "jsHello " + name; +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/sca.module new file mode 100644 index 0000000000..1ec0f7ed94 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/main/resources/sca.module @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005 BEA Sytems Inc. + Copyright (c) 2005 International Business Machines + + 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. + --> +<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" + xmlns:js="http://org.apache.tuscany/xmlns/js/0.9" + name="sampleHelloworld"> + + <component name="HelloWorldServiceComponent"> + <js:implementation.js scriptFile="org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentImpl.js"/> + </component> + +</module> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/test/java/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentTestCase.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/test/java/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentTestCase.java new file mode 100644 index 0000000000..6a61e7e13a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldjs/src/test/java/org/apache/tuscany/samples/helloworldjs/HelloWorldServiceComponentTestCase.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldjs; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * + */ +public class HelloWorldServiceComponentTestCase extends TestCase { + public boolean verbose = true; + + public void testGeetings() throws Exception { + + if (verbose) + System.out.println("starting test.."); + System.out.flush(); + + + TuscanyRuntime tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + assertNotNull(moduleContext); + System.out.println("module context name '" + + moduleContext.getName() + "'"); + System.out.println("module context uri '" + moduleContext.getURI() + + "'"); + HelloWorldServiceComponent helloworldService = (HelloWorldServiceComponent) moduleContext + .locateService("HelloWorldServiceComponent"); + + assertNotNull(helloworldService); + + + String value = helloworldService + .getGreetings("World"); + + if (verbose) + System.out.println("Value = '" + value + "'"); + + assertEquals("jsHello World", value); + + tuscany.stop(); + + } + + public final static void main(String[] args) throws Exception { + HelloWorldServiceComponentTestCase hwc = new HelloWorldServiceComponentTestCase(); + hwc.setVerbose(true); + hwc.testGeetings(); + + } + + public boolean isVerbose() { + return verbose; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/pom.xml new file mode 100644 index 0000000000..99d58e9a8a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/pom.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldmc</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample multi-component HelloWorld</name> + <description>Sample helloworld with multiple components</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-java</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-js</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/readme.htm new file mode 100644 index 0000000000..f37ae9dda8 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/readme.htm @@ -0,0 +1,151 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany Hello World Multi-Component Sample</title>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+
+<body>
+
+<h2>Tuscany Hello World Multi-Component Sample</h2>
+
+<h3>Overview</h3>
+
+<p>The Tuscany hello world multi-component sample shows using the Tuscany SCA
+ runtime in a J2SE environment loading a component that
+ implements the classic introductory hello world example. This sample
+ shows the wiring of multiple components in a single SCA module. </p>
+
+
+<h3>Setup</h3>The jars for a <a href="http://wiki.apache.org/ws/Tuscany/J2SESetup" target="_blank">J2SE setup</a> not requiring web
+services are required including the sample's own jar <span style="font-weight: bold;">helloworldmc-SNAPSHOT.jar</span>.
+
+<h3>Running</h3>
+Using JDK 1.5 java command with the previous jars run the class
+org.apache.tuscany.samples.helloworldmc.HelloWorldServiceComponentImpl<br>
+
+<h3>Results</h3>
+
+<p>The sample when run should simply display to the standard
+ output:<br>
+
+ <code>Hello SCA World</code></p>
+
+
+<h3>Code Overview</h3>
+
+The source files are physically organized as shown below:<br>
+
+<table style="text-align: left; width: 1206px; height: 238px;" border="1" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td>
+ <pre>main<br>+---java<br> ¦ sca.module<br> ¦<br> +---org<br> +---apache<br>
+ +---tuscany<br> +---samples<br> +---helloworldmc<br> GreetingPortionProvider.java<br>
+ GreetingPortionProviderImpl.java<br> HelloWorldService.java<br>
+ HelloWorldServiceComponentImpl.java<br><br></pre>
+
+ </td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+<br>
+
+<p> </p>
+
+<table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td style="vertical-align: top;">sca.module</td>
+
+ <td>Defines the SCA module and the
+ <span style="font-weight: bold;">HelloWorldServiceComponent</span>,
+ <span style="font-weight: bold;">GreetingPrefixComponent</span>
+ and <span style="font-weight: bold;">GreetingSuffixComponent
+ </span>components Wires the <span style="font-weight: bold;">HelloWorldServiceComponent</span>
+ to reference the <span style="font-weight: bold;">GreetingPrefixComponent</span>
+ and <span style="font-weight: bold;">GreetingSuffixComponent</span>.
+ Customizes the <span style="font-weight: bold;">GreetingPrefixComponent</span>
+ and <span style="font-weight: bold;">GreetingSuffixComponent</span>
+ components with the greetings. </td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">GreetingPortionProvider.java</td>
+
+ <td>Defines the Java interface implemented by the
+ component. <span style="font-weight: bold;">GreetingPrefixComponent</span>
+ and <span style="font-weight: bold;">GreetingSuffixComponent</span></td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">GreetingPortionProviderImpl.java</td>
+
+ <td>Implements the SCA components <span style="font-weight: bold;">GreetingPrefixComponent</span>
+ and <span style="font-weight: bold;">GreetingSuffixComponent</span>
+ . Uses the SCA service
+ annotation tag on the class to show what SCA interface is being
+ implemented. Uses the SCA defined <span style="font-weight: bold;">Property</span>
+ Java annotation on the <code>greetingPortion </code>Java
+ field to customize the component in the sca.module file.</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldService.java</td>
+
+ <td>Defines the Java interface implemented by the
+ component. <span style="font-weight: bold;">HelloWorldServiceComponent</span>. </td>
+
+ </tr>
+
+ <tr>
+
+ <td style="white-space: nowrap;">HelloWorldServiceComponentImpl.java <br>
+
+ </td>
+
+ <td>Implements the <span style="font-weight: bold;">HelloWorldServiceComponent</span>
+ component. Shows two Java fields being used to reference the
+ and <span style="font-weight: bold;">GreetingPrefixComponentGreetingSuffixComponent</span>
+ components.</td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+<br>
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProvider.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProvider.java new file mode 100644 index 0000000000..d023b3023b --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProvider.java @@ -0,0 +1,22 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldmc; + +public interface GreetingPortionProvider { + + public String getGreetingPortion(); +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProviderImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProviderImpl.java new file mode 100644 index 0000000000..a881a17dae --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProviderImpl.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldmc; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(GreetingPortionProvider.class) +public class GreetingPortionProviderImpl implements GreetingPortionProvider { + + @Property + public String greetingPortion; + + public String getGreetingPortion() { + return greetingPortion; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldClient.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldClient.java new file mode 100644 index 0000000000..36d7e3eb03 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldClient.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldmc; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component + * and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Start the runtime + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + String value = helloworldService.getGreetings(); + + System.out.println(value); + + // Stop the runtime + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldService.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldService.java new file mode 100644 index 0000000000..3d455aca68 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldmc; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + public String getGreetings(); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..664c6343d3 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentImpl.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldmc; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceComponentImpl implements HelloWorldService { + + @Property + public String greetingMiddle; + + @Reference + public GreetingPortionProvider greetingPrefix; + + @Reference + public GreetingPortionProvider greetingSuffix; + + /** + * @return + */ + public String getGreetings() { + String middle; + if (greetingMiddle == null) + middle = ""; + else + middle = greetingMiddle; + + return greetingPrefix.getGreetingPortion() + " " + middle + " " + greetingSuffix.getGreetingPortion(); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/resources/sca.module new file mode 100644 index 0000000000..13892eff7b --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/resources/sca.module @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 BEA Sytems Inc.
+ Copyright (c) 2005 International Business Machines
+
+ 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="sampleHelloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworldmc.HelloWorldServiceComponentImpl"/>
+ <references>
+ <v:greetingPrefix>GreetingPrefixComponent</v:greetingPrefix>
+ <v:greetingSuffix>GreetingSuffixComponent</v:greetingSuffix>
+ </references>
+ <properties>
+ <v:greetingMiddle>SCA</v:greetingMiddle>
+ </properties>
+ </component>
+
+ <component name="GreetingPrefixComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworldmc.GreetingPortionProviderImpl"/>
+ <properties>
+ <v:greetingPortion>Hello</v:greetingPortion>
+ </properties>
+ </component>
+
+ <component name="GreetingSuffixComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworldmc.GreetingPortionProviderImpl"/>
+ <properties>
+ <v:greetingPortion>World</v:greetingPortion>
+ </properties>
+ </component>
+</module>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/test/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentTestCase.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/test/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentTestCase.java new file mode 100644 index 0000000000..a53973b9ed --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/test/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentTestCase.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldmc; + +import junit.framework.TestCase; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +public class HelloWorldServiceComponentTestCase extends TestCase { + public boolean verbose = true; + + public void testGeetings() throws Exception { + + if (verbose) + System.out.println("starting test.."); + System.out.flush(); + + TuscanyRuntime tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + assertNotNull(moduleContext); + System.out.println("module context name '" + + moduleContext.getName() + "'"); + System.out.println("module context uri '" + moduleContext.getURI() + + "'"); + HelloWorldService helloworldService = + (HelloWorldService) moduleContext.locateService + ("HelloWorldServiceComponent"); + + assertNotNull(helloworldService); + + String value = helloworldService.getGreetings(); + + if (verbose) + System.out.println("Value = '" + value + "'"); + + assertEquals("Hello SCA World", value); + + tuscany.stop(); + } + + public final static void main(String[] args) throws Exception { + HelloWorldServiceComponentTestCase hwc = + new HelloWorldServiceComponentTestCase(); + hwc.setVerbose(true); + hwc.testGeetings(); + } + + public boolean isVerbose() { + return verbose; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/pom.xml new file mode 100644 index 0000000000..7eb7c0ec0f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldWeb</artifactId> + <packaging>war</packaging> + <name>Tuscany sample HelloWorld WEB</name> + <description>Sample classic helloworld with JSP</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war--> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-java</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war--> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/readme.htm new file mode 100644 index 0000000000..158d379e16 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/readme.htm @@ -0,0 +1,130 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany Hello World Web Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+
+<body>
+
+<h2>Tuscany Hello World Web Sample</h2>
+
+<h3>Overview</h3>
+
+<p>The Tuscany hello world web sample shows using the Tuscany SCA
+ runtime in a Tomcat environment being accessed from a JSP
+ page that
+ implements the classic introductory hello world example. </p>
+
+
+<h3>Setup</h3>Set up your server as described in the <a href="http://wiki.apache.org/ws/Tuscany/TomcatIntegration" target="_blank">Tomcat
+ Setup</a>. If you are not configuring with the acceptance test the server, you will need to add <span
+ style="font-weight: bold;">helloworldWeb-SNAPSHOT.war</span> to your tomcat's webapp directory.<br>
+
+<h3>Running</h3>
+
+Once you've started your web server, use your browse to view the
+following URL: <a href="http://localhost:8080/helloworldWeb-SNAPSHOT/" target="_blank">http://localhost:8080/helloworldWeb-SNAPSHOT/</a>
+<br>
+
+You should see a form you can supply your name and a submit button.
+ Once you submit the form the JSP page calls a Java class that
+gets the CurrentModuleContext and locates the SCA component to execute
+the greeting service. Note, unlike the a J2SE in a Tomcat environment the Tuscany runtime is automatically
+initialized and running.
+<h3>Results</h3>
+
+<p>The page should be updated with the greeting displayed below
+ the form.<br>
+
+</p>
+
+<h3>Code Overview</h3>
+
+The source files are physically organized as shown below:<br>
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td>
+ <pre>+---main<br>¦ +---java<br>¦ ¦ sca.module<br>¦ ¦
+ <br>¦ +---org<br>¦ +---apache<br>¦ +---tuscany
+ <br>¦ +---samples<br>¦ +---helloworldweb
+ <br>¦ HelloWorldService.java<br>¦
+ HelloWorldServiceComponentImpl.java<br>¦<br>+---webapp<br> ¦ HelloWorldWeb.jsp
+ <br> ¦<br> +---WEB-INF<br> web.xml<br></pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+<br>
+
+<p> </p>
+
+<table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td style="vertical-align: top;">sca.module</td>
+
+ <td>Defines the SCA module and component. Defines for the
+ HelloWorldServiceComponent component and the Java class that
+ implements that component</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldService.java</td>
+
+ <td>Defines the Java interface implemented by the component.</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldServiceComponentImpl.java</td>
+
+ <td>Implements the SCA component. Uses the SCA service
+ annotation tag on the class to show what SCA interface is being
+ implemented.</td>
+
+ </tr>
+
+
+ <tr>
+ <td>HelloWorldWeb.jsp</td>
+ <td>Handles Web form input.. Obtains the module context which was defined by the
+ sca.module file. From the module context locates the
+ HelloWorldServiceComponent and then calls the getGreetings
+ method to invoke the component. and formats returned results.</td>
+ </tr>
+ <tr>
+ <td>web.xml</td>
+ <td>Standard J2EE web application's web.xml</td>
+ </tr>
+
+ </tbody>
+</table>
+
+<br>
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponent.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..4775291e27 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponent.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldweb; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldServiceComponent { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..1441f9ff36 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponentImpl.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldweb; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldServiceComponent.class) +public class HelloWorldServiceComponentImpl implements HelloWorldServiceComponent { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/resources/sca.module new file mode 100644 index 0000000000..aa045e4a80 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/resources/sca.module @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 BEA Sytems Inc.
+ Copyright (c) 2005 International Business Machines
+
+ 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="sampleHelloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworldweb.HelloWorldServiceComponentImpl"/>
+ </component> +
+</module>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/webapp/HelloWorldWeb.jsp b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/webapp/HelloWorldWeb.jsp new file mode 100644 index 0000000000..9a54d0cbf9 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/webapp/HelloWorldWeb.jsp @@ -0,0 +1,79 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ --%>
+
+<HTML>
+<HEAD>
+ <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1" session="true" autoFlush="true"
+ isThreadSafe="true" isErrorPage="false"
+ import="org.apache.tuscany.samples.helloworldweb.HelloWorldServiceComponent"
+ import="java.io.PrintWriter"
+ import="java.io.StringWriter"
+ import="org.osoa.sca.CurrentModuleContext"
+ import="org.osoa.sca.ModuleContext"
+ %>
+ <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <META name="GENERATOR" content="IBM Software Development Platform">
+ <TITLE>Tuscany HelloWorld WEB Example</TITLE>
+ <%
+ String name = request.getParameter("name");
+ %>
+</HEAD>
+
+<BODY>
+<H2>Tuscany HelloWorld WEB Example</H2>
+
+<P> </P>
+
+<form action="HelloWorldWeb.jsp" method="get">Name
+ please: <INPUT type="text" id="i1" name="name"
+ size="40" maxlength="220"
+ value="<%= null == name ? "World" : name %>"> <BR>
+ <BR>
+ <INPUT type="submit" name="submit" value="Submit"></FORM>
+<BR>
+
+<%
+ try {
+ if (null != name) {
+ ModuleContext moduleContext = CurrentModuleContext.getContext();
+ HelloWorldServiceComponent helloworldService = (HelloWorldServiceComponent) moduleContext.locateService("HelloWorldServiceComponent");
+ String value = helloworldService.getGreetings(name);
+%>
+<HR>
+
+<P><%=value%>
+ <%}
+}catch(Exception e){
+ e.printStackTrace();
+ StringWriter sw= new StringWriter();
+ PrintWriter pw= new PrintWriter(sw);
+
+ e.printStackTrace(pw);
+ pw.flush();
+
+%>
+ Whoops!<BR clear="all">
+<PRE>
+ Exception "<%=e.getClass().getName()%>" Exception message: "<%=e.getMessage()%>"<BR clear="all">
+ <%=sw.toString() %>
+</PRE>
+<%
+
+ }%>
+</BODY>
+</HTML>
\ No newline at end of file diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..9765b182dc --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web +Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> + +<web-app> + <display-name>Tuscany sample HelloWorld WEB</display-name> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>HelloWorldWeb.jsp</welcome-file> + </welcome-file-list> + +</web-app> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/test/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponentTestCase.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/test/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponentTestCase.java new file mode 100644 index 0000000000..72c7cedb49 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldweb/src/test/java/org/apache/tuscany/samples/helloworldweb/HelloWorldServiceComponentTestCase.java @@ -0,0 +1,84 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldweb; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * + */ +public class HelloWorldServiceComponentTestCase extends TestCase { + public boolean verbose = false; + + public void testGeetings() throws Exception { + // todo should use SCA ;-) + final boolean viaSCA = false; + TuscanyRuntime tuscany; + ModuleContext moduleContext = null; + if (verbose) + System.out.println("starting test.."); + System.out.flush(); + HelloWorldServiceComponent helloworldService = null; + + if (viaSCA) { + tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + moduleContext = CurrentModuleContext.getContext(); + + assertNotNull(moduleContext); + System.out.println("module context name '" + + moduleContext.getName() + "'"); + System.out.println("module context uri '" + moduleContext.getURI() + + "'"); + helloworldService = (HelloWorldServiceComponent) moduleContext + .locateService("HelloWorldServiceComponent"); + + assertNotNull(helloworldService); + } else + helloworldService = new HelloWorldServiceComponentImpl(); + + String value = helloworldService + .getGreetings("World"); + + if (verbose) + System.out.println("Value = '" + value + "'"); + assertEquals("Hello World", value); + if (viaSCA) + tuscany.stop(); + + } + + public final static void main(String[] args) throws Exception { + HelloWorldServiceComponentTestCase hwc = new HelloWorldServiceComponentTestCase(); + hwc.setVerbose(true); + hwc.testGeetings(); + + } + + public boolean isVerbose() { + return verbose; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/pom.xml new file mode 100644 index 0000000000..bd63c96676 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/pom.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldws</artifactId> + <packaging>war</packaging> + <name>Tuscany sample HelloWorld WS Service</name> + <description>Sample classic helloworld SCA Service</description> + <version>SNAPSHOT</version> + +<build> + + <!-- + <plugins> + + <plugin> + + <artifactId>maven-war-plugin</artifactId> + + + <configuration> + + <warName>tuscany-samples-helloworldws-service</warName> + + </configuration> + + </plugin> + + </plugins> + --> + + </build> + <dependencies> + + <name>SCA API</name> + <dependency> + <groupId>org.osoa</groupId> + <artifactId>sca-api</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war--> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-java</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war--> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-binding-axis2</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war--> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-tomcat</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/readme.htm new file mode 100644 index 0000000000..2fce89cf02 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/readme.htm @@ -0,0 +1,186 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html><head>
+
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+
+
+ <title>Tuscany Hello World Web Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+
+<body>
+
+
+<h2>Tuscany Hello World WS Sample</h2>
+
+
+<h3>Overview</h3>
+
+
+<p>The Tuscany hello world ws sample shows using the Tuscany SCA
+ runtime in a Tomcat environment providing a web service.. </p>
+
+
+<h3>Setup</h3>
+
+
+Set up your server as described in the <a href="http://wiki.apache.org/ws/Tuscany/TomcatIntegration" target="_blank">Tomcat Setup</a>. If
+you are not configuring with the acceptance test the server, you will need to add <span style="font-weight: bold;">helloworldws-SNAPSHOT.war</span>
+to your Tomcat's webapp directory.
+
+
+<h3>Running</h3>
+
+This service can be invoked by either the Tuscany SCA <a target="_blank" href="../helloworldwsclient/readme.htm">helloworldwsclient</a>
+sample or <a href="../helloworldaxis/readme.htm" target="_blank">hello
+ world Axis sample's</a> client sample.<br>
+
+<h3>Code Overview</h3>
+
+
+The source files are physically organized as shown below:<br>
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td>+---main<br>
+ ¦ +---java<br>
+ ¦ ¦ ¦ sca.module<br>
+ ¦ ¦ ¦<br>
+ ¦ ¦ +---org<br>
+ ¦ ¦ +---apache<br>
+ ¦ ¦ +---tuscany
+ <br>
+ ¦ ¦
+ +---samples<br>
+ ¦
+ ¦
+ +---helloworldws<br>
+ ¦
+ ¦
+ HelloWorldService.java<br>
+ ¦
+ ¦
+ HelloWorldServiceComponentImpl.java<br>
+ ¦ ¦<br>
+ ¦ +---resources<br>
+ ¦ ¦ tuscany-model.config<br>
+ ¦ ¦<br>
+ ¦ +---wsdl<br>
+ ¦
+ helloworld.wsdl<br>
+ ¦<br>
+ ¦<br>
+ +---webapp<br>
+ +---WEB-INF<br>
+ web.xml<br>
+ </td>
+
+ </tr>
+
+
+ </tbody>
+</table>
+
+<br>
+
+<br>
+
+
+<table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2">
+
+
+ <tbody>
+
+
+ <tr>
+
+
+ <td style="vertical-align: top; height: 62px;">sca.module</td>
+
+
+ <td style="height: 62px;">Defines the SCA module, entryPoint
+ and component. Defines for the
+ HelloWorldServiceComponent component and the Java class that
+ implements the component For the entryPoint it defines WSDL for the
+ service, the Java interface provided by the service, and wires the
+ service to the HelloWorldServiceComponent</td>
+
+
+ </tr>
+
+
+ <tr>
+
+
+ <td style="vertical-align: top; height: 26px;">HelloWorldService.java</td>
+
+
+ <td style="height: 26px;">Defines the Java interface implemented by the component.</td>
+
+
+ </tr>
+
+
+ <tr>
+
+
+ <td style="vertical-align: top;">HelloWorldServiceComponentImpl.java</td>
+
+
+ <td>Implements the SCA component. Uses the SCA service
+ annotation tag on the class to show what SCA interface is being
+ implemented. Also uses the SCA Java annotation "Remotable" to
+ indicate that a component implemented by this class can be
+ referenced out side of the SCA module it resides in.</td>
+
+
+ </tr>
+
+
+ <tr>
+
+ <td>tuscany-model.config</td>
+
+ <td>Maps the SCA Entry point WSDL to the physical WSDL file location.</td>
+
+ </tr>
+
+ <tr>
+ <td>helloworld.wsdl</td>
+ <td>WSDL for the service.</td>
+ </tr>
+ <tr>
+
+ <td>web.xml</td>
+
+ <td>Standard J2EE web application's web.xml</td>
+
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/java/org/apache/tuscany/samples/helloworldws/HelloWorldService.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/java/org/apache/tuscany/samples/helloworldws/HelloWorldService.java new file mode 100644 index 0000000000..535e7ae5dc --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/java/org/apache/tuscany/samples/helloworldws/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldws; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/java/org/apache/tuscany/samples/helloworldws/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/java/org/apache/tuscany/samples/helloworldws/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..cbbdce7619 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/java/org/apache/tuscany/samples/helloworldws/HelloWorldServiceComponentImpl.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldws; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceComponentImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/resources/sca.module new file mode 100644 index 0000000000..95b0126553 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/resources/sca.module @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 BEA Sytems Inc.
+ Copyright (c) 2005 International Business Machines
+
+ 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="sampleHelloworld">
+
+ <entryPoint name="HelloWorldService">
+ <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#HelloWorldServiceImpl"/> + <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#helloworld"/> + <reference>HelloWorldServiceComponent/HelloWorldService</reference>
+ </entryPoint>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworldws.HelloWorldServiceComponentImpl"/>
+ </component> +
+ <import.wsdl + location="wsdl/helloworld.wsdl" + namespace="http://helloworldaxis.samples.tuscany.apache.org"/> + +</module>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..b1189031e7 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/webapp/WEB-INF/axis2.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/webapp/WEB-INF/axis2.xml new file mode 100644 index 0000000000..d42457fdf6 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/webapp/WEB-INF/axis2.xml @@ -0,0 +1,167 @@ +<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">false</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">false</parameter>
+ <!-- Uncomment this to enable REST support -->
+ <!-- <parameter name="enableREST" locked="false">true</parameter>-->
+
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <parameter name="seralizeLocation" locked="false">.</parameter>
+ <hostConfiguration>
+ <ip>127.0.0.1</ip>
+ <port>5555</port>
+ </hostConfiguration>
+
+
+ <!--if you want to extract the service archive file and work with that please uncomment this-->
+ <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+ <!--exploded directory into /service directory-->
+ <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </messageReceivers>
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+ <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+ <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+ </transportReceiver> -->
+
+ <!--REMOVED FOR TUSCANY transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver -->
+
+ <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener">
+ <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter>
+ <parameter name="java.naming.factory.initial" locked="false">
+ org.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ </transportReceiver>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> -->
+ <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> -->
+ <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <!--REMOVED FOR TUSCANY module ref="addressing"/> -->
+
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="TransportIn"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="userphase1"/>
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- user can add his own phases to this area -->
+ <phase name="userphase1"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- user can add his own phases to this area -->
+ <phase name="userphase1"/>
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- user can add his own phases to this area -->
+ <phase name="userphase1"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..e537b650e4 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web +Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + <display-name>Tuscany sample HelloWorld WS</display-name> + +</web-app> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/pom.xml new file mode 100644 index 0000000000..4953fa5b02 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldwsclient</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample HelloWorld Webservice SCA Client</name> + <description>Sample classic helloworldws client</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-container-java</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-binding-axis2</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/readme.htm b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/readme.htm new file mode 100644 index 0000000000..03e1323cee --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/readme.htm @@ -0,0 +1,189 @@ +<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany Hello World Web Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --></head>
+
+<body>
+
+<h2>Tuscany Hello World WS Client Sample</h2>
+
+<h3>Overview</h3>
+
+<p>The Tuscany hello world WS client sample shows using the Tuscany SCA
+ runtime in a J2SE environment invoking a web service. </p>
+
+<h3>Setup</h3>
+
+The jars for a <a href="http://wiki.apache.org/ws/Tuscany/J2SESetup" target="_blank">J2SE setup</a> including those necessary
+for web services are required including the sample's own jar <span style="font-weight: bold;">helloworldwsclient-SNAPSHOT.jar</span>.
+
+<h3>Running</h3>
+Using JDK 1.5 java command with the previous mentioned jars run the
+class org.apache.tuscany.samples.helloworldwsclient.HelloWorldClient
+
+<h3>Results</h3>
+
+<p>The sample when run should simply display to the standard
+ output:<br>
+
+ <code>Hello World</code></p>
+
+<h3>Code Overview</h3>
+
+The source files are physically organized as shown below:<br>
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td>main<br>
+
+ +---java<br>
+
+ ¦ ¦
+ sca.module<br>
+
+ ¦ ¦<br>
+
+ ¦ +---org<br>
+
+ ¦
+ +---apache<br>
+
+ ¦
+ +---tuscany<br>
+
+ ¦
+ +---samples<br>
+
+ ¦
+ +---helloworldwsclient<br>
+ ¦
+ HelloWorldClient.java<br>
+ ¦
+ HelloWorldService.java<br>
+ ¦
+ HelloWorldServiceComponentImpl.java<br>
+
+ ¦<br>
+
+ +---resources<br>
+
+ ¦
+ tuscany-model.config<br>
+
+ ¦<br>
+
+ +---wsdl<br>
+
+
+ helloworld.wsdl<br>
+
+ <br>
+
+ </td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+<br>
+
+<br>
+
+<table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2">
+
+ <tbody>
+
+ <tr>
+
+ <td style="vertical-align: top; height: 62px;">sca.module</td>
+
+ <td style="height: 62px;">Defines the SCA module,
+ externalService
+ and component. Defines for the
+ HelloWorldServiceComponent component and the Java class that
+ implements the component For the externalService it defines WSDL for
+ the
+ service, the Java interface provided by the service.
+ The the HelloWorldServiceComponent is via a
+ referenced wired to the externalService</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldClient.java</td>
+
+ <td>Creates a Tuscany runtime and starts it.
+ Obtains the module context which was defined by the
+ sca.module file. From the module context locates the
+ HelloWorldServiceComponent and then calls the getGreetings
+ method to invoke the component.</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top; height: 26px;">HelloWorldService.java</td>
+
+ <td style="height: 26px;">Defines the Java interface
+ implemented by the component.</td>
+
+ </tr>
+
+ <tr>
+
+ <td style="vertical-align: top;">HelloWorldServiceComponentImpl.java</td>
+
+ <td>It does not directly implement the service; instead it
+ has an SCA reference that is wired in the sca.module to an
+ externalService that will provide the service. The service providing the implementation is the <a
+ href="../helloworldws/readme.htm" target="_blank">helloworldws</a> sample.<br>
+
+ </td>
+
+ </tr>
+
+ <tr>
+
+ <td>tuscany-model.config</td>
+
+ <td>Maps the SCA Entry point WSDL to the physical WSDL file
+ location.</td>
+
+ </tr>
+
+ <tr>
+
+ <td>helloworld.wsdl</td>
+
+ <td>WSDL for the service.</td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+</body></html>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldClient.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldClient.java new file mode 100644 index 0000000000..beece1cae4 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldClient.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldwsclient; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component + * and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Start the runtime + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + String value = helloworldService.getGreetings("World"); + + System.out.println(value); + + // Stop the runtime + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldService.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldService.java new file mode 100644 index 0000000000..00e0af3a9d --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldwsclient; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..62702b50bb --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldServiceComponentImpl.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldwsclient; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; +import org.osoa.sca.annotations.Reference; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +//FIXME workaround for JIRA TUSCANY-41 +@Scope("MODULE") +public class HelloWorldServiceComponentImpl implements HelloWorldService { + + @Reference + public HelloWorldService hellowWorldService = null; // Injected by the SCA container. + + /** + * @see org.apache.tuscany.samples.helloworldwsclient.HelloWorldService#getGreetings(java.lang.String) + */ + public String getGreetings(final String name) { + assert null != hellowWorldService : "helloWorldService was not set by the SCA runtime!"; + + return hellowWorldService.getGreetings(name); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/axis2.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/axis2.xml new file mode 100644 index 0000000000..a38cf9864a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/axis2.xml @@ -0,0 +1,167 @@ +<axisconfig name="AxisJava2.0"> + <!-- ================================================= --> + <!-- Parameters --> + <!-- ================================================= --> + <parameter name="hotdeployment" locked="false">false</parameter> + <parameter name="hotupdate" locked="false">false</parameter> + <parameter name="enableMTOM" locked="false">false</parameter> + <!-- Uncomment this to enable REST support --> + <!-- <parameter name="enableREST" locked="false">true</parameter>--> + + + <parameter name="userName" locked="false">admin</parameter> + <parameter name="password" locked="false">axis2</parameter> + + <parameter name="seralizeLocation" locked="false">.</parameter> + <hostConfiguration> + <ip>127.0.0.1</ip> + <port>5555</port> + </hostConfiguration> + + + <!--if you want to extract the service archive file and work with that please uncomment this--> + <!--else , it wont extract archive file or does not take into consideration if someone drop--> + <!--exploded directory into /service directory--> + <!--<parameter name="extractServiceArchive" locked="false">true</parameter>--> + + + <!-- The way of adding listener to the system--> + <!-- <listener class="org.apache.axis2.ObserverIMPL">--> + <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>--> + <!-- </listener>--> + + <!-- ================================================= --> + <!-- Message Receivers --> + <!-- ================================================= --> + <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for --> + <!--all the other MEP implement it and add the correct entry to here , so that you can refer from--> + <!--any operation --> + <!--Note : You can ovride this for particular service by adding the same element with your requirement--> + <messageReceivers> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" + class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" + class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> + </messageReceivers> + <!-- ================================================= --> + <!-- Transport Ins --> + <!-- ================================================= --> + <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer"> + <parameter name="port" locked="false">6060</parameter> + </transportReceiver> + + <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver + <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener"> + <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter> + <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter> + <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter> + <parameter name="transport.mail.pop3.port" locked="false">110</parameter> + <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter> + </transportReceiver> --> + + <!--REMOVED FOR TUSCANY transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"> + <parameter name="port" locked="false">6060</parameter> + </transportReceiver --> + + <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener"> + <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter> + <parameter name="java.naming.factory.initial" locked="false"> + org.activemq.jndi.ActiveMQInitialContextFactory</parameter> + <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> + </transportReceiver> + --> + + <!-- ================================================= --> + <!-- Transport Outs --> + <!-- ================================================= --> + + <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> --> + <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/> + <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> --> + <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding" locked="false">chunked</parameter> + </transportSender> + <transportSender name="https" + class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding" locked="false">chunked</parameter> + </transportSender> + + <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver + <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> + <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter> + <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter> + <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter> + <parameter name="transport.mail.smtp.port" locked="false">25</parameter> + </transportSender> + --> + + <!-- ================================================= --> + <!-- Global Modules --> + <!-- ================================================= --> + <!-- Comment this to disable Addressing --> + <!--REMOVED FOR TUSCANY module ref="addressing"/> --> + + + <!--Configuring module , providing parameters for modules whether they refer or not--> + <!--<moduleConfig name="addressing">--> + <!--<parameter name="addressingPara" locked="false">N/A</parameter>--> + <!--</moduleConfig>--> + + <!-- ================================================= --> + <!-- Phases --> + <!-- ================================================= --> + <phaseOrder type="inflow"> + <!-- System pre defined phases --> + <phase name="TransportIn"/> + <phase name="PreDispatch"/> + <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> + <handler name="AddressingBasedDispatcher" + class="org.apache.axis2.engine.AddressingBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="RequestURIBasedDispatcher" + class="org.apache.axis2.engine.RequestURIBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="SOAPActionBasedDispatcher" + class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="SOAPMessageBodyBasedDispatcher" + class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + <handler name="InstanceDispatcher" + class="org.apache.axis2.engine.InstanceDispatcher"> + <order phase="PostDispatch"/> + </handler> + </phase> + <!-- System pre defined phases --> + <!-- After Postdispatch phase module author or or service author can add any phase he want --> + <phase name="userphase1"/> + </phaseOrder> + <phaseOrder type="outflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + <!--system predefined phase--> + <!--these phase will run irrespective of the service--> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> + <phaseOrder type="INfaultflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + </phaseOrder> + <phaseOrder type="Outfaultflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> +</axisconfig> + diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/sca.module new file mode 100644 index 0000000000..9642b2157d --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/sca.module @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="sampleHelloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.helloworldwsclient.HelloWorldServiceComponentImpl"/>
+ <references>
+ <v:hellowWorldService>HelloWorldService</v:hellowWorldService>
+ </references>
+ </component>
+
+ <externalService name="HelloWorldService">
+ <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#HelloWorldServiceImpl"/>
+ <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#helloworld"/>
+ <!--
+ <interface.java interface="org.apache.tuscany.samples.helloworldwsclient.HelloWorldServiceComponent"/>
+ <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#wsdl.endpoint(HelloWorldServiceImplService/helloworldws)"/>
+ -->
+ </externalService> + + <import.wsdl + location="wsdl/helloworld.wsdl" + namespace="http://helloworldaxis.samples.tuscany.apache.org"/> +
+</module>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..75b732e3a5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <!-- Tuscany SCA Service --> + <wsdlsoap:address location="http://localhost:8080/helloworldws-SNAPSHOT/services/HelloWorldService"/> +
+ <!-- Axis Web Service -->
+ <!-- + <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc-SNAPSHOT/services/helloworld"/>
+ --> +
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/pom.xml new file mode 100644 index 0000000000..f9cefafaca --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/pom.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples</groupId> + <artifactId>tuscany-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <packaging>pom</packaging> + <name>Tuscany HelloWorld Samples</name> + <version>SNAPSHOT</version> + + <modules> + <module>helloworld</module> + <!-- + <module>helloworldaxis</module> + <module>helloworldaxissvc</module> + --> + <module>helloworldjs</module> + <module>helloworldmc</module> + <module>helloworldweb</module> + <module>helloworldws</module> + <module>helloworldwsclient</module> + </modules> +</project> |