You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2007/10/23 07:17:18 UTC

Re: Interceptors between services

Hi,

You need to add an extension to Tuscany and then you can add interceptors as 
follows:

1) Implement the org.apache.tuscany.sca.invocation.Interceptor interface for 
your interceptor

2) Implement org.apache.tuscany.sca.runtime.RuntimeWireProcessor interface

public void process(RuntimeWire wire) {
    List<InvocationChain> chains = wire.getInvocationChains();
    for (InvocationChain chain : chains) {
            chain.addInterceptor(...); // Add your interceptor here per 
operation
    }
}

3) Implement org.apache.tuscany.sca.core.ModuleActivator interface and 
register your impl class with 
org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint in the 
module activator.

public class YourModuleActivator implements ModuleActivator {
    public void start(ExtensionPointRegistry registry) {
        RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = 
registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
        if (wireProcessorExtensionPoint != null) {
            wireProcessorExtensionPoint.addWireProcessor(new 
YourRuntimeWireProcessor(mediator, dataBindings));
        }
    }

    public void stop(ExtensionPointRegistry registry) {
    }
}

4) Register your module activator in a file named 
"META-INF/services/org.apache.tuscany.sca.core.ModuleActivator". The content 
of the file will be the implementation class of your module activator.

The steps are a bit involved. We could simplify the RuntimeWireProcessor 
extensions by allowing registration using 
"META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessor". 
This will be a TODO for our future releases.

Thanks,
Raymond

----- Original Message ----- 
From: "haleh mahbod" <hm...@gmail.com>
To: <tu...@ws.apache.org>; <de...@acm.org>
Sent: Monday, October 22, 2007 9:53 PM
Subject: Re: Interceptors between services


> Hi Deepak,
> There is support for policy in SCA release 1.0. Is this what you are
> referring to here?
>
> Haleh
>
> On 8/3/07, Deepak Nadig <de...@gmail.com> wrote:
>>
>>
>> Hi,
>>
>> Are there any plans for an interceptor model between service invocations?
>> While the framework does a good job in wiring services into a composite, 
>> I
>> did not find a good way for applications to intercept calls into/out-of
>> services.
>>
>> Thanks,
>>
>> Deepak
>>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org