Update interface
diff --git a/src/main/java/org/apache/sling/feature/spi/context/ExtensionHandlerContext.java b/src/main/java/org/apache/sling/feature/spi/context/ExtensionHandlerContext.java
index 7aa1786..90c4830 100644
--- a/src/main/java/org/apache/sling/feature/spi/context/ExtensionHandlerContext.java
+++ b/src/main/java/org/apache/sling/feature/spi/context/ExtensionHandlerContext.java
@@ -23,10 +23,12 @@
import java.net.URL;
import java.util.Dictionary;
+import java.util.Map;
public interface ExtensionHandlerContext {
/**
* Add a bundle to be installed by the launcher.
+ * @param id The bundle's artifact ID
* @param startLevel The start level for the bundle.
* @param file The file with the bundle.
*/
@@ -34,11 +36,11 @@
/**
* Add an artifact to be installed by the launcher
- * @param artifactId The ID of the artifact
+ * @param id The artifact's ID
* @param url The url to the Artifact resource
* @param props Additional installation metadata
*/
- public void addInstallableArtifact(ArtifactId artifactId, final URL url, final Dictionary<String,Object> props);
+ public void addInstallableArtifact(ArtifactId id, final URL url, final Map<String,Object> props);
/**
* Add a configuration to be installed by the launcher
diff --git a/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java b/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
index 3b4a60d..f114821 100644
--- a/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
+++ b/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
@@ -52,6 +52,7 @@
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
/**
* This task installs a feature model resources.
@@ -183,43 +184,6 @@
}
}
- /* done by RepoinitExtensionHandler
- // repoinit
- final Extension repoInit = feature.getExtensions().getByName(Extension.EXTENSION_NAME_REPOINIT);
- if (repoInit != null && repoInit.getType() == ExtensionType.TEXT) {
- final String configPid = REPOINIT_FACTORY_PID.concat(feature.getId().toMvnName().replace('-', '_'));
- final Dictionary<String, Object> props = new Hashtable<>();
- props.put("scripts", repoInit.getText());
- props.put(Constants.SERVICE_RANKING, 200);
-
- result.add(new InstallableResource("/".concat(configPid).concat(".config"), null,
- props, null, InstallableResource.TYPE_CONFIG, null));
- }
- */
-
- /* done by APIRegionsExtensionHandler
- // api regions
- final Extension regionExt = feature.getExtensions().getByName(ApiRegions.EXTENSION_NAME);
- if ( regionExt != null ) {
- try {
- final ApiRegions regions = ApiRegions.parse(regionExt.getJSONStructure().asJsonArray());
-
- 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, this.installContext.artifactManager)));
- props.put(PROP_bundleFeatures, convert(LauncherProperties.getBundleIDtoFeaturesMap(feature)));
- props.put(PROP_featureRegions, convert(LauncherProperties.getFeatureIDtoRegionsMap(regions)));
- props.put(PROP_regionPackage, convert(LauncherProperties.getRegionNametoPackagesMap(regions)));
-
- result.add(new InstallableResource("/".concat(configPid).concat(".config"), null,
- props, null, InstallableResource.TYPE_CONFIG, null));
- } catch (final IOException ioe) {
- logger.warn("Unable to parse region information " + feature.getId().toMvnId(), ioe);
- return null;
- }
- }
- */
-
// bundles
for (final Artifact bundle : feature.getBundles()) {
if (!addArtifact(bundle, result)) {
@@ -227,17 +191,6 @@
}
}
- /*
- // artifact extensions
- for(final Extension ext : feature.getExtensions()) {
- if ( ext.getType() == ExtensionType.ARTIFACTS ) {
- for (final Artifact artifact : ext.getArtifacts()) {
- addArtifact(artifact, result);
- }
- }
- }
- */
-
return result;
}
@@ -331,10 +284,13 @@
}
@Override
- public void addInstallableArtifact(ArtifactId id, URL url, Dictionary<String,Object> props) {
+ public void addInstallableArtifact(ArtifactId id, URL url, Map<String,Object> props) {
try {
+ Dictionary <String,Object> dict = new Hashtable<>();
+ props.entrySet().stream().forEach(e -> dict.put(e.getKey(), e.getValue()));
+
InputStream is = url.openStream();
- results.add(new InstallableResource("/".concat(id.toMvnName()), is, props, null /* TODO digest? */,
+ results.add(new InstallableResource("/".concat(id.toMvnName()), is, dict, null /* TODO digest? */,
InstallableResource.TYPE_FILE, null));
} catch (IOException e) {
logger.warn("Unable to read artifact " + id + " from url " + url, e);