Hi Karl,
I've been working with PojoSR, in an attempt to use ECF's implementation of OSGi Remote Services. I've found that the ECF TopologyManager's EventListenerHook was not being called when run under PojoSR, and I've tracked it down to a bug in EventDispatcher class
In the filterListenersUsingHooks method
de.kalpatec.pojosr.framework.felix.framework.util.EventDispatcher.filterListenersUsingHooks(ServiceEvent, Map<BundleContext, List<ListenerInfo>>)
Specifically, on line 590 is this test:
if (felix != null)
|
{
|
org.osgi.framework.hooks.service.EventListenerHook elh = null;
|
try
|
{
|
elh = m_registry.getService(felix, sr);
|
}
|
catch (Exception ex)
|
{
|
// If we can't get the hook, then ignore it.
|
}
|
|
Where the 'felix' variable is passed into the method as a Framework instance. But I find that it's always null for service events, because in PojoSR class is this code
public class PojoSR implements PojoServiceRegistry
|
{
|
private final BundleContext m_context;
|
private final ServiceRegistry m_reg = new ServiceRegistry(
|
new ServiceRegistry.ServiceRegistryCallbacks()
|
{
|
|
public void serviceChanged(ServiceEvent event,
|
Dictionary oldProps)
|
{
|
--->>> m_dispatcher.fireServiceEvent(event, oldProps, null);
|
}
|
});
|
|
Note the 'null' in fireServiceEvent. This is supposed to be the Framework instance, but as you can see the if (felix != null) fails and the EventListenerHook is never called.
Actually, in looking this I think the Framework parameter can be removed from fireServiceEvent *and* fireListenersUsingHooks, and it's actual usage in the elh = m_registry.getService(felix, sr); can be replaced with: elh = m_registry.getService(sr.getBundle(), sr)...since there are not separate bundles in PojoSR.
Also, it seems that the org.osgi.* classes that you include in this version of PojoSR are now kind of old (4.3?)...as the specification is now complete for version 6. Would it make sense to update to something more recent?
I can/will contribute these fixes and additions if you would like. Once these fixes have been made, I've been able to use PojoSR and ECF Remote Services to export an example Remote Service! It's pretty cool!
Also, I think that Google Code is being deprecated...in favor of Github. Do you have any plans to move the project to Github? Again I will help with that if you like. Another idea...there could be quite a few other strategies of for loading/starting different configurations of bundles (i.e. in addition to ClasspathScanner). I would be willing to help with some such additions if you would like.
Thanksinadvance,
Scott