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

Referencing a Declarative Service on Karaf via Annotations

I fail to correctly reference a service interface with the @Reference Annotation. public class TestServiceProcessor implements Processor { @Reference private TestService testService; The Service is up and running on the Karaf Instance and i…
0
votes
1 answer

Camel-SCR ( Declarative Services ) not able to access javax.sql.DataSource

I have created datssource service with pax-jdbc-config and following URL https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/61767710/Create+DataSource+from+config Now datasource service is available karaf@root()> service:list…
ImranRazaKhan
  • 1,955
  • 5
  • 33
  • 74
0
votes
1 answer

Failing Bundle Start-Up if Declarative Service Fails

Is there a way to prevent a Bundle from being marked as 'ACTIVE' should one of its DS components fails to initialise? For example if I were to implement BundleActivator I could throw a BundleException in the start() method and no services offered by…
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97
0
votes
1 answer

Multiple references and dependencies with declarative services

I am experiencing problems with the order components are loaded when using OSGi declaratives services through Karaf. I have this situation: @Component public class A implements IA { doSomething() {...} } @Component public class B implements…
0
votes
2 answers

Can Declarative Services be used in a Thread?

I have the following code as an OSGi module. When it runs, I get the message that the logger has been set: UdpListener > setStoreLog: 'com.mine.logger.internal.storeindb.StoreLog@1c6f579' But immediatly after that, the loop in the run() function…
Frank
  • 5,741
  • 4
  • 28
  • 49
0
votes
2 answers

State unsatisfied (reference) for service in Karaf - where is the mistake? (OSGi, declarative service, annotations)

I have a very simple service provider and consumer. For some reason I cannot solve the problem that my consumer would use provider's service. Here is the bundle source code for provider: package test; import…
neodix
  • 25
  • 7
0
votes
1 answer

Issue with service dynamism and blueprint

I have a non-blueprint bundle which provides a service via Declarative Service annotations. I have another bundle, using blueprint, which contains a optional reference for this service and then injects this reference into a number of declared…
0
votes
2 answers

OSGi: Ensure that all extensions are loaded in a Declarative Services application

I am working on an application that is meant to be extensible by the customer. It is based on OSGi (Equinox) and makes heavy use of Declarative Services (DS). Customer-installed bundles provide their own service implementations which my application…
0
votes
2 answers

OSGI: do declarative services become available after bundle start

The question is simple, but I can't find answer - Can I state that all declarative services in bundle A become available after bundle A start? For example, bundle=context.installBundle("file:bundleA-1.0.0.jar"); bundle.start(); //In this point are…
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
0
votes
2 answers

Best approach to handle dynamic additions of services

I have this component (pseudo code): @Component class ServiceComponent { Set set = synchronizedSet(); @Activate activate(){... process set...} @Reference addService(MyService service){set.add(service)} } Now, initially, when…
erdal.karaca
  • 693
  • 1
  • 4
  • 20
0
votes
2 answers

OSGi DS service configuration and ServiceTracker

Let's say I have an OSGi service A, declared using DS and metatype configuration. Then let's call B another service which is tracking any object based on a property filter, which does not belong to A's configuration. Is there any possibility, in A,…
cyberz
  • 884
  • 1
  • 8
  • 16
0
votes
2 answers

OSGi activation method fallback

I was wondering if it is somehow possible to create a fallback from one activation method to another? Let's say i have a bundle that is activated via Declarative Services, but SCR is not installed on the application server in question. Is it…
Martin Nielsen
  • 1,865
  • 6
  • 30
  • 54
0
votes
1 answer

Dynamically reference bundles for integration test with Pax Exam

I have created an OSGi example project and want to improve the provisioning of the bundles needed for the integration test. Right now the bundles are statically references by file name, utilizing CoreOptions.bundle("reference:file:" + ), the…
mike
  • 4,929
  • 4
  • 40
  • 80
0
votes
0 answers

Felix + WAR packaging => Component descriptor entry 'OSGI-INF/*.xml' not found

I'm trying to deploy the Java backend of a web application on GlassFish 4.1.1. I use OSGi with declarative services. Declarative services seem to work when the bundle in question is published as a JAR but I'm having some trouble with WARs: Felix…
Alix
  • 927
  • 7
  • 21
0
votes
2 answers

Using declarative services with embedded Felix framework

I am developing a desktop OSGi app with declarative services on Mac OS X using Netbeans and Maven. I start the Felix framework from within a Java application and load my OSGi bundles using AutoProcessor.process(). However, I cannot get services…
Stephen Winnall
  • 301
  • 3
  • 14