SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
!"#$%&'&()"*
Marcel Offermans
Dependencies,
dependencies,
dependencies
1
Marcel Offermans
• Fellow and Software Architect at
Luminis Technologies
marcel.offermans@luminis.nl
• Member and Committer at
Apache Software Foundation
marrs@apache.org
2
Agenda
• Introduction
• Basic Concepts
• Dependencies
• Design Patterns
• Custom Dependencies
• Add-ons
• Wrap-up
3
Agenda
• Introduction
• Basic Concepts
• Dependencies
• Design Patterns
• Custom Dependencies
• Add-ons
• Wrap-up
Software distribution:
copy both zip archives from the
memory stick
3
Introduction
4
Framework
!"#"$%&'()"*$+",-&./
012&$3'"4/56'7
1/,)'&(8
+69)*/
:&3/$,8,*/
1/'#&,/
;).9*/ ;).9*/ ;).9*/
5
Service Dependencies
• framework: ServiceListener
– notification whenever there is a change
in the service registry
– but: only changes that occur while you
are listening
• utility: ServiceTracker
– solves the listening issue
– adds ability to customize services
6
Problem
• using the framework supplied
tooling, you are dealing with
dependencies at a very low level
• a lot of boiler plate code is needed
to implement real world scenarios
• there are very few design patterns
that deal with composing an
application based on services
7
Declaring your dependencies
• Service Binder
• Dependency Manager
• Declarative Services
• iPOJO
• Blueprint
• ...many more
8
Dependency Manager
• Subproject of Apache Felix
• Nearing a 3.0 release
• Some interesting new features
...I’m not unbiased, being it’s author
9
Basic Concepts
10
Basic Concepts
• Component: class that implements
certain behaviour (a POJO)
• Dependency: something our
component needs or wants (ie. a
service)
• Service: OSGi service interface(s)
under which our component is
registered
11
Declarative API
• Declarative ≠ XML
• Using a Java API has many
advantages:
– less error prone because of syntax and
compile time checking
– refactoring support, completion
– very readable through fluid API
– everything in one place, no magic
12
Example code
• Projects
– Download: http://www.xs4all.nl/~mfo/projects.zip
• Uses Eclipse + BndTools
– Homepage: http://njbartlett.name/bndtools.html
– Update Site: http://bndtools-updates.s3.amazonaws.com
• Based on a snapshot release of the
upcoming Dependency Manager 3.0
• During the presentation, we will
switch between slides and Eclipse to
show running examples
13
Example code
• Projects
– Download: http://www.xs4all.nl/~mfo/projects.zip
• Uses Eclipse + BndTools
– Homepage: http://njbartlett.name/bndtools.html
– Update Site: http://bndtools-updates.s3.amazonaws.com
• Based on a snapshot release of the
upcoming Dependency Manager 3.0
• During the presentation, we will
switch between slides and Eclipse to
show running examples
On the memory stick:
a) an Eclipse update site for BndTools
b) a set of Eclipse projects
13
Using the Dependency Manager
public class Activator extends DependencyActivatorBase {
public void init(BundleContext context, DependencyManager manager) throws Exception {
manager.add(createComponent()
.setImplementation(new HelloWorld())
);
}
public void destroy(BundleContext context, DependencyManager manager) throws Exception {
}
}
Import-Package = org.apache.felix.dm;version="[3.0,4)"
14
Basic Use Cases
• Declare a component
• Declare it lazily
	 	 	 HelloWorld helloWorld = new HelloWorld();
	 	 	 manager.add(createComponent()
	 	 	 	 .setImplementation(helloWorld)
	 	 	 );
	 	 	 manager.add(createComponent()
	 	 	 	 .setImplementation(HelloWorld.class)
	 	 	 );
15
Component Life Cycle
• methods of the component
• setCallbacks(“init”, “start”, ...)
setCallbacks(inst, “init”, “start”, ...)
– to invoke the methods on ‘inst’
• ComponentStateListener
– if you want to listen from the outside
	 public static class HelloWorldLifeCycle {
	 	 private void init() { System.out.println("init"); }
	 	 private void start() { System.out.println("start"); }
	 	 private void stop() { System.out.println("stop"); }
	 	 private void destroy() { System.out.println("destroy"); }
	 }
