So you want the Bus to have the addInterceptor(id) method? Or would that be
the function of the instrumentationManager? It would seem rather odd to me
to have the former. If its the later, you could just make the
InstrumentationManager ApplicationContextAware, no? (of course I probably
don't understand all the ins and outs quite yet...)

- Dan

On 2/26/07, Soltysik, Seumas <[EMAIL PROTECTED]> wrote:

Hi Dan,
In order to use the ApplicationContextAware mechanism, the object I am
instrumenting would have to created by Spring itself which is not
necessarily the case.
Here is what I would like to do:
1)Expose the Bus as an MBean. In the CXFBusImpl constructor, construct an
MBeanWrapper around the Bus and register it with the InstrumentationManager.
This BusMBeanWrapper would have a addInterceptor(String id) method on it. It
would be nice if this wrapper had a handle to the ApplicationContext which
was used to create the Bus. However, since the Bus itself is not
ApplicationContextAware, I am not sure how to do this.
2)Users call addInterceptor(String id) on Bus MBean. This id is used to
lookup interceptor from ApplicationContext so that if this method is called
several times, the same interceptor is always used for the given ID.

For starters, users would have to define any interceptors that they
expected to use in the bean.xml file used to configure the Bus. Later on
we could make such that Interceptors beans could be specified at runtime.
Seumas

-----Original Message-----
From: Dan Diephouse [mailto:[EMAIL PROTECTED]
Sent: Monday, February 26, 2007 12:33 PM
To: [email protected]
Subject: Re: Dynamically deploying interceptors via JMX


In your JMX component you could implement ApplicationContextAware which
will
give you a handle on the ApplicationContext.

What if the interceptor isn't previously defined in an XML file? For
example, lets say I want to add a logging interceptor. I would have to
have
it predefined in my beans.xml then, right?

- Dan

On 2/26/07, Soltysik, Seumas <[EMAIL PROTECTED]> wrote:
>
> I would like to expose the various InterceptorProviders (Bus, Service,
> Endpoint) as MBeans and provide methods on these MBeans to dynamically
> deploy interceptors into these providers. In order to do this, I need a
> mechanism to instantiate an interceptor before adding it to the
provider.
> Now I could pass in a classname to the MBean [BusMBean.addInterceptor
(classname)]
> and instantiate the interceptor that way but that seems lame. A better
way
> would be if I could get a handle on the Spring BeanFactory used to
create
> other CXF objects and use it as a factory for creating dynamic
interceptors.
> So instead of using a classname to instantiate an object, I could simply
use
> a spring id to get a handle on the desired interceptor. I am think that
a
> user could specify their interceptor bean in the cxf*.xml file used to
> configure the bus and later reference the bean using the id.
> Is it possible to get a handle on the BeanFactory used to load Bus
> configuration? Is this a reasonable approach?
> Regards,
> Seumas
>



--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog




--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to