-
Notifications
You must be signed in to change notification settings - Fork 89
Brooklyn OSGification - step 2 (brooklyn-rest-server and jsgui) #1048
Conversation
Enable pax-web WAR Extender to find and automatically install the web application into the web container.
jersey-core-1.18.1 suffers from the split-package problem by providing javax.ws.rs*, which can affect OSGi bundle resolution
This brings brooklyn's REST API online within karaf using jersey.
…ils-rest-swagger swagger-core and swagger-jaxrs versions 1.5.3 have package io.swagger.config, which leads to a split-package situation. The selected workaround is to inline both these dependencies into brooklyn-utils-rest-swagger and re-export them for higher level client code. When brooklyn moves to guava-18.0 we can migrate to swagger 1.5.4, which are properly bundled.
Fix the code detecting if we are running within an OSGi framework.
Allow 3rd party libs to inject the managment context into various objects by renaming MagementContextInjectable.injectManagementContext() to setManagementContext().
|
Currently brooklyn-rest-server can be properly deployed as a feature in karaf, integrated with pax-web WAR extender. This allows the use of Jersey as a plain servlet for the REST api. However, at this point the contents of REST resources is not initialized with the appropriate management context, and so are the servlet filters. For this reason, launching the rest server within karaf still crashes, but that will be done as soon as we find a clean solution to inject the management context into the servlet context. brooklyn-jsgui is also deployable as a WAR. For the purpose of separating concerns, having multiple GUIs pluggable into the karaf container we must have the GUI and REST APIs deployable at configurable base URLs (or at least base paths on the same server). |
In order to keep both the monolithic launcher and have the OSGi launcher working we need a temporary solution that works both ways. This OSGi antipattern should be removed as soon as client code gets better.
Rename injectManagementContext to setManagementContext
|
@CMoH I looked into this this weekend, builds ok, tests work, webui works with the old launcher. However the karaf tests gave the following trace: Is this still WIP? |
|
Well, before syncing up with master I had the rest-server and the jsgui working. Although there still is a problem for them to work together (see below), the rest-server was completely usable. However, the new commits from master seem to expose jython classes in the bundle exported packages, so we're back again to the winrm problem. We need to integrate @splatch's work on brooklyn-itest, so other developers can see if their unrelated changes break the karaf assembly project, so this does not happen anymore. The problem with integrating brooklyn-jsgui and brooklyn-rest-server is that neither of them is deployable as a separate karaf feature. They can only work together in the presence of the highly customized webcontext that is created by the |
Use brooklyn-rest-server and brooklyn-jsgui as main features, since they pull in the whole tree.
New unrelated code added an unwanted dependency towards jython, that causes the karaf assembly to break. Ignoring this dependency for now, until winrm work and its jython dependency gets isolated in a proper bundle.
|
Fixed; brooklyn-rest-server works fine within karaf. From my perspective this can and should be merged. |
|
Thanks @CMoH , I'll review and test this evening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaks binary + source compatibility, but I guess it's fine as we've already have another precedent for this release. Worth adding to the release notes.
Out of curiosity, is this needed for OSGi injection, which library will be able to inject the context here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aries blueprints injects using setter methods. I had this working with CXF resources, where the management context gets injected by the framework. I've since gone on the jersey path, and I'm not sure how to achieve the same with jersey, so I made a proposal to migrate to CXF altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's code in Brooklyn using python APIs should migrate it to guava instead of doing this. Worth adding to the maven api check as well, not the first time this has snuck in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far it seems to be because of winrm. Will be dropped once references to winrm are contained in brooklyn-software-winrm, for instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this must be resolved in a follow-up commit.
|
Looks good, some minor comments worth addressing. |
|
I'll address some. Thanks @neykov |
The settings in pom.xml are inherited from the parent and not needed here. javax-servlet-api.version is already provided by parent pom.
Slipped in while syncing with master
This is still work in progress, but I've decided to make the PR earlier on to achieve a quicker review process.