PojoSR or OSGi (µ)Services For the Rest of Us

31
PojoSR or (OSGi) µServices for the rest of us Karl Pauls !"#$%&’&()"* Dienstag, 25. Oktober 2011

description

 

Transcript of PojoSR or OSGi (µ)Services For the Rest of Us

Page 1: PojoSR or OSGi (µ)Services For the Rest of Us

PojoSRor(OSGi)µServicesfortherestofus

KarlPauls

!"#$%&'&()"*Dienstag, 25. Oktober 2011

Page 2: PojoSR or OSGi (µ)Services For the Rest of Us

Karl

• MemberApacheSo?wareFoundaDon

• PMC:Felix,Sling,Incubator

• PPMC:Ace,Clerezza,Celix

• FellowatLuminis

• ProjectOwnerPojoSR

• Co‐Authorof„OSGiinAcDon“

[email protected]

([email protected])

Hallet al.

OSGiIN ACTION

M A N N I N G

Richard S. HallKarl Pauls

Stuart McCullochDavid Savage

FOREWORD BY PETER KRIENS

Creating Modular Applications in Java

Dienstag, 25. Oktober 2011

Page 3: PojoSR or OSGi (µ)Services For the Rest of Us

ServiceOrientaDon

Dienstag, 25. Oktober 2011

Page 4: PojoSR or OSGi (µ)Services For the Rest of Us

PromoDngaservice‐orientedinteracDonpaSern

!"#$%&"'(#)$%*"#

!"#$%&"'+",-"./"#

!"#$%&"'+"0%./#1

2-34%.5

%6/"#7&/

86*

Dienstag, 25. Oktober 2011

Page 5: PojoSR or OSGi (µ)Services For the Rest of Us

µServices

Dienstag, 25. Oktober 2011

Page 6: PojoSR or OSGi (µ)Services For the Rest of Us

µServices

• Interface‐basedprogramming,butmore

• ServiceRegistry

• Centrallyaccessible

• Browsable

• NoDficaDons

• ServiceRegistryBenefits

• ConsumingcodeisincontrolofproviderselecDon

• ButnotproviderinstanDaDonandconfiguraDon

• Providercodeisincontrolofwhentoprovide

• Promotesveryloosecouplingandlatebinding

Dienstag, 25. Oktober 2011

Page 7: PojoSR or OSGi (µ)Services For the Rest of Us

OSGi(µ)Services

Dienstag, 25. Oktober 2011

Page 8: PojoSR or OSGi (µ)Services For the Rest of Us

OSGiservices

• OSGiframeworkprovidestheconceptsweneed

• Centralizedserviceregistry

• ConsumerhascontroloverselecDon

• Providerhascontroloverwhentoprovide

• Plusfull‐blowndeploymentandpackagingmodularitywithrun‐Dmedynamism

Dienstag, 25. Oktober 2011

Page 9: PojoSR or OSGi (µ)Services For the Rest of Us

OSGi

Dienstag, 25. Oktober 2011

Page 10: PojoSR or OSGi (µ)Services For the Rest of Us

OSGi

• ThedownsidetoOSGiisthatitrequiresaboSom‐upcommitment

• Youneedtoconvertallofyourcodeintopropermodulestotakeadvantageofservices

• Atop‐downapproachofadopDngservicescanhelpeasemigraDontomoremodularcode

Dienstag, 25. Oktober 2011

Page 11: PojoSR or OSGi (µ)Services For the Rest of Us

OSGiframework

Dienstag, 25. Oktober 2011

Page 12: PojoSR or OSGi (µ)Services For the Rest of Us

PojoSR

Dienstag, 25. Oktober 2011

Page 13: PojoSR or OSGi (µ)Services For the Rest of Us

WhatisPojoSR?

• ItlargelyremovesthemodularitylayerfromtheOSGiframework

• Provides

• AcentralizedserviceregistrybasedonOSGiAPI

• LifecyclehooksforJARfiles

• A“light”OSGiframeworkfortheclasspath

Dienstag, 25. Oktober 2011

Page 14: PojoSR or OSGi (µ)Services For the Rest of Us

Whythisapproach?

• OSGiAPIisastandardwithyearsofexperiencebehindit

