You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/07/28 23:01:43 UTC

svn commit: r980218 - in /tuscany/sca-java-2.x/trunk: modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/ modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/we...

Author: rfeng
Date: Wed Jul 28 21:01:41 2010
New Revision: 980218

URL: http://svn.apache.org/viewvc?rev=980218&view=rev
Log:
Allow Spring WebApplicationContext to be used by Tuscany
Bring up a sample web application which demonstrates the integration between Spring and Tuscany

Added:
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/LICENSE
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/MANIFEST.MF   (with props)
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/NOTICE
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/pom.xml   (with props)
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/webapp/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml
      - copied, changed from r980214, tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java   (with props)
Modified:
    tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
    tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
    tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
    tuscany/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
    tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
    tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java
    tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml
    tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite

Modified: tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java Wed Jul 28 21:01:41 2010
@@ -27,6 +27,7 @@ import java.util.List;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.LifeCycleListener;
@@ -173,6 +174,11 @@ public class DefaultServletHostExtension
         public void stop() {
             ServiceHelper.stop(host);
         }
+
+        @Override
+        public ServletContext getServletContext() {
+            return getServletHost().getServletContext();
+        }
     }
 
     public void start() {

Modified: tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java Wed Jul 28 21:01:41 2010
@@ -24,6 +24,7 @@ import java.util.List;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
@@ -131,4 +132,9 @@ public class ExtensibleServletHost imple
     public String getName() {
         return getDefaultServletHost().getName();
     }
+
+    @Override
+    public ServletContext getServletContext() {
+        return getDefaultServletHost().getServletContext();
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java Wed Jul 28 21:01:41 2010
@@ -22,6 +22,7 @@ import java.net.URL;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
 
 /**
  * Interface implemented by host environments that allow Servlets to be
@@ -35,6 +36,8 @@ import javax.servlet.Servlet;
  */
 public interface ServletHost {
     
+    ServletContext getServletContext();
+    
     /**
      * Sets the default port for the server.
      * 

Modified: tuscany/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java Wed Jul 28 21:01:41 2010
@@ -32,12 +32,13 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@@ -80,7 +81,7 @@ public class JettyServer implements Serv
 
     private boolean sendServerVersion;
     private WorkScheduler workScheduler;
-    
+
     // TODO - this static seems to be set by the JSORPC binding unit test
     //        doesn't look to be a great way of doing things
     public static int portDefault = 8080;
@@ -130,12 +131,12 @@ public class JettyServer implements Serv
                 keyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
                 trustStoreType = System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType());
 
-                System.setProperty("JETTY_NO_SHUTDOWN_HOOK", "true");                
+                System.setProperty("JETTY_NO_SHUTDOWN_HOOK", "true");
                 return null;
             }
         });
     }
-    
+
     public String getName() {
         return "jetty";
     }
@@ -181,11 +182,14 @@ public class JettyServer implements Serv
     private void configureSSL(SslSocketConnector connector, SecurityContext securityContext) {
         connector.setProtocol("TLS");
         if (securityContext != null) {
-            keyStoreType = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
+            keyStoreType =
+                securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
             keyStore = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStore");
             keyStorePassword = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStorePassword");
 
-            trustStoreType = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType());
+            trustStoreType =
+                securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStoreType",
+                                                               KeyStore.getDefaultType());
             trustStore = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStore");
             trustStorePassword = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStorePassword");
         }
@@ -203,30 +207,31 @@ public class JettyServer implements Serv
         }
 
     }
-    
+
     public String addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
         return addServletMapping(suri, servlet, null);
-    }    
+    }
 
-    public String addServletMapping(String suri, Servlet servlet, final SecurityContext securityContext) throws ServletMappingException {
+    public String addServletMapping(String suri, Servlet servlet, final SecurityContext securityContext)
+        throws ServletMappingException {
         URI uri = URI.create(suri);
 
         // Get the URI scheme and port
         String scheme = null;
-        if(securityContext != null && securityContext.isSSLEnabled()) {
+        if (securityContext != null && securityContext.isSSLEnabled()) {
             scheme = "https";
         } else {
             scheme = uri.getScheme();
             if (scheme == null) {
                 scheme = "http";
-            }            
+            }
         }
-        
+
         String host = uri.getHost();
         if ("0.0.0.0".equals(host)) {
             host = null;
         }
-        
+
         int portNumber = uri.getPort();
         if (portNumber == -1) {
             if ("http".equals(scheme)) {
@@ -350,21 +355,21 @@ public class JettyServer implements Serv
     public URL getURLMapping(String suri, SecurityContext securityContext) throws ServletMappingException {
         return map(suri, securityContext, true);
     }
-    
+
     private URL map(String suri, SecurityContext securityContext, boolean resolve) throws ServletMappingException {
         URI uri = URI.create(suri);
-        
+
         // Get the URI scheme and port
         String scheme = null;
-        if(securityContext != null && securityContext.isSSLEnabled()) {
+        if (securityContext != null && securityContext.isSSLEnabled()) {
             scheme = "https";
         } else {
             scheme = uri.getScheme();
             if (scheme == null) {
                 scheme = "http";
-            }            
+            }
         }
-        
+
         int portNumber = uri.getPort();
         if (portNumber == -1) {
             if ("http".equals(scheme)) {
@@ -372,7 +377,7 @@ public class JettyServer implements Serv
             } else {
                 portNumber = defaultSSLPort;
             }
-        }        
+        }
 
         // Get the host
         String host = uri.getHost();
@@ -576,7 +581,16 @@ public class JettyServer implements Serv
             Log.setLog(jettyLogger);
         } catch (Throwable e) {
             // Ignore
-        } 
+        }
+    }
+
+    @Override
+    public ServletContext getServletContext() {
+        if (ports.size() > 0) {
+            return ports.values().iterator().next().getServletHandler().getServletContext();
+        } else {
+            return null;
+        }
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java Wed Jul 28 21:01:41 2010
@@ -335,4 +335,8 @@ public class WebAppServletHost implement
             tempAttributes.put(name, value);
         }
     }
+
+    public ServletContext getServletContext() {
+        return servletContext;
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java Wed Jul 28 21:01:41 2010
@@ -93,9 +93,11 @@ public class PropertyAnnotationProcessor
                         throw new IllegalStateException("Property annotation is not supported on static methods");
                     }
 
+                    /*
                     if (Modifier.isPrivate(method.getModifiers())) {
                         throw new IllegalStateException("Property annotation is not supported on private methods");
                     }
+                    */
 
                     if (method.getParameterTypes().length == 0) {
                         throw new IllegalStateException("Property annotation requires at least one argument: " + method);
@@ -124,9 +126,11 @@ public class PropertyAnnotationProcessor
                         throw new IllegalStateException("Property annotation is not supported on static fields");
                     }
 
+                    /*
                     if (Modifier.isPrivate(field.getModifiers())) {
                         throw new IllegalStateException("Property annotation is not supported on private fields");
                     }
+                    */
 
                     ReflectionUtils.makeAccessible(field);
 

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java Wed Jul 28 21:01:41 2010
@@ -92,9 +92,11 @@ public class ReferenceAnnotationProcesso
                         throw new IllegalStateException("Reference annotation is not supported on static methods");
                     }
 
+                    /*
                     if (Modifier.isPrivate(method.getModifiers())) {
                         throw new IllegalStateException("Reference annotation is not supported on private methods");
                     }
+                    */
 
                     if (method.getParameterTypes().length == 0) {
                         throw new IllegalStateException(
@@ -124,9 +126,11 @@ public class ReferenceAnnotationProcesso
                         throw new IllegalStateException("Reference annotation is not supported on static fields");
                     }
 
+                    /*
                     if (Modifier.isPrivate(field.getModifiers())) {
                         throw new IllegalStateException("Reference annotation is not supported on private fields");
                     }
+                    */
 
                     ReflectionUtils.makeAccessible(field);
 

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java Wed Jul 28 21:01:41 2010
@@ -110,10 +110,6 @@ class SCAParentApplicationContext implem
         return EMPTY_ARRAY;
     }
 
-    public ApplicationContext getParent() {
-        return null;
-    }
-
     public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
         return null;
     }
@@ -199,4 +195,10 @@ class SCAParentApplicationContext implem
         // resource loading mechanism is exposed right now.
         return this.getClass().getClassLoader();
     }
