use of org.apache.karaf.features.Repository in project karaf by apache.
the class FeaturesPlugin method getFeatures.
private List<ExtendedFeature> getFeatures(List<Repository> repositories) {
List<ExtendedFeature> features = new ArrayList<>();
if (featuresService == null) {
this.log.error("Features service is not available");
return features;
}
try {
for (Repository r : repositories) {
for (Feature f : r.getFeatures()) {
ExtendedFeature.State state = featuresService.isInstalled(f) ? ExtendedFeature.State.INSTALLED : ExtendedFeature.State.UNINSTALLED;
features.add(new ExtendedFeature(state, r.getName(), f));
}
}
} catch (Exception e) {
this.log.error(e.getMessage());
}
Collections.sort(features, new ExtendedFeatureComparator());
return features;
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class FeaturesServiceImpl method createFeatureCacheInternal.
private Map<String, Map<String, Feature>> createFeatureCacheInternal() throws Exception {
Map<String, Map<String, Feature>> map = new HashMap<>();
Repository[] repos = repositories.listRepositories();
for (Repository repo : repos) {
for (Feature f : repo.getFeatures()) {
if (map.get(f.getName()) == null) {
Map<String, Feature> versionMap = new HashMap<>();
versionMap.put(f.getVersion(), f);
map.put(f.getName(), versionMap);
} else {
map.get(f.getName()).put(f.getVersion(), f);
}
}
}
return map;
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class RepositoryCache method removeRepository.
public synchronized void removeRepository(URI repositoryUri) throws Exception {
List<String> toRemove = new ArrayList<>();
toRemove.add(repositoryUri.toString());
while (!toRemove.isEmpty()) {
Repository rep = repositoryCache.remove(toRemove.remove(0));
if (rep != null) {
for (URI u : rep.getRepositories()) {
toRemove.add(u.toString());
}
}
}
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class ListFeatureVersionsCommand method doExecute.
protected void doExecute(FeaturesService admin) throws Exception {
ShellTable table = new ShellTable();
table.column("Version");
table.column("Repository");
table.column("Repository URL");
table.emptyTableText("No versions available for features '" + feature + "'");
for (Repository r : Arrays.asList(admin.listRepositories())) {
for (Feature f : r.getFeatures()) {
if (f.getName().equals(feature)) {
table.addRow().addContent(f.getVersion(), r.getName(), r.getURI());
}
}
}
table.print(System.out, !noFormat);
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class RepoListCommand method reloadAllRepos.
private void reloadAllRepos(FeaturesService featuresService) throws Exception {
System.out.println("Reloading all repositories from their urls");
System.out.println();
List<Exception> exceptions = new ArrayList<>();
for (Repository repo : featuresService.listRepositories()) {
try {
featuresService.addRepository(repo.getURI());
} catch (Exception e) {
exceptions.add(e);
}
}
MultiException.throwIf("Unable to reload repositories", exceptions);
}
Aggregations