SlideShare a Scribd company logo
1 of 85
Open Your Eyes
           To OSGi
                  By : Yanai Franchi
                Chief Architect , Tikal
Eclipse DemoCamps Galileo 2009/Tel Aviv
Agenda

                                        Introduction

                                         – What is OSGi ?
                                         – What problems does it help us to solve ?
                                         – How does it work ?

                                        OSGi programming model

                                         – Live Demo

                                        OSGi in Enterprise Applications

                                         – Spring DM




Copyright 2009 Tikal Knowledge, Ltd.                        | 2 |
OSG - what?


Copyright 2009 Tikal Knowledge, Ltd.       | 3 |
OSGi Acronym



                                            O = Open
                                            S = Services
                                            G = Gateway
                                             i = initiative

Copyright 2009 Tikal Knowledge, Ltd.               | 4 |
TM
                                       OSGi




                                       OSGi                 TM

                                       The Dynamic Module System For Java




Copyright 2009 Tikal Knowledge, Ltd.                | 5 |
Original OSGi Vision




Copyright 2009 Tikal Knowledge, Ltd.          | 6 |
Who's Doing It ?
                                        Open source implementation

                                          » Equinox
                                          » Felix
                                          » Knoplerfish
                                        Significant enterprise Java usage

                                          » Eclipse
                                          » IBM – WebSphere, Lotus
                                          » JonAS
                                          » BEA
                                          » Oracle
                                          » JBoss
                                          » SpringSource


Copyright 2009 Tikal Knowledge, Ltd.                       | 7 |
Why Do We Need OSGi ?




Copyright 2009 Tikal Knowledge, Ltd.          | 8 |
The Humble JAR File




Copyright 2009 Tikal Knowledge, Ltd.         | 9 |
Typical Java Application




Copyright 2009 Tikal Knowledge, Ltd.          | 10 |
Copyright 2009 Tikal Knowledge, Ltd.   | 11 |
Our Application Stack...




Copyright 2009 Tikal Knowledge, Ltd.          | 12 |
No Runtime Representation




Copyright 2009 Tikal Knowledge, Ltd.        | 13 |
Loading Classes...




Copyright 2009 Tikal Knowledge, Ltd.          | 14 |
...The ClassLoader Found One




