use of aQute.bnd.osgi.repository.BridgeRepository in project bnd by bndtools.
the class FileSetRepository method readFiles.
private Promise<BridgeRepository> readFiles() {
List<Promise<Resource>> promises = new ArrayList<>(getFiles().size());
for (File file : getFiles()) {
promises.add(parse(Promises.resolved(file)));
}
Promise<List<Resource>> all = Promises.all(promises);
return all.map(new Function<List<Resource>, BridgeRepository>() {
@Override
public BridgeRepository apply(List<Resource> resources) {
try {
ResourcesRepository rr = new ResourcesRepository();
for (Resource r : resources) {
if (r != null) {
logger.debug("{}: adding resource {}", getName(), r);
rr.add(r);
}
}
return new BridgeRepository(rr);
} catch (Exception e) {
throw Exceptions.duck(e);
}
}
});
}
use of aQute.bnd.osgi.repository.BridgeRepository in project bnd by bndtools.
the class BndPomRepository method refresh.
@Override
public boolean refresh() throws Exception {
init();
repoImpl.refresh();
bridge = new BridgeRepository(repoImpl);
return true;
}
use of aQute.bnd.osgi.repository.BridgeRepository in project bnd by bndtools.
the class OSGiIndex method readIndexes.
private Promise<BridgeRepository> readIndexes(boolean refresh) throws Exception {
List<Promise<List<Resource>>> promises = new ArrayList<>(getURIs().size());
for (URI uri : getURIs()) {
promises.add(download(uri, refresh));
}
Promise<List<List<Resource>>> all = Promises.all(promises);
return all.map(new Function<List<List<Resource>>, BridgeRepository>() {
@Override
public BridgeRepository apply(List<List<Resource>> resources) {
try {
ResourcesRepository rr = new ResourcesRepository();
for (List<Resource> p : resources) {
rr.addAll(p);
}
return new BridgeRepository(rr);
} catch (Exception e) {
throw Exceptions.duck(e);
}
}
});
}
use of aQute.bnd.osgi.repository.BridgeRepository in project bnd by bndtools.
the class P2Indexer method refresh.
public void refresh() throws Exception {
Repository repository = readRepository();
save(repository);
this.bridge = new BridgeRepository(repository);
}
use of aQute.bnd.osgi.repository.BridgeRepository in project bnd by bndtools.
the class BndPomRepository method init.
public synchronized void init() {
try {
if (inited)
return;
inited = true;
Workspace workspace = registry.getPlugin(Workspace.class);
HttpClient client = registry.getPlugin(HttpClient.class);
File localRepo = IO.getFile(configuration.local(MAVEN_REPO_LOCAL));
File location = workspace.getFile(getLocation());
List<MavenBackingRepository> release = MavenBackingRepository.create(configuration.releaseUrls(), reporter, localRepo, client);
List<MavenBackingRepository> snapshot = MavenBackingRepository.create(configuration.snapshotUrls(), reporter, localRepo, client);
MavenRepository repository = new MavenRepository(localRepo, name, release, snapshot, Processor.getExecutor(), reporter, null);
boolean transitive = configuration.transitive(true);
if (pomFiles != null) {
repoImpl = new PomRepository(repository, client, location, transitive).uris(pomFiles);
} else if (revisions != null) {
repoImpl = new PomRepository(repository, client, location, transitive).revisions(revisions);
} else if (query != null) {
repoImpl = new SearchRepository(repository, location, query, queryUrl, workspace, client, transitive);
} else {
repository.close();
throw new IllegalStateException("We have neither a pom, revision, or query set!");
}
bridge = new BridgeRepository(repoImpl);
} catch (Exception e) {
throw Exceptions.duck(e);
}
}
Aggregations