Search in sources :

Example 6 with BuildValidationHelper

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;
}
Also used : BuildValidationHelper(org.guvnor.common.services.project.builder.service.BuildValidationHelper) IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage)

Aggregations

BuildValidationHelper (org.guvnor.common.services.project.builder.service.BuildValidationHelper)6 IncrementalBuildResults (org.guvnor.common.services.project.builder.model.IncrementalBuildResults)3 ValidationMessage (org.guvnor.common.services.shared.validation.model.ValidationMessage)3 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Predicate (java.util.function.Predicate)1 PomModel (org.appformer.maven.support.PomModel)1 KieBuilderImpl (org.drools.compiler.kie.builder.impl.KieBuilderImpl)1 PipelineRegistry (org.guvnor.ala.registry.PipelineRegistry)1 InMemoryPipelineRegistry (org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry)1 FileDiscoveryService (org.guvnor.common.services.backend.file.FileDiscoveryService)1 FileDiscoveryServiceImpl (org.guvnor.common.services.backend.file.FileDiscoveryServiceImpl)1 MetadataServerSideService (org.guvnor.common.services.backend.metadata.MetadataServerSideService)1 MetadataServiceImpl (org.guvnor.common.services.backend.metadata.MetadataServiceImpl)1 CommentedOptionFactory (org.guvnor.common.services.backend.util.CommentedOptionFactory)1 CommentedOptionFactoryImpl (org.guvnor.common.services.backend.util.CommentedOptionFactoryImpl)1 ModuleRepositoriesContentHandler (org.guvnor.common.services.project.backend.server.ModuleRepositoriesContentHandler)1 ModuleRepositoryResolverImpl (org.guvnor.common.services.project.backend.server.ModuleRepositoryResolverImpl)1