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
1 answer

Services are not listed in Karaf while migrating from Felix SCR to OSGI Declarative Services

I'm Migrating from Felix SCR Annotations to R6 OSGI Declarative Services but the Service is not listed inside karaf .As per below code SampleServiceImpl should list is karaf .But it is not listing . Is there any other configuration i have to in…
0
votes
1 answer

Migrating Apache Felix SCR to OSGI Declarative Services

I'm Migrating from Apache Felix SCR Annotations to OSGI Declarative Services and here is my Problem. Before I had: SCR annotation Implementation @Component (ds = true, immediate = true, metatype = false, policy =…
0
votes
1 answer

Sling/OSGi request scope object issue. How can I access the same instance of the object in filter and service class (in same request context)?

I am working in Sling framework with OSGi DS annotations. Background: I am working with micro services. When we send calls between them, we pass around and log a "transaction ID" (which is just a UUID). That way we can easily trace calls between all…
Shea
  • 47
  • 1
  • 4
0
votes
2 answers

How to scale an OSGi Service with Declarative Services correctly?

Project description: I have a simple demo project with OSGi. The Domain is a weather station which has multiple sensor types. Each sensors sends its data to the weather station. Via an API the data is exposed and visualized on a website via a…
user7906470
0
votes
2 answers

Component creation fails when using @Reference on OSGi DS service

I am trying to get bind/unbind methods called on a DS component. I've reduced it to the simplest example that doesn't work. If I remove the @Reference on the bind method then the test is successful. Obviously the log statements don't get called.…
Timothy Vogel
  • 1,363
  • 2
  • 21
  • 39
0
votes
2 answers

OSGI Service visibility/DS annotation component injection

I have a service instantiated by Apache Felix Dependency Manager, because I need to use a factory method to return the implementation: manager.add( manager.createComponent() .setInterface(aServiceName, new Properties()) …
0
votes
1 answer

how to update OSGI @Reference List if my service starts earlier than half of referenced ones

That's one more attempt to make a dig at the theme "there is no order of OSGI bundles activation". I have 4 services (bundles) which implement the same interface DataProvider meaning they implement it literally and also have it as service = {…
gehirndienst
  • 424
  • 2
  • 13
0
votes
0 answers

How to use a scr component factory?

Here is my code: An interface : public interface FieldProvisioner { Optional provisionField(FieldProvisionRecord record); FieldName getFieldName(); } An abstract Base Class that implements the above…
Tiya
  • 553
  • 8
  • 26
0
votes
1 answer

Dynamic sharing of data between 2 Plugins Eclipse rcp

Assume there are two plugins P1 and P2 are available in eclipse rcp application. Both P1 and P2 are built separately by different build process In my scenario depending on the user's choice only p1, only p2 or both plugins are available in the base…
Gani
  • 709
  • 3
  • 13
  • 21
0
votes
1 answer

OSGi DS: Why are exceptions thrown by binding methods only logged?

Why is it spec to only log an exception thrown from a binding method? I would expect that the component would not activate in this case. How should exceptions thrown from binding methods be handled to ensure the component is set up correctly?
Dave H
  • 547
  • 1
  • 5
  • 16
0
votes
1 answer

How to Add Existing Bundles as Declarative Services Within OSGI Enroute

I have a folder of existing bundled jars I need to use as declarative services. I'm aware of how to treat these like typical Eclipse Plugins and have them declared inside of the typical Component.xml file inside of my plugin project OSGI-INF…
0
votes
1 answer

OSGi declarative-services does not bind services when manually installing bundles

What I am trying to achieve Using netbeans modular system to prepare the application for us, as we implement the modules in OSGi using declarative-services via apache felix. Here is the module setup: Module A - Provides service A and B Module B -…
jonaslagoni
  • 663
  • 7
  • 23
0
votes
1 answer

Component instantiation and registration when extending abstract classes

It is my understanding that a component that extends an abstract class is properly instantiated by SCR but it isn't saved into the service registry. It is saved only if it implements an interface. Is this correct?
Karl S.
  • 345
  • 1
  • 9
0
votes
1 answer

Injecting components in manually created instances

Suppose I have something like this: @Component(immediate = true) public class A {} public class B { @Reference public void injectA(A a) {...} } Is there a way to have A be injected into B if I manually create instances of B? If not, is the…
Karl S.
  • 345
  • 1
  • 9
0
votes
1 answer

OSGi console "ls -c": References are bound although there is no provider

While debugging service binding issues, I called the command ls -c (or equivalent list -c) and got the following output for my component: 21 Component[ name = org.example.myproject.repo activate = activate deactivate =…
oberlies
  • 11,503
  • 4
  • 63
  • 110