use of alien4cloud.tosca.parser.ParsingContext in project alien4cloud by alien4cloud.
the class ArchiveUploadService method preParsing.
@ToscaContextual
public Map<CSARDependency, CsarDependenciesBean> preParsing(Set<Path> paths, List<ParsingResult<Csar>> parsingResults) {
Map<CSARDependency, CsarDependenciesBean> csarDependenciesBeans = Maps.newHashMap();
for (Path path : paths) {
try {
// FIXME cleanup git import archives
ParsingResult<CsarDependenciesBean> parsingResult = parser.parseImports(path);
parsingResult.getResult().setPath(path);
csarDependenciesBeans.put(parsingResult.getResult().getSelf(), parsingResult.getResult());
} catch (ParsingException e) {
ParsingResult<Csar> failedResult = new ParsingResult<>();
failedResult.setContext(new ParsingContext(path.getFileName().toString()));
failedResult.getContext().setParsingErrors(e.getParsingErrors());
parsingResults.add(failedResult);
log.debug("Not able to parse archive, ignoring it", e);
}
}
return csarDependenciesBeans;
}
Aggregations