/** * Delete all permissions from locally installed bundles */ private void deleteUserBundlePermissions() { Enumeration<ConditionalPermissionInfo> cpis = cpa.getConditionalPermissionInfos(); while (cpis.hasMoreElements()) { ConditionalPermissionInfo cpi = cpis.nextElement(); if (!NON_USER_CPI_NAMES.contains(cpi.getName())) { cpi.delete(); } } }
/** * The function is called whenever a bundle changes its state. According to * the state, the bundle recieves permissions or loses all permissions. * @param event A specific <code>BundleEvent</code> according to the bundle state */ @Override public void bundleChanged(BundleEvent event) { logger.debug("Got bundle event {}", event.getType()); final String bundleLocation = event.getBundle().getLocation(); switch (event.getType()) { // give the bundle permissions according to the system graph case BundleEvent.INSTALLED: logger.debug("Bundle INSTALLED: {}", bundleLocation); if (bundleLocation.startsWith("userbundle:")) { updateFromSystemGraph(bundleLocation); } break; // delete all permissions of this bundle case BundleEvent.UNINSTALLED: logger.debug("Bundle UNINSTALLED: {}", bundleLocation); cpa.getConditionalPermissionInfo(bundleLocation).delete(); break; } } }
infos.nextElement().delete();
infos.nextElement().delete();
infos.nextElement().delete();
infos.nextElement().delete();