private void update(Bundle bundle, URL location) throws IOException, BundleException { try (InputStream is = location.openStream()) { File file = BundleUtils.fixBundleWithUpdateLocation(is, location.toString()); try (FileInputStream fis = new FileInputStream(file)) { bundle.update(fis); } file.delete(); } }
System.out.println("updating: " + bundle.getSymbolicName()); try { BundleUtils.update(bundle, new URL(e.getValue())); } catch (BundleException ex) { System.err.println("Failed to update: " + bundle.getSymbolicName()+", due to: "+e);
bundle.getSymbolicName(), location); if (!simulate) { BundleUtils.update(bundle, location); bundle.start();
private void update(Bundle bundle, URL location) throws IOException, BundleException { try (InputStream is = location.openStream()) { File file = BundleUtils.fixBundleWithUpdateLocation(is, location.toString()); try (FileInputStream fis = new FileInputStream(file)) { bundle.update(fis); } file.delete(); } }
private void update(Bundle bundle, URL location) throws IOException, BundleException { try (InputStream is = location.openStream()) { if (raw) { bundle.update(is); } else { File file = BundleUtils.fixBundleWithUpdateLocation(is, location.toString()); try (FileInputStream fis = new FileInputStream(file)) { bundle.update(fis); } file.delete(); } } }
@Override public void updateBundle(Bundle bundle, String uri, InputStream is) throws BundleException { // We need to wrap the bundle to insert a Bundle-UpdateLocation header try { File file = BundleUtils.fixBundleWithUpdateLocation(is, uri); bundle.update(new FileInputStream(file)); file.delete(); } catch (IOException e) { throw new BundleException("Unable to update bundle", e); } }
private void update(Bundle bundle, URL location) throws IOException, BundleException { try (InputStream is = location.openStream()) { if (raw) { bundle.update(is); } else { File file = BundleUtils.fixBundleWithUpdateLocation(is, location.toString()); try (FileInputStream fis = new FileInputStream(file)) { bundle.update(fis); } file.delete(); } } }
private void updateBundleIfNecessary(File localRepository, List<Bundle> updated, Bundle bundle) throws BundleException, IOException { File location = getBundleExternalLocation(localRepository, bundle); if (location != null && location.exists() && location.lastModified() > bundle.getLastModified()) { try (InputStream is = new FileInputStream(location)) { logger.info("[Watch] Updating watched bundle: {} ({})", bundle.getSymbolicName(), bundle.getVersion()); if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null) { logger.info("[Watch] Bundle {} is a fragment, so it's not stopped", bundle.getSymbolicName()); } else { bundle.stop(Bundle.STOP_TRANSIENT); } // We don't really want to loose the update-location String updateLocation = getLocation(bundle); if (!updateLocation.equals(bundle.getLocation())) { File file = BundleUtils.fixBundleWithUpdateLocation(is, updateLocation); try (FileInputStream fis = new FileInputStream(file)) { bundle.update(fis); } file.delete(); } else { bundle.update(is); } updated.add(bundle); } } }
private void updateBundleIfNecessary(File localRepository, List<Bundle> updated, Bundle bundle) throws BundleException, IOException { File location = getBundleExternalLocation(localRepository, bundle); if (location != null && location.exists() && location.lastModified() > bundle.getLastModified()) { try (InputStream is = new FileInputStream(location)) { logger.info("[Watch] Updating watched bundle: {} ({})", bundle.getSymbolicName(), bundle.getVersion()); if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null) { logger.info("[Watch] Bundle {} is a fragment, so it's not stopped", bundle.getSymbolicName()); } else { bundle.stop(Bundle.STOP_TRANSIENT); } // We don't really want to loose the update-location String updateLocation = getLocation(bundle); if (!updateLocation.equals(bundle.getLocation())) { File file = BundleUtils.fixBundleWithUpdateLocation(is, updateLocation); try (FileInputStream fis = new FileInputStream(file)) { bundle.update(fis); } file.delete(); } else { bundle.update(is); } updated.add(bundle); } } }