Hello Philipp,

> On 09 Dec 2014, at 10:03 am, Bulu <b...@romandie.com> wrote:
> 
> In Felix DM, can I publish a certain object as several services / interfaces, 
> but each with different properties?
> Calling setInterface() multiple times does not seem to do the trick. Calling 
> setInterface(String[],Dictionary) will assign the same properties to each.
> 
> If I use several interface (with that last call), can I change the properties 
> in init(). I see I can do the following, but that changes the one set of 
> properties for all interfaces
> 
> public void init(Component c){
>  ...
>  Dictionary<String, Object> props = c.getServiceProperties();
>  props.put(someKey, someValue);
>  c.setServiceProperties(props);
> }

OSGi allows you to publish a service with multiple interfaces, but the 
properties then apply to all of them. DM follows that model, so what you’re 
seeing makes sense from that point of view. If you want different properties, 
you have to define multiple DM “components” (which can all use the same 
instance if that’s what you want). 

> Unrelated: can I use component as a dependency without publishing it as a 
> service? Like so:

You might have hit “send” too soon… You cannot depend on something that is not 
a service. You can have a component that does not publish a service but does 
have dependencies on other services.

Well, the only thing you could do is implement some custom form of dependency, 
but that would then have to lookup components in a registry. Which almost 
sounds like another service registry. :)

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to