use of org.drools.compiler.compiler.ResourceTypeDeclarationWarning in project drools by kiegroup.
the class KnowledgeBuilderImpl method registerBuildResource.
public void registerBuildResource(final Resource resource, ResourceType type) {
InternalResource ires = (InternalResource) resource;
if (ires.getResourceType() == null) {
ires.setResourceType(type);
} else if (ires.getResourceType() != type) {
addBuilderResult(new ResourceTypeDeclarationWarning(resource, ires.getResourceType(), type));
}
if (ResourceType.CHANGE_SET == type) {
try {
ChangeSet changeSet = parseChangeSet(resource);
List<Resource> resources = new ArrayList<>();
resources.add(resource);
resources.addAll(changeSet.getResourcesAdded());
resources.addAll(changeSet.getResourcesModified());
resources.addAll(changeSet.getResourcesRemoved());
buildResources.push(resources);
} catch (Exception e) {
results.add(new DroolsError() {
public String getMessage() {
return "Unable to register changeset resource " + resource;
}
public int[] getLines() {
return new int[0];
}
});
}
} else {
buildResources.push(Collections.singletonList(resource));
}
}
Aggregations