use of org.apache.maven.shared.osgi.Maven2OsgiConverter in project sling by apache.
the class BaseBundleList method add.
/**
* Merge bundle into a start level using the supplied level if present.
* @param mergeStartLevel
* @param newBnd
*/
private void add(StartLevel mergeStartLevel, Bundle newBnd) {
Bundle current = get(newBnd, false);
if (current != null) {
final Maven2OsgiConverter converter = new DefaultMaven2OsgiConverter();
// compare versions, the highest will be used
final Version newVersion = new Version(converter.getVersion(newBnd.getVersion()));
final Version oldVersion = new Version(converter.getVersion(current.getVersion()));
if (newVersion.compareTo(oldVersion) > 0) {
current.setVersion(newBnd.getVersion());
}
} else {
StartLevel startLevel = null;
if (mergeStartLevel == null || newBnd.getStartLevel() != 0) {
startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
} else {
startLevel = getOrCreateStartLevel(mergeStartLevel.getStartLevel());
}
startLevel.getBundles().add(newBnd);
}
}
Aggregations