in src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java [96:134]
public boolean handle(ExtensionContext context, Extension extension) throws Exception {
File registryHome = getRegistryHomeDir(context);
if (extension.getType() == ExtensionType.ARTIFACTS
&& extension.getName().equals(Extension.EXTENSION_NAME_CONTENT_PACKAGES)) {
Map<Integer, Collection<Artifact>> orderedArtifacts = new TreeMap<>();
for (final Artifact a : extension.getArtifacts()) {
int order;
// content-packages without explicit start-order to be installed last
if (a.getMetadata().get(Artifact.KEY_START_ORDER) != null) {
order = a.getStartOrder();
} else {
order = Integer.MAX_VALUE;
}
orderedArtifacts.computeIfAbsent(order, id -> new ArrayList<>()).add(a);
}
List<String> executionPlans = new ArrayList<>();
Set<PackageId> satisfiedPackages = new HashSet<>();
for (Object key : orderedArtifacts.keySet()) {
Collection<Artifact> artifacts = orderedArtifacts.get(key);
ExecutionPlanBuilder builder = buildExecutionPlan(artifacts, satisfiedPackages, context, registryHome);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
builder.save(baos);
executionPlans.add(baos.toString("UTF-8"));
}
// Workaround for too bold relocation mechanism - corresponding details at https://issues.apache.org/jira/browse/MSHADE-156
final Configuration initcfg = new Configuration("org.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer");
initcfg.getProperties().put("executionplans", executionPlans.toArray(new String[executionPlans.size()]));
initcfg.getProperties().put("statusfilepath", registryHome.getAbsolutePath() + "/executedplans.file");
context.addConfiguration(initcfg.getPid(), null, initcfg.getProperties());
// Workaround for too bold relocation mechanism - corresponding details at https://issues.apache.org/jira/browse/MSHADE-156
final Configuration registrycfg = new Configuration("org.UNSHADE.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry");
registrycfg.getProperties().put("homePath", registryHome.getPath());
context.addConfiguration(registrycfg.getPid(), null, registrycfg.getProperties());
return true;
} else {
return false;
}
}