Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling -...

46
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved Platform O.N.E. Deutsche Telekom‘s OSGi based Application Platform for Third Party Enabling Elmar Brauch and Christian Baranowski Deutsche Telekom AG, Products & Innovation and SEITENBAU GmbH 20.09.2011 Page 1

description

Platform O.N.E. is an OSGi based application platform of Deutsche Telekom. The talk gives an overview of the key architectural concepts, design patterns and ideas behind the Platform O.N.E. The talk is practically orientated and will be accompanied by slides and a live coding demo with a running example. The core idea behind the Platform O.N.E. is to provide easy access for third party users (e.g. mobile-apps, web-applications, or other kind of clients) to internal services of Deutsche Telekom. The internal services are exported by platform modules as REST or SOAP services. A platform module provides an easy way to enhance a service with features like: authentication, authorization, security, billing, logging, profiling, monitoring etc. For module implementation the platform provides: an OSGi based run-time, a standard module design, a maven based build process and a set of Platform O.N.E. specific OSGi services. The talk consists of three parts. The fist part gives an overview of the platform architecture and the OSGi technologies used. The second part discusses the design of a platform module and shows the advantages arising from modular design and the use of an OSGi based platform. The second part will be presented on a running example module as a live coding demonstration. The final part of the talk summarizes the key learnings and discusses which OSGi technologies might play a role in the future development of Platform O.N.E.

Transcript of Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling -...

Page 1: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved

Platform O.N.E. Deutsche Telekom‘s OSGi based

Application Platform for Third Party Enabling

Elmar Brauch and Christian Baranowski

Deutsche Telekom AG, Products & Innovation and SEITENBAU GmbH

20.09.2011

Page 1

Page 2: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 2

Welcome

• Christian Baranowski

• Software Quality Assurance @ Seitenbau GmbH

Konstanz (DE) • Custom Software Solutions

• E-Government Solutions

• Identity Management and SSO Solutions

• www.seitenbau.com

Page 3: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 3

Agenda

• Overview Platform O.N.E • Platform features

• Architecture context

• OSGi relevant architecture concepts • Design goals

• Overview of platform architecture

• Design of OSGi related core services (REST exporter, logging, ...)

• Design of Platform modules • Bundle structure for a module (bundle structure blueprint)

• Advantages of the module structure

• Live demo

• Summary

Page 4: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Welcome

• Elmar Brauch

• Technical Product Manager @

Deutsche Telekom, Products & Innovation

• Study of computer science at university of

Koblenz-Landau.

• Worked as Software Engineer at Capgemini and

United Internet

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 4

Page 5: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Overview Platform O.N.E What is the Platform O.N.E?

Page 5 OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 6: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Overview

• Platform O.N.E. is an OSGi based application platform.

• Platform O.N.E. connects mobile apps or third party

clients with internal services of Deutsche Telekom.

• Internal services are exported as REST or SOAP

services.

Page 6 OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

• Developer Garden uses SMS module.

• http://www.developergarden.com

• Mediencenter uses DLS module.

• http://medien-center.t-online.de

Page 7: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Architecture Context

Page 7

Core DLSi … … … …

DLSn

SMS …

Platform O.N.E.

TV

Service Layer SMS DLSn DLSi …

Devices

Edge P&I

Exp. Layer

Laptop/PC

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 8: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Idea

• Platform O.N.E. offers features as services:

• Authentication, authorization,

• Security, billing(quota handling), logging

• Features are implemented as components which

provides the features as OSGi services.

• Platform modules exporting backend services can

easily use these features.

Page 8 OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 9: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Motivation

• Pros

• Faster module development,

because technical issues are solved in the platform.

• Cheaper modules,

because all features and services are reusable in

other modules.

• Save hardware,

because different modules

can use the same servers.

Page 9 OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 10: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 10

OSGi Relevant Architecture Concepts

Page 11: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 11

Design Goals

Design Goals

Goals from P3GW

