public class BuilderContext extends Object
FeatureBuilder and controls
how features are assembled and aggregated.
When two features are merged, being it a prototype with the feature using the prototype or two features, there might be a clash with bundles or artifacts. A clash occurs when there is an artifact in the source and the target with different versions. If the version is the same, the source artifact will override the target artifact. However, all other cases need instructions on how to proceed.
An override rule is an artifact id. As the version for the rule, one of
VERSION_OVERRIDE_ALL,
VERSION_OVERRIDE_LATEST or
VERSION_OVERRIDE_HIGHEST as well as any version can be
specified. If the artifact id should match more than a single artifact
COORDINATE_MATCH_ALL can be specified as group id,
artifact id, type and/or classifier.
This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_FAIL_ON_CLASH
Used to handle configuration merging - fail the merge when there is a clash for a PID - this is the default
|
static String |
CONFIG_FAIL_ON_PROPERTY_CLASH
Used to handle configuration merging - fail the merge only when there is a clash on a property level
|
static String |
CONFIG_MERGE_FIRST
Used to handle configuration merging - merge the first configuration in, latest props will not override previous values
|
static String |
CONFIG_MERGE_LATEST
Used to handle configuration merging - merge the latest configuration in, latest props might override previous values
|
static String |
CONFIG_USE_FIRST
Used to handle configuration merging - use the first configuration, don't merge
|
static String |
CONFIG_USE_LATEST
Used to handle configuration merging - use the latest configuration, but don't merge
|
static String |
COORDINATE_MATCH_ALL
Used in override rule to match all coordinates
|
static String |
VERSION_OVERRIDE_ALL
Used in override rule to select all candidates.
|
static String |
VERSION_OVERRIDE_HIGHEST
Used in override rule to select the candidate with the highest version (OSGi
version comparison rules).
|
static String |
VERSION_OVERRIDE_LATEST
Used in override rule to select the last candidate applied.
|
| Constructor and Description |
|---|
BuilderContext(FeatureProvider provider)
Create a new context.
|
public static final String VERSION_OVERRIDE_ALL
public static final String VERSION_OVERRIDE_HIGHEST
public static final String VERSION_OVERRIDE_LATEST
public static final String COORDINATE_MATCH_ALL
public static final String CONFIG_FAIL_ON_CLASH
public static final String CONFIG_FAIL_ON_PROPERTY_CLASH
public static final String CONFIG_USE_LATEST
public static final String CONFIG_USE_FIRST
public static final String CONFIG_MERGE_LATEST
public static final String CONFIG_MERGE_FIRST
public BuilderContext(FeatureProvider provider)
provider - A provider providing the prototype featuresIllegalArgumentException - If feature provider is nullpublic BuilderContext setArtifactProvider(ArtifactProvider ap)
ap - An ArtifactProvider to resolve artifact IDs to URLspublic BuilderContext addVariablesOverrides(Map<String,String> vars)
vars - The overridespublic BuilderContext addFrameworkPropertiesOverrides(Map<String,String> props)
props - The overrides@Deprecated public BuilderContext addArtifactsOverrides(List<String> overrides)
addArtifactsOverride(ArtifactId) instead.overrides - The overridesIllegalArgumentException - If the provided overrides are not following
the artifact id syntaxpublic BuilderContext addArtifactsOverride(ArtifactId override)
override - The overridepublic BuilderContext addConfigsOverrides(Map<String,String> overrides)
overrides - The overridespublic BuilderContext addMergeExtensions(MergeHandler... extensions)
extensions - A list of merge extensions.public BuilderContext addPostProcessExtensions(PostProcessHandler... extensions)
extensions - A list of extensionspublic BuilderContext setHandlerConfiguration(String name, Map<String,String> cfg)
MergeHandlers and PostProcessHandlers. The name of a handler
is the simple class name of the class implementing the handler. To pass the
same configuration to all handlers, use the
CONFIGURATION_ALL_HANDLERS_KEY name.name - The name of the handlercfg - The configuration for the handlerCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.