in profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/ProfitBricksComputeServiceAdapter.java [398:438]
public Iterable<Provisionable> listImages() {
// fetch images..
ListenableFuture<List<Image>> images = executorService.submit(new Callable<List<Image>>() {
@Override
public List<Image> call() throws Exception {
logger.trace("<< fetching images..");
// Filter HDD types only, since JClouds doesn't have a concept of "CD-ROM" anyway
Iterable<Image> filteredImages = Iterables.filter(api.imageApi().getList(new DepthOptions().depth(1)), new Predicate<Image>() {
@Override
public boolean apply(Image image) {
return image.properties().imageType() == Image.Type.HDD;
}
});
logger.trace(">> images fetched.");
return ImmutableList.copyOf(filteredImages);
}
});
// and snapshots at the same time
ListenableFuture<List<Snapshot>> snapshots = executorService.submit(new Callable<List<Snapshot>>() {
@Override
public List<Snapshot> call() throws Exception {
logger.trace("<< fetching snapshots");
List<Snapshot> remoteSnapshots = api.snapshotApi().list(new DepthOptions().depth(1));
logger.trace(">> snapshots feched.");
return remoteSnapshots;
}
});
ImmutableList.Builder<Provisionable> provisionables = ImmutableList.builder();
provisionables.addAll(getUnchecked(images));
provisionables.addAll(getUnchecked(snapshots));
return provisionables.build();
}