Download - OSGi enRoute Unveiled - P Kriens

Transcript
Page 1: OSGi enRoute Unveiled - P Kriens

OSGi enRouteAn Development Chain for OSGi

αβ

Page 2: OSGi enRoute Unveiled - P Kriens

A

B

AB

C

D

7.

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

04.23.14 EnRoute LOGO DEVELOPMENT ALTERNATIVE DESIGN SOLUTIONS

A

1

2

3

B C

Page 3: OSGi enRoute Unveiled - P Kriens
Page 4: OSGi enRoute Unveiled - P Kriens

The existential question

Page 5: OSGi enRoute Unveiled - P Kriens

Why OSGi?

Page 6: OSGi enRoute Unveiled - P Kriens

“Hello World”

Page 7: OSGi enRoute Unveiled - P Kriens

… is not a benchmark

Page 8: OSGi enRoute Unveiled - P Kriens
Page 9: OSGi enRoute Unveiled - P Kriens

Language

Dev Chain

Page 10: OSGi enRoute Unveiled - P Kriens
Page 11: OSGi enRoute Unveiled - P Kriens

Small versus Largeco

st o

f cha

nge

functionality

dynamic languages

Java & OSGi

Startup cost of Java (statically typed

languages) is higher

However, long term cost is much lower

Page 12: OSGi enRoute Unveiled - P Kriens

target.foo(15,”abc”); target.foo(15,”abc”);

Javascript Java

You HOPE target implements foo …

You KNOW target implements foo …

and expects an integer and a string

Your IDE knows exactly who is using this

Page 13: OSGi enRoute Unveiled - P Kriens

OSGi extends type safety to modules that evolve

Page 14: OSGi enRoute Unveiled - P Kriens

What is OSGi enRoute?co

st o

f cha

nge

functionality

dynamic languages

Java & OSGi

Page 15: OSGi enRoute Unveiled - P Kriens

How?

Page 16: OSGi enRoute Unveiled - P Kriens

OSGi enRoute• µService Oriented Programming

• To reduce system complexity

• Dependency Management

• To reduce errors in development & operations

• Tooling

• To reduce time to market

• Documentation & Training

• To reduce confusion with developers

Page 17: OSGi enRoute Unveiled - P Kriens

Development Process

Components

Run!Descriptor

Distro

enRoute!Profile

other!API’s

Deployable!Unit

test

compile

resolve

build

release

define

baseline

external dependencies

QA & Production

staging

Page 18: OSGi enRoute Unveiled - P Kriens

bnd, the little engine that built …

Page 19: OSGi enRoute Unveiled - P Kriens

bndlib

bndtools (eclipse)maven

gradle, ant

bnd command line

Page 20: OSGi enRoute Unveiled - P Kriens

bundle bundle

workspace

project

cnf

project

Page 21: OSGi enRoute Unveiled - P Kriens

profiles

Page 22: OSGi enRoute Unveiled - P Kriens

Profiles• A profile is specific catalog of specifications that vendors

can provide in a distribution.

• An OSGi Profile consists of

• µServices — Specifications of either OSGi Alliance or external µservices.

• Extenders — An extender provides support functionality to OSGi bundles.

• Capabilities — A capability describes a feature/function/resource of the underlying system in abstract format.

Page 23: OSGi enRoute Unveiled - P Kriens

Profiles• Each OSGi enRoute Profile is represented by a

clean signed JAR library that can be used to build bundles against.

• This is a specification only library,

• It can not introduce unwanted dependencies, or

• Let developers accidentally use proprietary features of a vendor

Page 24: OSGi enRoute Unveiled - P Kriens

Planned Profiles• java 1.8 — All profiles are based on Java 1.8

• base — A minimum profile, mostly as common base and for demonstrations. It provides support for the best practices in our industry.

• base.debug — Supports developing and debugging

• web — Web application development optimized for single page web apps.

• web.debug — Supports developing and debugging web apps.

• persistence — Provides support for JPA on OSGi

Page 25: OSGi enRoute Unveiled - P Kriens

Base Profile• OSGi Core Framework — R6

• OSGi Compendium — ConfigurationAdmin, Coordinator, EventAdmin, LogService, MetaTypeService,UserAdmin

• Logging — Extensive Java Logging and SLF4J (dynamic!) logging support. Both service based an statics.

• OSGi enRoute Support!

• Requirements and Capabilities — Completely developed with the R&C model in mind

• Specifications in code — Extensive support to use Java classes and interfaces to also specifies non-Java aspects. E.g. license headers, forms, versioning, etc. Mostly through annotations.

Page 26: OSGi enRoute Unveiled - P Kriens

Base Profile• OSGi enRoute services!

• Authenticator and Authority — For extensible security

• ConfigurationDone — To signal end of initialization at startup

• DTOs — Extensive support for Data Transfer Objects (JSON, conversion, diffing, named access)

• Launched — Provides access to startup parameters

