Keel 2.1RC2

org.apache.excalibur.configuration.merged
Class ConfigurationMerger

java.lang.Object
  extended byorg.apache.excalibur.configuration.merged.ConfigurationMerger

public class ConfigurationMerger
extends java.lang.Object

The ConfigurationMerger will take a Configuration object and layer it over another. It will use special attributes on the layer's children to control how children of the layer and base are combined. In order for a child of the layer to be merged with a child of the base, the following must hold true:

  1. The child in the layer Configuration has an attribute named phoenix-configuration:merge and its value is equal to a boolean TRUE
  2. There must be a single child in both the layer and base with the same getName() OR there exists an attribute named phoenix-configuration:key-attribute that names an attribute that exists on both the layer and base that can be used to match multiple children of the same getName()

Author:
See Also:
ConfigurationSplitter

Constructor Summary
ConfigurationMerger()
           
 
Method Summary
private static void copyAttributes(Configuration source, DefaultConfiguration dest)
           
private static Configuration getMergePartner(Configuration toMerge, Configuration layer, Configuration base)
           
private static java.lang.String getValue(Configuration layer, Configuration base)
           
static Configuration merge(Configuration layer, Configuration base)
          Merge two configurations.
private static void mergeChildren(Configuration layer, Configuration base, DefaultConfiguration merged)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationMerger

public ConfigurationMerger()
Method Detail

merge

public static Configuration merge(Configuration layer,
                                  Configuration base)
                           throws ConfigurationException
Merge two configurations.

Parameters:
layer - Configuration to layer over the base
base - Configuration layer will be merged with
Returns:
Result of merge
Throws:
ConfigurationException - if unable to merge

mergeChildren

private static void mergeChildren(Configuration layer,
                                  Configuration base,
                                  DefaultConfiguration merged)
                           throws ConfigurationException
Throws:
ConfigurationException

getMergePartner

private static Configuration getMergePartner(Configuration toMerge,
                                             Configuration layer,
                                             Configuration base)
                                      throws ConfigurationException
Throws:
ConfigurationException

getValue

private static java.lang.String getValue(Configuration layer,
                                         Configuration base)

copyAttributes

private static void copyAttributes(Configuration source,
                                   DefaultConfiguration dest)
                            throws ConfigurationException
Throws:
ConfigurationException

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.