use of org.apache.karaf.features.Repository in project karaf by apache.
the class FeaturesValidationTest method testNs11.
@Test
public void testNs11() throws Exception {
Repository features = unmarshalAndValidate("f04.xml");
;
assertNotNull(features);
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class FeaturesValidationTest method testNs13.
@Test
public void testNs13() throws Exception {
Repository features = unmarshalAndValidate("f07.xml");
assertNotNull(features);
Feature f0 = features.getFeatures()[0];
Feature f1 = features.getFeatures()[1];
assertEquals("2.5.6.SEC02", f0.getVersion());
assertTrue(f1.isHidden());
assertNotNull(f1.getLibraries());
assertEquals(1, f0.getLibraries().size());
Library lib = f0.getLibraries().get(0);
assertEquals("my-library", lib.getLocation());
assertEquals(Library.TYPE_ENDORSED, lib.getType());
assertFalse(lib.isExport());
assertTrue(lib.isDelegate());
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class RepositoryCacheImpl method removeRepository.
@Override
public void removeRepository(URI repositoryUri) {
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 RepositoryCacheImpl method getRepositoryClosure.
/**
* Returns a set containing the given repository and all its dependencies recursively
*/
@Override
public Set<Repository> getRepositoryClosure(Repository repo) {
Set<Repository> closure = new HashSet<>();
Deque<Repository> remaining = new ArrayDeque<>(Collections.singleton(repo));
while (!remaining.isEmpty()) {
Repository rep = remaining.removeFirst();
if (closure.add(rep)) {
for (URI uri : rep.getRepositories()) {
remaining.add(getRepository(uri.toString()));
}
}
}
return closure;
}
use of org.apache.karaf.features.Repository in project karaf by apache.
the class FeaturesCommandSupport method selectRepositories.
protected Set<URI> selectRepositories(String nameOrUrl, String version) throws Exception {
Set<URI> uris = new LinkedHashSet<>();
String effectiveVersion = (version == null) ? "LATEST" : version;
URI uri = featuresService.getRepositoryUriFor(nameOrUrl, effectiveVersion);
if (uri == null) {
// add regex support on installed repositories
Pattern pattern = Pattern.compile(nameOrUrl);
for (Repository repository : featuresService.listRepositories()) {
URI u = repository.getURI();
String rname = repository.getName();
if (pattern.matcher(u.toString()).matches() || rname != null && pattern.matcher(rname).matches()) {
uris.add(u);
}
}
} else {
uris.add(uri);
}
return uris;
}
Aggregations