@Override public void reloadBundles(String[] bundleIdStrings) { for (String bundleIdString : bundleIdStrings) { long id; try { id = Long.parseLong(bundleIdString); } catch (NumberFormatException e) { log.error("Invalid bundle id: " + bundleIdString, e); continue; } List<Set<Long>> bundleIdLayers = Generic.list(bundles.dependentBundles(id)); Collections.reverse(bundleIdLayers); for (Set<Long> bundleIds : bundleIdLayers) { for (long bundleId : bundleIds) { unmanage(bundleId); } } for (Set<Long> bundleIds : bundleIdLayers) { for (long bundleId : bundleIds) { try { bundles.reload(bundleId); } catch (UnknownBundleException e) { log.warn("Unknown bundle: " + id + " Exception: " + e.getMessage()); } catch (Exception e) { log.error("Failed to reload " + id, e); } } } } }
@Override public void bundleSpecificationRemoved(BundleSpecification bundleSpecification) { if (bundles.isHosting(bundleSpecification)) { Long bundleId = bundles.getBundleId(bundleSpecification); if (isManaged(bundleId)) { unmanage(bundleId); } bundles.uninstall(bundleSpecification); } }
private void closeResources() { bundles.close(); queuer.synchUp(); try { queuer.close(); } catch (IOException e) { throw new IORuntimeException(this + " failed to close " + queuer, e); } }
@Override public void bundleSpecificationAdded(BundleSpecification bundleSpecification) { if (isShuttingDown()) { log.info( "Ignoring bundle add:" + bundleSpecification + ", shutdown initiated in " + shutdownThread() + "!"); } else { log.info("Installing " + bundleSpecification); try { bundles.install(bundleSpecification); } catch (Exception e) { log.error(this + " failed to install " + bundleSpecification, e); } } }
@Override public void deactivated(Bundle bundle) { long bundleId = bundle.getBundleId(); unmanage(bundleId); bundles.uninstall(bundleId); }