• Canre‐useOSGimodules(a.k.a.bundles)and/ortechnology

• Canleverageserviceswithouthavingtocompletelymodularizefirst(i.e.,top‐down)

• Providesapathtofull‐blownmodularity

Dienstag, 25. Oktober 2011

Page 15: PojoSR or OSGi (µ)Services For the Rest of Us

UseCases

Dienstag, 25. Oktober 2011

Page 16: PojoSR or OSGi (µ)Services For the Rest of Us

MigraDon

Dienstag, 25. Oktober 2011

Page 17: PojoSR or OSGi (µ)Services For the Rest of Us

MigraDon

• WithoutPojoSR

• TurnapplicaDonintoonebigbundle(jar)

• Splitintoseveralbundles

• Fixproblems

• Splitintoevenmorebundles(etc.)

• Eventually,startusingservices

• Allowsyoutoremoveuglyhacksneededtofixproblems

• WithPojoSR

• Startusingservices

• SplitintobundlesDienstag, 25. Oktober 2011

Page 18: PojoSR or OSGi (µ)Services For the Rest of Us

UseOSGiwhereyoucan‘t

• OSGi(lite)onGoogleAppEngineusingPojoSR

Dienstag, 25. Oktober 2011

Page 19: PojoSR or OSGi (µ)Services For the Rest of Us

UseOSGiwhereyoucan‘t

• hSp://vimeo.com/22571224

Dienstag, 25. Oktober 2011

Page 20: PojoSR or OSGi (µ)Services For the Rest of Us

Android

Dienstag, 25. Oktober 2011

Page 21: PojoSR or OSGi (µ)Services For the Rest of Us

Commondiscovery(SPI)

Dienstag, 25. Oktober 2011

Page 22: PojoSR or OSGi (µ)Services For the Rest of Us

Commondiscovery(SPI)

Dienstag, 25. Oktober 2011

Page 23: PojoSR or OSGi (µ)Services For the Rest of Us

ServicesanddependencyinjecDon

• AdvantageswhencombinedwithserviceorientaDon

• DependencyinjecDonnolongerneedsglobalview

• InformaDonlocalizedtojusttheprovider/consumer

• NolongerrestrictedtoasingleDIframework

• DifferentDIframeworkscanplaytogetherviatheserviceregistry

Dienstag, 25. Oktober 2011

Page 24: PojoSR or OSGi (µ)Services For the Rest of Us

Usage

Dienstag, 25. Oktober 2011

Page 25: PojoSR or OSGi (µ)Services For the Rest of Us

AsaServiceRegistry

Dienstag, 25. Oktober 2011

Page 26: PojoSR or OSGi (µ)Services For the Rest of Us

AsanOSGi„light“framework

Dienstag, 25. Oktober 2011

Page 27: PojoSR or OSGi (µ)Services For the Rest of Us

Standalone

Dienstag, 25. Oktober 2011

Page 28: PojoSR or OSGi (µ)Services For the Rest of Us

Demo

Dienstag, 25. Oktober 2011

Page 29: PojoSR or OSGi (µ)Services For the Rest of Us

ClosingRemarks

Dienstag, 25. Oktober 2011

Page 30: PojoSR or OSGi (µ)Services For the Rest of Us

BenefitsandDrawbacks

• PojoSRprovidespartofthepowerofOSGi

• inanon‐intrusiveway.

• allowstoincreasemodularityanduseµServices

• withoutfirstriddinganexisDngcodebaseofclassloaderhacks

• CanrunOSGibundleswhereyoucan‘t

• Thedrawbacksare

• doesnotenforcesmoduleboundaries

• doesnotallowmulDpleversionsofthesamepackage;doesnotsupporttheBundle‐ClassPath.

• ButyoucanusetheµServicemodeltogetridoftheclassloadinghacksoverDme,a?erwhichitwillbeeasiertomovetoOSGiandgetsidebysideversioningandrealmoduleboundaries.

Dienstag, 25. Oktober 2011

Page 31: PojoSR or OSGi (µ)Services For the Rest of Us

QuesDons?

http://pojosr.googlecode.com

Dienstag, 25. Oktober 2011