summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-03 09:44:31 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-03 09:44:31 +0000
commitaff5630d391450d81822457de16b1b55b7b0e8a5 (patch)
treead91b49f62f97bcdd916793ae3a12fd6e2c363bd
parent06f51bda3bd98c0f791639dfb355027b1260fbfe (diff)
Modify TargetImpl to use getCallbackReference() instead of injection
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810848 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/TargetImpl.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/TargetImpl.java
index 86686e9233..e744aa7967 100644
--- a/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/TargetImpl.java
+++ b/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/TargetImpl.java
@@ -18,7 +18,9 @@
*/
package composite;
+import org.osoa.sca.ComponentContext;
import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -27,15 +29,16 @@ import org.osoa.sca.annotations.Service;
@Scope("COMPOSITE")
public class TargetImpl implements Target {
- private SourceCallback sourceCallback;
+ private ComponentContext ctx;
- @Callback
- public void setSourceCallback(SourceCallback sourceCallback) {
- this.sourceCallback = sourceCallback;
+ @Context
+ public void setContext(ComponentContext context) {
+ ctx = context;
}
public void someMethod(String arg) {
System.out.println("Target: " + arg);
+ SourceCallback sourceCallback = (SourceCallback)ctx.getRequestContext().getCallbackReference().getService();
sourceCallback.receiveResult(arg + " -> Target.someMethod");
}
}