At 05:02 PM 6/21/2002 -0700, you wrote:
>Peter Donald wrote:
>
> > >but I also was wondering if there is any container extension mechanism
> > >that is shared by the Avalon containers - or if there are plans for
> > >anything like that?
> >
> > It would be neat to have a generic interceptor architecture. For a
> > buisness-esque type layer you could have interceptor interface such as
> >
> > interface Interceptor
> > {
> >    Object invoke( InterceptorContext ctx, Object[] args ) throws Exception;
> > }
> >
> > interface InterceptorContext
> > {
> >    ComponentMetaData getCaller();
> >    ComponentMetaData getCallee();
> >    DependencyMetaData getCalledInterface();
> >    String getMethodSignature();
> >
> >    Object invokeNext( Object[] args ) throws Exception;
> > }
>
>this is actually closer to what I was originally thinking -- I was
>thinking about a generic mechanism to allow for dynamic proxies -- my
>original idea was to have a component implement a subclass of
>InvocationHandler, then have the container create a proxy from the
>InvocationHandler each lookup... but then I thought that allowing the
>component to implement a lookup() method might be more flexible... but
>then I wondered if this might be too flexible since it would step on the
>toes of the component manager.... but I digress :)


:)

>I have a couple questions about this Interceptor...
>
>1. would it be a component? i.e. do you imagine it being looked up like
>other components?  This seems like it would be a good idea, e.g. in the
>case of the AuthorizingInterceptor you described, it might be handy if
>another component could look it up and set some security settings.

It could be (up to the container) but I would probably not make it 
accessible that way. The Interceptor may be able to lookup another 
component and read security settings or have a component create it and the 
creator lookup another component. At least that is how I would do it.

2. Does this Interceptor interface have any benefits over dynamic proxies?
>[the container will need to generate a dynamic proxy to intercept the
>calls in order to pass them onto the interceptor].

I would have a single dynamic proxy reference multiple Interceptors as 
dynamic proxies instantiation are likely to be more expensive than 
Interceptor instantiation.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to