• LoggerAdmin — Administrative front end to logging. Can handle OSGi, SLF4J, and Java Logging

• java.util.Timer — Scheduled tasks

• java.util.concurrent.Executor — Background tasks

Page 27: OSGi enRoute Unveiled - P Kriens
Page 28: OSGi enRoute Unveiled - P Kriens
Page 29: OSGi enRoute Unveiled - P Kriens
Page 30: OSGi enRoute Unveiled - P Kriens

package com.api

publishbind

subscribe

dependency

Page 31: OSGi enRoute Unveiled - P Kriens

Components

Component (object)

Page 32: OSGi enRoute Unveiled - P Kriens

Creates a component

Can (de)activate, gets configuration data

Service dependency

Page 33: OSGi enRoute Unveiled - P Kriens

Bundles

Bundlecomponent

component

component

component

Page 34: OSGi enRoute Unveiled - P Kriens

Bundles

Bundle

Page 35: OSGi enRoute Unveiled - P Kriens

Private packages

Exported packages

Calculated imports

bnd descriptor

Page 36: OSGi enRoute Unveiled - P Kriens

Continuous build JARs

Content, e.g. Component XML

Page 37: OSGi enRoute Unveiled - P Kriens

external dependencies

(or where the heck is maven central????)

Page 38: OSGi enRoute Unveiled - P Kriens

Repository (includes maven central)

Page 39: OSGi enRoute Unveiled - P Kriens

Search repos

Opens browser window

Page 40: OSGi enRoute Unveiled - P Kriens
Page 41: OSGi enRoute Unveiled - P Kriens

OSGi Framework

Bundle

Assemble

Bundle

BundleBundle

BundleBundle

OSGi Framework

Page 42: OSGi enRoute Unveiled - P Kriens

distros

Page 43: OSGi enRoute Unveiled - P Kriens

Distros• A distro provides the runtime environment for one

or more profiles

• The OSGi enRoute project will deliver a reference distribution for all profiles based on open source and OSGi provided bundles

• Members and other companies can provide other, competing, interoperable, distributions (And are actively encouraged to do so).

Page 44: OSGi enRoute Unveiled - P Kriens

how do we prevent vendor lock-in?

Page 45: OSGi enRoute Unveiled - P Kriens

foo =14 base =“bar” id =21

namespace

Capability Model

(foo>=14)

Requirement Capability

Page 46: OSGi enRoute Unveiled - P Kriens

osgi.wiring.package

Capability Model

(& (osgi.wiring.package=com.acme) (version>=1.2) )

Import Export

osgi.wiring.package=com.acme version=1.2

Page 47: OSGi enRoute Unveiled - P Kriens

Resolve requirements

bndrun descriptor

Requirements

Debug

Page 48: OSGi enRoute Unveiled - P Kriens

Running

Resolved bundles

Page 49: OSGi enRoute Unveiled - P Kriens
Page 50: OSGi enRoute Unveiled - P Kriens
Page 51: OSGi enRoute Unveiled - P Kriens

staging

Page 52: OSGi enRoute Unveiled - P Kriens

StagingOSGi Framework

Page 53: OSGi enRoute Unveiled - P Kriens

Export

Page 54: OSGi enRoute Unveiled - P Kriens

release

Page 55: OSGi enRoute Unveiled - P Kriens

Semantic Versioning

• major – Breaking change for consumers

• minor – Breaking change for providers

• micro – Invisible change

Page 56: OSGi enRoute Unveiled - P Kriens
Page 57: OSGi enRoute Unveiled - P Kriens

baselining

Page 58: OSGi enRoute Unveiled - P Kriens

Released bundles

Page 59: OSGi enRoute Unveiled - P Kriens

NoSuchMethodException

Page 60: OSGi enRoute Unveiled - P Kriens

Incompatible API change

version wrong

Page 61: OSGi enRoute Unveiled - P Kriens

command line

Page 62: OSGi enRoute Unveiled - P Kriens
Page 63: OSGi enRoute Unveiled - P Kriens
Page 64: OSGi enRoute Unveiled - P Kriens

continuous integration

Page 65: OSGi enRoute Unveiled - P Kriens
Page 66: OSGi enRoute Unveiled - P Kriens
Page 67: OSGi enRoute Unveiled - P Kriens

summary

Page 68: OSGi enRoute Unveiled - P Kriens

Continuous Integration?

IDE? command line?

Repository?

MethodClassPackageBundleWorkspace returnparameters methodmethodclass classpackage packagebundle bundle

bnd(tools) gradle, bnd

jpm4j (maven central)

travis

Page 69: OSGi enRoute Unveiled - P Kriens

// TODO

Page 70: OSGi enRoute Unveiled - P Kriens

TODO• bnd(tools) documentation

• Base Tutorial

• Additional profiles

• Additional deployment standards

• Create a community!

Page 71: OSGi enRoute Unveiled - P Kriens