tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r451144 - in /incubator/tuscany/java: samples/sca/spring/ samples/sca/spring/client/src/main/java/sample/ samples/sca/spring/client/src/main/webapp/ samples/sca/spring/client/src/main/webapp/META-INF/sca/ samples/sca/spring/client/src/main/...
Date Fri, 29 Sep 2006 07:29:01 GMT
Author: jmarino
Date: Fri Sep 29 00:28:58 2006
New Revision: 451144

URL: http://svn.apache.org/viewvc?view=rev&rev=451144
Log:
[PATCH] commit patch from Andy for TUSCANY-699; ScaWebApplicationContext not added yet pendng changes to web app bootstrapper

Added:
    incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java   (with props)
Modified:
    incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBean.java
    incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBeanImpl.java
    incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponent.java
    incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponentImpl.java
    incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/META-INF/sca/default.scdl
    incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/classes/application-context.xml
    incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/web.xml
    incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/test.jsp
    incubator/tuscany/java/samples/sca/spring/pom.xml
    incubator/tuscany/java/samples/sca/spring/server/pom.xml
    incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponent.java
    incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponentImpl.java
    incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/classes/application-context.xml
    incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml
    incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/test.jsp
    incubator/tuscany/java/sca/kernel/core/pom.xml
    incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/Launcher.java
    incubator/tuscany/java/sca/services/containers/container.spring/pom.xml
    incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java
    incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java
    incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java
    incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java
    incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml
    incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
    incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/test.xml
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingService.java
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBean.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBean.java (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBean.java Fri Sep 29 00:28:58 2006
@@ -5,4 +5,5 @@
  */
 public interface TestBean {
   TestComponent getTestComponent();
+  String getName();
 }

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBeanImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBeanImpl.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBeanImpl.java (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestBeanImpl.java Fri Sep 29 00:28:58 2006
@@ -24,9 +24,18 @@
 
 public class TestBeanImpl implements TestBean {
   private TestComponent testComponent;
+  private String name;
 
   public TestComponent getTestComponent() {
     return testComponent;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getName() {
+    return name;
   }
 
   public void setTestComponent(TestComponent testComponent) {

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponent.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponent.java (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponent.java Fri Sep 29 00:28:58 2006
@@ -7,4 +7,5 @@
 
     String echo(String msg);
 
+    String getName();
 }

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponentImpl.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponentImpl.java (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/java/sample/TestComponentImpl.java Fri Sep 29 00:28:58 2006
@@ -23,9 +23,18 @@
  */
 
 public class TestComponentImpl implements TestComponent {
+  private String name;
 
 
-    public String echo(String msg) {
-        return msg;
-    }
+  public String echo(String msg) {
+      return msg;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
 }

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/META-INF/sca/default.scdl?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/META-INF/sca/default.scdl Fri Sep 29 00:28:58 2006
@@ -19,7 +19,7 @@
 -->
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="SpringSample">
     <component name="SpringSample">
-        <implementation.spring location="application-context.xml">
+        <implementation.spring>
             <reference name="testReference">
                 <interface.java interface="sample.TestComponent"/>
                 <binding.socket host="localhost" port="8888"/>
@@ -27,7 +27,13 @@
         </implementation.spring>
     </component>
 
-    <component name="ScaComponent">
-        <implementation.java class="sample.TestComponentImpl"/>
-    </component>
+    <!--component name="ScaComponent">
+        <implementation.spring location="application-context.xml">
+            <service name="testService">
+                <interface.java interface="sample.TestComponent"/>
+                <binding.test/>
+                <reference>testComponent</reference>
+            </service>
+        </implementation.spring>
+    </component-->
 </composite>

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/classes/application-context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/classes/application-context.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/classes/application-context.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/classes/application-context.xml Fri Sep 29 00:28:58 2006
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:sca="http://www.springframework.org/schema/sca"
-       xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://bjlinux15/tuscany/spring-sca.xsd">
-
-    <bean id="testBean" class="sample.TestBeanImpl" lazy-init="true">
-        <property name="testComponent" ref="testReference"/>
-    </bean>
-
-  <!--<sca:reference name="testReference" type="sample.TestComponent"/>   -->
-
-</beans>

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/web.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/web.xml Fri Sep 29 00:28:58 2006
@@ -24,12 +24,12 @@
     <display-name>Tuscany Spring Sample</display-name>
 
     <context-param>
-        <param-name>systemScdlPath</param-name>
-        <param-value>/META-INF/sca/webapp.system.scdl</param-value>
+        <param-name>tuscany.systemScdlPath</param-name>
+        <param-value>/META-INF/tuscany/webapp.scdl</param-value>
     </context-param>
 
     <context-param>
-        <param-name>applicationScdlPath</param-name>
+        <param-name>tuscany.applicationScdlPath</param-name>
         <param-value>/META-INF/sca/default.scdl</param-value>
     </context-param>
 
@@ -38,6 +38,12 @@
         <param-value>SpringSample</param-value>
     </context-param>
 
+    <context-param>
+      <param-name>contextClass</param-name>
+      <param-value>org.apache.tuscany.container.spring.webapp.ScaWebApplicationContext</param-value>
+    </context-param>
+
+    <!-- Filter is required to set the CompositeContext per thread/request -->
     <filter>
         <filter-name>TuscanyFilter</filter-name>
         <filter-class>org.apache.tuscany.runtime.webapp.TuscanyFilter</filter-class>
@@ -45,27 +51,12 @@
 
     <filter-mapping>
         <filter-name>TuscanyFilter</filter-name>
-        <url-pattern>*</url-pattern>
+        <url-pattern>/*</url-pattern>
     </filter-mapping>
 
-    <listener>
-        <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
-    </listener>
 
     <listener>
-        <listener-class>org.apache.tuscany.runtime.webapp.TuscanySessionListener</listener-class>
+      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
-
-    <servlet>
-        <servlet-name>TuscanyServlet</servlet-name>
-        <display-name>Tuscany Servlet</display-name>
-        <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>TuscanyServlet</servlet-name>
-        <url-pattern>/services/*</url-pattern>
-    </servlet-mapping>
-
 
 </web-app>

Modified: incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/test.jsp
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/test.jsp?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/test.jsp (original)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/test.jsp Fri Sep 29 00:28:58 2006
@@ -1,6 +1,7 @@
 <%@ page import="org.osoa.sca.CompositeContext" %>
 <%@ page import="org.osoa.sca.CurrentCompositeContext" %>
 <%@ page import="sample.TestBean" %>
+<%@ page import="sample.TestComponent"%>
 <%--
 
 Demonstrates accessing the current application context
@@ -9,17 +10,15 @@
 <html>
 <head><title>Tuscany Spring sample</title></head>
 
-<body>A Sample Spring application</body>
+<body>
+<h1>A Sample Spring application</h1>
 <%
     CompositeContext context = CurrentCompositeContext.getContext();
     // locates a bean in the Spring context
 
-    TestBean testBean = context.locateService(TestBean.class, "testBean");
-    System.out.println("component" + (testBean.getTestComponent() != null));
-    System.out.println("bean:" + testBean);
-
-    System.out.println("component: " + context.locateService(TestBean.class, "ScaComponent"));
-
-    System.out.println("injected component: " + testBean.getTestComponent().echo("hello"));
-%>
+    TestBean testBean = context.locateService(TestBean.class, "testBean");%>
+<p>Client side bean: <b><%= testBean.getName() %></b></p>
+<p>Injected server component: <b><%= testBean.getTestComponent().getName() %></b></p>
+<p>Invoke of server component echo: <b><%= testBean.getTestComponent().echo("hello") %></b></p>
+</body>
 </html>

Modified: incubator/tuscany/java/samples/sca/spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/pom.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/pom.xml Fri Sep 29 00:28:58 2006
@@ -33,6 +33,7 @@
 
     <modules>
         <module>client</module>
+        <module>server</module>
     </modules>
 
 </project>

Modified: incubator/tuscany/java/samples/sca/spring/server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/pom.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/server/pom.xml Fri Sep 29 00:28:58 2006
@@ -69,12 +69,6 @@
             <scope>runtime</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>test</artifactId>
-            <version>${sca.version}</version>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring</artifactId>
             <version>2.0-rc3</version>

Modified: incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponent.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponent.java (original)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponent.java Fri Sep 29 00:28:58 2006
@@ -7,4 +7,5 @@
 
     String echo(String msg);
 
+    String getName();
 }

Modified: incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponentImpl.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponentImpl.java (original)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/java/sample/TestComponentImpl.java Fri Sep 29 00:28:58 2006
@@ -24,6 +24,15 @@
 
 public class TestComponentImpl implements TestComponent {
 
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
 
     public String echo(String msg) {
         return msg;

Modified: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/classes/application-context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/classes/application-context.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/classes/application-context.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/classes/application-context.xml Fri Sep 29 00:28:58 2006
@@ -8,6 +8,7 @@
 
 
     <bean id="testBean" class="sample.TestComponentImpl">
+        <property name="name" value="My test component"/>
     </bean>
 
   <!--<sca:reference name="testReference" type="sample.TestComponent"/>   -->

Modified: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml Fri Sep 29 00:28:58 2006
@@ -6,12 +6,12 @@
     <display-name>Tuscany Spring Sample</display-name>
 
     <context-param>
-        <param-name>systemScdlPath</param-name>
-        <param-value>/META-INF/sca/webapp.system.scdl</param-value>
+        <param-name>tuscany.systemScdlPath</param-name>
+        <param-value>/META-INF/tuscany/webapp.scdl</param-value>
     </context-param>
 
     <context-param>
-        <param-name>applicationScdlPath</param-name>
+        <param-name>tuscany.applicationScdlPath</param-name>
         <param-value>/META-INF/sca/default.scdl</param-value>
     </context-param>
 
@@ -27,7 +27,7 @@
 
     <filter-mapping>
         <filter-name>TuscanyFilter</filter-name>
-        <url-pattern>*</url-pattern>
+        <url-pattern>/*</url-pattern>
     </filter-mapping>
 
     <listener>
@@ -49,5 +49,5 @@
         <url-pattern>/services/*</url-pattern>
     </servlet-mapping>
 
-    
+
 </web-app>

Modified: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/test.jsp
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/test.jsp?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/test.jsp (original)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/test.jsp Fri Sep 29 00:28:58 2006
@@ -1,15 +0,0 @@
-<%@ page import="org.osoa.sca.CompositeContext" %>
-<%@ page import="org.osoa.sca.CurrentCompositeContext" %>
-<%@ page import="sample.TestBean" %>
-<%--
-
-Demonstrates accessing the current application context
---%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<html>
-<head><title>Tuscany Spring sample</title></head>
-
-<body>A Sample Spring application</body>
-
-Spring server application
-</html>
\ No newline at end of file

Modified: incubator/tuscany/java/sca/kernel/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/pom.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/pom.xml (original)
+++ incubator/tuscany/java/sca/kernel/core/pom.xml Fri Sep 29 00:28:58 2006
@@ -37,6 +37,12 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.tuscany.sca.kernel</groupId>
+            <artifactId>tuscany-host-api</artifactId>
+            <version>${sca.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.tuscany</groupId>
             <artifactId>commonj-api_r1.1</artifactId>
         </dependency>

Modified: incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/Launcher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/Launcher.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/Launcher.java (original)
+++ incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/Launcher.java Fri Sep 29 00:28:58 2006
@@ -33,23 +33,23 @@
     /**
      * Boot the Tuscany runtime.
      *
-     * @param systemScdl the SCDL defining the runtime's system configuration
+     * @param systemScdl        the SCDL defining the runtime's system configuration
      * @param systemClassLoader the root classloader to use to deploy the system SCDL
-     * @param monitorFactory the monitor factory initialize the runtime with
+     * @param monitorFactory    the monitor factory initialize the runtime with
      * @throws TuscanyException if there was a problem booting the runtimr
      */
     void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitorFactory)
-        throws TuscanyException;
+            throws TuscanyException;
 
     /**
      * Shutdown the Tuscany runtime.
      */
     void shutdownRuntime();
-
+    
     /**
      * Boot a default application into the runtime.
      *
-     * @param applicationScdl the application's SCDL
+     * @param applicationScdl        the application's SCDL
      * @param applicationClassLoader the classloader to use to deploy the application
      * @return the CompositeContext for the application
      */

Modified: incubator/tuscany/java/sca/services/containers/container.spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/pom.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/pom.xml (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/pom.xml Fri Sep 29 00:28:58 2006
@@ -39,6 +39,20 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.tuscany.sca.kernel</groupId>
+            <artifactId>core</artifactId>
+            <version>${sca.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca.runtime</groupId>
+            <artifactId>webapp</artifactId>
+            <version>${sca.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring</artifactId>
             <version>2.0-rc3</version>
@@ -49,7 +63,7 @@
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
             <version>1.0.4</version>
-            <scope>runtime</scope>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
@@ -61,6 +75,12 @@
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymockclassextension</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
         </dependency>
 
     </dependencies>

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java Fri Sep 29 00:28:58 2006
@@ -1,24 +1,23 @@
 /*
- * Copyright 2002-2006 the original author or authors.
+ * 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
  *
- * Licensed 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.
+ *   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 org.apache.tuscany.container.spring.config;
 
-import org.apache.tuscany.spi.model.CompositeComponentType;
-
-import org.apache.tuscany.container.spring.impl.SpringScaAdapter;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -28,19 +27,23 @@
 import org.springframework.sca.ScaAdapterAware;
 import org.springframework.sca.ScaAdapterPostProcessor;
 
+import org.apache.tuscany.container.spring.impl.SpringScaAdapter;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+
 /**
  * @author Andy Piper
  * @since 2.1
  */
 public class ScaApplicationContext extends AbstractXmlApplicationContext {
+    public static final String APP_CONTEXT_PROP = "org.springframework.sca.application.context";
     private Resource appXml;
-    private CompositeComponentType componentType;
+    private SpringComponentType componentType;
 
-    public ScaApplicationContext(Resource appXml, CompositeComponentType componentType) {
+    public ScaApplicationContext(Resource appXml, SpringComponentType componentType) {
         this(null, appXml, componentType);
     }
 
-    public ScaApplicationContext(ApplicationContext parent, Resource appXml, CompositeComponentType componentType) {
+    public ScaApplicationContext(ApplicationContext parent, Resource appXml, SpringComponentType componentType) {
         super(parent);
         this.appXml = appXml;
         this.componentType = componentType;
@@ -50,7 +53,7 @@
     protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
         // beanDefinitionReader.setEntityResolver(null);
         beanDefinitionReader
-            .setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(getClassLoader(), componentType));
+                .setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(getClassLoader(), componentType));
     }
 
     protected Resource[] getConfigResources() {

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java Fri Sep 29 00:28:58 2006
@@ -18,21 +18,20 @@
  */
 package org.apache.tuscany.container.spring.impl;
 
-import org.osoa.sca.annotations.Constructor;
+import org.springframework.context.support.AbstractRefreshableApplicationContext;
+import org.springframework.core.io.Resource;
+import org.springframework.sca.ScaServiceExporter;
 
+import org.apache.tuscany.container.spring.config.ScaApplicationContext;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
 import org.apache.tuscany.spi.annotation.Autowire;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.loader.LoaderRegistry;
-
-import org.apache.tuscany.container.spring.config.ScaApplicationContext;
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.apache.tuscany.container.spring.model.SpringImplementation;
-import org.springframework.context.support.AbstractRefreshableApplicationContext;
-import org.springframework.core.io.Resource;
-import org.springframework.sca.ScaServiceExporter;
+import org.apache.tuscany.host.RuntimeInfo;
 
 /**
  * Loads a component type for a Spring <code>ApplicationContext</code>. The implementation creates a new instance of a
@@ -44,9 +43,11 @@
 public class SpringComponentTypeLoader extends ComponentTypeLoaderExtension<SpringImplementation> {
     public static final String SERVICE_BEAN_SUFFIX = ".SCAService";
 
-    @Constructor
-    public SpringComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry) {
+    private org.apache.tuscany.host.RuntimeInfo runtimeInfo;
+
+    public SpringComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry, @Autowire RuntimeInfo runtimeInfo) {
         super(loaderRegistry);
+        this.runtimeInfo = runtimeInfo;
     }
 
     @Override
@@ -71,7 +72,12 @@
         Resource resource = implementation.getApplicationResource();
         SpringComponentType componentType = new SpringComponentType();
         // REVIEW andyp -- pass in deploymentContext.getClassLoader()?
-        AbstractRefreshableApplicationContext ctx = new ScaApplicationContext(resource, componentType);
+        AbstractRefreshableApplicationContext ctx;
+        if (runtimeInfo instanceof SpringRuntimeInfo) {
+            ctx = ((SpringRuntimeInfo) runtimeInfo).getApplicationContext();
+        } else {
+            ctx = new ScaApplicationContext(resource, componentType);
+        }
         componentType.setApplicationContext(ctx); // FIXME andyp@bea.com -- don't do this!
 
         // If there are <sca:service> elements, they define (and limit) the services exposed

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java Fri Sep 29 00:28:58 2006
@@ -60,10 +60,10 @@
 import org.apache.tuscany.spi.loader.MissingResourceException;
 import org.apache.tuscany.spi.model.BoundReferenceDefinition;
 import org.apache.tuscany.spi.model.BoundServiceDefinition;
-import org.apache.tuscany.host.RuntimeInfo;
 
 import org.apache.tuscany.container.spring.model.SpringComponentType;
 import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.apache.tuscany.host.RuntimeInfo;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.UrlResource;
 
@@ -97,13 +97,15 @@
         throws XMLStreamException, LoaderException {
 
         String locationAttr = reader.getAttributeValue(null, "location");
-        if (locationAttr == null) {
+        if (locationAttr == null && !contextProvided()) {
             throw new MissingResourceException("No location supplied");
         }
 
         SpringImplementation implementation = new SpringImplementation();
         ClassLoader classLoader = deploymentContext.getClassLoader();
-        implementation.setApplicationResource(getApplicationContextResource(locationAttr, classLoader));
+        if (!contextProvided()) {
+            implementation.setApplicationResource(getApplicationContextResource(locationAttr, classLoader));
+        }
         registry.loadComponentType(parent, implementation, deploymentContext);
         SpringComponentType type = implementation.getComponentType();
         while (true) {
@@ -203,5 +205,9 @@
             }
         }
         throw new MissingResourceException(APPLICATION_CONTEXT);
+    }
+
+    private boolean contextProvided() {
+        return runtimeInfo instanceof SpringRuntimeInfo;
     }
 }

Added: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java?view=auto&rev=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java Fri Sep 29 00:28:58 2006
@@ -0,0 +1,59 @@
+/*
+ * 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 org.apache.tuscany.container.spring.impl;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.tuscany.host.RuntimeInfo;
+import org.springframework.context.support.AbstractRefreshableApplicationContext;
+
+/**
+ * @author Andy Piper
+ * @since 2.1
+ */
+public class SpringRuntimeInfo implements RuntimeInfo {
+    private AbstractRefreshableApplicationContext applicationContext;
+    private File appRootDir;
+
+    public SpringRuntimeInfo(File appRootDir, AbstractRefreshableApplicationContext applicationContext) {
+        this.appRootDir = appRootDir;
+        this.applicationContext = applicationContext;
+    }
+
+    public AbstractRefreshableApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    public void setApplicationContext(AbstractRefreshableApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+
+    public File getInstallDirectory() {
+        return null;
+    }
+
+    public File getApplicationRootDirectory() {
+        return appRootDir;
+    }
+
+    public URL getBaseURL() {
+        return null;
+    }
+}

Propchange: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java Fri Sep 29 00:28:58 2006
@@ -16,8 +16,7 @@
  */
 package org.apache.tuscany.container.spring.impl;
 
-import org.apache.tuscany.spi.model.CompositeComponentType;
-
+import org.apache.tuscany.container.spring.model.SpringComponentType;
 import org.springframework.sca.ScaAdapter;
 
 /**
@@ -25,14 +24,18 @@
  * @since 2.1
  */
 public class SpringScaAdapter implements ScaAdapter {
-    //private final CompositeComponentType componentType;
+    //private final SpringComponentType componentType;
 
-    public SpringScaAdapter(CompositeComponentType componentType) {
+    public SpringScaAdapter(SpringComponentType componentType) {
         //this.componentType = componentType;
     }
 
     public Object getServiceReference(String referenceName, Class referenceType, String moduleName,
                                       String defaultServiceName) {
+        /*
+        ReferenceDefinition reference = null;
+        componentType.getReferences().put(referenceName, reference);
+        */
         return null;
     }
 
@@ -42,6 +45,10 @@
 
     public void publishAsService(Object serviceImplementation, Class serviceInterface, String serviceName,
                                  String moduleName) {
-        // componentType.getServices().put(serviceName, serviceImplementation);
+        /*
+        componentType.addServiceType(serviceName, serviceInterface);
+        ServiceDefinition service = null;
+        componentType.getServices().put(serviceName, service);
+        */
     }
 }

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml Fri Sep 29 00:28:58 2006
@@ -4,7 +4,7 @@
        xmlns:sca="http://www.springframework.org/schema/sca"
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/SpringSCA.xsd">
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
 
     <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl" lazy-init="true">
         <property name="bean" ref="testReference"/>

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml Fri Sep 29 00:28:58 2006
@@ -4,7 +4,7 @@
        xmlns:sca="http://www.springframework.org/schema/sca"
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/SpringSCA.xsd">
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
 
     <sca:service name="fooBean" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
 

Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/test.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/test.xml?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/test.xml (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/test/resources/test.xml Fri Sep 29 00:28:58 2006
@@ -4,7 +4,7 @@
        xmlns:sca="http://www.springframework.org/schema/sca"
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/SpringSCA.xsd">
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
 
     <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
 

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingService.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingService.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingService.java Fri Sep 29 00:28:58 2006
@@ -79,17 +79,20 @@
             }
             while (!end) {
                 try {
-                    // only handle one client at a time
                     clientSocket = socket.accept();
                     is = new ObjectInputStream(clientSocket.getInputStream());
                     String operation = is.readUTF();
-                    Object o = is.readObject();
+                    int argn = is.readInt();
+                    Object[] args = new Object[argn];
+                    for (int i = 0; i<argn; i++) {
+                        args[i] = is.readObject();
+                    }
                     Map<Operation<?>, InboundInvocationChain> chains = getInboundWire().getInvocationChains();
                     for (InboundInvocationChain chain : chains.values()) {
                         if (chain.getOperation().getName().equals(operation)) {
                             Message message = new MessageImpl();
                             message.setTargetInvoker(chain.getTargetInvoker());
-                            message.setBody(new Object[]{o});
+                            message.setBody(args);
                             message = chain.getHeadInterceptor().invoke(message);
                             os = new ObjectOutputStream(clientSocket.getOutputStream());
                             os.writeObject(message.getBody());

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java?view=diff&rev=451144&r1=451143&r2=451144
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java Fri Sep 29 00:28:58 2006
@@ -57,11 +57,13 @@
      * Sends the payload over a socket
      */
     public Object invokeTarget(final Object object) throws InvocationTargetException {
-        Object payload;
-        if (object != null && !object.getClass().isArray()) {
-            payload = object;
+        int argn;
+        if (object == null) {
+            argn = 0;
+        } else if (!object.getClass().isArray()) {
+            argn = 1;
         } else {
-            payload = ((Object[]) object)[0];
+            argn = ((Object[])object).length;
         }
 
         Socket socket = null;
@@ -71,7 +73,15 @@
             socket = new Socket(host, port);
             os = new ObjectOutputStream(socket.getOutputStream());
             os.writeUTF(operation);
-            os.writeObject(payload);
+            os.writeInt(argn);
+            for (int i=0; i<argn; i++) {
+                if (!object.getClass().isArray()) {
+                    os.writeObject(object);
+                }
+                else {
+                    os.writeObject(((Object[])object)[i]);
+                }
+            }
             os.flush();
             is = new ObjectInputStream(socket.getInputStream());
             return is.readObject();



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


Mime
View raw message