Hi Pierre,
Am Dienstag, den 25.03.2008, 23:19 +0100 schrieb Pierre De Rop:
> Ok, now it's clear to me.
> Thanks a lot for your quick response.
You are welcome ;-)
Regards
Felix
>
> /Pierre
>
> Felix Meschberger wrote:
> > Hi Pierre,
> >
> > According to the spec, the component must be cycled (deactivate -
> > activate) when the configuration is updated. The Configuration itself
> > should not register a ManagedService for its own PID.
> >
> > You could of course create another PID and from within your component
> > register a ManagedService with that new PID. You then update the
> > configuration for that PID, get it in the ManagedService and may update
> > your component with this configuration.
> >
> > However, I am not sure, whether your requirements are so hard, that it
> > justifies this overhead.
> >
> > Alternatively, you might want to not create an SCR component at all and
> > create your component from a bundle activator and just register it as a
> > ManagedService directly and act upon the update method call.
> >
> > Hope this helps.
> >
> > Regards
> > Felix
> >
> > Am Dienstag, den 25.03.2008, 21:48 +0100 schrieb Pierre De Rop:
> >
> >> Hello every one;
> >>
> >> I am wondering if it's possible to reconfigure a Service Component
> >> without restarting it at all !
> >> Here is my use case: I have a Service Component which is activated by
> >> the Declarative Service. The corresponding DS xml is:
> >>
> >> <?xml version="1.0" encoding="utf-8"?>
> >> <component name="hello">
> >> <implementation class="test.HelloComponent"/>
> >> </component>
> >>
> >> Now, my HelloComponent's activate method is defined as this:
> >>
> >> public class HelloComponent {
> >> protected void activate(ComponentContext ctx) {
> >> // initialize our HelloComponent using ctx.getProperties()
> >> }
> >> }
> >>
> >> if I create a Configuration using the Config Admin Service with a pid
> >> equals to the
> >> HelloComponent's name (that is: "*hello*"), then my HelloComponent will
> >> retrieve its
> >> properties from the *ComponentContext.getProperties*() method. So far,
> >> all is working like a charm.
> >>
> >> Now here is my question: Is there a way for my HelloComponent to
> >> register a ManagedService in order
> >> to be notified when properties are updated by the Configuration Admin
> >> Service ?
> >> I ask this question because I have observed that SCR *REACTIVATES* the
> >> HelloComponent, when the
> >> properties are updated by the Config Admin Service. That is: when Config
> >> Admin updates the
> >> configuration, my HelloComponent is deactivated (it is removed from the
> >> OSGi servide registry), and
> >> then re-activated (my activate method is invoked again).
> >> The problem here is that my HelloComponent is actually a "crutial"
> >> component which must not be *shutdown* when
> >> properties are modified (because I don't wan't to interrupt the service
> >> while re-activating my
> >> HelloComponent).
> >>
> >> /Pierre
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]