Package org.apache.sling.feature.builder
Class FeatureBuilder
java.lang.Object
org.apache.sling.feature.builder.FeatureBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Featureassemble(ArtifactId featureId, BuilderContext context, Feature... features) Assemble a feature based on the provided features.static Featureassemble(Feature feature, BuilderContext context) Assemble the full feature by processing its prototype.static Feature[]deduplicate(BuilderContext context, Feature... features) Remove duplicate and prototype features.static Feature[]resolve(BuilderContext context, String... featureIds) Resolve a set of features based on their ids.static voidresolveVariables(Feature feature, Map<String, String> additionalVariables) Resolve variables in the feature.
-
Constructor Details
-
FeatureBuilder
public FeatureBuilder()
-
-
Method Details
-
assemble
Assemble the full feature by processing its prototype.- Parameters:
feature- The feature to startcontext- The builder context- Returns:
- The assembled feature.
- Throws:
IllegalArgumentException- If feature or context isnullIllegalStateException- If a prototype feature can't be provided or merged.
-
resolve
Resolve a set of features based on their ids.- Parameters:
context- The builder contextfeatureIds- The feature ids- Returns:
- An array of features, the array has the same order as the provided ids
- Throws:
IllegalArgumentException- If context or featureIds isnullIllegalStateException- If the provided ids are invalid, or the feature can't be provided
-
deduplicate
Remove duplicate and prototype features. If a feature with the same id but different version is contained several times, only the one with the highest version is kept in the result list. If a feature has another feature as prototype from the provided set, the prototype feature is removed from the set.- Parameters:
context- The builder contextfeatures- A list of features- Returns:
- A list of features without duplicates.
-
assemble
Assemble a feature based on the provided features. The features are processed in the order they are provided. If the same feature is included more than once only the feature with the highest version is used. The others are ignored.- Parameters:
featureId- The feature id to use.context- The builder contextfeatures- The features- Returns:
- The application
- Throws:
IllegalArgumentException- If featureId, context or featureIds isnullIllegalStateException- If a feature can't be provided or the feature can't be assembled
-
resolveVariables
Resolve variables in the feature. Variables are allowed in the values of framework properties and in the values of configuration properties.- Parameters:
feature- The featureadditionalVariables- Optional additional variables
-