use of org.apache.karaf.main.util.SimpleMavenResolver in project karaf by apache.
the class Main method launch.
public void launch() throws Exception {
if (config == null) {
config = new ConfigProperties();
}
config.performInit();
if (config.delayConsoleStart) {
System.out.println(config.startupMessage);
}
String log4jConfigPath = System.getProperty("karaf.etc") + "/org.ops4j.pax.logging.cfg";
BootstrapLogManager.setProperties(config.props, log4jConfigPath);
lockCallback = new KarafLockCallback();
InstanceHelper.updateInstancePid(config.karafHome, config.karafBase, true);
BootstrapLogManager.configureLogger(LOG);
for (String provider : config.securityProviders) {
addSecurityProvider(provider);
}
List<File> bundleDirs = getBundleRepos();
ArtifactResolver resolver = new SimpleMavenResolver(bundleDirs);
// Start up the OSGI framework
ClassLoader classLoader = createClassLoader(resolver);
FrameworkFactory factory = loadFrameworkFactory(classLoader);
framework = factory.newFramework(config.props);
setLogger();
framework.init();
framework.getBundleContext().addFrameworkListener(lockCallback);
framework.start();
FrameworkStartLevel sl = framework.adapt(FrameworkStartLevel.class);
sl.setInitialBundleStartLevel(config.defaultBundleStartlevel);
// If we have a clean state, install everything
if (framework.getBundleContext().getBundles().length == 1) {
LOG.info("Installing and starting initial bundles");
File startupPropsFile = new File(config.karafEtc, STARTUP_PROPERTIES_FILE_NAME);
List<BundleInfo> bundles = readBundlesFromStartupProperties(startupPropsFile);
installAndStartBundles(resolver, framework.getBundleContext(), bundles);
LOG.info("All initial bundles installed and set to start");
}
ServerInfo serverInfo = new ServerInfoImpl(args, config);
framework.getBundleContext().registerService(ServerInfo.class, serverInfo, null);
activatorManager = new KarafActivatorManager(classLoader, framework);
activatorManager.startKarafActivators();
setStartLevel(config.lockStartLevel);
// Progress bar
if (config.delayConsoleStart) {
new StartupListener(LOG, framework.getBundleContext());
}
monitor();
registerSignalHandler();
watchdog();
}
Aggregations