I do not think there should be an IllegalStateException in this case, just 
doing the update with the empty dictionary is the most logical action as far as 
I can see. I do not see a use case for the Illegal State Exception and it 
complicates the life cycle therefore unnecessary as far as I can see.

Kind regards,

        Peter Kriens


On 20 dec 2010, at 09:04, Felix Meschberger wrote:

> Hi all,
> 
> In a private communication we have been discussion, the correct outcome
> of the following code:
> 
>   Configuration c =
>       configurationAdmin.createFactoryConfiguration(factoryPid);
>   c.update();
> 
> In the Apache Felix implementation the call to the parameterless
> Configuration.update() method throws IOException because the
> createFactoryConfiguration does not yet persist any configuration data
> for the newly created configuration.
> 
> This contrasts to the following code:
> 
>   Configuration c = configurationAdmin.getConfiguration(pidid);
>   c.update();
> 
> which does not throw an IOException because the getConfiguration method
> persist the (still empty) configuration data.
> 
> Now, the Configuration.update() method states an IllegalStateException
> is to be thrown if the configuration has been deleted and that an
> IOException must be thrown if the configuration properties cannot be
> read from persistence.
> 
> But what happens for newly created configurations where
> Configuration.getProperties() would return null ?
> 
> I see two options :
> 
> (a) Throw an IllegalStateException because there is nothing yet
>       to be updated, pushed through plugins and provided to
>       ManagedService[Factory] services
> (b) Update with nothing (empty Dictionary), push through plugins
>       and update services.
> 
> Thanks for any help and/or guidance.
> 
> Regards
> Felix
> 
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev


_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to