monitoring osgi applications with the web console - carsten ziegeler
DESCRIPTION
OSGi Community Event 2013 (http://www.osgi.org/CommunityEvent2013/Schedule) ABSTRACT This session introduces the latest version of the famous Apache Felix web console which allows to monitor and inspect OSGi web applications through the browser. The web console is based on a flexible plugin mechanism to add custom information and functionality. Learn how to write your own extensions and how to leverage the available functionality for monitoring and troubleshooting OSGi installations. SPEAKER BIO Carsten Ziegeler is senior developer at Adobe Research Switzerland and spends most of his time on architectural and infrastructure topics. Working for over 25 years in open source projects, Carsten is a member of the Apache Software Foundation and heavily participates in several Apache communities including Sling, Felix and ACE. He is a frequent speaker on technology and open source conferences and participates in the OSGi Core Platform and Enterprise expert groups.TRANSCRIPT
![Page 1: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/1.jpg)
Carsten Ziegeler| Adobe Research Switzerland Monitoring OSGi Applications with the Web Console
![Page 2: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/2.jpg)
About [email protected] @cziegeler
§ Rnd Team at Adobe Research Switzerland
§ OSGi Core Platform and Enterprise Expert Groups
§ Member of the ASF
§ Most active in Apache Sling, Felix, Ace
§ Conference Speaker
§ Technical Reviewer
§ Article/Book Author
2
![Page 3: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/3.jpg)
Problem Description
§ Manage an OSGi based application
§ Remotely
§ Easy of use
§ Extensibility
§ Offline support
3
![Page 4: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/4.jpg)
Various Solutions
§ JMX
§ Text based
§ Apache Felix Shell, Apache Felix Gogo Shell
§ Knopflerfish Shell
§ Equinox Console
§ OSGi RFC 147 (Command Line Interface)
§ GUI based
§ Knopflerfish Desktop (Swing)
§ Apache Felix Web Console
4
![Page 5: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/5.jpg)
Apache Felix Web Console
§ Rich set of core functionality
§ Bundles
§ Services
§ Configuration Admin
§ System Information
§ JQuery based UI
§ Extensible
§ Pluggable authentication
§ Still light-weight
5
![Page 6: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/6.jpg)
Installation
§ Dependencies
§ OSGi Http Service
§ Commons IO 1.4 (*)
§ Commons File Upload 1.2 (*)
§ org.json (.e.g. Apache Geronimo Bundles: json-20090211) (*)
§ Two flavors: bundle with and without above marked dependencies
§ Additional optional dependencies
§ Additional plugins
6
![Page 7: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/7.jpg)
Extension Points
§ Plugins
§ Inventory Printer (Configuration Printer)
§ Security Provider
§ Branding
§ Translations
7
![Page 8: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/8.jpg)
Plugins
§ javax.servlet.Servlet service
§ Optional extend AbstractWebConsolePlugin
§ Service properties
§ felix.webconsole.label
§ felix.webconsole.title
§ felix.webconsole.category
8
![Page 9: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/9.jpg)
Sample Plugin #1
9
@Component@Service(value=HttpServlet.class)@Properties({ @Property(name="felix.webconsole.label", value="sample"), @Property(name="felix.webconsole.title", value="Sample Plugin"), @Property(name="felix.webconsole.category", value="My App")})public class SamplePlugin extends HttpServlet { @Override public void service(ServletRequest rq, ServletResponse rs) throws ServletException, IOException { rs.getWriter().println("Hello World..."); }}
![Page 10: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/10.jpg)
Sample Plugin #2
10
public class Sample2 extends SimpleWebConsolePlugin { public Sample2(BundleContext ctx) { super("sample2", "Sample Plugin #2", null); register(ctx); } @Override protected void renderContent( HttpServletRequest req, HttpServletResponse res) throws IOException { res.getWriter().println("Hi There ...") } }
![Page 11: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/11.jpg)
Apache Felix Inventory
§ OSGi service providing status information
§ Bundle list, services, system properties etc.
§ Different formats: text, html, json
§ Optional attachments
§ Directly support in web console
11
![Page 12: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/12.jpg)
Inventory Printer Sample
12
@Component@Service(value={InventoryPrinter.class})@Properties({ @Property(name=InventoryPrinter.NAME, value="slingjobs"), @Property(name=InventoryPrinter.TITLE, value="Sling Jobs"), @Property(name=InventoryPrinter.FORMAT, value={"TEXT", "JSON"})})public class InventoryPlugin implements InventoryPrinter { public void print(final PrintWriter pw, final Format format, final boolean isZip) { // print something }}Attachments: ZipAttachmentProvider
![Page 13: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/13.jpg)
Branding
§ Service Interface: BrandingPlugin
§ Default Branding: DefaultBrandingPlugin
§ Branding Fragment
§ /META-INF/webconsole.properties webconsole.brand.name = Apache Sling Web Console webconsole.product.name = Apache Sling webconsole.product.url = http://sling.apache.org webconsole.product.image = /res/sling/logo.png webconsole.favicon = /res/sling/favicon.ico
§ Sample
§ Sling Web Console Branding Plugin
13
![Page 14: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/14.jpg)
Security Provider
§ Service interface: WebConsoleSecurityProvider § HTTP Basic Authentication Based
§ Validates Username / Password
§ Access Control (hook only)
§ Service Interface: WebConsoleSecurityProvider2
§ Extends WebConsoleSecurityProvider
§ Flexible Authentication (implementing HttpContext.handleSecurity)
§ Implementations § Default: Single configurable User
§ Karaf: JAAS based authentication
§ Sling § Authenticates against JCR Repository
§ Supports Sling Authentication Setup
14
![Page 15: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/15.jpg)
Security Provider
§ WebConsoleSecurityProvider, WebConsoleSecurityProvider2
§ Web Console uses them for authentication
§ Methods for authorization not used atm
§ On the road map for next version!
15
![Page 16: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/16.jpg)
Translations
§ Out-of-the-box
§ Bulgarian, English, German, Russian
§ Extensible
§ Fragment to the Web Console
§ Based on Standard Bundle Localization
§ OSGI-INF/l10n/bundle*.properties
16
![Page 17: Monitoring OSGi Applications with the Web Console - Carsten Ziegeler](https://reader033.vdocuments.mx/reader033/viewer/2022051412/548475aab47959050d8b4bf5/html5/thumbnails/17.jpg)