static List<ResourceInfo> list(DirectIoPath path) {
LOG.debug("listing: {} ({})", path, path.getBarePath());
try {
if (path.isComponentRoot()) {
return Collections.singletonList(new ResourceInfo(
path.getSource().getId(),
path.getSource().getEntity().path(path.getComponentPath().getPathString()),
true));
} else if (path.getResourcePattern().isPresent()) {
return path.getSource().getEntity().list(
path.getComponentPath().getPathString(),
path.getResourcePattern().get(),
new Counter());
} else {
return path.getSource().getEntity().list(
BasePath.EMPTY.getPathString(),
path.getComponentPath().asFilePattern(),
new Counter());
}
} catch (IOException | InterruptedException e) {
throw new CommandExecutionException(MessageFormat.format(
"error occurred while resolving path: {0} ({1})",
path,
path.getBarePath()), e);
}
}
}