You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/06/25 07:51:32 UTC

svn commit: r550366 - in /incubator/tuscany/java/sca/samples: ./ web-resource/ web-resource/src/ web-resource/src/main/ web-resource/src/main/java/ web-resource/src/main/java/web/ web-resource/src/main/java/web/resource/ web-resource/src/main/resources...

Author: jsdelfino
Date: Sun Jun 24 22:51:31 2007
New Revision: 550366

URL: http://svn.apache.org/viewvc?view=rev&rev=550366
Log:
Added a new sample showing how to use <implementation.resource> and <binding.resource>.

Added:
    incubator/tuscany/java/sca/samples/web-resource/   (with props)
    incubator/tuscany/java/sca/samples/web-resource/pom.xml   (with props)
    incubator/tuscany/java/sca/samples/web-resource/src/
    incubator/tuscany/java/sca/samples/web-resource/src/main/
    incubator/tuscany/java/sca/samples/web-resource/src/main/java/
    incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/
    incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/
    incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java   (with props)
    incubator/tuscany/java/sca/samples/web-resource/src/main/resources/
    incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite   (with props)
    incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/
    incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html   (with props)
Modified:
    incubator/tuscany/java/sca/samples/pom.xml

Modified: incubator/tuscany/java/sca/samples/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/pom.xml?view=diff&rev=550366&r1=550365&r2=550366
==============================================================================
--- incubator/tuscany/java/sca/samples/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/pom.xml Sun Jun 24 22:51:31 2007
@@ -65,6 +65,7 @@
                 <module>simple-bigbank</module>
                 <module>simple-callback</module>
                 <module>supplychain</module>
+                <module>web-resource</module>
             </modules>
         </profile>
 

Propchange: incubator/tuscany/java/sca/samples/web-resource/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jun 24 22:51:31 2007
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/samples/web-resource/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/web-resource/pom.xml?view=auto&rev=550366
==============================================================================
--- incubator/tuscany/java/sca/samples/web-resource/pom.xml (added)
+++ incubator/tuscany/java/sca/samples/web-resource/pom.xml Sun Jun 24 22:51:31 2007
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-samples</artifactId>
+        <version>1.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>sample-web-resource</artifactId>
+    <name>Apache Tuscany Web Resource Sample</name>
+
+    <repositories>
+       <repository>
+          <id>apache.incubator</id>
+          <url>http://people.apache.org/repo/m2-incubating-repository</url>
+       </repository>
+    </repositories>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-resource</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-http-tomcat</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+    
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+
+</project>

Propchange: incubator/tuscany/java/sca/samples/web-resource/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/web-resource/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java?view=auto&rev=550366
==============================================================================
--- incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java (added)
+++ incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java Sun Jun 24 22:51:31 2007
@@ -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:8083/myWeb/index.html");
+            System.out.println();
+            System.in.read();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        scaDomain.close();
+        System.out.println("Sample server stopped");
+    }
+}

Propchange: incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite?view=auto&rev=550366
==============================================================================
--- incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite (added)
+++ incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite Sun Jun 24 22:51:31 2007
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	targetNamespace="http://web"
+    name="WebResource">
+
+	<service name="WebResource" promote="WebResourceComponent">
+		<binding.resource uri="http://localhost:8083/myWeb"/>
+	</service>
+
+    <component name="WebResourceComponent">
+        <implementation.resource location="myContent"/>
+    </component>      
+
+</composite>

Propchange: incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/web-resource/src/main/resources/WebResource.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html?view=auto&rev=550366
==============================================================================
--- incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html (added)
+++ incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html Sun Jun 24 22:51:31 2007
@@ -0,0 +1,50 @@
+<html>
+<!--
+ * 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.    
+ -->
+  <head>
+    <title>Tuscany Sample Web Resource</TITLE>
+  </head>
+
+  <body>
+  	<h1>A Sample Web Resource</h1>
+
+  	<p>Tuscany allows you to publish Web resources using SCA components declared with an
+	<b>&lt;implementation.resource&gt;</b> component implementation type and made available
+	to HTTP clients using a <b>&lt;binding.resource&gt;</b> binding.</p>
+
+  	<p>Here is the SCA composite that publishes this page:</p>
+  	
+  	<pre>
+&lt;composite xmlns=&quot;http://www.osoa.org/xmlns/sca/1.0&quot;
+  targetNamespace=&quot;http://web&quot;
+  name=&quot;WebResource&quot;&gt;
+
+  &lt;service name=&quot;WebResource&quot; promote=&quot;WebResourceComponent&quot;&gt;
+    &lt;binding.resource uri=&quot;http://localhost:8083/myWeb&quot;/&gt;
+  &lt;/service&gt;
+
+  &lt;component name=&quot;WebResourceComponent&quot;&gt;
+    &lt;implementation.resource location=&quot;myContent&quot;/&gt;
+  &lt;/component&gt;      
+
+&lt;/composite&gt;
+  	</pre>
+  	
+  </body>
+</html>

Propchange: incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/web-resource/src/main/resources/myContent/index.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org