ops4j / org.ops4j.pax.web

OSGi R7 Http Service, Whiteboard and Web Applications (OSGi CMPN Release chapters 102, 140 and 128) implementation using Jetty 9, Tomcat 9 or Undertow 2.
https://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
Other
144 stars 184 forks source link

Switch Pax Web extender war to DS [PAXWEB-786] #1078

Closed ops4j-issues closed 9 years ago

ops4j-issues commented 9 years ago

Achim Nierbeck created PAXWEB-786


Votes: 0, Watches: 2

ops4j-issues commented 9 years ago

Achim Nierbeck commented

doesn't look like the DS supports Bundle Tracker ....

ops4j-issues commented 9 years ago

Christoph Läubrich commented

You can make use of DS the following way:

  1. Create a Component with an activate and deactivate method with parameter BundleContext
  2. create/start/stop BundleTracker there

That way you don't need an activator and it can be activated/deactivated like every other DS component as well as havin Refernces to other services.

ops4j-issues commented 9 years ago

Achim Nierbeck commented

well, how is a component without interface and activate/deactivate differently then an activator class?
I don't see much benefit of switching to that, cause it just behaves like an activator.
If it walks like a duck, quacks like a duck, it might just be a duck :wink:

ops4j-issues commented 9 years ago

Christoph Läubrich commented

Just consider the following:

  1. If the Task is "Switch to DS for Pax Web" is just consistent to transform all components to DS
  2. The Activator at least tracks one service and register one service so it is perfectly suited to be replaced by DS components logic

From looking at the code it seems that you can drop the Activator at all and transform WebObserver into a DS Component, you might want to use AbstractExtender still as an inner class for doing the tracking job.

Beside this even though you hava a pice of code that wants to interact with the OSGi-Framework you have the following benefits using DS:

ops4j-issues commented 9 years ago

Achim Nierbeck commented

you're mostly right, still I don't see the point of removing a perfectly working Activator to another thing that is doing the same. At this point it doesn't make any sense as it doesn't give a benefit at all.
Might also be interested in the views of a DS-Evangelist ... (http://njbartlett.name/2010/08/05/when-servicetrackers-trump-ds.html)

ops4j-issues commented 9 years ago

Christoph Läubrich commented

I just wanted to show a kind of alternative to "dosen't work / is not supported" :wink:

IMO its perfectly fine to keep this open and migrate step-by step (e.g. next time when refactoring takes place).

About your link, there is no "direct-declarative-only" way but still one without ServiceTracker.

If you can provide an example of the problem I'll try to outline it a little bit more, that often shows it better than some very abstract and vague A/B/C-FooBars :grinning:

ops4j-issues commented 9 years ago

Achim Nierbeck commented

Not worth the hazzle