Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Beyond OSGi Software Architecture


Published on

Slides from the JFall '09 session on OSGi Software Architecture by Marcel Offermans and Jeroen van Grondelle.

Published in: Technology

Beyond OSGi Software Architecture

  1. 1. Beyond OSGi Software Architecture Jeroen van Grondelle Marcel Offermans 11 november - JFall 2009
  2. 2. About Us Marcel Offermans Jeroen van Grondelle
  3. 3. Lean Development Service Interfaces OSGi based Apps Service Creation Patterns
  4. 4. Lean Development Part 1
  5. 5. Anticipate Change Yes, there WILL be new requirements...
  6. 6. "Non-Functionals“ Great functionality! And can you do that, in a ... way. Based on Luke Hohmann's book Beyond Software Architecture
  7. 7. Anticipate, don’t over dimension Do not try to support the things now that MIGHT be required next...
  8. 8. No decision is irreversible, but some are VERY expensive to reverse...
  9. 9. Service Interfaces that help you Change Part 2
  10. 10. Behavior Only Do NOT disclose parameters and implementation details. Do NOT shape a Service after your rst/only implementation. This is NOT Object Orientation. Or is it... ;-)
  11. 11. Scale Invariance Service Interface should NOT re ect the scale  your ( rst) implementation will support.
  12. 12. Decoupling If your implementations require other services,  access these services through interfaces only.
  13. 13. Think BIG act small! Your service interface should be future proof, your implementation should t your current needs. Keep many possible implementations  (functionality, scale) in mind when designing interfaces.
  14. 14. Service Oriented Apps using OSGi Part 3
  15. 15. OSGi Recap Service Log Store Prefs publish publish publish use use use Bundle Bundle Bundle Bundle install Life Cycle installed Service start start starting Bundle Bundle Bundle Life Cycle resolved active Module end uninstall stopping stop Security uninstalled OSGi framework Java Virtual Machine Module Bundle Bundle Bundle Bundle imports exports imports exports exports exports org.apache.util 1.0 org.apache.db 1.4 org.apache.log 2.3 org.apache.util 1.1
  16. 16. Container Style Development Application consists of interdependent Services Public Services are accessed through UI/SOAP/JMS/...
  17. 17. Be a Good Host Offer facilities to your components OSGi Compendium is a Catalog of generic Facilities Add your own to the container if needed
  18. 18. Deploy Everything Not just code! Content Configurations Testcases Work
  19. 19. Inversion of Control Use declarative Lifecycle and Dependency Management Develop POJO’s Delegate injection
  20. 20. Add Chemistry Deployed services react on each other Resulting in behavior and new services Define these reactions in terms of life cycle and dependencies
  21. 21. Patterns for Creating Service Graphs Part 4
  22. 22. Singleton Services Singleton Document Repository get() Storage getVersions() requires get(version) store(Document) Bind Logic in a Single Instance
  23. 23. Singleton Services class Activator { public void init(context, manager) { manager.add( createService() .setInterface(DocumentRepository.class.getName()) (Pseudo)Code .setImplementation(DocumentRepositoryImpl.class) .add( createServiceDependency() .setService(Storage.class))); } }
  24. 24. Aspect Services Aspect Repository Cache Repository get() get() getVersions() intercepts getVersions() get(version) get(version) store(Document) store(Document) Transparently inject an interceptor service  "in front of" all services matching a lter
  25. 25. Aspect Services class Activator { public void init(context, manager) { manager.add( createAspectService( DocumentRepository.class, DocumentRepositoryCache.class, 10)); } }
  26. 26. Adapter Services Adapter Repository Cache Repository Cache Manageable get() getCacheHits() getVersions() adapts setSize() get(version) setTTL() store(Document) flush() Start an instance of the adapter service for any "adaptee" service matching a lter
  27. 27. Adapter Services class Activator { public void init(context, manager) { manager.add( createAdapterService( Manageable.class, DocumentRepositoryCache.class, DocumentRepositoryCacheManageable.class)); } }
  28. 28. Resource Adapters Resource Audio Track Adapter play() MP3 adapts pause() File stop() Start an instance of a Resource Driven Service for all resources matching a lter Resources: File(system) abstraction, access by InputStream
  29. 29. Resource Adapters class Activator { public void init(context, manager) { manager.add( createResourceAdapterService( "(extension=mp3)", AudioTrack.class, MP3AudioTrack.class)); } }
  30. 30. Dependency Management & OSGi Not standard OSGi, a number of extensions available. Felix Dependency Manager implements these patterns.
  31. 31. Lean Development Service Interfaces OSGi based Apps Service Creation Patterns
  32. 32. Questions? Marcel Offermans Jeroen van Grondelle