@Override @Deprecated public void deployFolder(File folder, ClassLoader loader) throws Exception { DirectoryBundleFile bf = new DirectoryBundleFile(folder); BundleImpl bundle = new BundleImpl(osgi, bf, loader); osgi.install(bundle); }
@Override public void installBundle(BundleFile bundleFile) throws BundleException { osgi.install(new BundleImpl(osgi, bundleFile, loader.getLoader())); }
public void setSystemBundle(SystemBundle systemBundle) throws BundleException { if (this.systemBundle != null) { throw new IllegalStateException("Cannot set system bundle"); } install(systemBundle); registry.addBundleAlias("system.bundle", systemBundle.getSymbolicName()); this.systemBundle = systemBundle; systemBundle.getBundleContext().registerService(PackageAdmin.class.getName(), new PackageAdminImpl(this), null); }
public synchronized void deployBundle(File file) throws BundleException, IOException { if (!isStarted()) { throw new IllegalStateException("Framework not started"); } if (!file.getPath().endsWith(".jar")) { return; // not a valid bundle } BundleFile bf = file.isDirectory() ? new DirectoryBundleFile(file) : new JarBundleFile(file); try { BundleImpl bundle = new BundleImpl(osgi, bf, loader); if (bundle.getSymbolicName() != null) { osgi.install(bundle); } } catch (NullPointerException t) { // do nothing: may happen with non OSGi manifests // System.out.println("Ignore: "+file); } }
@Override public Bundle installBundle(String location) throws BundleException { File file = new File(location); try { BundleFile bf = file.isDirectory() ? new DirectoryBundleFile(file) : new JarBundleFile(file); BundleImpl b = new BundleImpl(bundle.osgi, bf, bundle.loader); if (b.getSymbolicName() != null) { bundle.osgi.install(b); } return b; } catch (IOException e) { throw new BundleException("Failed to install bundle at " + location, e); } }
public static String install(File f) throws IOException, BundleException { BundleFile bf; if (f.isDirectory()) { bf = new DirectoryBundleFile(f); } else { bf = new JarBundleFile(f); } BundleImpl bundle = new BundleImpl(osgi, bf, loader); if (bundle.getState() == 0) { // not a bundle (no Bundle-SymbolicName) return null; } osgi.install(bundle); return bundle.getSymbolicName(); }