You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2009/10/29 19:20:57 UTC

svn commit: r831056 - in /geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet: ./ src/ src/main/ src/main/java/ src/main/java/sample/ src/main/java/sample/ejb3/ src/main/webapp/ src/main/webapp/WEB-INF/

Author: vamsic007
Date: Thu Oct 29 18:20:56 2009
New Revision: 831056

URL: http://svn.apache.org/viewvc?rev=831056&view=rev
Log:
A simple helloworld servlet sample to demonstrate rewiring of EJB references using SCA.

Added:
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml   (with props)
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java   (with props)
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java   (with props)
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml   (with props)
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.composite
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml   (with props)
    geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html   (with props)

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml Thu Oct 29 18:20:56 2009
@@ -0,0 +1,63 @@
+<?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.    
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.geronimo.plugins</groupId>
+        <artifactId>tuscany-samples</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>helloworld-simple-servlet</artifactId>
+    <name>Geronimo Plugins :: Helloworld Simple Servlet sample</name>
+    <packaging>war</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_2.5_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+            </plugin>
+        </plugins>
+        <finalName>${artifactId}</finalName>
+    </build>
+</project>

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java Thu Oct 29 18:20:56 2009
@@ -0,0 +1,69 @@
+/*
+ * 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 java.io.IOException;
+import java.io.Writer;
+
+import javax.ejb.EJB;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osoa.sca.annotations.Reference;
+
+import sample.ejb3.HelloworldService;
+
+/**
+ * Servlet to demonstrate re-wiring of EJB reference through SCA.
+ */
+public class HelloworldServlet extends HttpServlet {
+    private static final long serialVersionUID = -4448818871934180718L;
+
+    @EJB
+    protected HelloworldService service;
+    
+    @Reference
+    protected HelloworldService scaService;
+    
+    @EJB
+    protected HelloworldService ejbService;
+
+    @Override
+    protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        String name = request.getParameter("name");
+        String greeting = service.getGreetings(name);
+        String greeting2 = scaService.getGreetings(name);
+        String greeting3 = ejbService.getGreetings(name);
+
+        Writer out = response.getWriter();
+        out.write("<html><head><title>Apache Tuscany Helloworld Simple Servlet Sample</title></head><body>");
+        out.write("<h2>Apache Tuscany Helloworld Simple Servlet Sample</h2>");
+        out.write("This page displays the responses got from an EJB, an SCA service and an EJB rewired using SCA.");
+        out.write("<br><br>EJB :: HelloworldService.getGreeting: "+name);
+        out.write("<br>"+greeting);
+        out.write("<br><br>SCA :: HelloworldService.getGreeting: "+name);
+        out.write("<br>"+greeting2);
+        out.write("<br><br>EJB rewired using SCA :: HelloworldService.getGreeting: "+name);
+        out.write("<br>"+greeting3);
+        out.write("</body></html>");
+        out.flush();
+        out.close();
+    }
+}

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/HelloworldServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java Thu Oct 29 18:20:56 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.ejb3;
+
+import javax.ejb.Remote;
+
+/**
+ * HelloworldService EJB interface.
+ */
+
+@Remote
+public interface HelloworldService {
+	String getGreetings(String name);
+}

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/java/sample/ejb3/HelloworldService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml Thu Oct 29 18:20:56 2009
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  * 
+  *   http://www.apache.org/licenses/LICENSE-2.0
+  * 
+  * Unless required by applicable law or agreed to in writing,
+  * software distributed under the License is distributed on an
+  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.    
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
+    <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
+        <dep:moduleId>
+            <dep:groupId>test</dep:groupId>
+            <dep:artifactId>helloworld-simple-servlet</dep:artifactId>
+            <dep:version>1.0</dep:version>
+            <dep:type>war</dep:type>
+        </dep:moduleId>
+        <dep:dependencies>
+            <dep:dependency>
+                <dep:groupId>test</dep:groupId>
+                <dep:artifactId>helloworld-simple-ejb</dep:artifactId>
+                <dep:version>1.0</dep:version>
+                <dep:type>jar</dep:type>
+            </dep:dependency>
+        </dep:dependencies>
+    </dep:environment>
+    <context-root>helloworld-simple-servlet</context-root>
+    <nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
+        <nam:ref-name>sample.HelloworldServlet/service</nam:ref-name>
+        <nam:pattern>
+            <nam:groupId>test</nam:groupId>
+            <nam:artifactId>helloworld-simple-ejb</nam:artifactId>
+            <nam:version>1.0</nam:version>
+            <nam:name>HelloworldServiceSimpleBean</nam:name>
+        </nam:pattern>
+    </nam:ejb-ref>
+    <nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
+        <nam:ref-name>sample.HelloworldServlet/ejbService</nam:ref-name>
+        <nam:pattern>
+            <nam:groupId>test</nam:groupId>
+            <nam:artifactId>helloworld-simple-ejb</nam:artifactId>
+            <nam:version>1.0</nam:version>
+            <nam:name>HelloworldServiceSimpleBean</nam:name>
+        </nam:pattern>
+    </nam:ejb-ref>
+</web-app>
\ No newline at end of file

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.composite
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.composite?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.composite (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.composite Thu Oct 29 18:20:56 2009
@@ -0,0 +1,30 @@
+<?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://sample"
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+           name="helloworld-simple-servlet">
+    <component name="helloworld-simple-servlet-war-component">
+        <implementation.web web-uri="helloworld-simple-servlet.war"/>
+        <reference name="sample.HelloworldServlet_scaService" target="HelloworldServiceComponent"/>
+        <reference name="sample.HelloworldServlet_ejbService" target="HelloworldServiceComponent"/>
+    </component>
+</composite>
+

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml Thu Oct 29 18:20:56 2009
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  * 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.    
+-->
+
+<!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>Helloworld Simple Servlet Sample</display-name>
+
+  <servlet>
+     <servlet-name>HelloworldServlet</servlet-name>
+     <servlet-class>sample.HelloworldServlet</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+     <servlet-name>HelloworldServlet</servlet-name>
+     <url-pattern>/HelloworldServlet</url-pattern>
+  </servlet-mapping>
+
+  <welcome-file-list id="WelcomeFileList">
+    <welcome-file>hello.html</welcome-file>
+  </welcome-file-list>
+
+</web-app>

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html?rev=831056&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html Thu Oct 29 18:20:56 2009
@@ -0,0 +1,46 @@
+<!--
+ * 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.
+-->
+<html>
+
+<head>
+<title>Apache Tuscany Helloworld Simple Servlet Sample</title>
+</head>
+
+<body>
+
+<h2>Apache Tuscany Helloworld Simple Servlet Sample</h2>
+
+<form action="HelloworldServlet" method="post">
+    <table>
+        <tr>
+            <td>Enter your name:</td>
+            <td>
+                <input type="text" name="name" width="10">
+            </td>
+        </tr>
+        <tr>
+            <td align="left" colspan="2">
+                <button name="submit" type="submit">Say hello</button>
+            </td>
+        </tr>
+    </table>
+</form>
+
+</body>
+</html>

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-simple-servlet/src/main/webapp/hello.html
------------------------------------------------------------------------------
    svn:mime-type = text/html