You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/10/01 13:10:17 UTC

svn commit: r820607 - in /tuscany/java/sca/samples/webapps/helloworld-jms: ./ src/main/java/helloworld/ src/main/java/sample/ src/main/webapp/ src/main/webapp/META-INF/sca-deployables/ src/main/webapp/WEB-INF/

Author: antelder
Date: Thu Oct  1 11:10:16 2009
New Revision: 820607

URL: http://svn.apache.org/viewvc?rev=820607&view=rev
Log:
Add new 2.x JMS webapp sample migrated from 1.x

Added:
    tuscany/java/sca/samples/webapps/helloworld-jms/   (props changed)
      - copied from r820598, tuscany/branches/sca-java-1.x/samples/helloworld-jms-webapp/
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite
Removed:
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/helloworld/
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/META-INF/sca-deployables/
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/geronimo-web.xml
Modified:
    tuscany/java/sca/samples/webapps/helloworld-jms/README
    tuscany/java/sca/samples/webapps/helloworld-jms/pom.xml
    tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp

Propchange: tuscany/java/sca/samples/webapps/helloworld-jms/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct  1 11:10:16 2009
@@ -0,0 +1,19 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+derby.log
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders
+activemq-data
+maven-eclipse.xml

Propchange: tuscany/java/sca/samples/webapps/helloworld-jms/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Oct  1 11:10:16 2009
@@ -0,0 +1 @@
+/tuscany/branches/sca-java-1.3/samples/helloworld-jms-webapp:671193

Modified: tuscany/java/sca/samples/webapps/helloworld-jms/README
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/README?rev=820607&r1=820598&r2=820607&view=diff
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/README (original)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/README Thu Oct  1 11:10:16 2009
@@ -9,12 +9,12 @@
 
 As this sample provides a web app there is a manual step where the WAR file
 that contains the sample is copied to your web app container. If you just want 
-to give this sample a go deploy the WAR file (target/sample-helloworld-jms-webapp.war )
+to give this sample a go deploy the WAR file (target/helloworld-jms.war )
 to you web application server. 
 
 Once the web app is deployed use your browser to visit the following URL;
 
-http://localhost:8080/sample-helloworld-jms-webapp/
+http://localhost:8080/helloworld-jms
 
 The port and hostname will of course vary depending on your local installation. 
 

Modified: tuscany/java/sca/samples/webapps/helloworld-jms/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/pom.xml?rev=820607&r1=820598&r2=820607&view=diff
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/pom.xml (original)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/pom.xml Thu Oct  1 11:10:16 2009
@@ -1,64 +1,55 @@
 <?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.    
+ * 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-sca</artifactId>
-        <version>1.6-SNAPSHOT</version>
+        <version>2.0-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
-    <artifactId>sample-helloworld-jms-webapp</artifactId>
+
+    <artifactId>helloworld-jms</artifactId>
     <packaging>war</packaging>
     <name>Apache Tuscany SCA Sample JMS HelloWorld in a WebApp</name>
 
-    <repositories>
-       <repository>
-          <id>apache.incubator</id>
-          <url>http://people.apache.org/repo/m2-incubating-repository</url>
-       </repository>
-    </repositories>
-
     <dependencies>
 
         <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>tuscany-host-webapp</artifactId>
-            <version>${pom.version}</version>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>compile</scope>
         </dependency>
 
         <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>tuscany-binding-jms-runtime</artifactId>
-            <version>${pom.version}</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-jms-asf</artifactId>
-            <version>1.6-SNAPSHOT</version>
+            <artifactId>tuscany-implementation-web-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>runtime</scope>
         </dependency>
 
         <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>tuscany-implementation-java-runtime</artifactId>
-            <version>${pom.version}</version>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jms-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
         </dependency>
 
         <dependency>

Added: tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java?rev=820607&view=auto
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java (added)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java Thu Oct  1 11:10:16 2009
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package sample;
+
+/**
+ * The HelloWorld client implementation
+ */
+public class HelloWorldClient implements HelloWorldService {
+   
+    HelloWorldService helloWorldRef;
+
+    public String sayHello(String name) {
+        System.out.println("HelloWorldClient.sayHello " + name);
+        return helloWorldRef.sayHello(name);
+    }
+
+    public void setHelloWorldRef(HelloWorldService helloWorldRef) {
+        System.out.println("HelloWorldClient .setHelloWorldService " + helloWorldRef);        
+        this.helloWorldRef = helloWorldRef;
+    }
+}
\ No newline at end of file

Added: tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java?rev=820607&view=auto
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java (added)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java Thu Oct  1 11:10:16 2009
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+    public String sayHello(String name);
+}

Added: tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java?rev=820607&view=auto
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java (added)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java Thu Oct  1 11:10:16 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package sample;
+
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+    public String sayHello(String name) {
+        System.out.println("HelloWorldServiceImpl .sayHello " + name);        
+        return "Hello " + name;
+    }
+
+}

Added: tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite?rev=820607&view=auto
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite (added)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite Thu Oct  1 11:10:16 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+           targetNamespace="http://samples"
+           name="Helloworld">
+
+    <component name="foo">
+        <implementation.web web-uri=""/>
+        <reference name="service" target="HelloWorldClientComponent"/>
+    </component>
+
+    <component name="HelloWorldClientComponent">
+        <implementation.java class="sample.HelloWorldClient"/>
+        <reference name="helloWorldRef">
+            <binding.jms uri="jms:HelloWorldService"/>
+        </reference>
+    </component>
+
+    <component name="HelloWorldServiceComponent">
+        <implementation.java class="sample.HelloWorldServiceImpl" />
+	    <service name="HelloWorldService">
+            <binding.jms />
+        </service>
+    </component>
+
+</composite>

Modified: tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp
URL: http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp?rev=820607&r1=820598&r2=820607&view=diff
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp (original)
+++ tuscany/java/sca/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp Thu Oct  1 11:10:16 2009
@@ -17,14 +17,11 @@
  * under the License.
 --%>
 
-<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
-<%@ page import="helloworld.HelloWorldService" %>
-
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%
-   SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
-   HelloWorldService helloWorldService = (HelloWorldService)scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
-%>
+<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %>
+
+<sca:reference name="service" type="sample.HelloWorldService" />
+
 <html>
 <head><title>HelloWorld JMS sample</title></head>
 
@@ -32,7 +29,7 @@
 
 If this sample is working correctly you should see "Hello World" on the next line...
 <p>
-<%= helloWorldService.sayHello("world") %>
+<%= service.sayHello("world") %>
 <p>
 If you do not see "Hello World" on the line above then there has been a problem.
 <p>