@Override public void update(InputStream input) throws BundleException { getEquinoxContainer().checkAdminPermission(this, AdminPermission.LIFECYCLE); try { if (input != null) input.close(); } catch (IOException e) { // do nothing } ((EquinoxSystemModule) getModule()).asyncUpdate(); }
public Bundle installBundle(String location, InputStream in) throws BundleException { Context c; try { in.close(); try { @SuppressWarnings("unused") URL url = new URL(location); } catch (MalformedURLException e) { throw new BundleException( "For the mini framework, the location must be a proper URL even though this is not required by the specification " + location, e); } c = new Context(this, last, ++ID, location); bundles.put(new Long(c.id), c); last = c; return c; } catch (Exception e) { throw new BundleException("Can't install " + location, e); } }
private String getManifestEntry(File bundleFile, String entry) { try { String value = null; if (bundleFile.isDirectory()) { File m = new File(bundleFile, "META-INF/MANIFEST.MF"); InputStream os; os = new FileInputStream(m); Manifest mf; mf = new Manifest(os); value = mf.getMainAttributes().getValue(entry); os.close(); } else { JarFile bundleJar = new JarFile(bundleFile); value = bundleJar.getManifest().getMainAttributes().getValue(entry); } if (value.indexOf(";") > -1) { String[] valueElements = value.split(";"); return valueElements[0]; } return value; } catch (IOException e) { return null; } }