Dependency management at

Runtime

Dependency injection instead

of inheritance

Testability

Operational goals

Monitoring

Configuration management

Packaging as RPM

Module developers

goals

Easy programming

model

Technical details should be

hidden

Blueprints for module design

Other goals

No dependency on OSGi in

Platform code

P3GW = Predecessor of Platform O.N.E

Page 12: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 12

Architecture Overview

Page 13: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 13

Technologies

Eclipse Equinox

OSGi HTTP

Service Jetty

Spring

Spring Dynamic Modules

JAX-RS – Jersey

SOAP - Axis

SLF4J and

Logback

Page 14: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 14

Design of Platform O.N.E

OSGi related core services

Page 15: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 15

Logging and Log Service

• The platform logger provides an abstraction layer for the actual logging implementation (Logback)

• The logger will be accessed in a static way, not as OSGi service

• Backend implementation (Logback) is pluggable

• Logger works in other environments, e.g. Java SE for debugging unit tests

• One platform exposure module is associated with one Logback instance

• Design is inspired by the Pax logging project

Page 16: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 16

Logging and Log Service

Logger Client API

Page 17: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 17

Logging and Log Service

• 3rd party logging framework integration

Page 18: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 18

Logging and Log Service

Page 19: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 19

Logging and Log Service

• Pros • Logger API for the client classes

• Pluggable logging implementation (e.g. logger implementation can be changed at runtime)

• Common log frameworks are integrated over SLF4 bridges

• The OSGi log service is integrated

• There is always a log, even when the log service is not active, e.g. at startup

• One Logback (log) instance per exposure module

• A log message is associated with request

Page 20: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 20

Logging and Log Service

• Cons

• Performance overhead delegation the logging call

through the abstraction layer to the log backend

service implementation

• Not OSGi Standard (but you could use the OSGi

log service as backend log service)

Page 21: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 21

Web Extender

• SOAP and REST web services must be registered as

servlets at the HTTP Service

• The module implementation should not depend on the

Servlet API or on the OSGi HTTP Service API

• To this end the platform provides a platform specific

extender which registers the servlets for the SOAP and

REST modules

• Design is motivated by Neil Bartlett - jaxrs-osgi-

extender project

Page 22: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 22

Web Extender

Register a REST Web Service

Page 23: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 23

Web Extender

• Pros • The OSGi dependency on the HTTP Service and the BundleContext

API is contained locally in a single class in the web extender

• There are no OSGi dependencies in the modules

• The web extender implements a proxy servlet for generic platform

logic which should be invoked for each request, e.g. Token Handling

• Modules do not depend on the JAX-RS Implementation, but only on

the JAX-RS API

Page 24: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 24

Web Extender

• Cons

• Implementation depends on the BundleContext API

• Implementation using whiteboard pattern preferable

• The BundleTracker API was not used in the implementation

Page 25: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 25

Design Platform O.N.E. Modules

Page 26: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Design of exposure modules

• Main task of Platform O.N.E.

exposure modules:

build an exposure layer for

backend services.

• apps are kept independent of

backend changes.

• Exposure modules have no

business logic –

cheap and simple.

• Features are added to

modules by the platform.

Page 26

Core

BSP

Com

men

Rest Soap

BSP

Com

men Core

BSP

Com

men

Rest

Core

BSP

Com

men

Soap Rest

Core

BSP

Com

mon

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 27: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Design of exposure modules

• Each exposure module has

a standard bundle structure:

• BSP connection to backend

• CORE adds platform features

• COMMON functions required

in all bundles

• REST or SOAP connection to

clients

Page 27

Core

BSP

Com

men

Rest Soap

BSP

Com

men Core

BSP

Com

men

Rest

Core

BSP

Com

men

Soap Rest

Core

BSP

Com

mon

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 28: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Design of extension modules

• Extension modules can be

imported by Platform O.N.E.

modules.

• Extension modules have

business logic, they represent

