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 |
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.
|
| Modifier and Type | Method and Description |
|---|---|
BuilderContext |
addArtifactsOverride(ArtifactId override)
Add an override for artifact clashes.
|
BuilderContext |
addArtifactsOverrides(List<String> overrides)
Deprecated.
Use
addArtifactsOverride(ArtifactId) instead. |
BuilderContext |
addFrameworkPropertiesOverrides(Map<String,String> props)
Add overrides for the framework properties.
|
BuilderContext |
addMergeExtensions(MergeHandler... extensions)
Add merge extensions
|
BuilderContext |
addPostProcessExtensions(PostProcessHandler... extensions)
Add post process extensions
|
BuilderContext |
addVariablesOverrides(Map<String,String> vars)
Add overrides for the variables.
|
BuilderContext |
setArtifactProvider(ArtifactProvider ap)
Set the artifact provider.
|
BuilderContext |
setHandlerConfiguration(String name,
Map<String,String> cfg)
Set a handler configuration.
|
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 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 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–2019 The Apache Software Foundation. All rights reserved.