You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/05/11 21:02:59 UTC

svn commit: r537266 - in /incubator/tuscany/java/sca/samples/das-service/webclient: ./ src/main/java/das/ src/main/resources/ src/main/webapp/ src/main/webapp/WEB-INF/

Author: lresende
Date: Fri May 11 12:02:58 2007
New Revision: 537266

URL: http://svn.apache.org/viewvc?view=rev&rev=537266
Log:
Bring-up das-web sample using TuscanyContextListener

Added:
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/java/das/
      - copied from r536568, incubator/tuscany/java/sca/samples/das-service/service/src/main/java/das/
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/java/das/DASService.java
      - copied unchanged from r537261, incubator/tuscany/java/sca/samples/das-service/service/src/main/java/das/DASService.java
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/java/das/DASServiceException.java
      - copied unchanged from r537261, incubator/tuscany/java/sca/samples/das-service/service/src/main/java/das/DASServiceException.java
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/java/das/DASServiceImpl.java
      - copied unchanged from r537261, incubator/tuscany/java/sca/samples/das-service/service/src/main/java/das/DASServiceImpl.java
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/resources/dasservice.composite
Removed:
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/default.composite
Modified:
    incubator/tuscany/java/sca/samples/das-service/webclient/pom.xml
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml

Modified: incubator/tuscany/java/sca/samples/das-service/webclient/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/webclient/pom.xml?view=diff&rev=537266&r1=537265&r2=537266
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/webclient/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/das-service/webclient/pom.xml Fri May 11 12:02:58 2007
@@ -35,7 +35,7 @@
         <!-- runtime is need for webapp integration to include jar -->
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-embedded</artifactId>
+            <artifactId>tuscany-host-webapp</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
 
@@ -46,13 +46,7 @@
             <scope>runtime</scope>
         </dependency>
         
-        <!--  das service -->
-        <dependency>
-	    <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-samples-das-service-service</artifactId>
-            <version>1.0-incubating-SNAPSHOT</version>
-        </dependency>
-        
+        <!--  das & sdo -->
         <dependency>
             <groupId>org.apache.tuscany.das</groupId>
             <artifactId>tuscany-das-rdb</artifactId>
@@ -67,28 +61,18 @@
             <scope>compile</scope>
         </dependency>
 
+        <!-- testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <!-- this will place the java source files inside the war -->
     <build>
-       <!-- <finalName>companyweb-service-client</finalName> -->
-       <!-- plugins>
-    	<plugin>
-    	    <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
-    	    <artifactId>tuscany-war-plugin</artifactId>
-    	    <executions>
-    		<execution>
-    		    <id>tuscany-war</id>
-    		    <goals>
-    			<goal>tuscany-war</goal>
-    		    </goals>
-    		</execution>
-    	    </executions>
-    	</plugin>
-       </plugins -->
-
-    
-    
+        <finalName>${artifactId}</finalName>
         <sourceDirectory>src/main/java</sourceDirectory>
         <resources>
             <resource>

Added: incubator/tuscany/java/sca/samples/das-service/webclient/src/main/resources/dasservice.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/webclient/src/main/resources/dasservice.composite?view=auto&rev=537266
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/webclient/src/main/resources/dasservice.composite (added)
+++ incubator/tuscany/java/sca/samples/das-service/webclient/src/main/resources/dasservice.composite Fri May 11 12:02:58 2007
@@ -0,0 +1,33 @@
+<?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://DASService"
+            name="DASService">
+
+    <service name="DASService"  promote="DASServiceComponent">
+        <interface.java interface="das.DASService"/>
+        <reference>DASServiceComponent</reference>
+    </service>
+    
+    <component name="DASServiceComponent">
+	    <implementation.java class="das.DASServiceImpl"/>
+    </component>
+
+</composite>

Modified: incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp?view=diff&rev=537266&r1=537265&r2=537266
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp (original)
+++ incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp Fri May 11 12:02:58 2007
@@ -20,9 +20,7 @@
 
 <%@ page import="java.util.*" %>
 
-<%@ page import="org.apache.tuscany.host.embedded.SCARuntime"%>
-<%@ page import="org.osoa.sca.ComponentContext" %>
-<%@ page import="org.osoa.sca.ServiceReference" %>
+<%@ page import="org.apache.tuscany.host.embedded.SCADomain"%>
 
 <%@ page import="commonj.sdo.*" %>
 <%@ page import="das.*" %>
@@ -32,17 +30,24 @@
 <%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
 <%
 
-   SCARuntime.start("dasservice.composite");
+   SCADomain domain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); 
+   if (domain == null) {
+    System.out.println("domain == NULL");
+   }
+
+
+   DASService dasService = domain.getService(DASService.class, "DASServiceComponent");
    
-   ComponentContext context = SCARuntime.getComponentContext("DASServiceComponent");
-   ServiceReference<DASService> service = context.createSelfReference(DASService.class);
-   DASService dasService = service.getService();
+   if (dasService == null) {
+       System.out.println("DASService == NULL");
+   }
+
    List companyList = null;
 
    try{
 		dasService.configureService(getClass().getClassLoader().getResourceAsStream("CompanyConfig.xml"));
 		DataObject root = dasService.executeCommand("all companies", null);
-   	companyList = root.getList("COMPANY");
+   	    companyList = root.getList("COMPANY");
    }catch(Exception e){
        //TODO: handle case where dasService can't be initiated properly
    }
@@ -85,8 +90,4 @@
 
 </form>
 </body>
-<% 
-   //stop the runtime
-   SCARuntime.stop();
-%>
 </html>

Modified: incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml?view=diff&rev=537266&r1=537265&r2=537266
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml Fri May 11 12:02:58 2007
@@ -28,19 +28,8 @@
     </welcome-file-list>
 
     <!--  SCA Related configuration -->
-    <!--
-    <filter>
-        <filter-name>TuscanyFilter</filter-name>
-        <filter-class>org.apache.tuscany.runtime.webapp.TuscanyFilter</filter-class>
-    </filter>
-    <filter-mapping>
-        <filter-name>TuscanyFilter</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
     <listener>
-        <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+     <listener-class>org.apache.tuscany.sca.webapp.TuscanyContextListener</listener-class>
     </listener>
-    -->
     <!--  END of SCA Related configuration -->
 </web-app>



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