the Platform O.N.E. features.

• Extension modules consist of

two bundle types:

• Interface describes feature’s API.

• Implementation implements the

feature.

Page 28

Core

BSP

Com

men

Rest Soap Interface

Implementation

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 29: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Example:

DLS exposure modules

Page 29

• Digital Life Storage -

Mediencenter

• Two different systems

• Target: Only one

system to save costs

• First step get rid of

German App

• Migration needs only

new DLSn exposure

module

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 30: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Example:

DLS exposure modules

Page 30

• Only new BSP bundle

must be developed

• DLSi and DLSn have

same REST, CORE and

COMMON bundles.

• Minimal development

costs - no App or

Backend changes

• App developement is

focused

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved

Page 31: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 31

Platform O.N.E - Live Demo

Page 32: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 32

Summary

• OSGi benefits in the Platform O.N.E • Dependency management at runtime

• OSGi provides a dynamic plugin framework out of the box

• A platform exposure module can be used with different BSP bundles

(Composition)

• Dynamic component system,

e.g. start and stop REST or SOAP endpoint at runtime

• SOA at very low level

• Sharing classes and logic between modules in form of

OSGi services

• …

Page 33: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 33

Summary

• OSGi disadvantages • Build process and build tools (Maven, …)

• Integration of 3rd party frameworks and libraries can be difficult

• Maven dependency management and OSGi do not always fit together

• OSGi is simple in concept but not as easy to learn, classloader

problems etc.

• IDE and tooling (PDE, STS, BndTools …)

• Dynamic approach brings more complexity to the system

• Testing – In-container testing (Pax Exam, BND, …)

Page 34: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 34

Summary

• Lessons learned

• Modularization does not come for free

• XML libraries in Java are hell

• Use Bundle Tracker OSGi util class to implement an extender

pattern

• In some cases a whiteboard pattern is a better solution than an

extender pattern

• …

Page 35: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 35

Summary

• Technology radar • JAX-WS and Apache CXF Implementation

• Spring Version 3.0.0

• BNDTools as IDE

• Web Bundles (WAR) - RFC66

• Apache Felix

• Jersey Version 1.8

• Jetty 7

• Apache Karaf

• Eclipse Virgo

• …

Page 36: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 36

Discussion and Q&A

Page 37: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 37

References Ressources and Links

• Richard S. Hall et al. - OSGi in Action

• Pax Logging - http://team.ops4j.org/wiki/display/paxlogging/Pax+Logging

• Ekke - Logging in OSGi Applications - http://ekkescorner.wordpress.com/blog-series/osgi-apps/

• Neil Bartlett - jaxrs-osgi-extender - https://github.com/njbartlett/jaxrs-osgi-extender

• Spring Dynamic Modules - http://www.springsource.org/osgi

• Gemini Blueprint - http://www.eclipse.org/gemini/blueprint/

• Jersey and OSGi - http://jersey.java.net/nonav/documentation/latest/osgi.html

Page 38: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 38

Appendix

Page 39: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 39

Logging and Log Service

Page 40: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

Logging and Log Service

Page 41: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 41

Web Extender

Page 42: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 42

Web Extender

Page 43: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 43

Request Context Service

• Idea from the Spring Framework where Spring Beans

can be in the Request scope

• There is one RequestContext which contains data that

are associated with the actual request

• The RequestContext instance is bound to the local

thread

• The Client obtains the RequestContext via the

RequestContextService

Page 44: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 44

Request Context Service

Page 45: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 45

Request Context Service

• Pros • Simple generic way to pass parameters through the request

processing

• Makes implemention of e.g. the Token Service simple: the Client does

not have to know anything about the token and where it comes from

Page 46: Platform O.N.E. - Deutsche Telekom’s OSGi based Application Platform for Third Party Enabling - Elmar Brauch & Christian Baranowski

OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved Page 46

Request Context Service

• Cons • Only works in an application where you have one thread per request