If you're not using DS or a similar approach to reflect config admin
configurations as service properties you can't really change them as
you correctly observe that you can't obtain the Service Registration.

An alternative approach that you could take is to shadow/proxy the
service registration with another one that has the modified
properties. Service Registry hooks can be used for this. I once wrote
a blog article about this:
http://coderthoughts.blogspot.com/2009/11/altering-osgi-service-lookups-with.html
that might be of help here...

Best regards,

David

On 20 May 2015 at 16:23, Timothy Ward <tim.w...@paremus.com> wrote:
> Hi Frank,
>
> If you use Declarative Services to publish your service object then you can 
> easily change its service properties at runtime using Config Admin. Every DS 
> component has an associated PID (it defaults to the name of the component) 
> and any public configuration properties (i.e. ones that don’t start with a 
> ‘.’ character) are automatically published as service properties. If you 
> update the configuration in Config Admin then the service properties are 
> updated too.
>
> Regards,
>
> Tim
>
>> On 20 May 2015, at 16:14, Frank Langel <fr...@frankjlangel.com> wrote:
>>
>> Hi,
>>
>> I would like to change and add properties to an OSGI service. The only way I 
>> know requires access to the ServiceRegistration object of the service 
>> instance.
>> However, this ServiceRegistration object cannot be retrieved from the OSGI 
>> registry, but is returned only when we register the service and therefore 
>> hardly available to a 3rd party that hasn’t created the service.
>>
>> Is there any other way to change service properties or obtain the 
>> ServiceRegistration object?
>> Thanks in advance
>> Frank
>>
>> _______________________________________________
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to