diff options
Diffstat (limited to 'sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java')
-rw-r--r-- | sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java index 481f3b2b0a..2c36acbf94 100644 --- a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java @@ -19,54 +19,50 @@ package org.apache.tuscany.sca.binding.event.impl; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.DataExchangeSemantics; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; /** - * TODO: Implement event binding invoker + * Event binding invoker * @version $$ */ -public class EventBindingInvoker implements Interceptor, DataExchangeSemantics { - private InvocationChain chain; +public class EventBindingInvoker implements Invoker, DataExchangeSemantics { + + private Invoker baseInvoker; /** - * Construct a EventBindingInvoker that delegates to the service invocaiton chain + * Construct a EventBindingInvoker that delegates to the service invocation chain * @param chain */ - public EventBindingInvoker(InvocationChain chain) { + public EventBindingInvoker(ReferenceBindingProvider baseBindingProvider, Operation operation) { super(); - this.chain = chain; - } - - /** - * @see org.apache.tuscany.sca.invocation.Interceptor#getNext() - */ - public Invoker getNext() { - return chain.getHeadInvoker(); + + // TODO: Should we match producer event types with the event types of the operation? + baseInvoker = baseBindingProvider.createInvoker(operation); } - /** - * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker) - */ - public void setNext(Invoker next) { - // NOOP - } /** * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message) */ public Message invoke(Message msg) { - return getNext().invoke(msg); + if (baseInvoker != null) { + return baseInvoker.invoke(msg); + } + else { + msg.setBody(null); + return msg; + } } /** * @see org.apache.tuscany.sca.invocation.DataExchangeSemantics#allowsPassByReference() */ public boolean allowsPassByReference() { - return chain.allowsPassByReference(); + return true; } } |