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

Multiple event topics in OSGi Declarative Service component description

I'm sure it's really simple, but I fail to understand the required XML schema to make my component listen to multiple event topics in the OSGi framework. I want to handle the following 2 events and at some point even…
Joern
  • 479
  • 1
  • 8
  • 14
0
votes
2 answers

Bundle is being instantiated more than once using DS

I'm creating an application that has hips of bundles. Some of them are interfaces and some are implementation of those interfaces. I'm using declarative services (DS) to provide and use services, which means that each bundle has a component.xml…
Fappaz
  • 3,033
  • 3
  • 28
  • 39
0
votes
2 answers

Get Declarative Service at runtime

What is the correct way to get a service, hopefully using Declarative Service if possible, when you don't know the attributes of the service to request until after runtime? The use case is analogous to having 3 bundles providing services version…
Hilikus
  • 9,954
  • 14
  • 65
  • 118
0
votes
1 answer

Trying to get Declarative Services SCR to run on WebSphere 8.5 (non-liberty)

I have a blueprint-managed OSGI application running on WebSphere v8.5(Non-Liberty Profile) where one service, Service_A, has a reference to another service, Service_B. I would like the Service_B to be managed by the declarative services service…
0
votes
2 answers

When to shutdown HttpClient's ConnectionManager in OSGi

I have an OSGi bundle which is using two services through DS, A and B. B service is using internally Apache's HttpClient. My question is, when should I shutdown the HttpClient's ConnectionManager, I tried to do it inside the "unbind" method for…
0
votes
1 answer

How can i add Declarative Services support to embedded felix in Netbeans?

In netbeans, embedded felix does not support DS.How can we add Felix Service Component Runtime to embedded felix in netbeans.
0
votes
1 answer

OSGi Declarative services injection

I am trying to do a simple OSGi service using Declarative Services on a local Glassfish server. The plugin which provides is always active. I got trouble with the injection into my servlet that consumes my service, the reference is null when the…
0
votes
1 answer

Load component definition located out of bundle's jar

I need to load a component defition (xml file) from outside the jar (bundle). I've tried to put it under: plugins/my.bundle.name/OSGI-INF/mycomponent.xml plugins/OSGI-INF/mycomponent.xml And i've played with bundle's classpath too, with no luck.
0
votes
1 answer

Osgi Equinox enable component from external bundle

Given this scenario: Bundle A: component 1A (enabled:false) Bundle B: component 2B How can i enable component 1A from Bundle B or Component 2B? I've tried to do it by using componentContext, dsContext.enableComponent("1A"); but it seems to work…
0
votes
2 answers

control instantiation of osgi declarative service

I am looking for a simple way to control the instantiation of a declarative service. What I want is something like a factory which is asked to return an instance of a component, but where I can control the instantiation. Currently I just found the…
SimFirehawk
  • 157
  • 1
  • 9
0
votes
1 answer

ServiceTracker and DS combined?

Let's imagine a bundle in which exists: A component is responsible of listen all "Device" service instances in the service registry. The same component needs an "adaptor factory" in order to create "Adaptors" by using the discovered devices. The…
0
votes
1 answer

Printing messages on the OSGi console

I'm implementing a very light weight (embedded) OSGi framework which runs on a target piece of hardware. To attach a console I'm using org.apache.felix.gogo.shell and org.apache.felix.shell.remote. To date, I've logged all custom messages using…
Aaron
  • 343
  • 3
  • 10
0
votes
1 answer

Setting a non string compatible property

I'm using Declarative Services and facing the following problem. I want to register my component with properties like using bc.registerService(MyClass.class.getName(), this, props); However, with Declarative Services I have to provide a XML file…
Ewgenij Sokolovski
  • 897
  • 1
  • 12
  • 31
0
votes
1 answer

Can I have instances of a Component Factory that references different target services?

I have created 3 different components: Client, Executor and Methodology. I can have multiple Client instances that references its own Executor instance. So I turned Executor as a DS factory component. Executor can execute the Client request…
Cristiano
  • 1,414
  • 15
  • 22
0
votes
2 answers

Best practice for referencing OSGi DS in given bundle

My Requirement: I have a service which takes care of persistence in my project. Let me call this service as PersistenceProvider service and lets assume it's residing in "my.persistenceservice" bundle. Now, I have another bundle named…
1 2 3
13
14