+
+    @Override
+    public ApplicationContext getParent() {
+        return implementation.getParentApplicationContext();
+    }
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java Wed Jul 28 21:01:41 2010
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
 
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.context.ApplicationContext;
 
 /**
  * This is the runtime side stub for the corresponding Tuscany-side stub class.
@@ -40,6 +41,7 @@ public class SpringImplementationStub {
     Method getComponentTie;
     Method getPropertyValueTie;
     Method getClassLoader;
+    Method getParentApplicationContext;
 
     public SpringImplementationStub(Object tie) {
         this.tie = tie;
@@ -51,6 +53,7 @@ public class SpringImplementationStub {
             getComponentTie = tieClass.getMethod("getComponentTie");
             getPropertyValueTie = tieClass.getMethod("getPropertyValueTie");
             getClassLoader = tieClass.getMethod("getClassLoader");
+            getParentApplicationContext = tieClass.getMethod("getParentApplicationContext");
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -126,4 +129,19 @@ public class SpringImplementationStub {
             throw new RuntimeException(e);
         }
     }
+    
+    /**
+     * Get the parent Spring application context set by the Tuscany runtime
+     * @return
+     */
+    public ApplicationContext getParentApplicationContext() {
+        try {
+
+            return (ApplicationContext)getParentApplicationContext.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
 }

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/LICENSE?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/LICENSE (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/LICENSE Wed Jul 28 21:01:41 2010
@@ -0,0 +1,205 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
+
+

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/MANIFEST.MF?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/MANIFEST.MF (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/MANIFEST.MF Wed Jul 28 21:01:41 2010
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+SCA-Version: 1.1
+Bundle-Name: Apache Tuscany SCA Spring Implementation WebApp Integration
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Spring Implementation Runtime Model
+Bundle-SymbolicName: org.apache.tuscany.sca.implementation.spring.webapp
+Bundle-DocURL: http://www.apache.org/
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Import-Package: javax.servlet,
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.extensibility;version="2.0.0",
+ org.apache.tuscany.sca.implementation.spring;version="2.0.0",
+ org.apache.tuscany.sca.implementation.spring.invocation;version="2.0.0",
+ org.apache.tuscany.sca.provider;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.springframework.beans;version="3.0.2.RELEASE",
+ org.springframework.beans.factory;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.annotation;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.config;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.support;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.xml;version="3.0.2.RELEASE",
+ org.springframework.context;version="3.0.2.RELEASE",
+ org.springframework.context.support;version="3.0.2.RELEASE",
+ org.springframework.core.io;version="3.0.2.RELEASE",
+ org.springframework.util;version="3.0.2.RELEASE"
+

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/NOTICE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/NOTICE?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/NOTICE (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/NOTICE Wed Jul 28 21:01:41 2010
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/pom.xml?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/pom.xml Wed Jul 28 21:01:41 2010
@@ -0,0 +1,60 @@
+<?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.
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>tuscany-implementation-spring-webapp</artifactId>
+    <name>Apache Tuscany SCA Spring Implementation WebApp Integration</name>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-spring</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-http</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <!-- Spring dependencies... -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>3.0.2.RELEASE</version>
+        </dependency>
+
+        <dependency>
+        	<groupId>javax.servlet</groupId>
+        	<artifactId>servlet-api</artifactId>
+        	<version>2.5</version>
+        	<type>jar</type>
+        	<scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java Wed Jul 28 21:01:41 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.sca.implementation.spring.webapp;
+
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.support.ApplicationObjectSupport;
+
+/**
+ * A singleton utility class that can be added to the Spring application context to receive injection of the containing
+ * Spring application context.
+ * 
+ * The Spring bean definition file is: org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml
+ */
+public class ApplicationContextAccessor extends ApplicationObjectSupport implements ApplicationContextAware {
+    public final static String BEAN_ID = "tuscanySpringApplicationContextAccessor";
+    private final static ApplicationContextAccessor INSTANCE = new ApplicationContextAccessor();
+
+    private ApplicationContextAccessor() {
+    }
+
+    // Spring static factory method to create the singleton instance
+    public static ApplicationContextAccessor getInstance() {
+        return INSTANCE;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java Wed Jul 28 21:01:41 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.sca.implementation.spring.webapp;
+
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.http.ExtensibleServletHost;
+import org.apache.tuscany.sca.implementation.spring.invocation.SpringApplicationContextHelper;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class SpringWebModuleActivator implements ModuleActivator {
+    private static Logger log = Logger.getLogger(SpringWebModuleActivator.class.getName());
+    private ExtensionPointRegistry registry;
+
+    public SpringWebModuleActivator(ExtensionPointRegistry registry) {
+        super();
+        this.registry = registry;
+    }
+
+    @Override
+    public void start() {
+        ExtensibleServletHost servletHost = ExtensibleServletHost.getInstance(registry);
+        SpringApplicationContextHelper contextHelper = SpringApplicationContextHelper.getInstance(registry);
+
+        ServletContext servletContext = servletHost.getServletContext();
+        if (servletContext != null) {
+            ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
+            if (context != null) {
+                log.info("Spring WebApplicationContext is now injected on Tuscany");
+                contextHelper.setParentApplicationContext(context);
+            }
+        }
+    }
+
+    @Override
+    public void stop() {
+        // NO-OP
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/java/org/apache/tuscany/sca/implementation/spring/webapp/SpringWebModuleActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Wed Jul 28 21:01:41 2010
@@ -0,0 +1,17 @@
+# 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. 
+org.apache.tuscany.sca.implementation.spring.webapp.SpringWebModuleActivator
\ No newline at end of file

Copied: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml (from r980214, tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml?p2=tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml&p1=tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml&r1=980214&r2=980218&rev=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml Wed Jul 28 21:01:41 2010
@@ -1,30 +1,29 @@
-<?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.    
--->
-<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://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
-
-    <bean id="testBean" class="sample.HelloworldImpl" lazy-init="true">
-    </bean>
-
-</beans>
\ No newline at end of file
+<?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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+    <bean id="tuscanySpringApplicationContextAccessor"
+        class="org.apache.tuscany.sca.implementation.spring.webapp.ApplicationContextAccessor"
+        scope="singleton" factory-method="getInstance">
+    </bean>
+    
+</beans>

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java Wed Jul 28 21:01:41 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.sca.implementation.spring.webapp;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class ApplicationContextAccessorTestCase {
+
+    @Test
+    public void testContext() {
+        ApplicationContext context =
+            new ClassPathXmlApplicationContext(
+                                               new String[] {"org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml"});
+        Object accessor = context.getBean(ApplicationContextAccessor.BEAN_ID);
+        Assert.assertSame(ApplicationContextAccessor.getInstance(), accessor);
+        ApplicationContextAccessor contextAccessor = (ApplicationContextAccessor)accessor;
+        Assert.assertSame(context, contextAccessor.getApplicationContext());
+
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/META-INF/MANIFEST.MF?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/META-INF/MANIFEST.MF Wed Jul 28 21:01:41 2010
@@ -13,6 +13,7 @@ Import-Package: javax.jws,
  org.apache.tuscany.sca.assembly.builder;version="2.0.0",
  org.apache.tuscany.sca.assembly.impl;version="2.0.0",
  org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.context;version="2.0.0",
  org.apache.tuscany.sca.contribution;version="2.0.0",
  org.apache.tuscany.sca.contribution.processor;version="2.0.0",
  org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
@@ -39,15 +40,23 @@ Import-Package: javax.jws,
 Bundle-SymbolicName: org.apache.tuscany.sca.implementation.spring
 Bundle-DocURL: http://www.apache.org/
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
-Export-Package: org.apache.tuscany.sca.implementation.spring;version="2.0.0";
-  uses:="org.apache.tuscany.sca.assembly,
-   org.apache.tuscany.sca.assembly.impl,
-   org.apache.tuscany.sca.interfacedef,
-   javax.xml.namespace",
+Export-Package: org.apache.tuscany.sca.implementation.spring;version="2.0.0",
  org.apache.tuscany.sca.implementation.spring.introspect;version="2.0.0";
   uses:="org.apache.tuscany.sca.assembly,
+   org.apache.tuscany.sca.contribution.resolver,
    org.apache.tuscany.sca.implementation.java.introspect,
    org.apache.tuscany.sca.implementation.spring,
+   org.apache.tuscany.sca.contribution.processor,
    org.apache.tuscany.sca.implementation.java,
-   org.apache.tuscany.sca.policy,
-   org.apache.tuscany.sca.interfacedef.java"
+   org.apache.tuscany.sca.core,
+   org.apache.tuscany.sca.monitor,
+   org.apache.tuscany.sca.interfacedef.java",
+ org.apache.tuscany.sca.implementation.spring.invocation;version="2.0.0";
+  uses:="org.apache.tuscany.sca.invocation,
+   org.apache.tuscany.sca.runtime,
+   org.apache.tuscany.sca.context,
+   org.apache.tuscany.sca.provider,
+   org.apache.tuscany.sca.implementation.spring,
+   org.apache.tuscany.sca.core,
+   org.apache.tuscany.sca.core.invocation,
+   org.apache.tuscany.sca.interfacedef"

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java Wed Jul 28 21:01:41 2010
@@ -22,7 +22,7 @@ package org.apache.tuscany.sca.implement
 import java.util.List;
 
 import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 
 /**
@@ -34,9 +34,9 @@ import org.apache.tuscany.sca.runtime.Ru
 public class PropertyValueTie {
 
     private RuntimeComponent component;
-    private JavaPropertyValueObjectFactory propertyFactory;
+    private PropertyValueFactory propertyFactory;
 
-    public PropertyValueTie(RuntimeComponent component, JavaPropertyValueObjectFactory propertyFactory) {
+    public PropertyValueTie(RuntimeComponent component, PropertyValueFactory propertyFactory) {
         this.component = component;
         this.propertyFactory = propertyFactory;
     }
@@ -45,7 +45,7 @@ public class PropertyValueTie {
         List<ComponentProperty> props = component.getProperties();
         for (ComponentProperty prop : props) {
             if (prop.getName().equals(name)) {
-                return propertyFactory.createValueFactory(prop, prop.getValue(), type).getInstance();
+                return propertyFactory.createPropertyValue(prop, type);
             }
         }
         return null; // property name not found

Added: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java?rev=980218&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java Wed Jul 28 21:01:41 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.sca.implementation.spring.invocation;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+
+/**
+ * A utility to receive the parent Spring application context 
+ */
+public class SpringApplicationContextHelper {
+    private Object parentApplicationContext;
+
+    public SpringApplicationContextHelper(ExtensionPointRegistry registry) {
+    }
+
+    public static SpringApplicationContextHelper getInstance(ExtensionPointRegistry registry) {
+        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+        return utilities.getUtility(SpringApplicationContextHelper.class);
+    }
+
+    /**
+     * Get the parent Spring application context for the hosting environment. This will be used as the parent 
+     * application context for implementation.spring components
+     * @return
+     */
+    public Object getParentApplicationContext() {
+        return parentApplicationContext;
+    }
+
+    /**
+     * Set the root Spring application context. This is particually useful for Spring web integration where Spring
+     * creates WebApplicationContext and keeps it in the ServletContext
+     * @param parentApplicationContext
+     */
+    public void setParentApplicationContext(Object parentApplicationContext) {
+        this.parentApplicationContext = parentApplicationContext;
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java Wed Jul 28 21:01:41 2010
@@ -24,8 +24,8 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.util.List;
 
+import org.apache.tuscany.sca.context.PropertyValueFactory;
 import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
 import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 
@@ -44,16 +44,18 @@ public class SpringContextStub {
 
     public SpringContextStub(RuntimeComponent component,
                              SpringImplementation implementation,
+                             Object parentApplicationContext,
                              ProxyFactory proxyService,
-                             JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+                             PropertyValueFactory propertyValueObjectFactory) {
 
-        initTie(component, implementation, propertyValueObjectFactory);
+        initTie(component, implementation, parentApplicationContext, propertyValueObjectFactory);
 
     }
 
     private void initTie(RuntimeComponent component,
                          SpringImplementation implementation,
-                         JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+                         Object parentApplicationContext,
+                         PropertyValueFactory propertyValueObjectFactory) {
 
         // TODO: what class loader to use?
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -66,7 +68,7 @@ public class SpringContextStub {
                               cl);
             Constructor<?> stubConstructor = stubClass.getConstructor(new Class<?>[] {Object.class});
             Object stub =
-                stubConstructor.newInstance(new SpringImplementationTie(implementation, component,
+                stubConstructor.newInstance(new SpringImplementationTie(implementation, parentApplicationContext, component,
                                                                         propertyValueObjectFactory));
 
             Class<?> tieClass =

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java Wed Jul 28 21:01:41 2010
@@ -18,8 +18,8 @@
  */
 package org.apache.tuscany.sca.implementation.spring.invocation;
 
+import org.apache.tuscany.sca.context.PropertyValueFactory;
 import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
 import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
@@ -37,10 +37,6 @@ public class SpringImplementationProvide
     // A Spring application context object
     private SpringContextStub springContext;
 
-    private SpringImplementation implementation;
-
-    private JavaPropertyValueObjectFactory propertyValueObjectFactory;
-
     /**
      * Constructor for the provider - takes a component definition and a Spring implementation
      * description
@@ -49,14 +45,13 @@ public class SpringImplementationProvide
      */
     public SpringImplementationProvider(RuntimeComponent component,
                                         SpringImplementation implementation,
+                                        Object parentApplicationContext,
                                         ProxyFactory proxyService,
-                                        JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+                                        PropertyValueFactory propertyValueObjectFactory) {
         super();
-        this.implementation = implementation;
         this.component = component;
-        this.propertyValueObjectFactory = propertyValueObjectFactory;
 
-        springContext = new SpringContextStub(component, implementation, proxyService, propertyValueObjectFactory);
+        springContext = new SpringContextStub(component, implementation, parentApplicationContext, proxyService, propertyValueObjectFactory);
 
     } // end constructor
 

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java Wed Jul 28 21:01:41 2010
@@ -18,11 +18,11 @@
  */
 package org.apache.tuscany.sca.implementation.spring.invocation;
 
+import org.apache.tuscany.sca.context.PropertyValueFactory;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
 import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
 import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
@@ -34,21 +34,19 @@ import org.apache.tuscany.sca.runtime.Ru
  *
  */
 public class SpringImplementationProviderFactory implements ImplementationProviderFactory<SpringImplementation> {
-
     private ProxyFactory proxyFactory;
-    private JavaPropertyValueObjectFactory propertyFactory;
+    private PropertyValueFactory propertyFactory;
+    private SpringApplicationContextHelper contextHelper;
 
     /**
      * Simple constructor
      *
      */
-    public SpringImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+    public SpringImplementationProviderFactory(ExtensionPointRegistry registry) {
         super();
-
-        proxyFactory = ExtensibleProxyFactory.getInstance(extensionPoints);
-
-        // TODO: could the runtime have a default PropertyValueObjectFactory?
-        propertyFactory = new JavaPropertyValueObjectFactory(new MediatorImpl(extensionPoints));
+        contextHelper = SpringApplicationContextHelper.getInstance(registry);
+        proxyFactory = ExtensibleProxyFactory.getInstance(registry);
+        propertyFactory = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(PropertyValueFactory.class);
     }
 
     /**
@@ -60,7 +58,8 @@ public class SpringImplementationProvide
      */
     public ImplementationProvider createImplementationProvider(RuntimeComponent component,
                                                                SpringImplementation implementation) {
-        return new SpringImplementationProvider(component, implementation, proxyFactory, propertyFactory);
+        Object parentApplicationContext = contextHelper.getParentApplicationContext();
+        return new SpringImplementationProvider(component, implementation, parentApplicationContext, proxyFactory, propertyFactory);
     }
 
     /**
@@ -69,4 +68,5 @@ public class SpringImplementationProvide
     public Class<SpringImplementation> getModelType() {
         return SpringImplementation.class;
     }
+
 } // end class SpringImplementationProviderFactory

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java Wed Jul 28 21:01:41 2010
@@ -24,8 +24,7 @@ import java.util.List;
 import org.apache.tuscany.sca.assembly.ComponentProperty;
 import org.apache.tuscany.sca.assembly.Property;
 import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
 import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -40,15 +39,18 @@ import org.apache.tuscany.sca.runtime.Ru
 public class SpringImplementationTie {
 
     private SpringImplementation implementation;
+    private Object parentApplicationContext;
     private RuntimeComponent component;
-    private JavaPropertyValueObjectFactory propertyFactory;
+    private PropertyValueFactory propertyFactory;
 
     public SpringImplementationTie(SpringImplementation implementation,
+                                   Object parentApplicationContext,
                                    RuntimeComponent component,
-                                   JavaPropertyValueObjectFactory propertyFactory) {
+                                   PropertyValueFactory propertyFactory) {
         this.implementation = implementation;
         this.component = component;
         this.propertyFactory = propertyFactory;
+        this.parentApplicationContext = parentApplicationContext;
     }
 
     public String getURI() {
@@ -74,8 +76,7 @@ public class SpringImplementationTie {
             if (prop.getName().equals(name)) {
                 // On finding the property, create a factory for it and create a Bean using
                 // the factory
-                ObjectFactory<?> factory = propertyFactory.createValueFactory(prop, prop.getValue(), requiredType);
-                propertyObject = (B)factory.getInstance();
+                propertyObject = (B) propertyFactory.createPropertyValue(prop, requiredType);
             } // end if
         } // end for
 
@@ -146,5 +147,9 @@ public class SpringImplementationTie {
     public ClassLoader getClassLoader() {
         return implementation.getClassLoader();
     }
+    
+    public Object getParentApplicationContext() {
+        return parentApplicationContext;
+    }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java Wed Jul 28 21:01:41 2010
@@ -129,7 +129,7 @@ public class SpringImplementationProcess
      * specified in the header identify the context configuration files.
      * If there is no MANIFEST.MF file or no Spring-Context header within that file,
      * then the default behaviour is to build an application context using all the *.xml files
-     * in the METAINF/spring directory.
+     * in the META-INF/spring directory.
      */
     public SpringImplementation read(XMLStreamReader reader, ProcessorContext context)
         throws ContributionReadException, XMLStreamException {

Modified: tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java Wed Jul 28 21:01:41 2010
@@ -18,11 +18,17 @@
  */
 package sample;
 
+import org.oasisopen.sca.annotation.Reference;
 
 public class HelloworldImpl implements Helloworld {
+    @Reference(required = false)
+    private DateService dateService;
 
     public String sayHello(String name) {
-        return "Hello " + name;
+        if (dateService == null) {
+            return "Hello " + name;
+        }
+        return "[" + dateService.getDate() + "] Hello " + name;
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml (original)
+++ tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml Wed Jul 28 21:01:41 2010
@@ -24,7 +24,9 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
 
-    <bean id="testBean" class="sample.HelloworldImpl" lazy-init="true">
+    <bean id="testBean" class="sample.HelloworldImpl">
     </bean>
+    
+    <sca:reference name="dateService" type="sample.DateService"/>
 
 </beans>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite?rev=980218&r1=980217&r2=980218&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite (original)
+++ tuscany/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite Wed Jul 28 21:01:41 2010
@@ -19,11 +19,14 @@
 -->
 <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
       targetNamespace="http://sample"
-      xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
       name="helloworld">
     
     <component name="HelloworldComponent">
         <implementation.spring location="helloworld-context.xml"/>
+        <reference name="dateService" target="DateServiceComponent"/>
+    </component>
+    
+    <component name="DateServiceComponent">
+        <implementation.java class="sample.DateServiceImpl"/>
     </component>
-
 </composite>