use of org.apache.felix.framework.Felix in project felix by apache.
the class FelixLauncher method start.
public void start() throws BundleException {
StringBuffer autostart = new StringBuffer();
for (int i = 0; i < bundles.size(); i++) {
String bundle = (String) bundles.get(i);
autostart.append(bundle).append(" ");
}
props.put("felix.auto.start.1", autostart.toString());
StringBuffer spkg = new StringBuffer((String) packages.get(0));
packages.remove(0);
for (int i = 0; i < packages.size(); i++) {
String pkg = (String) packages.get(i);
spkg.append(", " + pkg);
}
props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, spkg.toString());
framework = new Felix(props, null);
framework.start();
}
use of org.apache.felix.framework.Felix in project motech by motech.
the class OsgiFrameworkService method init.
public void init(BootstrapConfig bootstrapConfig) {
try (InputStream is = getClass().getResourceAsStream("/osgi.properties")) {
Properties properties = readOSGiProperties(bootstrapConfig, is);
this.setOsgiFramework(new Felix(properties));
} catch (IOException e) {
throw new OsgiException("Cannot read OSGi properties", e);
}
try {
LOGGER.info("Initializing OSGi framework");
ServletContext servletContext = ((WebApplicationContext) applicationContext).getServletContext();
osgiFramework.init();
BundleContext bundleContext = osgiFramework.getBundleContext();
// This is mandatory for Felix http servlet bridge
servletContext.setAttribute(BundleContext.class.getName(), bundleContext);
if (bootstrapConfig != null) {
LOGGER.info("Installing all available bundles");
installAllBundles(servletContext, bundleContext);
registerBundleLoaderExecutor();
}
platformStatusProxy = new PlatformStatusProxy(bundleContext);
LOGGER.info("OSGi framework initialization finished");
} catch (BundleLoadingException e) {
throw new OsgiException("Failed to start the OSGi framework, unable to load bundles", e);
} catch (BundleException e) {
throw new OsgiException("Failed to start the OSGi framework, error processing bundles", e);
} catch (IOException e) {
throw new OsgiException("Failed to start the OSGi framework, IO Error", e);
}
}
Aggregations