On 21/09/2007, Richard S. Hall <[EMAIL PROTECTED]> wrote: > > It really just depends. One case where the extender model might be > useful is if you have existing artifacts that are already packaged as > JAR files and you don't want to modify them in any way. Thus, you could > install them "as is" into the framework and have a bundle that probes > them to do some necessary action on their behalf. > > Other examples would be similar to the way Eclipse uses this model, > where you are using large numbers of bundles to build a very large data > structure and you want to be able to cache the result. > > There are probably other examples.
Another example is when you want to delegate a responsibility to a single bundle. Such as servlet registration - rather than have each bundle track all instances of the HTTP Service and register its own servlets whenever a new provider appears, you can use an extender bundle to look for bundles with servlet resources and register/unregister them on their behalf. The benefit here is that the code for tracking the HTTP Service and registering servlets is in one place - the downside is that the extender bundle becomes a key failure point (ie. if it stops, your servlets won't get registered). some concrete examples of a servlet extender bundle: http://www.aqute.biz/Snippets/Extender http://wiki.ops4j.org/confluence/x/eYA6 Another useful pattern is the "whiteboard pattern", where you use the OSGi service registry as a way to find listeners (who register with the registry using a given API). This has several advantages over the classic "listener pattern" (fewer classes, no need to manage your own subscription lists) For services, they certainly should be used when you have higher degrees > of dynamism. Since the extender model is effectively keying off of > bundle installs, it doesn't expect much to change as long as the bundle > is installed, which is why it is able to do caching a little easier. On > the other hand, services may come and go at any time while a bundle is > active. > > -> richard > > Garrett Headley wrote: > > Although there is a brief discussion on the example application page as > to the differences between the service based model vs. the extender based > model, I was wondering if someone could go more into depth as to when one > strategy would be preferable over another. Or, more specifically, some use > cases where you would DEFINITELY want to use the service model over the > extender model and vice-versa. > > > > Thanks in advance > > Garrett > > > > > > --------------------------------- > > Be a better Globetrotter. Get better travel answers from someone who > knows. > > Yahoo! Answers - Check it out. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Cheers, Stuart

