Getting started with OSGi declarative services

Session details
Session Type: 
Experience level: 

OSGi declarative services exist for a long time and are used to implement a modular service-oriented architecture. Because of the supported dynamics, the easy way to define, register and consume services, declarative services can be found in various scenarios. With Eclipse 4 for example, declarative services are therefore used more often than the Equinox specific extension points. 

In this session I will give an introduction to declarative services in general. How to create and use them in combination with the DS annotations. This session will focus on the usage of Bndtools and Felix SCR to also show some of the features introduced with DS spec 1.3.

I published a Getting Started Tutorial that covers in general the contents of this session:

For the OSGi track I will of course remove the PDE specific things and focus only on DS in general and showing the examples with Bndtools.

Schedule info
Session Time Slot(s): 
Thursday, October 27, 2016 - 13:00 to 13:35
BJ Hargrave (IBM)'s picture

PDE is not a good tool for OSGi bundle development. And the recent support for DS annotations is only at the OSGi 1.2 spec level which is out of date. 1.3 is the latest spec level. Equinox DS impl is also out of date and only supports 1.2 spec. Please change your talk to use Bndtools and DS 1.3 (use Apache Felix SCR which supports DS 1.3 spec). I can't really support a session using PDE for DS development.

Public comment
Dirk Fauth (Robert Bosch GmbH)'s picture

First, of course I agree with your statements in general. When talking about plain OSGi development the use of Bndtools and Felix SCR is the way to go. I also hope that soon the Equinox DS implementation is replaced or makes use of Felix SCR to get DS 1.3 support and get rid of several issues.

But there are two things I want to notice here:

  1. The talk is mainly a general talk about declarative services, whether PDE or Bndtools is used doesn't matter in the end.
  2. Bndtools do not support Eclipse RCP application development.The old PDE component editor is the worst editor that was ever added to PDE and the annotation support added with Neon makes the creation of DS components for an Eclipse application fun again.

So the question is mainly, who should be the target audience? I thought of Eclipse RCP developers that should also learn about declarative services to make use of them in Eclipse. The intention is to bring Eclipse RCP developers more in the OSGi direction.

Your statement mainly suspects that I should target OSGi developers without taking Eclipse RCP developers into account. But IMHO there are a lot of Eclipse RCP application developers that should also start using declarative services. And as long as Bndtools is not an option for them, a talk that shows that the same (or at least similar) approach is now also possible for them is also a valuable information.

The main idea was to start with DS annotations in general, then show Eclipse RCP developers that they can use them now also for Eclipse RCP development, and at the end shortly show the capabilities of DS 1.3 by referencing your talk from last year by using Bndtools and Felix SCR. 

I can leave out the Eclipse RCP developers, but I wonder why you think that Eclipse RCP developers are not worth learning about declarative services and DS annotations. If Bndtools would support Eclipse RCP application development, I would be in the first line propagating the usage of Bndtools instead of PDE. But as of now that only works with a lot of very complicated workarounds from what I know. And these workarounds are a lot more painful than the usage of PDE IMHO.

Public comment
BJ Hargrave (IBM)'s picture

Thanks for the reply. I can see your points about Eclipse RCP developers caught in a hard place. But since this talk is proposed in the OSGi track, I would much rather see it focused on the latest DS spec (including field injection) especially since the title is "Getting Started with Declarative Services" rather than something like "Using OSGi Declarative Services in your Eclipse RCP Application". The latter title seems more indicative of your session proposal and thus more in inline with a track more focused on Eclipse RCP development. The title you have would seem to start from a cleaner slate than the baggage (PDE) that comes with Eclipse RCP development.

Public comment
Dirk Fauth (Robert Bosch GmbH)'s picture

I got your point and updated the session proposal accordingly. You're right that the title assumes a clean/plain OSGi view on the topic.

For the committee, I created an additional session proposal in the Eclipse Technology track regarding OSGi declarative services for Eclipse RCP development. Basically the same content with the difference that this talk is focusing on DS 1.3 and Bndtools while the Eclipse RCP talk is focusing on DS 1.2 with PDE to also get Eclipse RCP developers familiar with DS.

Public comment

Our Sponsors

For information about becoming a sponsor, please visit the EclipseCon Europe 2016 sponsor prospectus page.

Elite Dual ECE/OSGi CE



Project Quality Day

IoT Theme Day


EclipseCon Support Other Events

Our Other Events

Eclipse events are hosted all over the world!

  • EclipseCon Europe 2018