[ 
https://issues.apache.org/jira/browse/SLING-8647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Karl Pauls resolved SLING-8647.
-------------------------------
    Resolution: Fixed

Done. We now have the following possible policies:
{code:java}
/** Used to handle configuration merging - fail the merge when there is a clash 
for a PID - this is the default */
public static final String CONFIG_FAIL_ON_CLASH = "CLASH";

/** Used to handle configuration merging - fail the merge only when there is a 
clash on a property level */
public static final String CONFIG_FAIL_ON_PROPERTY_CLASH = "PROPERTY_CLASH";

/** Used to handle configuration merging - use the latest configuration, but 
don't merge */
public static final String CONFIG_USE_LATEST = "USE_LATEST";

/** Used to handle configuration merging - use the first configuration, don't 
merge */
public static final String CONFIG_USE_FIRST = "USE_FIRST";

/** Used to handle configuration merging - merge the latest configuration in, 
latest props might override previous values */
public static final String CONFIG_MERGE_LATEST = "MERGE_LATEST";

/** Used to handle configuration merging - merge the first configuration in, 
latest props will not override previous values */
public static final String CONFIG_MERGE_FIRST = "MERGE_FIRST";
{code}
They can be given to the BuilderContext via a map where the key is the pid and 
the value the policy. That map will be processed in order (it is a linked hash 
map internally) and the first matching policy will be used (with FAIL_ON_CASH 
as the default if none) where matching means:
 * factorypid only matches factorypid
 * pid only matches pid
 * and * at the end is a wildcard (in case of a fpid it is at the end of the 
fpid and the name
 * a * only is special to allow to match all configs (regardless of factory or 
not

As an Example:

org.apache.sling.* -> matches all pids (but not fpids) starting with 
org.apache.sling.

org.apache.sling.*~foo* -> matches all factory configs that have a factory pid 
starting with org.apache.sling. and a name starting with foo

'*' -> matches both

For the slingfeature-maven-plugin, the policies can be given just as the 
artifactOverrides can be given and the launcher has a new -CC option to give 
them as well.

 

> Provide policies for configuration merging
> ------------------------------------------
>
>                 Key: SLING-8647
>                 URL: https://issues.apache.org/jira/browse/SLING-8647
>             Project: Sling
>          Issue Type: Improvement
>          Components: Feature Model
>            Reporter: Carsten Ziegeler
>            Assignee: Karl Pauls
>            Priority: Major
>             Fix For: Feature Model 1.1.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> At the moment, configurations are merged automatically with properties from 
> the later feature potentially overwriting properties from an earlier feature.
> However for bundles/artifacts as well as framework properties we removed the 
> auto merge and introduced policies.
> As automatic merging of configurations can be a source of error, we should 
> introduce such policies for configurations as well



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to