cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From XiLai Dai <>
Subject RE: how to add bus extension to the existing bus on the osgi env?
Date Tue, 09 Apr 2013 09:32:18 GMT

I've tried with your suggestion but :
doesn't work.  The only way I can find to add extension class to bus is by provide /META-INF/bus-extensions.txt

-----Original Message-----
From: Daniel Kulp [] 
Sent: Monday, April 08, 2013 10:38 PM
To:; XiLai Dai
Subject: Re: how to add bus extension to the existing bus on the osgi env?

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(),
            if (references != null) {
                for (ServiceReference reference : references) {
                    if (reference != null) {
                        Bus bus = (Bus) bundleContext.getService(reference);

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.


On Apr 7, 2013, at 5:48 AM, XiLai Dai <> 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 - Talend Community Coder -

View raw message