commit | 0a7fcb0d56d3b2aabcd6c0a12420b6efa522d8a5 | [log] [tgz] |
---|---|---|
author | Carsten Ziegeler <cziegeler@apache.org> | Tue Dec 06 09:08:51 2022 +0100 |
committer | Carsten Ziegeler <cziegeler@apache.org> | Tue Dec 06 09:08:51 2022 +0100 |
tree | 4ab0c14f4f106c7953c70c9ebc58785c6987d0fd | |
parent | 6854224113ab2930e3a97e0f6b6a480adbf8317a [diff] |
SLING-11718 : Migrate to Jakarta JSON API
This tool aims to provide to Apache Sling users an easy-to-use tool which is able to detect differences between different released version of the same Apache Sling Feature Model.
Given two different versions of the same org.apache.sling.feature.Feature
, all we need to do is comparing them
import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures; import org.apache.sling.feature.Feature import org.apache.sling.feature.diff.DiffRequest; import org.apache.sling.feature.diff.DiffRequest; ... Feature previous = // somehow obtained Feature current = // somehow obtained DiffRequest diffRequest = new DiffRequest() .setPrevious(previous) .setCurrent(current) .setResultId("org.apache.sling:org.apache.sling.diff:1.0.0"); Feature featureDiff = compareFeatures(diffRequest);
The resulting featureDiff
is a new Feature
instance which prototypes from previous
and where necessary removals sections are populated and new elements may be added.
###Please note
The FeatureDiff.compareFeatures(Feature, Feature)
rejects (aka throws an IllegalArgumentException
) Feature
inputs that:
null
(bien sûr);Feature
.The DiffRequest
data object can be configured in order to include/exclude one ore more Feature section(s), available are:
bundles
configurations
extensions
framework-properties
Users can simply add via the include/exclude methods the section(s) they are interested:
DiffRequest diffRequest = new DiffRequest() .setPrevious(previous) .setCurrent(current) .addIncludeComparator("bundles") .addIncludeComparator("configurations") .setResultId("org.apache.sling:org.apache.sling.diff:1.0.0"); Feature featureDiff = compareFeatures(diffRequest);