diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-29 00:14:45 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-29 00:14:45 +0000 |
commit | 49a28fd5795d7ed1d155a2ee571a98e009214281 (patch) | |
tree | d19634ec9c8464688804afa3bb438d3ed1502abb /sca-java-2.x/trunk/samples | |
parent | f661a34f0314c405134067c843222312f8408db7 (diff) |
Add the parent delegation for the SCA spring application context
Improve the sample to demonstrate the child bean wired to a bean in the parent context (WebApplicationContext)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980272 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/samples')
5 files changed, 21 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java index 2b3c412de3..64bdd86f7c 100644 --- a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java +++ b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java @@ -30,6 +30,7 @@ import org.oasisopen.sca.annotation.Service; public class DateServiceImpl implements DateService { public Date getDate() { + System.out.println("DateServiceImpl.getDate()"); return new Date(); } diff --git a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java index a44dcacc3a..125c333ddc 100644 --- a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java +++ b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java @@ -18,17 +18,17 @@ */
package sample;
-import org.oasisopen.sca.annotation.Reference;
public class HelloworldImpl implements Helloworld {
- @Reference(required = false)
- private DateService dateService;
+
+ public HelloworldImpl() {
+ super();
+ System.out.println("HelloworldImpl()");
+ }
public String sayHello(String name) {
- if (dateService == null) {
- return "Hello " + name;
- }
- return "[" + dateService.getDate() + "] Hello " + name;
+ System.out.println("HelloworldImpl.sayHello(" + name + ")");
+ return "Hello " + name;
}
}
diff --git a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml index b5fba07d66..9ecd09974e 100644 --- a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml +++ b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld-context.xml @@ -24,9 +24,7 @@ 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">
+ <bean id="HelloworldBean" class="sample.HelloworldImpl">
</bean>
-
- <sca:reference name="dateService" type="sample.DateService"/>
</beans>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite index 0900c63a84..6d356758ae 100644 --- a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite +++ b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/resources/helloworld.composite @@ -19,10 +19,14 @@ -->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
targetNamespace="http://sample"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
name="helloworld">
- <component name="HelloworldComponent">
- <implementation.spring location="helloworld-context.xml"/>
+ <component name="HelloworldClientComponent">
+ <implementation.spring location="helloworld-client-context.xml"/>
+ <service name="HelloworldClientBean">
+ <tuscany:binding.jsonrpc/>
+ </service>
<reference name="dateService" target="DateServiceComponent"/>
</component>
diff --git a/sca-java-2.x/trunk/samples/webapps/helloworld-spring/pom.xml b/sca-java-2.x/trunk/samples/webapps/helloworld-spring/pom.xml index e184a014ae..59f3a25696 100644 --- a/sca-java-2.x/trunk/samples/webapps/helloworld-spring/pom.xml +++ b/sca-java-2.x/trunk/samples/webapps/helloworld-spring/pom.xml @@ -69,7 +69,12 @@ <version>4.8.1</version> <scope>test</scope> </dependency> - + <dependency> + <groupId>httpunit</groupId> + <artifactId>httpunit</artifactId> + <version>1.6.1</version> + <scope>test</scope> + </dependency> </dependencies> <build> |