Questions tagged [declarative-services]

Declarative Services (DS) is a component model that simplifies the creation of components that publish and/or reference OSGi Services.

Declarative Services (DS) is a component model that simplifies the creation of components that publish and/or reference OSGi Services. It was first defined in OSGi Release 4.0 and is inspired by an earlier model known as service binder by Richard Hall and Humberto Cervantes.

Its main features are:

  • Declarative : no need to write explicit code to publish or consume services.
  • Lazy : components that publish services are delayed, meaning that the service implementation class is not loaded or instantiated until the service is actually requested by a client.
  • Lifecycle: components have their own lifecycle (i.e. activation and deactivation), bounded by the lifecycle of the bundle in which they are defined.
  • Configuration: components can automatically receive configuration data from Configuration Admin.
198 questions
13
votes
5 answers

Using OSGi declarative services in the context of a JUnit test

I'm trying to figure out how to implement multi-bundle integration test in OSGi using JUnit. With integration test, I mean instantiating a subset of the bundles to automatically validate functionality in that subsystem. We're running Equinox and…
maasg
  • 37,100
  • 11
  • 88
  • 115
13
votes
2 answers

OSGi Declarative Services vs. ManagedService for configuring service?

I just recently stumbled upon the fact that Declarative Services in OSGi can set the configuration of a component to required so that the component receives it upon activation, removing the gap between component activation and configuration. I also…
oconnor0
  • 3,154
  • 6
  • 34
  • 52
10
votes
1 answer

Apache Felix SCR @Reference cheatsheet

I'm using Apache Felix declarative services in my application and I'm looking for a cheat sheet which describes the parameters one can give to the @Reference annotation. I saw a webpage once which contained a very informative cheat sheet (or table)…
Adam Arold
  • 29,285
  • 22
  • 112
  • 207
9
votes
2 answers

What is the proper way of disabling an OSGi service at service start?

I have created an OSGi bundle with an exposed (declarative) service. If I, when activate is called, notice that something is amiss such that I can not provide the service, I need to prevent it from being exposed. At the moment the activation…
Henrik Gustafsson
  • 51,180
  • 9
  • 47
  • 60
8
votes
1 answer

Osgi Declarative service conditional binding

I have this scenario, I have three declarative services that provide the same interface (say a reader interface and I have readerimpl1-database- readerimpl2-flat file- readerimpl3-memory). I want to have a consumer that binds only to the database…
el_eduardo
  • 3,138
  • 4
  • 21
  • 17
8
votes
1 answer

OSGi Declarative Services in Eclipse, multiple service interfaces, and Thread Safety

I just stumbled over a phenomenon in my code which comes down to this: I have an OSGi Declarative Service providing two service interfaces configured as follows:
Stefan Winkler
  • 3,871
  • 1
  • 18
  • 35
7
votes
1 answer

Does there exist an overview of OSGi terminology, frameworks and their relations?

I'm trying to get comfortable in the vast ecosystem of enterprise OSGi programming, but I find it very difficult to get an overview of how this technology stack is put together, which technologies build upon one another, which technologies solve…
Tormod Haugene
  • 3,538
  • 2
  • 29
  • 47
7
votes
2 answers

Can an OSGi fragment bundle publish a declarative service?

I have a fragment bundle that I created to access some add functionality to a second-party jar. My fragment should register a service to expose this new functionality. It doesn't seem to work. Before I get deep into troubleshooting, I'd like to know…
Chris Dolan
  • 8,905
  • 2
  • 35
  • 73
6
votes
3 answers

Eclipse RCP 4 use bundle via declarative service

I have written an OSGi bundle to use it in my eclipse 4 rcp application. The usage of the service works fine if I add the dependencies, register these service in my activator and inject it in my class. In activator IUserService service = new…
roschulze
  • 505
  • 2
  • 6
  • 21
6
votes
1 answer

How to declare a requirement on the SCR extender capability?

The OSGi Enterprise Release 5 Specification introduces the osgi.extender namespace. This namespace makes it possible for bundles that assume extenders such as Blueprint or Declarative Services are installed in the framework to model this dependency…
5
votes
2 answers

JPA with OSGi DS example

I am trying to figure out an example of JPA(containing an example of Student Entity, with name and class) using Eclipselink & Derby. I am able to do it in Java EE but I can't figure out a way to do it simply in OSGi using Declarative Services. Can…
Amrit
  • 2,295
  • 4
  • 25
  • 42
5
votes
3 answers

Best Practice in an OSGi UI application

I am somewhat new to the OSGi world. And some concepts still elude me. I'm trying to create a graphical OSGi application using Swing, Equinox and Declarative Services. The goal is to ease the creation of plugins and extensions for the application. I…
José Belo
  • 139
  • 1
  • 8
5
votes
1 answer

How do I start a specific bundle in my own OSGi application deployed in WAS 8.0?

I have quite a sophisticated OSGi application which uses Declarative Services and was designed to be deployed in Equinox. Now the task is to make this application be deployable in WAS 8. The first try was quite pragmatic: I have deployed an EAR…
4
votes
1 answer

In OSGi DS, how do I get notified when referenced service's properties update?

I have an OSGi service that references other services via declarative service injecting them. I would like to be notified when referenced service's properties update. I don't want my main service to stop every time a configuration changes in a…
oconnor0
  • 3,154
  • 6
  • 34
  • 52
4
votes
2 answers

OSGi Declarative Service - obtain ServiceReference in bind method

I'm using Eclipse 3.7 with Eclipse Gemini JPA / DBAccess. I implemented a declarative ServiceComponent which references EntityManagerBuilderFactory. The bind method looks like this: public void…
Muki
  • 3,513
  • 3
  • 27
  • 50
1
2 3
13 14