Hi Bertrand, Bertrand Delacretaz schrieb: > I'd like to add a webconsole plugin to the > contrib/extensions/jcrinstall/osgi module, which should have as few > dependencies as possible, to avoid stopping as much as possible when > other things are updated.
+1 > The standard way of creating webconsole plugins requires adding > dependencies to org.apache.felix.webconsole and to javax.servlet. > Then, stopping the console and refreshing packages causes the bundle > that provides the plugin to stop, which is not acceptable for my > bundle. Yes, but ... > > My current idea is to create a "console bridge" module, that > dynamically registers webconsole plugin services, based on bundle > headers like: > > Webconsole-Plugin-Class : o.a.s.MyPlugin > > Where the MyPlugin class is like > > /** @return a Map with the plugin's label and title */ > Map getPluginInfo() > > /** @return the HTML content of the plugin page */ > String getHTMLContent(Map requestParameters) > > The console bridge would then listen for bundles which provide this > bundle header, create an instance of the named class, and wrap it in a > proxy class (using reflection) that's the actual WebConsole plugin. > > Is there already such a mechanism? Other suggestions? Yes, IIRC it is already in WebConsole trunk: You may register a plain Servlet with two service properties (felix.webconsole.label and felix.webconsole.title). The Web Console provides the bridge between the AbstractWebConsolePlugin and the plain servlet. It is intended to even support providing resources (scripts, css, images) from the plugin using reflection and a specific method. So, you may simply create a Servlet (assuming the Servlet API remains stable ;-) ) and register it without any WebConsole dependencies. More and up-to-date information is at [1] and [2]. HTH Regards Felix [1]http://felix.apache.org/site/apache-felix-web-console.html [2]http://felix.apache.org/site/extending-the-apache-felix-web-console.html > > -Bertrand >
