Peter Donald wrote: > 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; > > > } > > >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.
For the interceptor to look up another component would imply it implments Composable -- and allowing it to implement other lifecycle methods would not be a bad thing --- I guess it could be an 'invisible component' (i.e. can't be looked up by other components). As for having another component create the interceptor, this would require that component to have an extra 'hook' into the container (to tell the container to use the interceptor) -- I was thinking more along the lines that interceptors would be specified in the configuration/assembly. > 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. that makes sense, and would also allow for dynamically changing the interceptors. Robert. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>