if(toRegister.isEmpty()) {
log.warn("No prepared resources found to register, use {} first", InstallerRegisterCommand.I_INSTALLER_REGISTER);
} else {
final String prefix = commandLine.getQualifier();
if(prefix == null || prefix.length() == 0) {
throw new CrankstartException("Missing command qualifier, required to specify installer resources prefix");
}
final BundleContext ctx = crankstartContext.getOsgiFramework().getBundleContext();
final String serviceClass = OsgiInstaller.class.getName();
final ServiceReference ref = ctx.getServiceReference(serviceClass);
if(ref == null) {
throw new CrankstartException("Installer service not available, cannot register resource (" + serviceClass + ")");
}
final OsgiInstaller installer = (OsgiInstaller)ctx.getService(ref);
try {
installer.registerResources(prefix, toRegister.toArray(new InstallableResource[] {}));
log.info("Registered {} resources with installer, using prefix '{}'", toRegister.size(), prefix);