Copyright 2009 Tikal Knowledge, Ltd.         | 15 |
...But I Need The Other Class :(




Copyright 2009 Tikal Knowledge, Ltd.          | 16 |
Copyright 2009 Tikal Knowledge, Ltd.   | 17 |
Dependency Graph




Copyright 2009 Tikal Knowledge, Ltd.       | 18 |
Still Something Wrong

                                   Classes can be

                                       tightly coupled


                                   Even across module

                                       boundaries




Copyright 2009 Tikal Knowledge, Ltd.                     | 19 |
Copyright 2009 Tikal Knowledge, Ltd.   | 20 |
We Have a Problem...




Copyright 2009 Tikal Knowledge, Ltd.         | 21 |
...A Big One...




Copyright 2009 Tikal Knowledge, Ltd.            | 22 |
...It Crashed :(




Copyright 2009 Tikal Knowledge, Ltd.             | 23 |
Need to Decouple




Copyright 2009 Tikal Knowledge, Ltd.        | 24 |
Late Binding




Copyright 2009 Tikal Knowledge, Ltd.         | 25 |
Why Did Eclipse
                                       Adopt OSGi ?


Copyright 2009 Tikal Knowledge, Ltd.          | 26 |
Pre-OSGi Eclipse (<3.0)

                                  •    Metadata in plugin.xml:
                                  •    Meaningful Name, Vendor
                                  •    Version
                                  •    Dependencies
                                  •    Private Internals
                                  •    De-Coupling Framework (Extension Registry)




Copyright 2009 Tikal Knowledge, Ltd.                       | 27 |
What Is
                                       Missing ???


Copyright 2009 Tikal Knowledge, Ltd.          | 28 |
Copyright 2009 Tikal Knowledge, Ltd.   | 29 |
Copyright 2009 Tikal Knowledge, Ltd.   | 30 |
But in Eclipse...




Copyright 2009 Tikal Knowledge, Ltd.                 | 31 |
A Little Open-Heart Surgery

                                  •       Equinox project
                                  started February 2003
                                  •       Replace old Eclipse
                                       runtime with OSGi
                                  •       Enhance OSGi
                                       standard
                                  •       Eclipse 3.0 released
                                       June 2004




Copyright 2009 Tikal Knowledge, Ltd.                        | 32 |
OSGi Architectural




Copyright 2009 Tikal Knowledge, Ltd.         | 33 |
Bundle

                                        By default a bundle is a black box

                                          » Completely protected
                                          » You can NOT see inside it
                                             • Not even by reflection
                                             • Or any other class loading trickery




Copyright 2009 Tikal Knowledge, Ltd.                        | 34 |
How Does It Look Like ?

                                        Its a jar file!
                                        No complicated tools or sophisticated
                                         packaging required.

                                         META-INF/MANIFEST.MF

                              Bundle-Name: Hello World
                              Bundle-SymbolicName: com.tikal.osgi.sample.helloworld

                              Bundle-Version: 2.1.0
                              Export-Package: com.tikal.osgi.sample
                              Import-Package: com.tikal.osgi.weather ,org.osgi.framework
                              Bundle-Activator: com.tikal.osgi.sample.HelloActivator



Copyright 2009 Tikal Knowledge, Ltd.                       | 35 |
Bundle Visibility

                                        Exposing Types can be done explicitly

                                          » A bundle can export one or more packages
                                          » Optionally with versioning information

                                        Only exported packages are visibly outside of
                                         the exporting bundle.
                                          » Stops unintended coupling between bundles
                                          » Enable independent development
                                          » Faster development cycles




Copyright 2009 Tikal Knowledge, Ltd.                       | 36 |
Bundle Visibility Cont.


                                                                           Service interface
                                                                           types exported
                                                                           with version
                                                                           information

                                                  Export-Packages: a,b,c
                                                   private
                                                   packages


                                                                “Passive” contribution
                                 Service                        Types added to type space
                                 implementation                 bundles see new version on
                                 locked away                    resolution after
                                                                install/refresh


Copyright 2009 Tikal Knowledge, Ltd.                   | 37 |
Bundle's Life Cycle– Dynamic !




Copyright 2009 Tikal Knowledge, Ltd.          | 38 |
OSGi Wiring




Copyright 2009 Tikal Knowledge, Ltd.        | 39 |
OSGi Wiring




Copyright 2009 Tikal Knowledge, Ltd.        | 40 |
OSGi Wiring




Copyright 2009 Tikal Knowledge, Ltd.        | 41 |
Versioning



                                                              MVC




                                                             Service




                                                     Repository '




Copyright 2009 Tikal Knowledge, Ltd.                | 42 |
Versioning



                                                                         MVC



                                       Two versions of
                                       the same service
                                       type... at the same              Service      Service '
                                       time!



                                                                      Repository '




Copyright 2009 Tikal Knowledge, Ltd.                         | 43 |
Versioning




Copyright 2009 Tikal Knowledge, Ltd.                | 44 |
Operational Control

                                        See all bundles and their status

                                          » OSGi console
                                          » Web Console
                                          » JMX
                                        Get information on wiring
                                        Install new bundles
                                        Activate/Deactivate bundles (and publish services)
                                        Refresh bundles
                                        Stop bundles
                                        Uninstall bundles


                                          All without stop or restart the application



Copyright 2009 Tikal Knowledge, Ltd.                         | 45 |
OSGi - Lessons Learned


               •                Visibility

               •                Versioning

               •                Operational
                                Control




Copyright 2009 Tikal Knowledge, Ltd.           | 46 |
OSGi Programming


                                   All access to OSGi is

                                       through
                                       BundleContext


                                   This is supplied to our

                                       BundleActivator




Copyright 2009 Tikal Knowledge, Ltd.                     | 47 |
BundleActivator

                            Bundle-Name: Hello World
                            Bundle-SymbolicName: com.tikal.osgi.sample.helloworld
                            Bundle-Activator: com.tikal.osgi.sample.HelloActivator



                        public class HelloActivator implements BundleActivator {
                          public void start(BundleContext context) throws Exception {
                            System.out.println(“Hello, world!”);
                            System.out.println(Arrays.asList(context.getBundles()));
                          }
                          public void stop(BundleContext context) throws Exception {
                            System.out.println(“Goodbye, world!”);
                          }
                        }




Copyright 2009 Tikal Knowledge, Ltd.                  | 48 |
Hello-World
                                       DEMO

Copyright 2009 Tikal Knowledge, Ltd.       | 49 |
Services in OSGi




Copyright 2009 Tikal Knowledge, Ltd.         | 50 |
SOA Architecture

                                   The OSGi framework promotes a service-oriented

                                       interaction pattern among bundles




Copyright 2009 Tikal Knowledge, Ltd.                    | 51 |
SOA For The JVM


                                                                      Published
                                                                      Services




                                                            “Active” contribution
                                 Private                    Services published in
                                 implementation             registry
                                 objects                    bundles see service
                                                            changes immediately


Copyright 2009 Tikal Knowledge, Ltd.               | 52 |
SOA in OSGi




Copyright 2009 Tikal Knowledge, Ltd.        | 53 |
SOA in OSGi




Copyright 2009 Tikal Knowledge, Ltd.        | 54 |
SOA in OSGi




Copyright 2009 Tikal Knowledge, Ltd.        | 55 |
SOA in OSGi




Copyright 2009 Tikal Knowledge, Ltd.        | 56 |
SOA in OSGi




Copyright 2009 Tikal Knowledge, Ltd.        | 57 |
Example: Paint Program




Copyright 2009 Tikal Knowledge, Ltd.        | 58 |
Naive Class Diagram




Copyright 2009 Tikal Knowledge, Ltd.        | 59 |
Register Is Easy...



                                       Hashtable dict = new Hashtable();
                                               dict.put(SimpleShape.NAME_PROPERTY, "Square");
                                               dict.put(SimpleShape.ICON_PROPERTY, new
                                       ImageIcon(getClass().getResource("square.png")));
                                       context.registerService(SimpleShape.class.getName(),
                                                                                 new Square(),dict);




Copyright 2009 Tikal Knowledge, Ltd.                            | 60 |
Consume Is ...




Copyright 2009 Tikal Knowledge, Ltd.              | 61 |
First Attempt

                                 ServiceReference ref = context.getServiceReference(
                                                                   SimpleShape.class.getName());
                                 SimpleShape shape = (SimpleShape) context.getService(ref)
                                 shape.draw();




Copyright 2009 Tikal Knowledge, Ltd.                        | 62 |
Oops, “ref” can be Null

                                 ServiceReference ref = context.getServiceReference(
                                                                   SimpleShape.class.getName());

                                 if(ref != null) {
                                   SimpleShape shape = (SimpleShape) context.getService(ref)
                                   shape.draw();
                                 }




Copyright 2009 Tikal Knowledge, Ltd.                        | 63 |
Oops, “shape” can be Null

                                 ServiceReference ref = context.getServiceReference(
                                                                   SimpleShape.class.getName());

                                 if(ref != null) {
                                   SimpleShape shape = (SimpleShape) context.getService(ref);
                                   if(shape != null)
                                     shape.draw();
                                 }




Copyright 2009 Tikal Knowledge, Ltd.                        | 64 |
How ???




Copyright 2009 Tikal Knowledge, Ltd.    | 65 |
Oops, Need to Clean Up

                                 ServiceReference ref = context.getServiceReference(
                                                                   SimpleShape.class.getName());

                                 if(ref != null) {
                                   SimpleShape shape = (SimpleShape) context.getService(ref);
                                   if(shape != null){
                                     try{
                                       shape.draw();
                                     }finally{
                                       context.ungetService(ref);
                                     }
                                 }




Copyright 2009 Tikal Knowledge, Ltd.                        | 66 |
Copyright 2009 Tikal Knowledge, Ltd.   | 67 |
ServiceTracker

                                   Shape Tracker goal – Use Inversion of Control

                                       principles to inject shapes into application

                                        » Created by the BundleActivator
                                        » Puts tracking logic in one place
                                        » Isolates application from OSGi API


                                   User “Observer” design pattern to track services

                                       for clients.




Copyright 2009 Tikal Knowledge, Ltd.                        | 68 |
Connecting The Dots




Copyright 2009 Tikal Knowledge, Ltd.     | 69 |
Connecting The Dots




Copyright 2009 Tikal Knowledge, Ltd.        | 70 |
Connecting The Dots




Copyright 2009 Tikal Knowledge, Ltd.        | 71 |
Shapes
                                       DEMO

Copyright 2009 Tikal Knowledge, Ltd.       | 72 |
Distributed OSGi... Its Here...




Copyright 2009 Tikal Knowledge, Ltd.   | 73 |
OSGi in ...
                                       Enterprise Applications




Copyright 2009 Tikal Knowledge, Ltd.            | 74 |
A Typical JEE Application


                                              D
                                                          Web Application       D           Lib
                                       Lib                   Context
                                                                                                  D
                                                      D                               Lib
                                        Lib
                                                                            D
                                              D             Middle-tier                           Lib
                                                             Context
                                       Lib                                      Lib
                                                  D




Copyright 2009 Tikal Knowledge, Ltd.                              | 75 |
JEE Application Base on OSGi

                                                      Each bundle is a segregated class
                                                      space

                                              MVC             MVC           MVC


                                                                                       Lib
                                        Lib         Service            Service
                                                                                             Lib



                                                                                  Domain
                                         Repository      Repository


Copyright 2009 Tikal Knowledge, Ltd.                          | 76 |
JEE Application on OSGi ?

                                   How can we exploit OSGi

                                       » Without adding complexity ?
                                       » Retaining our programming model?
                                   We want to treat bundles as beans

                                       » Instantiated, Configure, Assemble, Decorate
                                       » We want to easy way to publish/consume services
                                          • Dynamic management

                                       » Should we code this ourselves?
                                       » Preserve ability to test


Copyright 2009 Tikal Knowledge, Ltd.                        | 77 |
Spring-DM Kernel

                                   Integrates the simplicity and power of Spring...

                                       ...with the dynamic module system of OSGi
                                       – Use spring container to configure bundles
                                       – Make it easy to publish/subscribe services
                                       – Application can be coded with minimal OSGi code
                                          • Also easy test/integration-test

                                               POJO development on OSGi




Copyright 2009 Tikal Knowledge, Ltd.                         | 78 |
Spring-DM Kernel Cont.

                                   NO OSGi code & NO Spring code

                                       » No BundleActivator
                                       » No ServiceTracker
                                       » No Spring invasive code


                                   A Spring application context based on OSGi

                                       bundle.
                                       » OsgiBundleApplicationContext


                                   Enables UnitTest and Integration Test




Copyright 2009 Tikal Knowledge, Ltd.                         | 79 |
Bring POJO to OSGi Services
                      <bean name="bookDao" class="com....BookDaoImpl" />
                                 <property name=”datasource” ref=”datasource”/>
                      </bean>




                      <osgi:service id="bookDaoOsgi" ref="bookDao"
                                                        interface="com.tikal...BookDao" />




                      <bean name="bookService" class="com.tikal....BookServiceImpl">
                        <property name="bookDao">
                          <osgi:reference interface="com.tikal...BookDao" />
                        </property>
                      </bean>




Copyright 2009 Tikal Knowledge, Ltd.                 | 80 |
Spring dm Server




Copyright 2009 Tikal Knowledge, Ltd.           | 81 |
Copyright 2009 Tikal Knowledge, Ltd.   | 82 |
Summary
                                OSGi is a dynamic module system for Java

                                        » Proven
                                        » Scalable (up and down)
                                OSGi Offer benefits in terms of

                                        » Modularity (visibility)
                                        » Versioning
                                        » Operational Control
                                Spring dm kernel/server combines the simplicity

                                       and power of Spring with sophistication of OSGi
                                       platform.


Copyright 2009 Tikal Knowledge, Ltd.                           | 83 |
Q&A


Copyright 2009 Tikal Knowledge, Ltd.     | 84 |
Thank You

                                       yanai@tikalk.com


Copyright 2009 Tikal Knowledge, Ltd.           | 85 |

More Related Content

Similar to Osgi Democamp

MATI 2009 Conference: CAT Tools
MATI 2009 Conference: CAT ToolsMATI 2009 Conference: CAT Tools
MATI 2009 Conference: CAT ToolsDierk Seeburg
 
CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...
CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...
CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...Thomas Gross
 
Accelerate Your Rails Site with Automatic Generation-Based Action Caching
Accelerate Your Rails Site with Automatic Generation-Based Action CachingAccelerate Your Rails Site with Automatic Generation-Based Action Caching
Accelerate Your Rails Site with Automatic Generation-Based Action Cachingelliando dias
 
Karonis Rom Telecom
Karonis Rom TelecomKaronis Rom Telecom
Karonis Rom Telecomknowhowgr
 
Introduction to Cloud Computing
Introduction to Cloud ComputingIntroduction to Cloud Computing
Introduction to Cloud ComputingTikal Knowledge
 
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACEChargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACEOpen iT Inc.
 
Keynote de Mike Milinkovich
Keynote de Mike MilinkovichKeynote de Mike Milinkovich
Keynote de Mike MilinkovichEclipseDayParis
 
Cloud Computing on ISO/IEC JTC 1
Cloud Computing on ISO/IEC JTC 1Cloud Computing on ISO/IEC JTC 1
Cloud Computing on ISO/IEC JTC 1Seungyun Lee
 
OCCI Introduction
OCCI IntroductionOCCI Introduction
OCCI Introductionbefreax
 
Symfony Day 2009 - Symfony vs Integrating products
Symfony Day 2009 - Symfony vs Integrating productsSymfony Day 2009 - Symfony vs Integrating products
Symfony Day 2009 - Symfony vs Integrating productsXavier Lacot
 
OSGi and Private Clouds
OSGi and Private CloudsOSGi and Private Clouds
OSGi and Private Cloudsmfrancis
 
Getting Your Head in the Clouds
Getting Your Head in the CloudsGetting Your Head in the Clouds
Getting Your Head in the CloudsAndrew Townley
 
Wonderland CHIPS Workshop June 2009
Wonderland CHIPS Workshop June 2009Wonderland CHIPS Workshop June 2009
Wonderland CHIPS Workshop June 2009jonathankap
 
EMC World 2016 - cnaITL.01 Adopting An Open Source Strategy
EMC World 2016 - cnaITL.01 Adopting An Open Source StrategyEMC World 2016 - cnaITL.01 Adopting An Open Source Strategy
EMC World 2016 - cnaITL.01 Adopting An Open Source Strategy{code}
 

Similar to Osgi Democamp (19)

MATI 2009 Conference: CAT Tools
MATI 2009 Conference: CAT ToolsMATI 2009 Conference: CAT Tools
MATI 2009 Conference: CAT Tools
 
CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...
CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...
CRYPTO\'10: Credential Authenticated Identification and Key Exchange - Thomas...
 
Accelerate Your Rails Site with Automatic Generation-Based Action Caching
Accelerate Your Rails Site with Automatic Generation-Based Action CachingAccelerate Your Rails Site with Automatic Generation-Based Action Caching
Accelerate Your Rails Site with Automatic Generation-Based Action Caching
 
Karonis Rom Telecom
Karonis Rom TelecomKaronis Rom Telecom
Karonis Rom Telecom
 
Introduction to Cloud Computing
Introduction to Cloud ComputingIntroduction to Cloud Computing
Introduction to Cloud Computing
 
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACEChargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
 
Keynote de Mike Milinkovich
Keynote de Mike MilinkovichKeynote de Mike Milinkovich
Keynote de Mike Milinkovich
 
Cloud Computing on ISO/IEC JTC 1
Cloud Computing on ISO/IEC JTC 1Cloud Computing on ISO/IEC JTC 1
Cloud Computing on ISO/IEC JTC 1
 
OSGI,
OSGI,OSGI,
OSGI,
 
OCCI Introduction
OCCI IntroductionOCCI Introduction
OCCI Introduction
 
Symfony Day 2009 - Symfony vs Integrating products
Symfony Day 2009 - Symfony vs Integrating productsSymfony Day 2009 - Symfony vs Integrating products
Symfony Day 2009 - Symfony vs Integrating products
 
OSGi and Private Clouds
OSGi and Private CloudsOSGi and Private Clouds
OSGi and Private Clouds
 
Getting Your Head in the Clouds
Getting Your Head in the CloudsGetting Your Head in the Clouds
Getting Your Head in the Clouds
 
Wonderland CHIPS Workshop June 2009
Wonderland CHIPS Workshop June 2009Wonderland CHIPS Workshop June 2009
Wonderland CHIPS Workshop June 2009
 
Os gi l
Os gi lOs gi l
Os gi l
 
Codejam
CodejamCodejam
Codejam
 
Javawug Codejam
Javawug CodejamJavawug Codejam
Javawug Codejam
 
EMC World 2016 - cnaITL.01 Adopting An Open Source Strategy
EMC World 2016 - cnaITL.01 Adopting An Open Source StrategyEMC World 2016 - cnaITL.01 Adopting An Open Source Strategy
EMC World 2016 - cnaITL.01 Adopting An Open Source Strategy
 
CloudCamp
CloudCampCloudCamp
CloudCamp
 

More from Tikal Knowledge

Tabtale story: Building a publishing and monitoring mobile games architecture...
Tabtale story: Building a publishing and monitoring mobile games architecture...Tabtale story: Building a publishing and monitoring mobile games architecture...
Tabtale story: Building a publishing and monitoring mobile games architecture...Tikal Knowledge
 
Processing Big Data in Realtime
Processing Big Data in RealtimeProcessing Big Data in Realtime
Processing Big Data in RealtimeTikal Knowledge
 
Docking your services_with_docker
Docking your services_with_dockerDocking your services_with_docker
Docking your services_with_dockerTikal Knowledge
 
Writing a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media playerWriting a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media playerTikal Knowledge
 
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 Tikal Knowledge
 
Tikal's Backbone_js introduction workshop
Tikal's Backbone_js introduction workshopTikal's Backbone_js introduction workshop
Tikal's Backbone_js introduction workshopTikal Knowledge
 
Cloud computing - an insight into "how does it really work ?"
Cloud computing - an insight into "how does it really work ?" Cloud computing - an insight into "how does it really work ?"
Cloud computing - an insight into "how does it really work ?" Tikal Knowledge
 
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day   Access Layer Implementation (C#) Based On Mongo DbTikal Fuse Day   Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo DbTikal Knowledge
 
Ship early ship often with Django
Ship early ship often with DjangoShip early ship often with Django
Ship early ship often with DjangoTikal Knowledge
 
Building Components In Flex3
Building Components In Flex3Building Components In Flex3
Building Components In Flex3Tikal Knowledge
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
JBUG 11 - Outside The Java Box
JBUG 11 - Outside The Java BoxJBUG 11 - Outside The Java Box
JBUG 11 - Outside The Java BoxTikal Knowledge
 
JBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersJBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersTikal Knowledge
 

More from Tikal Knowledge (20)

Tabtale story: Building a publishing and monitoring mobile games architecture...
Tabtale story: Building a publishing and monitoring mobile games architecture...Tabtale story: Building a publishing and monitoring mobile games architecture...
Tabtale story: Building a publishing and monitoring mobile games architecture...
 
Kafka short
Kafka shortKafka short
Kafka short
 
Heatmap
HeatmapHeatmap
Heatmap
 
Processing Big Data in Realtime
Processing Big Data in RealtimeProcessing Big Data in Realtime
Processing Big Data in Realtime
 
Docking your services_with_docker
Docking your services_with_dockerDocking your services_with_docker
Docking your services_with_docker
 
Who moved my_box
Who moved my_boxWho moved my_box
Who moved my_box
 
Writing a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media playerWriting a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media player
 
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
 
Tikal's Backbone_js introduction workshop
Tikal's Backbone_js introduction workshopTikal's Backbone_js introduction workshop
Tikal's Backbone_js introduction workshop
 
TCE Automation
TCE AutomationTCE Automation
TCE Automation
 
Tce automation-d4
Tce automation-d4Tce automation-d4
Tce automation-d4
 
Cloud computing - an insight into "how does it really work ?"
Cloud computing - an insight into "how does it really work ?" Cloud computing - an insight into "how does it really work ?"
Cloud computing - an insight into "how does it really work ?"
 
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day   Access Layer Implementation (C#) Based On Mongo DbTikal Fuse Day   Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
 
Ship early ship often with Django
Ship early ship often with DjangoShip early ship often with Django
Ship early ship often with Django
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
AWS Case Study
AWS Case StudyAWS Case Study
AWS Case Study
 
Building Components In Flex3
Building Components In Flex3Building Components In Flex3
Building Components In Flex3
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
JBUG 11 - Outside The Java Box
JBUG 11 - Outside The Java BoxJBUG 11 - Outside The Java Box
JBUG 11 - Outside The Java Box
 
JBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersJBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java Programmers
 

Recently uploaded

08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking Men08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking MenDelhi Call girls
 
best weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdfbest weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdftour guide
 
char Dham yatra, Uttarakhand tourism.pptx
char Dham yatra, Uttarakhand tourism.pptxchar Dham yatra, Uttarakhand tourism.pptx
char Dham yatra, Uttarakhand tourism.pptxpalakdigital7
 
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh HaldighatiApsara Of India
 
visa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa Consultantvisa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa ConsultantSherazi Tours
 
Top 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptxTop 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptxdishha99
 
BERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptxBERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptxseri bangash
 
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...Find American Rentals
 
Hire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls AgencyHire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls AgencyNitya salvi
 
Book Cheap Flight Tickets - TraveljunctionUK
Book  Cheap Flight Tickets - TraveljunctionUKBook  Cheap Flight Tickets - TraveljunctionUK
Book Cheap Flight Tickets - TraveljunctionUKTravel Juncation
 
Kanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Kanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceKanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Kanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceDamini Dixit
 
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking Men08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking MenDelhi Call girls
 
Hire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls AgencyHire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls AgencyNitya salvi
 
Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236Sherazi Tours
 
Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236Sherazi Tours
 
08448380779 Call Girls In Shahdara Women Seeking Men
08448380779 Call Girls In Shahdara Women Seeking Men08448380779 Call Girls In Shahdara Women Seeking Men
08448380779 Call Girls In Shahdara Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking Men08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking Men
 
best weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdfbest weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdf
 
char Dham yatra, Uttarakhand tourism.pptx
char Dham yatra, Uttarakhand tourism.pptxchar Dham yatra, Uttarakhand tourism.pptx
char Dham yatra, Uttarakhand tourism.pptx
 
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
 
visa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa Consultantvisa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa Consultant
 
Rohini Sector 18 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 18 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 18 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 18 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Top 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptxTop 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptx
 
BERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptxBERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptx
 
Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance VV...
Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance  VV...Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance  VV...
Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance VV...
 
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
 
Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance VVVIP 🍎 S...
Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance  VVVIP 🍎 S...Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance  VVVIP 🍎 S...
Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance VVVIP 🍎 S...
 
Hire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls AgencyHire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
 
Book Cheap Flight Tickets - TraveljunctionUK
Book  Cheap Flight Tickets - TraveljunctionUKBook  Cheap Flight Tickets - TraveljunctionUK
Book Cheap Flight Tickets - TraveljunctionUK
 
Kanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Kanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceKanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Kanpur Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
 
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
 
08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking Men08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking Men
 
Hire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls AgencyHire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
 
Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236
 
Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236
 
08448380779 Call Girls In Shahdara Women Seeking Men
08448380779 Call Girls In Shahdara Women Seeking Men08448380779 Call Girls In Shahdara Women Seeking Men
08448380779 Call Girls In Shahdara Women Seeking Men
 

Osgi Democamp

  • 1. Open Your Eyes To OSGi By : Yanai Franchi Chief Architect , Tikal Eclipse DemoCamps Galileo 2009/Tel Aviv
  • 2. Agenda  Introduction – What is OSGi ? – What problems does it help us to solve ? – How does it work ?  OSGi programming model – Live Demo  OSGi in Enterprise Applications – Spring DM Copyright 2009 Tikal Knowledge, Ltd. | 2 |
  • 3. OSG - what? Copyright 2009 Tikal Knowledge, Ltd. | 3 |
  • 4. OSGi Acronym O = Open S = Services G = Gateway i = initiative Copyright 2009 Tikal Knowledge, Ltd. | 4 |
  • 5. TM OSGi OSGi TM The Dynamic Module System For Java Copyright 2009 Tikal Knowledge, Ltd. | 5 |
  • 6. Original OSGi Vision Copyright 2009 Tikal Knowledge, Ltd. | 6 |
  • 7. Who's Doing It ?  Open source implementation » Equinox » Felix » Knoplerfish  Significant enterprise Java usage » Eclipse » IBM – WebSphere, Lotus » JonAS » BEA » Oracle » JBoss » SpringSource Copyright 2009 Tikal Knowledge, Ltd. | 7 |
  • 8. Why Do We Need OSGi ? Copyright 2009 Tikal Knowledge, Ltd. | 8 |
  • 9. The Humble JAR File Copyright 2009 Tikal Knowledge, Ltd. | 9 |
  • 10. Typical Java Application Copyright 2009 Tikal Knowledge, Ltd. | 10 |
  • 11. Copyright 2009 Tikal Knowledge, Ltd. | 11 |
  • 12. Our Application Stack... Copyright 2009 Tikal Knowledge, Ltd. | 12 |
  • 13. No Runtime Representation Copyright 2009 Tikal Knowledge, Ltd. | 13 |
  • 14. Loading Classes... Copyright 2009 Tikal Knowledge, Ltd. | 14 |
  • 15. ...The ClassLoader Found One Copyright 2009 Tikal Knowledge, Ltd. | 15 |
  • 16. ...But I Need The Other Class :( Copyright 2009 Tikal Knowledge, Ltd. | 16 |
  • 17. Copyright 2009 Tikal Knowledge, Ltd. | 17 |
  • 18. Dependency Graph Copyright 2009 Tikal Knowledge, Ltd. | 18 |
  • 19. Still Something Wrong  Classes can be tightly coupled  Even across module boundaries Copyright 2009 Tikal Knowledge, Ltd. | 19 |
  • 20. Copyright 2009 Tikal Knowledge, Ltd. | 20 |
  • 21. We Have a Problem... Copyright 2009 Tikal Knowledge, Ltd. | 21 |
  • 22. ...A Big One... Copyright 2009 Tikal Knowledge, Ltd. | 22 |
  • 23. ...It Crashed :( Copyright 2009 Tikal Knowledge, Ltd. | 23 |
  • 24. Need to Decouple Copyright 2009 Tikal Knowledge, Ltd. | 24 |
  • 25. Late Binding Copyright 2009 Tikal Knowledge, Ltd. | 25 |
  • 26. Why Did Eclipse Adopt OSGi ? Copyright 2009 Tikal Knowledge, Ltd. | 26 |
  • 27. Pre-OSGi Eclipse (<3.0) • Metadata in plugin.xml: • Meaningful Name, Vendor • Version • Dependencies • Private Internals • De-Coupling Framework (Extension Registry) Copyright 2009 Tikal Knowledge, Ltd. | 27 |
  • 28. What Is Missing ??? Copyright 2009 Tikal Knowledge, Ltd. | 28 |
  • 29. Copyright 2009 Tikal Knowledge, Ltd. | 29 |
  • 30. Copyright 2009 Tikal Knowledge, Ltd. | 30 |
  • 31. But in Eclipse... Copyright 2009 Tikal Knowledge, Ltd. | 31 |
  • 32. A Little Open-Heart Surgery • Equinox project started February 2003 • Replace old Eclipse runtime with OSGi • Enhance OSGi standard • Eclipse 3.0 released June 2004 Copyright 2009 Tikal Knowledge, Ltd. | 32 |
  • 33. OSGi Architectural Copyright 2009 Tikal Knowledge, Ltd. | 33 |
  • 34. Bundle  By default a bundle is a black box » Completely protected » You can NOT see inside it • Not even by reflection • Or any other class loading trickery Copyright 2009 Tikal Knowledge, Ltd. | 34 |
  • 35. How Does It Look Like ?  Its a jar file!  No complicated tools or sophisticated packaging required. META-INF/MANIFEST.MF Bundle-Name: Hello World Bundle-SymbolicName: com.tikal.osgi.sample.helloworld Bundle-Version: 2.1.0 Export-Package: com.tikal.osgi.sample Import-Package: com.tikal.osgi.weather ,org.osgi.framework Bundle-Activator: com.tikal.osgi.sample.HelloActivator Copyright 2009 Tikal Knowledge, Ltd. | 35 |
  • 36. Bundle Visibility  Exposing Types can be done explicitly » A bundle can export one or more packages » Optionally with versioning information  Only exported packages are visibly outside of the exporting bundle. » Stops unintended coupling between bundles » Enable independent development » Faster development cycles Copyright 2009 Tikal Knowledge, Ltd. | 36 |
  • 37. Bundle Visibility Cont. Service interface types exported with version information Export-Packages: a,b,c private packages “Passive” contribution Service Types added to type space implementation bundles see new version on locked away resolution after install/refresh Copyright 2009 Tikal Knowledge, Ltd. | 37 |
  • 38. Bundle's Life Cycle– Dynamic ! Copyright 2009 Tikal Knowledge, Ltd. | 38 |
  • 39. OSGi Wiring Copyright 2009 Tikal Knowledge, Ltd. | 39 |
  • 40. OSGi Wiring Copyright 2009 Tikal Knowledge, Ltd. | 40 |
  • 41. OSGi Wiring Copyright 2009 Tikal Knowledge, Ltd. | 41 |
  • 42. Versioning MVC Service Repository ' Copyright 2009 Tikal Knowledge, Ltd. | 42 |
  • 43. Versioning MVC Two versions of the same service type... at the same Service Service ' time! Repository ' Copyright 2009 Tikal Knowledge, Ltd. | 43 |
  • 44. Versioning Copyright 2009 Tikal Knowledge, Ltd. | 44 |
  • 45. Operational Control  See all bundles and their status » OSGi console » Web Console » JMX  Get information on wiring  Install new bundles  Activate/Deactivate bundles (and publish services)  Refresh bundles  Stop bundles  Uninstall bundles All without stop or restart the application Copyright 2009 Tikal Knowledge, Ltd. | 45 |
  • 46. OSGi - Lessons Learned • Visibility • Versioning • Operational Control Copyright 2009 Tikal Knowledge, Ltd. | 46 |
  • 47. OSGi Programming  All access to OSGi is through BundleContext  This is supplied to our BundleActivator Copyright 2009 Tikal Knowledge, Ltd. | 47 |
  • 48. BundleActivator Bundle-Name: Hello World Bundle-SymbolicName: com.tikal.osgi.sample.helloworld Bundle-Activator: com.tikal.osgi.sample.HelloActivator public class HelloActivator implements BundleActivator { public void start(BundleContext context) throws Exception { System.out.println(“Hello, world!”); System.out.println(Arrays.asList(context.getBundles())); } public void stop(BundleContext context) throws Exception { System.out.println(“Goodbye, world!”); } } Copyright 2009 Tikal Knowledge, Ltd. | 48 |
  • 49. Hello-World DEMO Copyright 2009 Tikal Knowledge, Ltd. | 49 |
  • 50. Services in OSGi Copyright 2009 Tikal Knowledge, Ltd. | 50 |
  • 51. SOA Architecture  The OSGi framework promotes a service-oriented interaction pattern among bundles Copyright 2009 Tikal Knowledge, Ltd. | 51 |
  • 52. SOA For The JVM Published Services “Active” contribution Private Services published in implementation registry objects bundles see service changes immediately Copyright 2009 Tikal Knowledge, Ltd. | 52 |
  • 53. SOA in OSGi Copyright 2009 Tikal Knowledge, Ltd. | 53 |
  • 54. SOA in OSGi Copyright 2009 Tikal Knowledge, Ltd. | 54 |
  • 55. SOA in OSGi Copyright 2009 Tikal Knowledge, Ltd. | 55 |
  • 56. SOA in OSGi Copyright 2009 Tikal Knowledge, Ltd. | 56 |
  • 57. SOA in OSGi Copyright 2009 Tikal Knowledge, Ltd. | 57 |
  • 58. Example: Paint Program Copyright 2009 Tikal Knowledge, Ltd. | 58 |
  • 59. Naive Class Diagram Copyright 2009 Tikal Knowledge, Ltd. | 59 |
  • 60. Register Is Easy... Hashtable dict = new Hashtable(); dict.put(SimpleShape.NAME_PROPERTY, "Square"); dict.put(SimpleShape.ICON_PROPERTY, new ImageIcon(getClass().getResource("square.png"))); context.registerService(SimpleShape.class.getName(), new Square(),dict); Copyright 2009 Tikal Knowledge, Ltd. | 60 |
  • 61. Consume Is ... Copyright 2009 Tikal Knowledge, Ltd. | 61 |
  • 62. First Attempt ServiceReference ref = context.getServiceReference( SimpleShape.class.getName()); SimpleShape shape = (SimpleShape) context.getService(ref) shape.draw(); Copyright 2009 Tikal Knowledge, Ltd. | 62 |
  • 63. Oops, “ref” can be Null ServiceReference ref = context.getServiceReference( SimpleShape.class.getName()); if(ref != null) { SimpleShape shape = (SimpleShape) context.getService(ref) shape.draw(); } Copyright 2009 Tikal Knowledge, Ltd. | 63 |
  • 64. Oops, “shape” can be Null ServiceReference ref = context.getServiceReference( SimpleShape.class.getName()); if(ref != null) { SimpleShape shape = (SimpleShape) context.getService(ref); if(shape != null) shape.draw(); } Copyright 2009 Tikal Knowledge, Ltd. | 64 |
  • 65. How ??? Copyright 2009 Tikal Knowledge, Ltd. | 65 |
  • 66. Oops, Need to Clean Up ServiceReference ref = context.getServiceReference( SimpleShape.class.getName()); if(ref != null) { SimpleShape shape = (SimpleShape) context.getService(ref); if(shape != null){ try{ shape.draw(); }finally{ context.ungetService(ref); } } Copyright 2009 Tikal Knowledge, Ltd. | 66 |
  • 67. Copyright 2009 Tikal Knowledge, Ltd. | 67 |
  • 68. ServiceTracker  Shape Tracker goal – Use Inversion of Control principles to inject shapes into application » Created by the BundleActivator » Puts tracking logic in one place » Isolates application from OSGi API  User “Observer” design pattern to track services for clients. Copyright 2009 Tikal Knowledge, Ltd. | 68 |
  • 69. Connecting The Dots Copyright 2009 Tikal Knowledge, Ltd. | 69 |
  • 70. Connecting The Dots Copyright 2009 Tikal Knowledge, Ltd. | 70 |
  • 71. Connecting The Dots Copyright 2009 Tikal Knowledge, Ltd. | 71 |
  • 72. Shapes DEMO Copyright 2009 Tikal Knowledge, Ltd. | 72 |
  • 73. Distributed OSGi... Its Here... Copyright 2009 Tikal Knowledge, Ltd. | 73 |
  • 74. OSGi in ... Enterprise Applications Copyright 2009 Tikal Knowledge, Ltd. | 74 |
  • 75. A Typical JEE Application D Web Application D Lib Lib Context D D Lib Lib D D Middle-tier Lib Context Lib Lib D Copyright 2009 Tikal Knowledge, Ltd. | 75 |
  • 76. JEE Application Base on OSGi Each bundle is a segregated class space MVC MVC MVC Lib Lib Service Service Lib Domain Repository Repository Copyright 2009 Tikal Knowledge, Ltd. | 76 |
  • 77. JEE Application on OSGi ?  How can we exploit OSGi » Without adding complexity ? » Retaining our programming model?  We want to treat bundles as beans » Instantiated, Configure, Assemble, Decorate » We want to easy way to publish/consume services • Dynamic management » Should we code this ourselves? » Preserve ability to test Copyright 2009 Tikal Knowledge, Ltd. | 77 |
  • 78. Spring-DM Kernel  Integrates the simplicity and power of Spring... ...with the dynamic module system of OSGi – Use spring container to configure bundles – Make it easy to publish/subscribe services – Application can be coded with minimal OSGi code • Also easy test/integration-test POJO development on OSGi Copyright 2009 Tikal Knowledge, Ltd. | 78 |
  • 79. Spring-DM Kernel Cont.  NO OSGi code & NO Spring code » No BundleActivator » No ServiceTracker » No Spring invasive code  A Spring application context based on OSGi bundle. » OsgiBundleApplicationContext  Enables UnitTest and Integration Test Copyright 2009 Tikal Knowledge, Ltd. | 79 |
  • 80. Bring POJO to OSGi Services <bean name="bookDao" class="com....BookDaoImpl" /> <property name=”datasource” ref=”datasource”/> </bean> <osgi:service id="bookDaoOsgi" ref="bookDao" interface="com.tikal...BookDao" /> <bean name="bookService" class="com.tikal....BookServiceImpl"> <property name="bookDao"> <osgi:reference interface="com.tikal...BookDao" /> </property> </bean> Copyright 2009 Tikal Knowledge, Ltd. | 80 |
  • 81. Spring dm Server Copyright 2009 Tikal Knowledge, Ltd. | 81 |
  • 82. Copyright 2009 Tikal Knowledge, Ltd. | 82 |
  • 83. Summary  OSGi is a dynamic module system for Java » Proven » Scalable (up and down)  OSGi Offer benefits in terms of » Modularity (visibility) » Versioning » Operational Control  Spring dm kernel/server combines the simplicity and power of Spring with sophistication of OSGi platform. Copyright 2009 Tikal Knowledge, Ltd. | 83 |
  • 84. Q&A Copyright 2009 Tikal Knowledge, Ltd. | 84 |
  • 85. Thank You yanai@tikalk.com Copyright 2009 Tikal Knowledge, Ltd. | 85 |