use of org.phoenicis.containers.dto.ContainerCategoryDTO in project POL-POM-5 by PlayOnLinux.
the class GenericContainersManager method fetchContainers.
/**
* {@inheritDoc}
*/
@Override
public void fetchContainers(Consumer<List<ContainerCategoryDTO>> onSuccess, Consumer<Exception> onError) {
final File containersFile = new File(containersPath);
containersFile.mkdirs();
final File[] engineDirectories = containersFile.listFiles();
if (engineDirectories == null) {
onSuccess.accept(Collections.emptyList());
} else {
final List<ContainerCategoryDTO> containerCategories = new ArrayList<>();
for (File engineDirectory : engineDirectories) {
final List<ContainerDTO> containers = fetchContainers(engineDirectory);
if (!CollectionUtils.isEmpty(containers)) {
containerCategories.add(new ContainerCategoryDTO.Builder().withName(engineDirectory.getName()).withContainers(containers).build());
}
}
onSuccess.accept(containerCategories);
}
}
Aggregations