This isn't something that's "easy" to do right now, but it is possible.  

In your bundle activator, you can do something like:

            ServiceReference[] references = 
bundleContext.getServiceReferences(Bus.class.getName(), null);
            if (references != null) {
                for (ServiceReference reference : references) {
                    if (reference != null) {
                        Bus bus = (Bus) bundleContext.getService(reference);
                        bus.setExtension(…….);
                    }
                }
            }

or similar to add extensions to the existing bus's.      If you need to add 
things to existing services, you can extend that to something like:

            ServerRegistry reg = bus.getExtension(ServerRegistry.class);
            List<Server> servers = reg.getServers();           
            for (Server serv : servers) {
                … do whatever …
            }

You really cannot add anything to existing clients very easily at all as we do 
not hold onto anything client related so they can be fully garbage collected as 
appropriate.


Dan



On Apr 7, 2013, at 5:48 AM, XiLai Dai <[email protected]> wrote:

> Hi,
> 
> We have a CustomerFactoryBeanListener looks like:
> public class RegistryFactoryBeanListener implements FactoryBeanListener {
> public void handleEvent(Event ev, AbstractServiceFactoryBean factory, 
> Object... args) {
>        switch (ev) {
>        case CLIENT_CREATED: {
>          // do something
>        }case SERVER_CREATED: {
>          // do something
>        }
> }
> }
> 
> And register this class to the bus as a extension (add a line to 
> META-INF/cxf/bus-extensions.txt)
> 
> There have some existing cxf buses/services installed on the osgi (karak) 
> container before we install this extension bundle into container, the problem 
> is the extension isn't added to these "old" buses. (it only works for the new 
> installed buses/services)
> 
> Is it an know issue or maybe a cxf extension problem? Any workaround? Now we 
> have to refresh the "old" bundles (with cxf bus) manually to get the 
> extension added.
> 
> Thanks!
> Xilai

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to