[ 
https://issues.apache.org/jira/browse/FELIX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604810#action_12604810
 ] 

Felix Meschberger commented on FELIX-584:
-----------------------------------------

> The problem with this approach is the fact that in many cases the 
> Configuration instance
> will not be persisted or available until the update() method is used to set 
> new properties

This is not quite correct: A new configuration object is immediately persisted 
but _not_ delivered. Only when the update method is first called on the 
Configuration will the configuration be delivered.

Hence the operation of first creating and in a second request updating the 
configuration is not completely wrong.

Anyway, the current implementation of the GUI is problematic as it tries (and 
fails) to mix a selection mix for configuration objects and factories. A better 
approach, which you are also using, is to have two selection lists: One for 
concrete configurations (existing and non-existing for ManagedService 
instances) and one for factory configurations.

Now, the implementation would -- upon creation of a factory configuration -- 
show that factory configuration with default values filled in. The user may 
then update (aka save) the configuration and it will be delivered.

> org.apache.felix.webconsole.internal.compendium.AjaxConfigManagerAction.applyConfiguration():
>  "create" action is not handled properly
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-584
>                 URL: https://issues.apache.org/jira/browse/FELIX-584
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>            Reporter: Dieter Wimberger
>            Assignee: Felix Meschberger
>         Attachments: AjaxConfigManagerAction.java.diff
>
>
> The current revision of the code (662145) creates the configuration, and 
> returns true.
> else if ( request.getParameter( "create" ) != null )
> {
>     // pid is a factory PID and we have to create a new configuration
>     // we should actually also display that one !
>     Configuration config = ca.createFactoryConfiguration( pid, null );
>      // request.setAttribute(ATTR_REDIRECT_PARAMETERS, "pid=" +
>     // config.getPid());
>     return true;
>  }
> The problem with this approach is the fact that in many cases the 
> Configuration instance will not be persisted or available until the update() 
> method is used to set new properties.
> Based on the fact that the "create" action may be called already with a 
> complete set of properties edited in the form, I would suggest to only  
> differentiate between factory "create" and "save" in the way the 
> Configuration instance is created. i.e.:
>  if ( request.getParameter( "create" ) != null )
>  {
>      // pid is a factory PID and we have to create a new configuration
>      config = ca.createFactoryConfiguration( pid, null );
> } else {
>      // pid is managed service, get configuration
>      config = ca.getConfiguration( pid, null );
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to