From aff5630d391450d81822457de16b1b55b7b0e8a5 Mon Sep 17 00:00:00 2001 From: nash Date: Thu, 3 Sep 2009 09:44:31 +0000 Subject: 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 --- .../src/main/java/composite/TargetImpl.java | 11 +++++++---- 1 file 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"); } } -- cgit v1.2.3