private boolean removeRepository(String url) { boolean success = false; if (featuresService == null) { this.log.error("Features service is not available"); } try { featuresService.removeRepository(new URI(url)); success = true; } catch (Exception e) { this.log.error("Can't remove features repository {}", url, e); } return success; }
/** * Add an URI to the list of features repositories. * * @param uri the URI to add. * @throws Exception in case of add failure. */ private void addToFeaturesRepositories(URI uri) throws Exception { try { featuresService.removeRepository(uri); featuresService.addRepository(uri, false); LOGGER.info("Added feature repository '{}'", uri); } catch (Exception e) { LOGGER.warn("Unable to add repository '{}'", uri, e); } }
protected void doExecute(FeaturesService featuresService) throws Exception { URI uri; { Set<URI> uris = selectRepositories(nameOrUrl, version); if (uris.isEmpty()) { System.err.println("No matching repository for " + nameOrUrl + (version != null ? " / " + version : "")); return; } if (uris.size() > 1) { System.err.println("Multiple matching repositories for " + nameOrUrl + (version != null ? " / " + version : "")); return; } uri = uris.iterator().next(); } System.out.println("Removing features repository: " + uri); featuresService.removeRepository(uri, uninstall); } }
protected void doExecute(FeaturesService featuresService) throws Exception { URI uri; { Set<URI> uris = selectRepositories(nameOrUrl, version); if (uris.isEmpty()) { System.err.println("No matching repository for " + nameOrUrl + (version != null ? " / " + version : "")); return; } if (uris.size() > 1) { System.err.println("Multiple matching repositories for " + nameOrUrl + (version != null ? " / " + version : "")); return; } uri = uris.iterator().next(); } System.out.println("Removing features repository: " + uri); featuresService.removeRepository(uri, uninstall); } }
private void setLegacyExtensions(FeaturesService service, Map<String, Object> config) { if (legacy_addons_url != null) { if (config.get(CFG_LEGACY) != null && "true".equals(config.get(CFG_LEGACY).toString())) { try { service.addRepository(legacy_addons_url); } catch (Exception e) { logger.debug("Failed adding feature repo for legacy features - we might be offline: {}", e.getMessage()); } } else { try { service.removeRepository(legacy_addons_url); } catch (Exception e) { // This usually throws an error like // "Feature named 'openhab-binding-homematic1/1.9.0.SNAPSHOT' is not installed" // as Karaf seems to try to uninstall all features for whatever reason // the repo is removed nonetheless in such a case logger.debug("Failed removing feature repo of legacy features: {}", e.getMessage()); } } } }
@Override public void uninstall(String karName) throws Exception { File karDir = new File(storage, karName); if (!karDir.exists()) { throw new IllegalArgumentException("The KAR " + karName + " is not installed"); } List<URI> featuresRepositories = readFromFile(new File(karDir, FEATURE_CONFIG_FILE)); uninstallFeatures(featuresRepositories); for (URI featuresRepository : featuresRepositories) { featuresService.removeRepository(featuresRepository); } deleteRecursively(karDir); }
private synchronized boolean uninstallAppArtifacts(Application app) throws Exception { if (app.featuresRepo().isPresent() && featuresService.getRepository(app.featuresRepo().get()) != null) { featuresService.removeRepository(app.featuresRepo().get()); return true; } return false; }
public void removeRepository(String uri, boolean uninstall) throws Exception { List<URI> uris = new ArrayList<>(); Pattern pattern = Pattern.compile(uri); for (Repository repository : featuresService.listRepositories()) { if (repository.getName() != null && !repository.getName().isEmpty()) { // first regex on the repository name Matcher nameMatcher = pattern.matcher(repository.getName()); if (nameMatcher.matches()) { uris.add(repository.getURI()); } else { // fallback to repository URI regex Matcher uriMatcher = pattern.matcher(repository.getURI().toString()); if (uriMatcher.matches()) { uris.add(repository.getURI()); } } } else { // repository name is not defined, fallback to repository URI regex Matcher uriMatcher = pattern.matcher(repository.getURI().toString()); if (uriMatcher.matches()) { uris.add(repository.getURI()); } } } for (URI u : uris) { featuresService.removeRepository(u, uninstall); } }
featuresService.removeRepository(uri);
featuresService.removeRepository(uri);
if (isRepositoryRegisteredLocally(uri)) { LOGGER.debug("CELLAR FEATURE: removing repository URI {}", uri); featuresService.removeRepository(new URI(uri), event.getUninstall()); } else { LOGGER.debug("CELLAR FEATURE: repository URI {} is not registered locally");
if (isRepositoryRegisteredLocally(uri)) { LOGGER.debug("CELLAR FEATURE: removing repository URI {}", uri); featuresService.removeRepository(new URI(uri), event.getUninstall()); } else { LOGGER.debug("CELLAR FEATURE: repository URI {} is not registered locally");
for (String repo : addedRepositoryNames) { if (after.get(repo) != null) { featuresService.removeRepository(after.get(repo).getURI(), false);