On 11/19/2016 10:42 AM, Timothy Ward wrote:
Question:   If I use a component factory as suggested above to create a 
component instance, is there a straightforward way to associate every 
newInstance with a separate/new configuration?
The way that this is done is to pass the configuration using the newInstance 
method. Effectively your pattern would be to register a ConfigurationListener 
or ManagedServiceFactory, passing the configuration Dictionary to the Component 
Factory for each Factory Configuration.

The thing is - this is almost exactly the multiton pattern, so I can’t quite 
work out why setting the DS service scope to prototype isn’t enough for what 
you want to achieve… I guess I’m just not close enough to the detail.

Is there a description and/or example of the multiton pattern usage somewhere? It was my understanding (from BJ's comment) that prototype scoped instances shared the same component properties (rather than having separate properties as per component factory newInstance(props)).

This use case would like to a) have distinct service properties for every instance created (i.e. newInstance); b) also be able to configure each service instance dynamically via config admin.

Scott


_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to