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
2
votes
2 answers

Declarative services component both satisfied and unsatisfied

I am developing an OSGI-based system which uses declarative services to define components. However, when running it from Eclipse, one of my components is not initialized. When I investigate the issue using simple console commands, I get the…
David ten Hove
  • 2,748
  • 18
  • 33
2
votes
0 answers

Having type different than String without default value with Felix SCR Annotations

My problem in practice: @Property(name = "someProperty", intValue = 0) The annotation above generates: Can I specify the @Property annotation in the way that the "type" will be "Integer" but…
Balazs Zsoldos
  • 6,036
  • 2
  • 23
  • 31
2
votes
2 answers

Order of service binding with declarative services

Is there a way to find out or to determine the order of service binding with declarative services? My problem is that I have a logging service running in my OSGI among other services. Now, my component binds this logging service and a couple of…
Ewgenij Sokolovski
  • 897
  • 1
  • 12
  • 31
2
votes
2 answers

OSGi environment: how to update during runtime a class reference

I'm facing the following issue under OSGi environment: let's say I have a bundle A exporting com.mybiz.example package. This package, in its 1.0.0 version, contains a bean class MyBean so that public class MyBean { int var; public MyBean() { } …
Cristiano Ghersi
  • 1,944
  • 1
  • 20
  • 46
2
votes
2 answers

Is it best to use type or properties to choose between OSGi Declarative Services?

I'm currently converting a piece of code from plain Java code to OSGi Declarative Services. Original plain Java code new AggregateServiceImpl( new ChildServiceImpl1(), new ChildServiceImpl2(), new ChildServiceImpl3() ); The classes are…
Dan Gravell
  • 7,855
  • 7
  • 41
  • 64
2
votes
1 answer

Service Factory implementation using declarative services in OSGi

I am registering an OSGi service using OSGi declarative service and setting servicefactory="true" as follows.
Ravish
  • 2,428
  • 2
  • 18
  • 24
2
votes
2 answers

What is Bnd @Attribute annotation for?

When looking at annotations in aQute.bnd.annotation.component package in bndlib-1.50.0, there is one not listed at http://www.aqute.biz/Blog/20091020 or http://www.aqute.biz/Bnd/Components: @Attribute. What is it used for?
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
2
votes
2 answers

OSGi Declarative Service referencing non Declarative Service

I have a system declaring services "the old way", using activator methods. Now I'm writing a new bundle using Declarative Services. Is it possible to reference a service that is not published using the Declarative Services technique in my new…
1
vote
1 answer

multiple OSGi service instances and DS binding

I think I'm on the right track using OSGi services + DS together, however, I really feel like abusing it. Either that, or it's just pure awesome. (Both is still possible). So let's imagine the following application: it's a house database. I have two…
Zoltán
  • 121
  • 10
1
vote
0 answers

How to set different ECF distribution providers in the Component Definition of a Declarative Service?

I have to test the performance of all the remote service providers present in ECF (or at least, the common ones: generic, r-osgi, SOAP and REST), so changing from one provider to another in an easy way would help a lot. I know how to set the…
Pablo García
  • 237
  • 1
  • 10
1
vote
3 answers

OSGi and Component Management

I have a dynamic application that uses OSGi to load modular functionality at runtime. OSGi bundles contain the modular functionality and the application loads the bundles when they are needed. This approach works okay, but I would like a more…
Toolshed
  • 21
  • 6
1
vote
0 answers

There is an issue with the Apache Felix SCR implementation of OSGi DS

The OSGi DS Specification mentions : When the service is requested, if the service has the scope attribute set to bundle, SCR must create and activate a unique component configuration for each bundle requesting the service. In other words, if a…
Bourbon_7
  • 161
  • 7
1
vote
1 answer

How do I use Declarative Services to ensure that EventAdmin is not null?

Im new to OSGi and I tried to create a simple EventPublisher/-Admin application using DS to ensure that the EventAdmin is not null. But I'm not sure how to use the DS in the right way. The Activator class: package publishertest; import…
1
vote
0 answers

How should I declare a has-a dependency via OSGi declarative services?

My OSGi application uses a whiteboard pattern to register listeners for specific state changes. I use org.apache.felix.scr.annotations to declare my services and components instead of hand-coding the declarative XML. The easiest way to register my…
Chris Dolan
  • 8,905
  • 2
  • 35
  • 73
1
vote
1 answer

How can I access a Liferay local service in a non-OSGi portlet?

In an OSGi @Component Portlet, I can access a Liferay local service using OSGi declarative services: @Reference private MyExampleLocalService myExampleService; Beyond injecting the service into my portlet, @Reference also ensures that Liferay will…
stiemannkj1
  • 4,418
  • 3
  • 25
  • 45