16
Declaring as a service
• setInterface(...)
– allows you to declare multiple services
– allows you to specify service properties
	 manager.add(createComponent()
	 	 .setInterface(LogService.class.getName(),
new Properties() {{ put(Constants.SERVICE_RANKING, 20); }})
	 	 .setImplementation(MyLogService.class)
17
Declaring Dependencies
• Adding a dependency
• Injects dependency
– uses null object pattern
– injects other “OSGi” instances
• setCallbacks(...)
setCallbacks(inst, ...)
	 	 	 manager.add(createComponent()
	 	 	 	 .setImplementation(HelloWorldLogger.class)
	 	 	 	 .add(createServiceDependency()
	 	 	 	 	 .setService(LogService.class)
	 	 	 	 )
	 	 	 );
18
Dependencies
19
Dependencies
• Different types:
– Service Dependencies
– Configuration Dependencies
– Bundle Dependencies
– Resource Dependencies
20
Configuration Dependencies
• Based on Configuration Admin
– designed for required dependencies
– service.pid to identify the configuration
– allows you to only accept *valid*
configurations
• update() throws ConfigurationException
21
Bundle Dependencies
• Depend on a bundle:
– in certain states
– with certain manifest entries
• Bundle instance can be injected
22
Resource Dependencies
• Resources are modeled as URLs
• Are provided by a repository
– another bundle
– an Eclipse workspace
– some external source
• Filter on host, port, protocol, path
and URL
23
Design Patterns
24
Design Patterns
• Moving up a level in abstraction
• OSGi is too low level to expose to
everybody, but it is a great platform
to build on
• Patterns provide a common
language and describe solutions in
context
25
Overview of Design Patterns
• Whiteboard Pattern
• Null Object Pattern
• “Singleton” Service
• Aspect Service
• Adapter Service
• Resource Adapter Service
26
Whiteboard Pattern
“don’t  call  us...
we’ll  call  you”
27
Null Object Pattern
• An object that implements a certain
interface, can be safely invoked and
does nothing
28
“Singleton” Service
• Publishes a component as a service
• Ties its life cycle to that of its
dependencies
get()
getVersions()
get(version)
store(Document)
Document
Repository
Singleton
Storage
requires
29
Aspect Service
• Works at the service level
• “intercepts” certain services
• can be chained based on rankings
• completely dynamic
get()
getVersions()
get(version)
store(Document)
Repository Cache
Aspect
get()
getVersions()
get(version)
store(Document)
Repository
intercepts
30
Adapter Service
• Works on existing services
• Adapts them, publishes a different
service for each existing one
getCacheHits()
setSize()
setTTL()
flush()
Repository Cache
Manageable
Adapter
get()
getVersions()
get(version)
store(Document)
Repository Cache
adapts
31
Resource Adapter Service
• Adapts resources (instead of
services)
• Allows you to expose the behavior
of certain resources instead of their
“inner guts”
play()
pause()
stop()
Audio Track
Resource
Adapter
MP3
File
adapts
32
Custom
Dependencies
33
Custom Dependencies
• Dependency Manager is extensible
with custom dependencies:
– depend on time of day
– depend on some custom instance /
condition (start level, app state)
34
Add-ons
35
Add-ons
• Shell (Felix, Equinox, Gogo)
• Annotation based (Java 5 required)
• Legacy support (2.x API adapter)
36
Wrap-up
37
Wrap-up
• Points to take away:
– do not expose every developer to the
OSGi API
– build higher level abstractions, use
design patterns
– consider the dependency manager, it is
very flexible
38
More about OSGi
• ApacheCon 2010 North America
November 1-5, Atlanta
– OSGi tutorial
– full day OSGi track
• Masterclass on OSGi
October 12-15, Girona
– Neil Bartlett and Peter Kriens
39

Weitere ähnliche Inhalte

Was ist angesagt?

Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaKasun Indrasiri
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN StackTroy Miles
 
F5 Automation and service discovery
F5 Automation and service discoveryF5 Automation and service discovery
F5 Automation and service discoveryScott van Kalken
 
OWIN and Katana Project - Not Only IIS - NoIIS
OWIN and Katana Project - Not Only IIS - NoIISOWIN and Katana Project - Not Only IIS - NoIIS
OWIN and Katana Project - Not Only IIS - NoIISBilal Haidar
 
Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...All Things Open
 
Utilizing the open ntf domino api
Utilizing the open ntf domino apiUtilizing the open ntf domino api
Utilizing the open ntf domino apiOliver Busse
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applicationslmrei
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouJ On The Beach
 
Deployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDDeployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDWO Community
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Introduction to Asynchronous scala
Introduction to Asynchronous scalaIntroduction to Asynchronous scala
Introduction to Asynchronous scalaStratio
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Introduction tomcat7 servlet3
Introduction tomcat7 servlet3Introduction tomcat7 servlet3
Introduction tomcat7 servlet3JavaEE Trainers
 

Was ist angesagt? (20)

Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Owin and katana
Owin and katanaOwin and katana
Owin and katana
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
F5 Automation and service discovery
F5 Automation and service discoveryF5 Automation and service discovery
F5 Automation and service discovery
 
Packer
Packer Packer
Packer
 
OWIN and Katana Project - Not Only IIS - NoIIS
OWIN and Katana Project - Not Only IIS - NoIISOWIN and Katana Project - Not Only IIS - NoIIS
OWIN and Katana Project - Not Only IIS - NoIIS
 
Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...
 
Utilizing the open ntf domino api
Utilizing the open ntf domino apiUtilizing the open ntf domino api
Utilizing the open ntf domino api
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applications
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
 
Deployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDDeployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSD
 
iOS for ERREST
iOS for ERRESTiOS for ERREST
iOS for ERREST
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Input Method Kit
Input Method KitInput Method Kit
Input Method Kit
 
Introduction to Asynchronous scala
Introduction to Asynchronous scalaIntroduction to Asynchronous scala
Introduction to Asynchronous scala
 
Celery introduction
Celery introductionCelery introduction
Celery introduction
 
Node.js
Node.jsNode.js
Node.js
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
ASP.NET: Present and future
ASP.NET: Present and futureASP.NET: Present and future
ASP.NET: Present and future
 
Introduction tomcat7 servlet3
Introduction tomcat7 servlet3Introduction tomcat7 servlet3
Introduction tomcat7 servlet3
 

Andere mochten auch

OSGi Standardization - An Evolving Future - Carl Cargill, Sun Microsystems
OSGi Standardization - An Evolving Future - Carl Cargill, Sun MicrosystemsOSGi Standardization - An Evolving Future - Carl Cargill, Sun Microsystems
OSGi Standardization - An Evolving Future - Carl Cargill, Sun Microsystemsmfrancis
 
Simplify your external dependency management - DPC11
Simplify your external dependency management - DPC11Simplify your external dependency management - DPC11
Simplify your external dependency management - DPC11Stephan Hochdörfer
 
5 activities to manage project dependencies
5 activities to manage project dependencies5 activities to manage project dependencies
5 activities to manage project dependenciesPM Majik
 
Supply Chain Management System
Supply Chain Management SystemSupply Chain Management System
Supply Chain Management Systemguest631b66
 
Hotel Management System Final Report
Hotel Management System Final ReportHotel Management System Final Report
Hotel Management System Final ReportCharitha Gamage
 
A project on supply chain management
A project on supply chain managementA project on supply chain management
A project on supply chain managementgirish gupta
 
Project Proposal document for Hotel Management System
Project Proposal document for Hotel Management SystemProject Proposal document for Hotel Management System
Project Proposal document for Hotel Management SystemCharitha Gamage
 

Andere mochten auch (8)

OSGi Standardization - An Evolving Future - Carl Cargill, Sun Microsystems
OSGi Standardization - An Evolving Future - Carl Cargill, Sun MicrosystemsOSGi Standardization - An Evolving Future - Carl Cargill, Sun Microsystems
OSGi Standardization - An Evolving Future - Carl Cargill, Sun Microsystems
 
Simplify your external dependency management - DPC11
Simplify your external dependency management - DPC11Simplify your external dependency management - DPC11
Simplify your external dependency management - DPC11
 
5 activities to manage project dependencies
5 activities to manage project dependencies5 activities to manage project dependencies
5 activities to manage project dependencies
 
Supply Chain Management System
Supply Chain Management SystemSupply Chain Management System
Supply Chain Management System
 
Hotel Management System Final Report
Hotel Management System Final ReportHotel Management System Final Report
Hotel Management System Final Report
 
A project on supply chain management
A project on supply chain managementA project on supply chain management
A project on supply chain management
 
School Management System
School Management SystemSchool Management System
School Management System
 
Project Proposal document for Hotel Management System
Project Proposal document for Hotel Management SystemProject Proposal document for Hotel Management System
Project Proposal document for Hotel Management System
 

Ähnlich wie OSGi Community Event 2010 - Dependencies, dependencies, dependencies

Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...mfrancis
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
Building Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreBuilding Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreLevi Fuller
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & DevelopmentGlobalLogic Ukraine
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Amazon Web Services
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePiotr Pelczar
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applicationsIvano Malavolta
 
ASP.Net 5 and C# 6
ASP.Net 5 and C# 6ASP.Net 5 and C# 6
ASP.Net 5 and C# 6Andy Butland
 
SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4Jon Galloway
 
Getting Started with Innoslate
Getting Started with InnoslateGetting Started with Innoslate
Getting Started with InnoslateElizabeth Steiner
 
Docker presentasjon java bin
Docker presentasjon java binDocker presentasjon java bin
Docker presentasjon java binOlve Hansen
 
Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...
Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...
Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...Neven Cvetković
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0Ido Flatow
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceDarnette A
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectJadson Santos
 
AWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAmazon Web Services
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesHiroshi SHIBATA
 

Ähnlich wie OSGi Community Event 2010 - Dependencies, dependencies, dependencies (20)

Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Building Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreBuilding Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET Core
 
OSGi bootcamp - part 2
OSGi bootcamp - part 2OSGi bootcamp - part 2
OSGi bootcamp - part 2
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecture
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
ASP.Net 5 and C# 6
ASP.Net 5 and C# 6ASP.Net 5 and C# 6
ASP.Net 5 and C# 6
 
SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4
 
Getting Started with Innoslate
Getting Started with InnoslateGetting Started with Innoslate
Getting Started with Innoslate
 
Docker presentasjon java bin
Docker presentasjon java binDocker presentasjon java bin
Docker presentasjon java bin
 
Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...
Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...
Cloud Foundry Summit Europe 2018 - Deveveloper Experience with Cloud Foundry ...
 
React inter3
React inter3React inter3
React inter3
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhce
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
AWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment Complexity
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 

Mehr von mfrancis

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...mfrancis
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)mfrancis
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)mfrancis
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruumfrancis
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...mfrancis
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...mfrancis
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...mfrancis
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)mfrancis
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...mfrancis
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)mfrancis
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...mfrancis
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...mfrancis
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...mfrancis
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)mfrancis
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)mfrancis
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)mfrancis
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...mfrancis
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)mfrancis
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...mfrancis
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)mfrancis
 

