use of org.commonjava.indy.promote.validate.PromotionValidationException in project indy by Commonjava.
the class ValidationRequest method getSourcePaths.
public synchronized Set<String> getSourcePaths(boolean includeMetadata, boolean includeChecksums) throws PromotionValidationException {
if (requestPaths == null) {
Set<String> paths = null;
if (promoteRequest instanceof PathsPromoteRequest) {
paths = ((PathsPromoteRequest) promoteRequest).getPaths();
}
if (paths == null) {
ArtifactStore store = null;
try {
store = tools.getArtifactStore(promoteRequest.getSource());
} catch (IndyDataException e) {
throw new PromotionValidationException("Failed to retrieve source ArtifactStore: {}. Reason: {}", e, promoteRequest.getSource(), e.getMessage());
}
if (store != null) {
try {
paths = new HashSet<>();
listRecursively(store, "/", paths);
} catch (IndyWorkflowException e) {
throw new PromotionValidationException("Failed to list paths in source: {}. Reason: {}", e, promoteRequest.getSource(), e.getMessage());
}
}
}
requestPaths = paths;
}
if (!includeMetadata || !includeChecksums) {
Predicate<String> filter = (path) -> (includeMetadata || !path.matches(".+/maven-metadata\\.xml(\\.(md5|sha[0-9]+))?")) && (includeChecksums || !path.matches(".+\\.(md5|sha[0-9]+)"));
return requestPaths.stream().filter(filter).collect(Collectors.toSet());
}
return requestPaths;
}
Aggregations