Apache Felix Web Console Carsten Ziegeler | cziegeler@apache.org - - PowerPoint PPT Presentation

apache felix web console
SMART_READER_LITE
LIVE PREVIEW

Apache Felix Web Console Carsten Ziegeler | cziegeler@apache.org - - PowerPoint PPT Presentation

Apache Felix Web Console Carsten Ziegeler | cziegeler@apache.org ApacheCon NA 2014 About cziegeler@apache.org @cziegeler RnD Team at Adobe Research Switzerland Member of the Apache So fu ware Foundation Apache Felix and Apache


slide-1
SLIDE 1

Apache Felix Web Console

Carsten Ziegeler | cziegeler@apache.org

ApacheCon NA 2014

slide-2
SLIDE 2

About cziegeler@apache.org @cziegeler

  • RnD Team at Adobe Research Switzerland
  • Member of the Apache Sofuware Foundation
  • Apache Felix and Apache Sling (PMC and commituer)
  • And other Apache projects
  • OSGi Core Platform and Enterprise Expert Groups
  • Member of the OSGi Board
  • Book / article author, technical reviewer, conference speaker

2

slide-3
SLIDE 3

Problem Description

§ Manage an OSGi based application § Remotely § Easy of use § Extensibility § Offline support

3

slide-4
SLIDE 4

Various Solutions

§ JMX § Text based

§ Apache Felix Shell, Apache Felix Gogo Shell § Knopfmerfjsh Shell § Equinox Console § OSGi RFC 147 (Command Line Interface)

§ GUI based

§ Knopfmerfjsh Desktop (Swing) § Apache Felix Web Console

4

slide-5
SLIDE 5

Apache Felix Web Console

§ Rich set of core functionality

§ Bundles § Services § Confjguration Admin § System Information

§ JQuery based UI § Extensible § Pluggable authentication § Still light-weight

5

slide-6
SLIDE 6

Installation

§ Dependencies

§ OSGi Htup Service § Commons IO 1.4 (*) § Commons File Upload 1.2 (*) § org.json (.e.g. Apache Geronimo Bundles: json-20090211) (*)

§ Two fmavors: bundle with and without above marked dependencies § Additional optional dependencies § Additional plugins

6

slide-7
SLIDE 7

7

Demo

slide-8
SLIDE 8

Extension Points

§ Branding § Translations § Security Provider § Plugins § Inventory Printer (Confjguration Printer)

8

slide-9
SLIDE 9

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

9

slide-10
SLIDE 10

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

10

slide-11
SLIDE 11

Web Console Security

§ Secure access to the web console!

§ Consider blocking internet access

§ Confjgure authentication

11

slide-12
SLIDE 12

Security Provider

§ Service interface: WebConsoleSecurityProvider

§ HTTP Basic Authentication Based § Validates Username / Password § Access Control (hook only)

§ Service Interface: WebConsoleSecurityProvider2

§ Extends WebConsoleSecurityProvider § Flexible Authentication (implementing HtupContext.handleSecurity)

12

slide-13
SLIDE 13

Security Provider

§ Implementations

§ Default: Single confjgurable User § Apache Karaf: JAAS based authentication § Apache Sling

§ Authenticates against JCR Repository § Supports Sling Authentication Setup

13

slide-14
SLIDE 14

Security Provider

§ WebConsoleSecurityProvider, WebConsoleSecurityProvider2 § Web Console uses them for authentication § Methods for authorization not used atm § Authorization is on the road map for next version!

14

slide-15
SLIDE 15

Plugins

§ javax.servlet.Servlet service § Optional extend AbstractWebConsolePlugin or SimpleWebConsolePlugin § Service properties

§ felix.webconsole.label § felix.webconsole.title § felix.webconsole.category

15

slide-16
SLIDE 16

Sample Plugin #1

16

@Component @Service(value=HttpServlet.class 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 public class class SamplePlugin SamplePlugin extends extends HttpServlet HttpServlet { { @Override public public void void service( service(ServletRequest ServletRequest rq rq, , ServletResponse ServletResponse rs rs) throws throws ServletException ServletException, , IOException IOException { { rs.getWriter().println("Hello World..."); } }

slide-17
SLIDE 17

Sample Plugin #2

17

public class Sample2 extends SimpleWebConsolePlugin { public Sample2(BundleContext ctx) { super("sample2", "Sample Plugin #2", null); register(ctx); } @Override protected void renderContent( HtupServletRequest req, HtupServletResponse res) throws IOException { res.getWriter().println("Hi Tiere ...") } }

slide-18
SLIDE 18

Plugins

§ Rendering: service(), doGet() or renderContent() § Interaction: service(), doPost() § UI: jQuery § Add own js, css as resources § Simple templating support

18

slide-19
SLIDE 19

Apache Felix Inventory

§ OSGi service providing status information

§ Bundle list, services, system properties etc.

§ Different formats: text, html, json § Optional atuachments § Direct support in

web console

19

slide-20
SLIDE 20

Inventory Printer Sample

20

@Component @Service(value={InventoryPrinter.class class}) }) @Properties({ @Property(name=InventoryPrinter.NAME, value="slingjobs"), @Property(name=InventoryPrinter.TITLE, value="Sling Jobs"), @Property(name=InventoryPrinter.FORMAT, value={"TEXT", "JSON"}) }) public public class class InventoryPlugin InventoryPlugin implements implements InventoryPrinter InventoryPrinter { { public public void void print( print(final final PrintWriter PrintWriter pw, pw, final final Format format, Format format, final final boolean boolean isZip isZip) { ) { // print something // print something } } } Attachments: ZipAttachmentProvider

slide-21
SLIDE 21

Offline Usage

§ Status zip contains

§ Output from all inventory printers § Output from special web console plugins § Atuachments § JSON fjles

§ Automated analysis

§ Bundle list and status § Confjgurations § Log fjles

21

slide-22
SLIDE 22

22

Demo

slide-23
SLIDE 23

REST API

§ Today: Simple REST API

§ Bundles § Confjg Admin § htup://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-

console-restful-api.html

23

slide-24
SLIDE 24

OSGi REST API

§ RFC 182 - REST Interface for OSGi § Defjnition of REST API for

§ Framework status § Framework operations

§ Bundle states § Bundle operations § Service states § Service operations

24

slide-25
SLIDE 25

OSGi REST API

§ RFC 182 - REST Interface for OSGi § Extension mechanism

§ Confjg Admin?

§ Java client § Javascript client

25

slide-26
SLIDE 26

Apache Felix Web Console

§ Flexible and extensible administration console

§ Web based

§ Many plugins available § Offline support § Planned major task

§ Authorization § REST support

26