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

Eclipse P2 - Declarative Services with various P2 components?

So I've been having this issue where when I try to get the Metadata and Artifact repository managers from the provisioning agents using this: ServiceReference sr =…
MechaMarinara
  • 620
  • 1
  • 7
  • 22
1
vote
2 answers

What is the different Between 'Bind' and 'Activate

I started using OSGI in eclipse.Under Declarative Services I found out that there are two methods that's been executed once a service is activated. I.e Activate and Bind.. What is the difference between these two? If I want to execute certain…
D007
  • 39
  • 4
0
votes
2 answers

Eclipse/Equinox: starting all installed plugins?

I have an Eclipse product build using features. All of the services are registered via Declarative Services. As I understand it, the bundle must be started for the Service Component Runtime to pick up and then register the services exposed in each…
oconnor0
  • 3,154
  • 6
  • 34
  • 52
0
votes
0 answers

OSGi Confusion: Declarative Services with User-Interface Components and Controller-View pattern

I am confused. I am currently developing an application using OSGi declarative services (DS). I have an API for my application and the application works fine. Now I want to add a User Interface. So I decided on a separation between a Controller and…
A7exSchin
  • 382
  • 3
  • 17
0
votes
0 answers

What is the difference between DS reference scope "prototype" and "prototype_required"?

What is the difference between the two of them, as stated in the title ? The end result is the component references to services that uses the prototype service scope, isn't it ?
Bourbon_7
  • 161
  • 7
0
votes
1 answer

get list of services implementations with OSGi declarative services

I have a very simple example of declarative services. I'm following this tutorial http://www.eclipsezone.com/eclipse/forums/t97690.html?start=0. Every thing is working as expected. However, I cannot figure out how I can make the "SampleImporter"…
mimou
  • 81
  • 1
  • 6
0
votes
1 answer

How to reference a service in a non-service class?

As the title suggests, I would like to reference a service in a non-service class, the way I can think of is as follows : @Component( immediate = true ) public class Foo { @Reference private Bar bar ; } But Foo seems to be…
Bourbon_7
  • 161
  • 7
0
votes
2 answers

SCR Reference Annotation Not Updating to OSGI Reference Annotation (says, "annotation type not applicable to this kind of declaration")

I have this component, package com.path.http.impl; import com.path.api.http.ClientManager; import com.path.http.ConnectionManager; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Reference; import…
Jaft
  • 43
  • 2
  • 8
0
votes
1 answer

Reflecting on an OSGI DS @Reference in a ServiceFactory/PrototypeServiceFactory?

I'd like to be able to reflect on a field that has been marked @Reference in OSGI Declarative Services / Apache Felix SCR within a ServiceFactory. (This is research so I'm interested in both what is possible and what is practical). When an object is…
Sheena Artrip
  • 1,990
  • 12
  • 16
0
votes
0 answers

OSGi: How to share objects between components in a single bundle without exposing them to other bundles?

Is there any proper way to share objects between components in a single bundle? Objects in this case are somewhat similar to Spring beans. So they are created outside and independently of components. I've managed to do this by creating an additional…
Oleg_Andreych
  • 73
  • 1
  • 9
0
votes
1 answer

OSGi: Can a declarative service reference use a target filter of a prototype component?

I have a service interface Logger and a service factory interface LoggerFactory { Logger createLogger(String name) } My components use it like this: @Component public class User { private Logger logger; @Activate public…
F.L
  • 5
  • 2
0
votes
2 answers

Is there a way in OSGi to make sure only one things has access to a service at a time?

I have an interface that defines a device in a system. The devices are intented to be used by only one entity at a time. I would like to register each device as an OSGi service so others can access the devices through that mechanism (using…
Dave H
  • 547
  • 1
  • 5
  • 16
0
votes
1 answer

unsupported type java.util.concurrent.atomic.AtomicReference

I am writing OSGI services .After Starting the service,I got Below Message.Kindly suggest to overcome this Issue. @Component (service = Service.class, immediate = true) public class ServiceImpl implements Service{ @Reference (name =…
Kamalraj
  • 17
  • 5
0
votes
1 answer

How to use Cardinality of @Property annotation in OSGI Declarative Services

I'm Migrating Apache Felix SCR Annotations to OSGI Declarative Services[AEM]. While Migration I cant find exact replacement for cardinality in DS . Existing SCR Implementation : @Component (ds = true, immediate = true, metatype = false, policy =…
0
votes
2 answers

Getting Null value after bind method called in Reference object of OSGI

In my project I have an OSGI bundle. In this bundle I have osgi references with bind and unbind methods .When I restart my service first unbind method is called ,set reference object as null and then bind method is called set value for reference…