Is your preference not to use ServiceTracker because you would prefer to use some kind of injection (e.g. Declarative Services or Blueprint)?
I would think you would be able to develop a service component that has a optional/dynamic dependency on EventAdmin and gets injected with the BundleContext of your bundle (by specifying an activate method that takes a BundleContext). This would allow you to create and open your BundleTracker when your service component is activated and have access to the optional EventAdmin service. You likely would want the service component to be immediately activated (using the immediate=true attribute) so that you can register your BundleTracker eagerly. Tom |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Andrea Zoppello <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |OSGi - Dev <[email protected]>, | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |08/02/2012 04:18 AM | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |[osgi-dev] Using Event Admin inside a Bundle Tracker??? | >--------------------------------------------------------------------------------------------------------------------------------------------------| Hi all, In these days i'm doing some experiment within Bundle-Trackers because i need some functionality that looks at bundle headers and contents when bundles are installed uninstalled into osgi container. I've successfully developed a simple bundle tracker, but now i want to improve my code and made my bundle tracker to post event using the Event Admin Service. In general i prefer not to use service tracker, but in this case ( i need the bundle tracker use the event admin service ) it seems that Service Trascker is the only way to go.... Is there any other way to use an OSGi Service within a bundle tracker, without using a Service Tracker?? Thanks Andrea Zoppello _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
