an introduction to osgi

15
First steps in OSGi Andrea Chiodoni, 2009 martedì, 17 maggio 2011

Upload: andrea-chiodoni

Post on 01-Nov-2014

1.208 views

Category:

Technology


3 download

DESCRIPTION

An introduction to OSGi

TRANSCRIPT

Page 1: An introduction to OSGi

First steps in OSGiAndrea Chiodoni, 2009

martedì, 17 maggio 2011

Page 2: An introduction to OSGi

Understand: what OSGi is, why OSGi a n d w h y i t i s s o important to the Java community.

martedì, 17 maggio 2011

Page 3: An introduction to OSGi

AgendaJar Hell problemA definition of OSGiModularity and JavaArchitectureVersioningSample: ActivatorSample: ServiceOSGi implementationsTools for OSGiRepositoriesAdvanced topicsWhat comes next...

martedì, 17 maggio 2011

Page 4: An introduction to OSGi

Jar Hell problemMissing Module construct at runtime: JARs are only knows at build and deploy time

Information hiding not properly enforced

Version information not consumed at runtime

Java SE/EE are subject to JAR Hell problem

JAR specification is too old for the time being (JARs are not modules)!

Bootstrap Class Loader${JAVA_HOME}/jre/lib/rt.jar

Extension Class Loader${JAVA_HOME}/jre/lib/ext/

System Class Loader${CLASSPATH}

User-Defined Class Loader(s)

Delegate to

Delegate to

Delegate to

martedì, 17 maggio 2011

Page 5: An introduction to OSGi

Modularity and Java 1/2JSR 277: Java Module System

A new module system for Java (JAR -> JAM)Abandoned the 3.12.2008, proceed under Project Jigsaw

Project Jigsaw (OpenJDK)Many discussions around “The massive, monolithic JDK”Low-level module system to modularise the JDK 7Available for developers to use in their own codeNot an official part of the Java SE 7!Interoperate with other module systems (OSGi)Apache Harmony (based on OSGi core)

martedì, 17 maggio 2011

Page 6: An introduction to OSGi

Modularity and Java 2/2Open Service Gateway initiative (OSGi)

from OSGi Alliance, founded 1999 (Ericsson, IBM, Oracle,...)The Dynamic Module System for JavaTarget: embedded, client, server systemsWidely adopted: even by SUN (Glassfish v3)R1 (JSR 8) in May 2000, R4.1 (JSR 291) in May 2007 (current release)Will be closer to Java (language extensions), SUN-OSGi Alliance effort (JSR 294)

martedì, 17 maggio 2011

Page 7: An introduction to OSGi

What is OSGi

Extension of the JARModule = bundle

Naming + definitionVersioning

■ Gestione automatica delle dipendenze■ Gestione del ciclo di vita del codice (configurazione e distribuzione dinamica)

martedì, 17 maggio 2011

Page 8: An introduction to OSGi

Layered architecture

Native Operating SystemJava VM

Execution EnvironmentModulesLife Cycle

Services Security

Bundles

martedì, 17 maggio 2011

Page 9: An introduction to OSGi

Bundle states

Installed

Resolved

Uninstalled

Starting

Active

Stopped

install refreshupdate

refreshupdateresolve

uninstalluninstallstop

start

Explicit transitionAutomatic transition

martedì, 17 maggio 2011

Page 10: An introduction to OSGi

Service Registry

Service Registry

Service Provider<<bundle>>

Service Requester<<bundle>>

Service Description

publish

bind

discover

martedì, 17 maggio 2011

Page 11: An introduction to OSGi

Sample:xx

A B

<<service>><<bundle>><<bundle>>

get

listen

register S

martedì, 17 maggio 2011

Page 12: An introduction to OSGi

Execution Environments

Eclipse EquinoxEclipseSpring DM ServermBedded Server Equinox Edition

Apache FelixServiceMix Kernel

Knopflerfish

martedì, 17 maggio 2011

Page 13: An introduction to OSGi

Development Tools

Eclipse

Maven Bundle Plugin (Apache Felix)

http://www.springsource.com/repository

Bundle Tool (BND), http://www.aqute.biz/Code/Bnd

martedì, 17 maggio 2011

Page 14: An introduction to OSGi

What comes next

Advanced OSGiStandard ServicesWhiteboard PatternEvent AdminExtender Model Building WEB applicationsOSGi Bundle Repository (OBR, RFC 112)

Spring Dynamic ModulesDistributed OSGi Specification (RFC 119, OSGi R4.2)SCA and OSGi

martedì, 17 maggio 2011