tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1041540 - in /tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp: pom.xml src/main/java/demo/EightBallServlet.java src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/web.xml
Date Thu, 02 Dec 2010 19:11:26 GMT
Author: antelder
Date: Thu Dec  2 19:11:25 2010
New Revision: 1041540

URL: http://svn.apache.org/viewvc?rev=1041540&view=rev
Log:
Get the eightball webapp running

Modified:
    tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/pom.xml
    tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java
    tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/
  (props changed)
    tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml

Modified: tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/pom.xml?rev=1041540&r1=1041539&r2=1041540&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/pom.xml
(original)
+++ tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/pom.xml
Thu Dec  2 19:11:25 2010
@@ -28,21 +28,12 @@
 	<name>quickstart</name>
 
 	<dependencies>
-		<!--  TUSCANY DEPENDENCIES -->
             <dependency>
                <groupId>org.apache.tuscany.sca</groupId>
-               <artifactId>tuscany-sca-api</artifactId>
+               <artifactId>tuscany-base-runtime</artifactId>
                <version>${tuscany.version}</version>
-               <scope>provided</scope>
             </dependency>
 
-            <!--  dependency>
-               <groupId>org.apache.tuscany.sca</groupId>
-               <artifactId>tuscany-implementation-web-runtime</artifactId>
-               <version>${tuscany.version}</version>
-               <scope>runtime</scope>
-            </dependency -->
-
 		<!--  JUNIT DEPENDENCY FOR TESTING -->
 		<dependency>
 			<groupId>junit</groupId>
@@ -126,6 +117,42 @@
 					<downloadSources>true</downloadSources>
 				</configuration>
 			</plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-dependency-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>copy</id>
+                <phase>compile</phase>
+                <goals>
+                  <goal>copy</goal>
+                </goals>
+                <configuration>
+                   <artifactItems>
+                     <!-- these should really go in the target folder but i can't get
jetty:run to work using that -->
+                     <artifactItem>
+                       <groupId>demo</groupId>
+                       <artifactId>eightball</artifactId>
+                       <version>${pom.version}</version>
+                       <outputDirectory>src/main/webapp/WEB-INF/sca-contributions</outputDirectory>
+                     </artifactItem>
+                     <artifactItem>
+                       <groupId>demo</groupId>
+                       <artifactId>eightball-process</artifactId>
+                       <version>${pom.version}</version>
+                       <outputDirectory>src/main/webapp/WEB-INF/sca-contributions</outputDirectory>
+                     </artifactItem>
+                     <artifactItem>
+                       <groupId>demo</groupId>
+                       <artifactId>translator</artifactId>
+                       <version>${pom.version}</version>
+                       <outputDirectory>src/main/webapp/WEB-INF/sca-contributions</outputDirectory>
+                     </artifactItem>
+                   </artifactItems>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
 		</plugins>
 	</build>
 	<properties>

Modified: tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java?rev=1041540&r1=1041539&r2=1041540&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java
(original)
+++ tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java
Thu Dec  2 19:11:25 2010
@@ -21,10 +21,13 @@ package demo;
 import java.io.IOException;
 import java.io.Writer;
 
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.oasisopen.sca.ComponentContext;
 import org.oasisopen.sca.annotation.Reference;
 
 /**
@@ -35,6 +38,14 @@ public class EightBallServlet extends Ht
     protected EightBall eightball;
 
     @Override
+    public void init(ServletConfig servletConfig) throws ServletException {
+        if (eightball == null) {
+            ComponentContext cc = (ComponentContext)servletConfig.getServletContext().getAttribute("org.oasisopen.sca.ComponentContext");
+            eightball = cc.getService(EightBall .class, "eightball");
+        }
+    }
+
+    @Override
     protected void service(HttpServletRequest request, HttpServletResponse response) throws
IOException {
     	String question = request.getParameter("question");
     	String answer = eightball.askQuestion(question);

Propchange: tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec  2 19:11:25 2010
@@ -0,0 +1 @@
+sca-contributions

Modified: tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml?rev=1041540&r1=1041539&r2=1041540&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml
(original)
+++ tuscany/sca-java-2.x/trunk/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml
Thu Dec  2 19:11:25 2010
@@ -24,6 +24,8 @@
 
     <display-name>eightball-webapp</display-name>
 
+    <listener><listener-class>org.apache.tuscany.sca.host.webapp.TuscanyContextListener</listener-class></listener>
+
     <servlet>
         <servlet-name>EightBallServlet</servlet-name>
         <servlet-class>demo.EightBallServlet</servlet-class>
@@ -39,3 +41,4 @@
     </welcome-file-list>
 
 </web-app>
+



Mime
View raw message