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

Apache CXF ContainerRequestFilter with RSA and DS

I'm migrating CXF REST endpoints from blueprint to Declarative Services that runs on Apache Karaf. I use Aries RSA and DOSGI. In the old code ContainerRequestFilter is used (specified in blueprint), but I am not sure how it can be used with DS? From…
3
votes
1 answer

Valid ways to interrupt an OSGi component from being activated

I have an OSGi component: @Component(immediate=true) public class SomeComponent implements SomeInterface {...} Note that the component is immediate. Also, since the component class is implementing an interface, I understand that a service will be…
medalik
  • 139
  • 1
  • 10
3
votes
1 answer

OSGi: What happens if not to unget service

This is the way how I get OSGi service: ServiceReference reference = bundleContext.getServiceReference(Foo.class.getName()); Foo foo=(Foo) bundleContext.getService(reference); What happens if I don't do bunldeContext.ungetSerivice(reference) when…
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
3
votes
1 answer

Activating an OSGI LogListener before other services?

I am writing a OSGI-based desktop application, using Apache Felix, Declarative Services and Maven. It's going to use JavaFX, so I'm using Drombler FX too. In the bundles I develop, I'd like to use an appropriate logging mechanism, and I'm currently…
3
votes
2 answers

In Declarative Services. When a service is deactivated, when are references to it removed?

If I have a service A which is referenced by some other component (called B), at which point will B's reference to A become null? -Before the deactivate method of A is called? -After the deactivate method of A is called, finished? -After the…
santiagozky
  • 2,519
  • 22
  • 31
3
votes
1 answer

OSGi - get ds service by name (id)

I am newbie in OSGi. I have googled about a few hours but couldn't find the answer. Maybe my understanding is wrong. So the problem. Lets suppose I have a component.
user3488102
3
votes
1 answer

OSGi Declarative Services and Spring

I have a data access module that provides implementations of repositories using Spring and JDBC. Therefore, I define a Spring context as follows:
manash
  • 6,985
  • 12
  • 65
  • 125
3
votes
1 answer

OSGI: What is the best approach to wait for a declarative service component to start?

I have the following problem: 1: An OSGI bundle A (equinox) is activated, and the activator parses an XML file 2: in the XML file, a declarative service is requested, which is present in another bundle (B) 3: bundle B is not activated yet, so the…
keesp
  • 301
  • 2
  • 13
3
votes
1 answer

OSGi 'update' command; dynamic services wont restart

I'm developing an OSGi based system that I intend to periodically 'update' without bringing down the whole system. I am intending on using 'update' to facilitate bundle changes and as such wrote a small app (2 bundles) to try to prove the theory. My…
Aaron
  • 343
  • 3
  • 10
3
votes
1 answer

Bind order of OSGi declarative services

Assuming I use OSGi Declarative Services and I have a service that have a number references with policy = dynamic... A - Mandatory unary. B - Mandatory unary. C - Mandatory multiple. D - Optional unary. E - Optional multiple. All references are…
MarcB
  • 549
  • 6
  • 14
3
votes
2 answers

OSGi/Equinox, Declarative Service and Lazy Load

I'm attempting to use Declarative Services to create a service bundle that provides functionality to another bundle. However, I want my Service Provider bundle to not start until it is needed. Let me describe my conditions. There are two…
KevinO
  • 970
  • 2
  • 13
  • 31
3
votes
2 answers

How do you properly implement a ManagedServiceFactory as Decalarative Service in OSGi?

I have services that need to be created on a per-configuration base, each of which relies on an external resource and thus should manage it's own lifcycle (i.e. (de)register the service). Thus implementing these as DS and let SCR spawn multiple…
benjamin
  • 1,066
  • 11
  • 22
3
votes
1 answer

Issues with GWT in OSGi+Pax-Web using Declarative Services

I'm migrating an existing GWT app running on OSGi (Equinox) and Pax-web to use Declarative Services instead of programmatic Service Tracker. I'm using Pax-Web in Equinox. A WAR-based GWT application is loaded with no problems by PAX-WEB War…
maasg
  • 37,100
  • 11
  • 88
  • 115
3
votes
2 answers

Intra- and inter-bundle mutual dependencies in OSGi component models

In my current application, I've run into this pattern in a couple of places: I have two service interfaces in a single bundle which do different but related jobs. interface Service1 { ... } interface Service2 { ... } and want to have singleton…
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
2
votes
2 answers

Programmatically using components in OSGi

In my application, using services by themselves is pretty useless. You always need some external configuration information for a service to be usable. Components coupled with ConfigurationAdmin makes sense, since then for each configuration I…
Zoltán
  • 121
  • 10
1 2
3
13 14