Mehr von mfrancis (20)

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)
 

Kürzlich hochgeladen

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Kürzlich hochgeladen (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

OSGi Community Event 2010 - Dependencies, dependencies, dependencies

  • 2. Marcel Offermans • Fellow and Software Architect at Luminis Technologies marcel.offermans@luminis.nl • Member and Committer at Apache Software Foundation marrs@apache.org 2
  • 3. Agenda • Introduction • Basic Concepts • Dependencies • Design Patterns • Custom Dependencies • Add-ons • Wrap-up 3
  • 4. Agenda • Introduction • Basic Concepts • Dependencies • Design Patterns • Custom Dependencies • Add-ons • Wrap-up Software distribution: copy both zip archives from the memory stick 3
  • 7. Service Dependencies • framework: ServiceListener – notification whenever there is a change in the service registry – but: only changes that occur while you are listening • utility: ServiceTracker – solves the listening issue – adds ability to customize services 6
  • 8. Problem • using the framework supplied tooling, you are dealing with dependencies at a very low level • a lot of boiler plate code is needed to implement real world scenarios • there are very few design patterns that deal with composing an application based on services 7
  • 9. Declaring your dependencies • Service Binder • Dependency Manager • Declarative Services • iPOJO • Blueprint • ...many more 8
  • 10. Dependency Manager • Subproject of Apache Felix • Nearing a 3.0 release • Some interesting new features ...I’m not unbiased, being it’s author 9
  • 12. Basic Concepts • Component: class that implements certain behaviour (a POJO) • Dependency: something our component needs or wants (ie. a service) • Service: OSGi service interface(s) under which our component is registered 11
  • 13. Declarative API • Declarative ≠ XML • Using a Java API has many advantages: – less error prone because of syntax and compile time checking – refactoring support, completion – very readable through fluid API – everything in one place, no magic 12
  • 14. Example code • Projects – Download: http://www.xs4all.nl/~mfo/projects.zip • Uses Eclipse + BndTools – Homepage: http://njbartlett.name/bndtools.html – Update Site: http://bndtools-updates.s3.amazonaws.com • Based on a snapshot release of the upcoming Dependency Manager 3.0 • During the presentation, we will switch between slides and Eclipse to show running examples 13
  • 15. Example code • Projects – Download: http://www.xs4all.nl/~mfo/projects.zip • Uses Eclipse + BndTools – Homepage: http://njbartlett.name/bndtools.html – Update Site: http://bndtools-updates.s3.amazonaws.com • Based on a snapshot release of the upcoming Dependency Manager 3.0 • During the presentation, we will switch between slides and Eclipse to show running examples On the memory stick: a) an Eclipse update site for BndTools b) a set of Eclipse projects 13
  • 16. Using the Dependency Manager public class Activator extends DependencyActivatorBase { public void init(BundleContext context, DependencyManager manager) throws Exception { manager.add(createComponent() .setImplementation(new HelloWorld()) ); } public void destroy(BundleContext context, DependencyManager manager) throws Exception { } } Import-Package = org.apache.felix.dm;version="[3.0,4)" 14
  • 17. Basic Use Cases • Declare a component • Declare it lazily HelloWorld helloWorld = new HelloWorld(); manager.add(createComponent() .setImplementation(helloWorld) ); manager.add(createComponent() .setImplementation(HelloWorld.class) ); 15
  • 18. Component Life Cycle • methods of the component • setCallbacks(“init”, “start”, ...) setCallbacks(inst, “init”, “start”, ...) – to invoke the methods on ‘inst’ • ComponentStateListener – if you want to listen from the outside public static class HelloWorldLifeCycle { private void init() { System.out.println("init"); } private void start() { System.out.println("start"); } private void stop() { System.out.println("stop"); } private void destroy() { System.out.println("destroy"); } } 16
  • 19. Declaring as a service • setInterface(...) – allows you to declare multiple services – allows you to specify service properties manager.add(createComponent() .setInterface(LogService.class.getName(), new Properties() {{ put(Constants.SERVICE_RANKING, 20); }}) .setImplementation(MyLogService.class) 17
  • 20. Declaring Dependencies • Adding a dependency • Injects dependency – uses null object pattern – injects other “OSGi” instances • setCallbacks(...) setCallbacks(inst, ...) manager.add(createComponent() .setImplementation(HelloWorldLogger.class) .add(createServiceDependency() .setService(LogService.class) ) ); 18
  • 22. Dependencies • Different types: – Service Dependencies – Configuration Dependencies – Bundle Dependencies – Resource Dependencies 20
  • 23. Configuration Dependencies • Based on Configuration Admin – designed for required dependencies – service.pid to identify the configuration – allows you to only accept *valid* configurations • update() throws ConfigurationException 21
  • 24. Bundle Dependencies • Depend on a bundle: – in certain states – with certain manifest entries • Bundle instance can be injected 22
  • 25. Resource Dependencies • Resources are modeled as URLs • Are provided by a repository – another bundle – an Eclipse workspace – some external source • Filter on host, port, protocol, path and URL 23
  • 27. Design Patterns • Moving up a level in abstraction • OSGi is too low level to expose to everybody, but it is a great platform to build on • Patterns provide a common language and describe solutions in context 25
  • 28. Overview of Design Patterns • Whiteboard Pattern • Null Object Pattern • “Singleton” Service • Aspect Service • Adapter Service • Resource Adapter Service 26
  • 29. Whiteboard Pattern “don’t  call  us... we’ll  call  you” 27
  • 30. Null Object Pattern • An object that implements a certain interface, can be safely invoked and does nothing 28
  • 31. “Singleton” Service • Publishes a component as a service • Ties its life cycle to that of its dependencies get() getVersions() get(version) store(Document) Document Repository Singleton Storage requires 29
  • 32. Aspect Service • Works at the service level • “intercepts” certain services • can be chained based on rankings • completely dynamic get() getVersions() get(version) store(Document) Repository Cache Aspect get() getVersions() get(version) store(Document) Repository intercepts 30
  • 33. Adapter Service • Works on existing services • Adapts them, publishes a different service for each existing one getCacheHits() setSize() setTTL() flush() Repository Cache Manageable Adapter get() getVersions() get(version) store(Document) Repository Cache adapts 31
  • 34. Resource Adapter Service • Adapts resources (instead of services) • Allows you to expose the behavior of certain resources instead of their “inner guts” play() pause() stop() Audio Track Resource Adapter MP3 File adapts 32
  • 36. Custom Dependencies • Dependency Manager is extensible with custom dependencies: – depend on time of day – depend on some custom instance / condition (start level, app state) 34
  • 38. Add-ons • Shell (Felix, Equinox, Gogo) • Annotation based (Java 5 required) • Legacy support (2.x API adapter) 36
  • 40. Wrap-up • Points to take away: – do not expose every developer to the OSGi API – build higher level abstractions, use design patterns – consider the dependency manager, it is very flexible 38
  • 41. More about OSGi • ApacheCon 2010 North America November 1-5, Atlanta – OSGi tutorial – full day OSGi track • Masterclass on OSGi October 12-15, Girona – Neil Bartlett and Peter Kriens 39