use of org.guvnor.common.services.project.builder.service.BuildValidationHelper in project kie-wb-common by kiegroup.
the class Builder method addResource.
private IncrementalBuildResults addResource(final Path resource, final InputStream inputStream) {
checkNotNull("resource", resource);
// Only files can be processed
if (!Files.isRegularFile(resource)) {
return new IncrementalBuildResults(projectGAV);
}
checkAFullBuildHasBeenPerformed();
// Resource Type might require "external" validation (i.e. it's not covered by Kie)
final IncrementalBuildResults results = new IncrementalBuildResults(projectGAV);
final BuildValidationHelper validator = getBuildValidationHelper(resource);
if (validator != null) {
final List<ValidationMessage> addedValidationMessages = validator.validate(Paths.convert(resource));
results.addAllAddedMessages(convertValidationMessages(addedValidationMessages));
results.addAllRemovedMessages(convertValidationMessages(nonKieResourceValidationHelperMessages.remove(resource)));
nonKieResourceValidationHelpers.put(resource, validator);
nonKieResourceValidationHelperMessages.put(resource, addedValidationMessages);
}
synchronized (kieFileSystem) {
addNewResource(resource, inputStream);
buildIncrementally(results, destinationPath(resource));
}
return results;
}
Aggregations