public void uninstallFeature(String name) throws Exception { featuresService.uninstallFeature(name); }
public void uninstallFeature(String name, String version) throws Exception { featuresService.uninstallFeature(name, version); }
public void uninstallFeature(String name, boolean noRefresh) throws Exception { EnumSet<org.apache.karaf.features.FeaturesService.Option> options = EnumSet.noneOf(org.apache.karaf.features.FeaturesService.Option.class); if (noRefresh) { options.add(org.apache.karaf.features.FeaturesService.Option.NoAutoRefreshBundles); } featuresService.uninstallFeature(name, options); }
public void uninstallFeature(String name, String version, boolean noRefresh) throws Exception { EnumSet<org.apache.karaf.features.FeaturesService.Option> options = EnumSet.noneOf(org.apache.karaf.features.FeaturesService.Option.class); if (noRefresh) { options.add(FeaturesService.Option.NoAutoRefreshBundles); } featuresService.uninstallFeature(name, version, options); }
private boolean uninstallFeature(String feature, String version) { boolean success = false; if (featuresService == null) { this.log.error("Features service is not available"); } try { featuresService.uninstallFeature(feature, version); success = true; } catch (Exception e) { this.log.error("Can't uninstall feature {}/{}", feature, version, e); } return success; }
private synchronized boolean uninstallFeature(FeaturesService featuresService, String name) { try { Feature[] features = featuresService.listInstalledFeatures(); if (isInstalled(features, name)) { featuresService.uninstallFeature(name); logger.info("Uninstalled '{}'", name); postUninstalledEvent(name); return true; } } catch (Exception e) { logger.debug("Failed uninstalling '{}': {}", name, e.getMessage()); } return false; }
@Override public ShutdownResult execute(ShutdownCommand command) { try { if (command.isHalt()) { bundleContext.getBundle(0).stop(); } else { ServiceReference<FeaturesService> ref = bundleContext.getServiceReference(FeaturesService.class); FeaturesService featuresService = bundleContext.getService(ref); featuresService.uninstallFeature("cellar"); bundleContext.ungetService(ref); } } catch (Exception e) { // nothing to do } return new ShutdownResult(command.getId()); }
protected boolean executeOsgiUninstall( IPlugin plugin ) { String pluginId = plugin.getId(); this.removeFeatureFromKarafBoot( pluginId ); try { this.getFeaturesService().uninstallFeature( pluginId ); } catch ( Exception e ) { this.getLogger().debug( "No installed feature found with name " + pluginId + " when uninstalling OSGI plugin." ); } // remove KAR file from deploy folder if it exists String deployFolder = this.getKarafDeployFolder(); File karFile = new File( deployFolder + File.separator + pluginId + ".kar" ); if( karFile.exists() && karFile.isFile() ) { return FileUtils.deleteQuietly( karFile ); } return true; }
@Override public ShutdownResult execute(ShutdownCommand command) { try { if (command.isHalt()) { bundleContext.getBundle(0).stop(); } else { ServiceReference<FeaturesService> ref = bundleContext.getServiceReference(FeaturesService.class); FeaturesService featuresService = bundleContext.getService(ref); featuresService.uninstallFeature("cellar"); bundleContext.ungetService(ref); } } catch (Exception e) { // nothing to do } return new ShutdownResult(command.getId()); }
@Override protected void doExecute(FeaturesService admin) throws Exception { if (admin.isInstalled(admin.getFeature("tesb-aux"))) { admin.uninstallFeature("tesb-aux"); } if (admin.isInstalled(admin.getFeature("tesb-aux-common"))) { admin.uninstallFeature("tesb-aux-common"); } if (admin.isInstalled(admin.getFeature("tesb-aux-client-rest"))) { admin.uninstallFeature("tesb-aux-client-rest"); } if (admin.isInstalled(admin.getFeature("tesb-aux-service-rest"))) { admin.uninstallFeature("tesb-aux-service-rest"); } if (admin.isInstalled(admin.getFeature("tesb-aux-persistence"))) { admin.uninstallFeature("tesb-aux-persistence"); } if (admin.isInstalled(admin.getFeature("tesb-aux-server"))) { admin.uninstallFeature("tesb-aux-server"); } } }
private synchronized boolean uninstallAppFeatures(Application app) throws Exception { boolean changed = false; deactivateHooks.removeAll(app.id().name()).forEach(hook -> invokeHook(hook, app.id())); for (String name : app.features()) { Feature feature = featuresService.getFeature(name); if (feature != null && featuresService.isInstalled(feature)) { featuresService.uninstallFeature(name); changed = true; } else if (feature == null) { log.warn("Feature {} not found", name); } } return changed; }
/** * The feature service does not uninstall feature dependencies when uninstalling a single feature. * So we need to make sure we uninstall all features that were newly installed. */ protected void uninstallNewFeatures(Set<Feature> featuresBefore) { try { Feature[] features = featuresService.listInstalledFeatures(); for (Feature curFeature : features) { if (!featuresBefore.contains(curFeature)) { try { System.out.println("Uninstalling " + curFeature.getName()); featuresService.uninstallFeature(curFeature.getName(), curFeature.getVersion()); } catch (Exception e) { // ignore } } } } catch (Exception e) { throw ObjectHelper.wrapRuntimeCamelException(e); } }
/** * Uninstall all features contained in the list of features XML. * * @param featuresRepositories the list of features XML. */ private void uninstallFeatures(List<URI> featuresRepositories) throws Exception { for (Repository repository : featuresService.listRepositories()) { for (URI karFeatureRepoUri : featuresRepositories) { if (repository.getURI().equals(karFeatureRepoUri)) { try { for (Feature feature : repository.getFeatures()) { if (feature.getInstall() == null || Feature.DEFAULT_INSTALL_MODE.equals(feature.getInstall())) { try { featuresService.uninstallFeature(feature.getName(), feature.getVersion()); } catch (Exception e) { LOGGER.warn("Unable to uninstall Kar feature {}", feature.getName() + "/" + feature.getVersion(), e); } } } } catch (Exception e) { LOGGER.warn("Can't get features for KAR {}", karFeatureRepoUri, e); } } } } }
try { LOGGER.debug("CELLAR FEATURE: uninstalling feature {}/{}", state.getName(), state.getVersion()); featuresService.uninstallFeature(state.getName(), state.getVersion()); } catch (Exception e) { LOGGER.error("CELLAR FEATURE: failed to uninstall feature {}/{}", new Object[]{state.getName(), state.getVersion()}, e);
try { LOGGER.debug("CELLAR FEATURE: uninstalling feature {}/{}", state.getName(), state.getVersion()); featuresService.uninstallFeature(state.getName(), state.getVersion()); } catch (Exception e) { LOGGER.error("CELLAR FEATURE: failed to uninstall feature {}/{}", new Object[]{state.getName(), state.getVersion()}, e);
featuresService.uninstallFeature(name, version, options); } else { LOGGER.debug("CELLAR FEATURE: uninstalling feature {}", name); featuresService.uninstallFeature(name, options);
featuresService.uninstallFeature(name, version, options); } else { LOGGER.debug("CELLAR FEATURE: uninstalling feature {}", name); featuresService.uninstallFeature(name, options);
@Test public void testWebacInstallation() throws Exception { assertFalse("trellis-webac already installed!", featuresService.isInstalled(featuresService.getFeature("trellis-webac"))); featuresService.installFeature("trellis-triplestore"); featuresService.installFeature("trellis-webac"); checkTrellisBundlesAreActive(); assertTrue("trellis-webac not installed!", featuresService.isInstalled(featuresService.getFeature("trellis-webac"))); featuresService.uninstallFeature("trellis-webac"); featuresService.uninstallFeature("trellis-triplestore"); if (featuresService.isInstalled(featuresService.getFeature("trellis-audit"))) { featuresService.uninstallFeature("trellis-audit"); } }
@Test public void testAuditAndTriplestoreInstallation() throws Exception { // test these two together because trellis-triplestore depends on trellis-audit assertFalse("trellis-audit already installed!", featuresService.isInstalled(featuresService.getFeature("trellis-audit"))); featuresService.installFeature("trellis-audit"); assertTrue("trellis-audit not installed!", featuresService.isInstalled(featuresService.getFeature("trellis-audit"))); featuresService.uninstallFeature("trellis-audit"); assertFalse("trellis-audit still installed!", featuresService.isInstalled(featuresService.getFeature("trellis-audit"))); assertFalse("trellis-triplestore already installed!", featuresService.isInstalled(featuresService.getFeature("trellis-triplestore"))); featuresService.installFeature("trellis-triplestore"); checkTrellisBundlesAreActive(); assertTrue("trellis-triplestore not installed!", featuresService.isInstalled(featuresService.getFeature("trellis-triplestore"))); }