From 82df55ba981ff028bdf376f333d6e1e2cfee3644 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 30 Sep 2009 11:14:44 +0000 Subject: Tag for 1.5.1-RC3 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820247 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/sca/1.5.1-RC3/samples/web-resource/README | 76 ++++++++ .../sca/1.5.1-RC3/samples/web-resource/build.xml | 72 ++++++++ .../sca/1.5.1-RC3/samples/web-resource/pom.xml | 79 +++++++++ .../src/main/java/web/resource/SampleServer.java | 44 +++++ .../src/main/resources/WebResource.composite | 32 ++++ .../src/main/resources/myContent/index.html | 49 +++++ .../samples/web-resource/web-resource.png | Bin 0 -> 8418 bytes .../samples/web-resource/web-resource.svg | 197 +++++++++++++++++++++ 8 files changed, 549 insertions(+) create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/README create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/build.xml create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/pom.xml create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/java/web/resource/SampleServer.java create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/WebResource.composite create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/myContent/index.html create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.png create mode 100644 tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.svg (limited to 'tags/java/sca/1.5.1-RC3/samples/web-resource') diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/README b/tags/java/sca/1.5.1-RC3/samples/web-resource/README new file mode 100644 index 0000000000..56bffba6a3 --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/README @@ -0,0 +1,76 @@ +Web Resource Component Sample +====================================== +This sample demonstrates an SCA Web resource component. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-web-resource.jar web.resource.SampleServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-web-resource.jar web.resource.SampleServer + +Now the server is started you can point your Web browser to the URL of the Web resource. + +Sample Overview +--------------- +The sample provides a single component exposing a Web resource. + +web-resource/ + src/ + main/ + java/ + web/resource/ + SampleServer.java - starts the SCA Runtime and + deploys the WebResource.composite + resources/ + myContent/ + index.html - a Web HTML resource + WebResource.composite - the SCA assembly for this sample + web-resource.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd web-resource +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 14-Jan-2008 14:28:07 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8080/myWeb/* + [java] Sample server started (press enter to shutdown) + [java] + [java] To get the Web resource, point your Web browser to the following add +ress: + [java] http://localhost:8080/myWeb/index.html + [java] + +As this point the Web resource is exposed by a web server started automatically +by the SCA runtime. To stop the server just press enter. + +Building The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built using +Maven as follows. + +cd web-resource +mvn + diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/build.xml b/tags/java/sca/1.5.1-RC3/samples/web-resource/build.xml new file mode 100644 index 0000000000..5f6b6091e7 --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/pom.xml b/tags/java/sca/1.5.1-RC3/samples/web-resource/pom.xml new file mode 100644 index 0000000000..394b23544e --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.5.1 + ../../pom.xml + + sample-web-resource + Apache Tuscany SCA Sample Web Resource + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.5.1 + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 1.5.1 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 1.5.1 + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.5.1 + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/java/web/resource/SampleServer.java b/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/java/web/resource/SampleServer.java new file mode 100644 index 0000000000..9410de08c4 --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/java/web/resource/SampleServer.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package web.resource; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class SampleServer { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("WebResource.composite"); + + try { + System.out.println("Sample server started (press enter to shutdown)"); + System.out.println(); + System.out.println("To get the Web resource, point your Web browser to the following address:"); + System.out.println("http://localhost:8080/myWeb/index.html"); + System.out.println(); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("Sample server stopped"); + } +} diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/WebResource.composite b/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/WebResource.composite new file mode 100644 index 0000000000..66b8f25e17 --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/WebResource.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/myContent/index.html b/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/myContent/index.html new file mode 100644 index 0000000000..55de048373 --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/src/main/resources/myContent/index.html @@ -0,0 +1,49 @@ + + + + Tuscany Sample Web Resource + + + +

A Sample Web Resource

+ +

Tuscany allows you to publish Web resources using SCA components declared with an + <implementation.resource> component implementation type and made available + to HTTP clients using a <binding.http> binding.

+ +

Here is the SCA composite that publishes this page:

+ +
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+  targetNamespace="http://web"
+  name="WebResource">
+
+  <component name="myWeb">
+    <implementation.resource location="myContent"/>
+    <service name="Resource">
+      <binding.http/>
+    </service>
+  </component>      
+
+</composite>
+  	
+ + + diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.png b/tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.png new file mode 100644 index 0000000000..7259447b65 Binary files /dev/null and b/tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.png differ diff --git a/tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.svg b/tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.svg new file mode 100644 index 0000000000..0d1257316c --- /dev/null +++ b/tags/java/sca/1.5.1-RC3/samples/web-resource/web-resource.svg @@ -0,0 +1,197 @@ + + + + + + + + + + image/svg+xml + + + + + + + + WebResource + + + myWeb + implementation.resource + + File System + ./myContent /index.html + + binding.http + + -- cgit v1.2.3