Hi all,

that's probably a trivial question but I'm looking for the best practice to 
create and register OSGi Services from configurations.
Here's an example scenario:
- I have an interface FooBar
- I have an implementation DefaultFooBarImpl
- I want to be able to specify a node like:
{
    "jcr:primaryType" : "sling:OsgiConfig",
    "name" : "foo"
    "property-one" : "some-value", 
    "property-two" : "another-value",
}
- and consequently I'd like a new instance of DefaultFooBarImpl to be created 
and registered as a Service (of course implementing FooBar)
- then if a new configuration node is added: 
{
    "jcr:primaryType" : "sling:OsgiConfig",
    "name" : "bar"
    "property-one" : "some-other-value", 
    "property-two" : "yet-another-value",
}
- another instance of DefaultFooBarImpl is created and registered as a Service.

>From my basic understanding (which may be obviously completely wrong) it seems 
>to me that the best fit for my use case would be using ManagedServices [1] but 
>I'm not too sure I should do that to handle multiple instances.

Thanks in advance and have a nice day,
Tommaso

[1] : http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ManagedService.html


Reply via email to