in atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosCommands.java [109:146]
public void install(@Descriptor("Name of the layer") String name,
@Descriptor("LoaderType of the layer [OSGI, SINGLE, MANY]") String loaderType,
@Descriptor("Directory containing bundle JARs to install into the layer") File moduleDir)
throws BundleException
{
if (!moduleDir.isDirectory())
{
System.out.println(
"The specified path is not a directory: " + moduleDir.getAbsolutePath());
return;
}
Optional<LoaderType> oLoaderType = Stream.of(LoaderType.values()).filter(
e -> e.name().equalsIgnoreCase(loaderType)).findAny();
if (oLoaderType.isEmpty())
{
String v = Stream.of(LoaderType.values()).map(
LoaderType::name).collect(
Collectors.joining(", "));
System.out.printf("The specified loaderType is not valid. Use one of %s", v);
return;
}
AtomosLayer layer = runtime.getBootLayer().addLayer(name, oLoaderType.get(),
moduleDir.toPath());
List<Bundle> bundles = new ArrayList<>();
for (final AtomosContent atomosBundle : layer.getAtomosContents())
{
bundles.add(atomosBundle.install());
}
for (final Bundle b : bundles)
{
b.start();
}
layers(layer, new HashSet<>());
}