summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 21:01:41 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 21:01:41 +0000
commit9dafe3e2c4d2476cb3ea7789e3f3063418340059 (patch)
treefa543a6cc40ea6ec3ad43ee7f7bf0478685db344 /sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
parent83d18d1113e87315181b6d9f1daba6146ad12cc9 (diff)
Allow Spring WebApplicationContext to be used by Tuscany
Bring up a sample web application which demonstrates the integration between Spring and Tuscany git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980218 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
index 298d8944fb..bf46765f13 100644
--- a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
+++ b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
@@ -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);
+ }
+
+ }
}