I am trying to ensure my bundles play nice in OSGi and follow the
whiteboard pattern as much as possible so I was using the
ServiceTracker and ServiceListeners but I found I was writing a lot of
code so I put it into a couple of classes to make things easier for
myself. I realize that maybe there are already some standard/popular
utilities out there for doing this stuff but I had fun making these so
I thought I would:

A) Put the utilities up here to see what people think
Mutliple services tracker:
https://source.sakaiproject.org/contrib/caret/osgi-eb/trunk/eb-webapp/src/main/java/org/sakaiproject/eb/rest/osgi/util/ServicesTracker.java
Single services tracker:
https://source.sakaiproject.org/contrib/caret/osgi-eb/trunk/eb-webapp/src/main/java/org/sakaiproject/eb/rest/osgi/util/ServiceListenerTracker.java
An activator which is using these:
https://source.sakaiproject.org/contrib/caret/osgi-eb/trunk/eb-webapp/src/main/java/org/sakaiproject/eb/rest/osgi/EBRestActivator.java

B) Ask if there are some standard (or just popular) utils somewhere
already which do this already (are there?)

I basically want to simply avoid starting my services until the ones I
require are availabe, shut mine down when the ones I require go away,
react to changes in the required services (S1 is replaced by S2), and
track services which are optional but used by me (like extensions for
example). I also want it to be easy to get services and take advantage
of generics where possible to avoid constant casting.

I appreciate any advice or suggestions.
Thanks!
-AZ

(this is cross posted from the felix list since it is a more general
OSGi question)

-- 
Aaron Zeckoski ([email protected])
Senior Research Engineer - CARET - Cambridge University
[http://bugs.sakaiproject.org/confluence/display/~aaronz/]
Sakai Fellow - [http://aaronz-sakai.blogspot.com/]
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to