public synchronized void cleanup() { while ((!m_installed.isEmpty())) { try { Long id = m_installed.pop(); Bundle bundle = m_framework.getBundleContext().getBundle(id); bundle.uninstall(); LOG.debug("Uninstalled bundle " + id); } catch (BundleException e) { e.printStackTrace(); } } }
public synchronized long install(InputStream stream) { try { Bundle b = m_framework.getBundleContext().installBundle("local", stream); m_installed.push(b.getBundleId()); LOG.debug("Installed bundle " + b.getSymbolicName() + " as Bundle ID " + b.getBundleId()); setBundleStartLevel(b.getBundleId(), Constants.START_LEVEL_TEST_BUNDLE); // stream.close(); b.start(); return b.getBundleId(); } catch (BundleException e) { e.printStackTrace(); } return -1; }