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

Karaf bundles are not coming up ,Unable to start bundle

I am Unable to start bundle . While starting bundle error executing command: Error executing command on bundles: Error starting bundle 426: Could not resolve module: com.sample.eventFilter [426] Unresolved requirement: Import-Package:…
Kamalraj
  • 17
  • 5
1
vote
2 answers

OSGi Declarative Services - NullPointer Exception

I have a problem with my Declarative Services. I have 2 bundles, one is a server provider and another the user interface that consumes the service. On server side, the implementation is: public boolean checkUser(){ return true; } And the XML…
Jose Hdez
  • 2,297
  • 7
  • 38
  • 52
1
vote
1 answer

How to schedule service in Apache Felix?

I have deployed some Declarative Services OSGI in my bundle. After my bundle is started, these Services are activated and do some code in run() of Thread. However, I would like to schedule the time to start the run(). @Component(name = "ABC" …
1
vote
1 answer

How to enable components page in Apache Felix Web console

I would like to deploy Apache Felix Web Console for research purpose. According to the Apache Felix doc, there are the page to control components(OSGI services). However, after starting the web console on localhost port 8080, I can not access…
1
vote
1 answer

How do I implement properly a servlet using OSGi declarative services?

I'm trying (to learn how) to create a Servlet (javax.servlet.Servlet) using declarative services (DS), provided by OSGi, as below: import java.io.IOException; import javax.servlet.Servlet; import javax.servlet.ServletException; import…
lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
1
vote
3 answers

Bind order of OSGi declarative services using STATIC policy

Suppose I have the below OSGi component which is supposed to send an event every time a new implementation of SomeInterface is registered in the run-time. For that I bind EventAdmin into eventAdmin variable and then use it inside bindSomeInterface…
lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
1
vote
1 answer

How to deal with 2 OSGi Declarative Services Bundle component in the same Plugin?

I use OSGi services via manually component definition. Service components consist of an XML description and an object. My project was working just fine until I try to instantiate another service in the same plugin. Now it seems to me, as if I'm not…
Lycone
  • 650
  • 9
  • 18
1
vote
2 answers

Initialization of OSGi prototype components

In OSGi declarative services, I can create prototype instances declaring a ComponentServiceObjects like this: @Reference(unbind = "-", scope=ReferenceScope.PROTOTYPE_REQUIRED) private ComponentServiceObjects
AdrianRM
  • 2,622
  • 2
  • 25
  • 42
1
vote
1 answer

Osgi ConfigurationAdmin delay in activating Component

I have a service that requires a configuration @Component(service=InstrumenterService.class ,configurationPid = "InstrumenterService", configurationPolicy = ConfigurationPolicy.REQUIRE, scope = ServiceScope.PROTOTYPE) public class…
droopy
  • 11
  • 3
1
vote
1 answer

OSGi DS Prototype Reference not released

I've create a simple vaadin portlet in a Liferay 7/DXP or osgi 6 context and I noticed that my References do not get garbage collected if I use osgi declarative services with a prototype scope, but they do if I use serviceObjects. Why? Note: I've…
Marcel
  • 43
  • 5
1
vote
1 answer

Resource not exported up in OSGi container

I'm trying to expose a REST service through OSGi (using Apache Felix). I'm using the osgi-jax-rs-connector to publish the resource. Here is the resource interface: @Path("/bingo") public interface BingoService…
1
vote
1 answer

Declarative services in OSGI

I have created a (very) simple test to determine how to send and receive events using Apache Felix. This is my sender: package be.pxl; import org.osgi.service.component.annotations.Activate; import…
1
vote
1 answer

AEM 6.3 Migration - how do I handle configurationFactory in DS annotations?

I have a Component that uses SCR annotation with configurationFactory set true & I an using a Factory to manage its instances @Reference( name = SocialCollaborationServiceFactoryImpl.TRINAING_SERVICE_NAME, referenceInterface =…
curiouslever
  • 110
  • 1
  • 10
1
vote
0 answers

How to use ds in command bundle with karaf4.x?

I was trying karaf4.x with the DS(declarative service) in command bundles, but found it falied to get service via DS. karaf.log 2017-07-10T15:01:43,163 | INFO | pipe-bundle:install -s mvn:com.gogo.sdn/opensdn-hello-cli/1.0-SNAPSHOT |…
Tian Jian
  • 11
  • 1
1
vote
2 answers

OSGi-DS: Optional reference to required service in DS Component, is not really dynamically updatable

I want to start DS component which has many services are optional, if some service is not up then these component is not getting activated. So I set cardinality of these optional service as Optional so if these optional service is not available then…
Umesh Rajani
  • 139
  • 2
  • 13