I suppose when you say "CA is not present", you refer to the fact that the org.osgi.service.cm package is not exported at all in the framework (which leads to question 2).
I've done that in Felix fileinstall using an optional import on org.osgi.service.cm and doing some fancy stuff ensuring a correct default behavior when the package is not available in the activator: https://svn.apache.org/repos/asf/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/FileInstall.java All the cm related code is built into the ConfigAdminSupport inner class (which throw a NCDFE that is caught if cm is not available). On Fri, Nov 13, 2009 at 05:17, David Bosschaert <[email protected]> wrote: > Hi all, > > I have a bundle that can be configured through Configuration Admin. However > when CA is *not* present it can still function using default behaviour. > > Question 1: What would be the best way to let it check that the > Configuration Admin service is not present, so that it can proceed with its > default behaviour? > > Question 2: I would really like it to have an *optional* dependency on > org.osgi.service.cm. but still my code provides a class that implements > org.osgi.service.cm.ManagedService I guess this should be possible, right? I > was thinking of the following algorithm: > > If Not Config Admin Present then > default behaviour > else > register MyManagedService // only at this point the ManagedService class > gets loaded > ... handle configuration as soon as updated() gets called. > > Is this a feasible approach? > > Thanks, > > David > > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > -- Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://fusesource.com _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
