You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2021/07/01 10:03:02 UTC
[sling-org-apache-sling-installer-factory-feature] branch master
updated: SLING-10575: fill empty bundle to feature mappings
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-feature.git
The following commit(s) were added to refs/heads/master by this push:
new 026d66c SLING-10575: fill empty bundle to feature mappings
026d66c is described below
commit 026d66c67f9a5fa92103331d4656b03534c2e58a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Jul 1 11:41:50 2021 +0200
SLING-10575: fill empty bundle to feature mappings
---
bnd.bnd | 2 +-
pom.xml | 2 +-
.../model/impl/APIRegionsExtensionHandler.java | 39 +++++-----------------
3 files changed, 10 insertions(+), 33 deletions(-)
diff --git a/bnd.bnd b/bnd.bnd
index d2c832f..70ae9ad 100644
--- a/bnd.bnd
+++ b/bnd.bnd
@@ -1,2 +1,2 @@
--includeresource: @org.apache.sling.feature.extension.apiregions-[0-9.]*.jar!/org/apache/sling/feature/extension/apiregions/launcher/LauncherProperties.*
+-includeresource: @org.apache.sling.feature.extension.apiregions-[0-9.]*-SNAPSHOT.jar!/org/apache/sling/feature/extension/apiregions/launcher/LauncherProperties.*
Conditional-Package: org.apache.sling.feature.extension.apiregions.api
diff --git a/pom.xml b/pom.xml
index 6c90c2a..7596309 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,7 +110,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.feature.extension.apiregions</artifactId>
- <version>1.2.0</version>
+ <version>1.3.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
diff --git a/src/main/java/org/apache/sling/installer/factory/model/impl/APIRegionsExtensionHandler.java b/src/main/java/org/apache/sling/installer/factory/model/impl/APIRegionsExtensionHandler.java
index 5dddf1d..cb70100 100644
--- a/src/main/java/org/apache/sling/installer/factory/model/impl/APIRegionsExtensionHandler.java
+++ b/src/main/java/org/apache/sling/installer/factory/model/impl/APIRegionsExtensionHandler.java
@@ -18,8 +18,13 @@
*/
package org.apache.sling.installer.factory.model.impl;
-import org.apache.sling.feature.Artifact;
-import org.apache.sling.feature.ArtifactId;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
import org.apache.sling.feature.Extension;
import org.apache.sling.feature.ExtensionType;
import org.apache.sling.feature.Feature;
@@ -29,18 +34,6 @@ import org.apache.sling.feature.spi.context.ExtensionHandler;
import org.apache.sling.feature.spi.context.ExtensionHandlerContext;
import org.osgi.service.component.annotations.Component;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.stream.Collectors;
-
@Component
public class APIRegionsExtensionHandler implements ExtensionHandler {
private static final String REGION_FACTORY_PID = "org.apache.sling.feature.apiregions.factory~";
@@ -62,7 +55,7 @@ public class APIRegionsExtensionHandler implements ExtensionHandler {
final String configPid = REGION_FACTORY_PID.concat(feature.getId().toMvnName().replace('-', '_'));
final Dictionary<String, Object> props = new Hashtable<>();
props.put(PROP_idbsnver, convert(LauncherProperties.getBundleIDtoBSNandVersionMap(feature, context.getArtifactProvider())));
- props.put(PROP_bundleFeatures, convert(getBundleIDToFeatureMap(feature)));
+ props.put(PROP_bundleFeatures, convert(LauncherProperties.getBundleIDtoFeaturesMap(feature)));
props.put(PROP_featureRegions, convert(LauncherProperties.getFeatureIDtoRegionsMap(regions)));
props.put(PROP_regionPackage, convert(LauncherProperties.getRegionNametoPackagesMap(regions)));
@@ -78,20 +71,4 @@ public class APIRegionsExtensionHandler implements ExtensionHandler {
}
return result.toArray(new String[result.size()]);
}
-
- private static Properties getBundleIDToFeatureMap(Feature feature) {
- Properties bundleToFeatureMapping = LauncherProperties.getBundleIDtoFeaturesMap(feature);
- Properties result = new Properties();
- String featureId = feature.getId().toMvnId();
-
- for (Map.Entry<Object, Object> entry : bundleToFeatureMapping.entrySet()) {
- String value = entry.getValue().toString();
- if (value.isEmpty()) {
- value = featureId;
- }
- result.setProperty(entry.getKey().toString(), value);
- }
-
- return result;
- }
}