avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Kwong <mandr...@yahoo.com>
Subject Re: Container supported interceptable service
Date Mon, 19 Apr 2004 13:31:33 GMT
> On Friday 16 April 2004 11:39, Albert Kwong wrote:
> > What do you think?  
> 
> I think you have thrown in some fresh thinking into
the pot :o)
> 
> However, maybe I am a bit tired, or maybe not smart
enough, but I have a bit 
> of problems to realize all the details.
> 
> Could you elaborate with a larger example;
> 
> MyClientImpl  -->  InterceptorOne --> InterceptorTwo
 -->  MyServiceImpl
> 
> 
> The following things is a bit unclear;
> 
> 1. How does InceptorOne and InterceptorTwo,
respectively, declare that they 
> should be 'injected' where they are?
> 

Here's the configuration.  The container shall sort
out the execution order based on the 'order' attribute
of the intercept element.

<targets>
    <target name='MyServiceImpl'>
        <!-- nothing new here -->
    </target>

    <target name='InterceptorOne'>
        <intercept order='1000'>
            <source>MyServiceImpl</source>
        </intercept>
    </target>

    <target name='InterceptorTwo'>
        <intercept order='2000'>
            <source>MyServiceImpl</source>
        </intercept>
    </target>

</targets>

> 2. You mentioned that the Proxy for AbcServiceImpl
is implementing 
> AbcInterceptor (just like InterceptorOne and
InterceptorTwo above, I guess). 
> What if the two interceptors above are removed from
the chain?

During deployment, the container can figure out the
interceptor sequence based on the order attribute. 
The chain-of-responsibility pattern will only apply if
there is at least one interceptor.

Therefore, if the two interceptors are removed, the
MyServiceImpl will be called like normal components.

> 3. Is there something in the name between AbcService
and AbcInceptor?

Having a naming convention between the AbcService and
the AbcInterceptor is nice to have, but not absolutely
necessary.  In the AbcService's meta tag, the
AbcService declares the type of the interceptor (
@avalon.interceptor type='AbcInterceptor' ).  In my
redundant email, I made a little amendment where you
can declare @avalon.interceptor.skin for operations. 
i.e.

/**
 * @avalon.interceptor type='AbcInterceptor'
 */
public interface AbcService
{
    /** this operation can be intercepted */
    public String doAbc ();

    /**
     * This one forbids interception.
     * @avalon.interceptor.skin
     */
    public String doDef ();
}

With this setup, it shall be possible to generate the
AbcInterceptor.java file from the build process and
include it in the api package.

Albert

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


Mime
View raw message