in src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java [400:440]
private Manifest getRunModesManifest(Feature feature) throws MojoExecutionException {
Map<String, StringBuilder> runModes = new HashMap<>();
for (RunMode rm : feature.getRunModes()) {
for (ArtifactGroup ag : rm.getArtifactGroups()) {
int startOrder = ag.getStartLevel(); // For subsystems the start level on the artifact group is used as start order.
for (org.apache.sling.provisioning.model.Artifact a : ag) {
Artifact artifact = ModelUtils.getArtifact(this.project, this.mavenSession, this.artifactHandlerManager, this.resolver,
a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getType(), a.getClassifier());
File artifactFile = artifact.getFile();
String entryName = getEntryName(artifactFile, startOrder);
String [] runModeNames = rm.getNames();
if (runModeNames == null)
runModeNames = new String[] {ALL_RUNMODES_KEY};
for (String runModeName : runModeNames) {
StringBuilder sb = runModes.get(runModeName);
if (sb == null) {
sb = new StringBuilder();
runModes.put(runModeName, sb);
} else {
sb.append('|');
}
sb.append(entryName);
}
}
}
}
Manifest mf = new Manifest();
Attributes attrs = mf.getMainAttributes();
attrs.putValue("Manifest-Version", "1.0"); // Manifest does not work without this value
attrs.putValue("About-This-Manifest", "This is not a real manifest, it is used as information when this archive is transformed into a real subsystem .esa file");
for (Map.Entry<String, StringBuilder> entry : runModes.entrySet()) {
attrs.putValue(entry.getKey().replace(':', '_'), entry.getValue().toString());
}
return mf;
}