Hi all,

I've been playing with OSGi and Felix for the past week, and I think I have
a general understanding of how to apply it to my application. So far, I've
refactored my code into bundle-friendly packages and have setup a build
system to generate my bundles. For every bundle, I have the following
pattern:

FooActivator.java
FooService.java
FooServiceImpl.java

FooActivator implements BundleActivator, and in the start method registers
FooService. Pretty straightforward. The issues I've run into are the
following:

a) What is the best way to call BarService from FooServiceImpl? I've tried
both the ServiceTracker pattern, and the ServiceBinding-Utils, but both seem
a bit convoluted.
b) What is the best way to make sure that FooServiceImpl doesn't call
BarService before BarService has been reigstered?

For the second issue, I thought I was on the right path when I found the
Depedency Manager bundle, but the example isn't clear how registering a
ServiceDepedency on BarService instantiates the instance that FooServiceImpl
requires? This lead me to the iPOJO section, which promises to address these
issues, but I'm not sure if it's what I'm looking for either. Does using
Dependency Manager or iPOJOs also address my first issue of how to implicity
bind the services? Any pointers in the right direction are appreciated.

Regards,
Gerald

Reply via email to