Modular Java - OSGi

2,081
-1

Published on

Modular Java - OSGi

  1. 1. Modular Java An Introduction to OSGi Craig Walls
  2. 2. Who Am I? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  3. 3. Who Am I? Java, Spring, and OSGi fanatic Principal Consultant with . Author XDoclet in Action (Manning) Spring in Action (Manning) Modular Java (Pragmatic Bookshelf) E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  4. 4. What is OSGi?
  5. 5. OSGi is... A modularity specification for Java An intra-VM SOA E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  6. 6. OSGi is NOT... New Heavyweight Difficult Only for Eclipse EJB all over again An acronym Named very cool E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  7. 7. Modularity is... • High cohesion • Modules are focused in purpose • Low coupling • Modules have minimal/no direct dependency on each other • Not a new idea... “A well-defined segmentation of the project effort ensures system modularity. Each task forms a separate, distinct program module. At implementation time each module and its inputs and outputs are well-defined, there is no confusion in the intended interface with other system modules. At checkout time the integrity of the module is tested independently; there are few scheduling problems in synchronizing the completion of several tasks before checkout can begin. Finally, the system is maintained in modular fashion; system errors and deficiencies can be traced to specific system modules, thus limiting the scope of detailed error searching.” Designing Systems Programs, Richard Gauthier and Stephen Pont, 1970. E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  8. 8. Modularity promotes... E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  9. 9. Modularity promotes... • Testability E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  10. 10. Modularity promotes... • Testability E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  11. 11. Modularity promotes... • Testability • Comprehensibility E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  12. 12. Modularity promotes... • Testability • Comprehensibility E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  13. 13. Modularity promotes... • Testability • Comprehensibility • Flexibility E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  14. 14. Modularity promotes... • Testability • Comprehensibility • Flexibility E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  15. 15. Modularity promotes... • Testability • Comprehensibility • Flexibility • Reusability E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  16. 16. Modularity promotes... • Testability • Comprehensibility • Flexibility • Reusability E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  17. 17. Modularity promotes... • Testability • Comprehensibility • Flexibility • Reusability • Plugability E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  18. 18. Modularity in Java? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  19. 19. Modularity in Java? • Java lacks some essential features to support modular development E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  20. 20. Modularity in Java? • Java lacks some essential features to support modular development • Classes encapsulate data and functionality E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  21. 21. Modularity in Java? • Java lacks some essential features to support modular development • Classes encapsulate data and functionality • They’re too fine-grained for practical modularity E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  22. 22. Modularity in Java? • Java lacks some essential features to support modular development • Classes encapsulate data and functionality • They’re too fine-grained for practical modularity • Packages only contain classes E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  23. 23. Modularity in Java? • Java lacks some essential features to support modular development • Classes encapsulate data and functionality • They’re too fine-grained for practical modularity • Packages only contain classes • They’re only an organizational mechanism E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  24. 24. Modularity in Java? • Java lacks some essential features to support modular development • Classes encapsulate data and functionality • They’re too fine-grained for practical modularity • Packages only contain classes • They’re only an organizational mechanism • JAR files only contain packages/classes E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  25. 25. JAR Files: A false sense of modularity E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  26. 26. Where’s the modularity? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  27. 27. Where’s the modularity? public class MyAwesomeClass { public void doSomething() { FooInternal foo = new FooInternal(); // ... } } E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  28. 28. Where’s the modularity? public class MyAwesomeClass { public void doSomething() { FooInternal foo = new FooInternal(); // ... } } /** * Intended for INTERNAL USE ONLY!!! * Do not use directly!!! */ class FooInternal { ... } E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  29. 29. JAR Hell E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  30. 30. JAR Hell E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  31. 31. JAR/Classpath Hell E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  32. 32. No boundaries E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  33. 33. Building walls around JARs E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  34. 34. Delegating classloading E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  35. 35. Add a service registry E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  36. 36. Publish services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  37. 37. Consume services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  38. 38. Only import service API E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  39. 39. Only import service API OSGi! E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  40. 40. The solution...OSGi • Dynamic Runtime • Modules can be installed, started, stopped, updated, and uninstalled...in a live program • Ends JAR Hell • Multiple versions of a class can reside in OSGi simultaneously E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  41. 41. OSGi Basics
  42. 42. OSGi implementations E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  43. 43. OSGi implementations • Open Source • Eclipse Equinox (http://www.eclipse.org/equinox) • Apache Felix (http://felix.apache.org) • Knopflerfish (http://www.knopflerfish.org) • Concierge (http://concierge.sourceforge.net/) E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  44. 44. OSGi implementations • Open Source • Eclipse Equinox (http://www.eclipse.org/equinox) • Apache Felix (http://felix.apache.org) • Knopflerfish (http://www.knopflerfish.org) • Concierge (http://concierge.sourceforge.net/) • Commercial • Makewave Knopflerfish Pro (http://www.makewave.com) • ProSyst mBedded Server (http://www.prosyst.com) • Samsung OSGi R4 Solution • HitachiSoft SuperJ Engine Framework E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  45. 45. Bundles E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  46. 46. Bundles • Just JAR files E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  47. 47. Bundles • Just JAR files • Contain special metadata in MANIFEST.MF E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  48. 48. Bundles • Just JAR files • Contain special metadata in MANIFEST.MF • All content is private by default • May export packages to be imported by other bundles • May publish services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  49. 49. Bundles • Just JAR files • Contain special metadata in MANIFEST.MF • All content is private by default • May export packages to be imported by other bundles • May publish services • May be versioned E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  50. 50. Bundle Lifecycle E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  51. 51. Fragments E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  52. 52. Fragments • Just JAR files, like bundles, but... E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  53. 53. Fragments • Just JAR files, like bundles, but... • Must be hosted by another bundle E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  54. 54. Fragments • Just JAR files, like bundles, but... • Must be hosted by another bundle • Physically separate, logically united E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  55. 55. Fragments • Just JAR files, like bundles, but... • Must be hosted by another bundle • Physically separate, logically united • Used to add content (classes, resources, etc) to a hosting bundle E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  56. 56. OSGi Manifest • Defines the content of a bundle Manifest-Version: 1.0 Built-By: wallsc Created-By: Apache Maven Bundle Plugin Bundle-Activator: com.osgiknowhow.hello.consumer.internal.HelloConsumerActivator Import-Package: com.osgiknowhow.hello.service;version="1.0.0.SNAPSHOT", org.osgi.framework,org.osgi.util.tracker Bnd-LastModified: 1236686261405 Bundle-Version: 1.0.0.SNAPSHOT Ignore-Package: com.osgiknowhow.hello.consumer.internal Bundle-Name: com.osgiknowhow.hello.consumer Bundle-Description: Generated using Pax-Construct Build-Jdk: 1.5.0_16 Private-Package: com.osgiknowhow.hello.consumer.internal Bundle-ManifestVersion: 2 Bundle-SymbolicName: com.osgiknowhow.hello.consumer Tool: Bnd-0.0.255 • Don’t ever write this file yourself • Generate it (see Bnd, Bundlor, etc) E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  57. 57. Manifest headers Bundle-SymbolicName Bundle-Version Import-Package Export-Package Bundle-Activator E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  58. 58. Versioning E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  59. 59. Versioning • Bundles and packages can be versioned • Can even be versioned independent from each other E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  60. 60. Versioning • Bundles and packages can be versioned • Can even be versioned independent from each other • Multiple versions can be available simultaneously E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  61. 61. Versioning • Bundles and packages can be versioned • Can even be versioned independent from each other • Multiple versions can be available simultaneously • Packages can be imported by specifying a specific version, a version range, or no version at all (implying an infinite version range) E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  62. 62. Services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  63. 63. Services • Bundle functionality encapsulated behind services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  64. 64. Services • Bundle functionality encapsulated behind services • Bundles can publish/consume services • Identified by their interface(s) and optional parameters • Publish programatically using bundle context • Consume programatically using bundle context and service tracker E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  65. 65. Services • Bundle functionality encapsulated behind services • Bundles can publish/consume services • Identified by their interface(s) and optional parameters • Publish programatically using bundle context • Consume programatically using bundle context and service tracker • Can be published/consumed declaratively • Declarative Services, iPOJO, Spring-DM E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  66. 66. Example Time
  67. 67. OSGi Tools Disclaimer • My OSGi toolbox includes • Maven • Pax Construct • BND • TextMate (and Eclipse) • You don’t have to use what I use • There are a lot of options to choose from • Ant with BND also works fine E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  68. 68. Just enough Maven... • For the most part, you’ll only ever need... • mvn install • Occasionally you may need... • mvn test • mvn clean E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  69. 69. Pax Construct • Rails/Grails/Roo-ish model • Scripts backed by Maven archetypes • Key Pax Construct scripts: • pax-create-project • pax-create-bundle • pax-provision • pax-import-bundle • pax-add-repository E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  70. 70. BND • A giant in a small JAR • Can be used as an Ant task • Can be used as an Eclipse plugin • Can be used at the command line • Automatically infers much of a manifest • Can be coerced, if necessary • BND instructions can take wildcards! • It’s the magic underneath the Felix Maven Bundle Plugin • Which is some of the magic underneath Pax Construct E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  71. 71. Example 1 Simple Service/Consumer using a Bundle Activator
  72. 72. OSGi Blueprint Services
  73. 73. In the beginning (circa 2006) OSGi Declarative Services Spring Dynamic Modules iPOJO E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  74. 74. Publishing a Service In OSGI-INF/blueprint/*.xml: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/ blueprint-ext/v1.0.0" default-activation="lazy"> <bean id="numberService" class= "com.habuma.numbers.internal.NumberToEnglishServiceImpl" /> <service ref="numberService" interface="com.habuma.numbers.NumberToEnglishService" /> </blueprint> E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  75. 75. Consuming a Service In OSGI-INF/blueprint/*.xml: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/ blueprint-ext/v1.0.0" default-activation="lazy"> <bean id="numberService" class="com.habuma.numbers.ui.NumberConverterUI" /> <reference id="numberService" interface="com.habuma.numbers.NumberToEnglishService" /> </blueprint> E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  76. 76. Blueprint vs. Spring-DM E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  77. 77. Blueprint vs. Spring-DM Spring-DM implements Blueprint Services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  78. 78. Blueprint vs. Spring-DM Spring-DM implements Blueprint Services Spring-DM isn’t the only implementation E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  79. 79. Blueprint vs. Spring-DM Spring-DM implements Blueprint Services Spring-DM isn’t the only implementation If you want/need the power of Spring, then use Spring-DM E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  80. 80. Blueprint vs. Spring-DM Spring-DM implements Blueprint Services Spring-DM isn’t the only implementation If you want/need the power of Spring, then use Spring-DM Otherwise, any implementation of Blueprint Services will do E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  81. 81. Example 2 Service/Consumer using OSGi Blueprint Services
  82. 82. Testing OSGi
  83. 83. Levels of Testing Unit Integration User Acceptance Functional E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  84. 84. Levels of Testing Unit Integration Bundle User Acceptance Functional E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  85. 85. Bundle Testing E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  86. 86. Bundle Testing • Does the bundle export what it’s supposed to? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  87. 87. Bundle Testing • Does the bundle export what it’s supposed to? • Does the bundle publish the services that it’s supposed to? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  88. 88. Bundle Testing • Does the bundle export what it’s supposed to? • Does the bundle publish the services that it’s supposed to? • Does the bundle’s service(s) behave like they’re supposed to? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  89. 89. Bundle Testing • Does the bundle export what it’s supposed to? • Does the bundle publish the services that it’s supposed to? • Does the bundle’s service(s) behave like they’re supposed to? • Does the bundle get along with other bundles? E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  90. 90. Bundle Testing Options E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  91. 91. Bundle Testing Options Spring-DM E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  92. 92. Bundle Testing Options Spring-DM Pax Exam E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  93. 93. Bundle Testing Options Spring-DM Pax Exam DA-Testing (dynamicjava.org) E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  94. 94. Pax-Exam/Spring-DM Testing E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  95. 95. Pax-Exam/Spring-DM Testing Written as JUnit Test E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  96. 96. Pax-Exam/Spring-DM Testing Written as JUnit Test JUnit 3 for Spring-DM; JUnit 4 for Pax Exam E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  97. 97. Pax-Exam/Spring-DM Testing Written as JUnit Test JUnit 3 for Spring-DM; JUnit 4 for Pax Exam Test setup identifies one or more bundles and an OSGi framework to deploy to E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  98. 98. Pax-Exam/Spring-DM Testing Written as JUnit Test JUnit 3 for Spring-DM; JUnit 4 for Pax Exam Test setup identifies one or more bundles and an OSGi framework to deploy to Test methods make assertions against bundles and services E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  99. 99. Pax-Exam/Spring-DM Testing Written as JUnit Test JUnit 3 for Spring-DM; JUnit 4 for Pax Exam Test setup identifies one or more bundles and an OSGi framework to deploy to Test methods make assertions against bundles and services When run, test becomes an on-the-fly bundle running within the framework E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  100. 100. Example 3 Testing OSGi Services with Pax Exam
  101. 101. Moving to OSGi
  102. 102. Strategy E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  103. 103. Strategy 1. Convert full app into one large bundle a. Embed JARs (Use Bundle-ClassPath) b. Add Bundle-SymbolicName E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  104. 104. Strategy 1. Convert full app into one large bundle a. Embed JARs (Use Bundle-ClassPath) b. Add Bundle-SymbolicName 2. Peel off dependencies one-by-one a. Start with 3rd party libraries b. Pull out proprietary modules E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  105. 105. E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  106. 106. Converting Big Apps E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  107. 107. Converting Big Apps E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  108. 108. Converting Big Apps E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  109. 109. Converting Big Apps E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  110. 110. Converting Big Apps E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  111. 111. Dealing with Legacy JARs E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  112. 112. Dealing with Legacy JARs • BND E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  113. 113. Dealing with Legacy JARs • BND • Pax Construct: • pax-wrap-jar or pax-embed-jar E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  114. 114. Dealing with Legacy JARs • BND • Pax Construct: • pax-wrap-jar or pax-embed-jar • Find them in a bundle repository • OBR • http://www.osgi.org/Repository • SpringSource Enterprise Bundle Repository • http://www.springsource.com/repository E-mail: craig@habuma.com Blog: http://www.springinaction.com Twitter: @habuma Slides: http://www.slideshare.net/habuma
  115. 115. Thank You

×