use of org.kie.pmml.compiler.executor.PMMLCompiler in project drools by kiegroup.
the class PMMLCompilerService method getKiePMMLModelsFromResourceWithSources.
/**
* @param kbuilderImpl
* @param resource
* @return
*/
public static List<KiePMMLModel> getKiePMMLModelsFromResourceWithSources(KnowledgeBuilderImpl kbuilderImpl, Resource resource) {
PMMLCompiler pmmlCompiler = kbuilderImpl.getCachedOrCreate(PMML_COMPILER_CACHE_KEY, PMMLCompilerService::getCompiler);
String[] classNamePackageName = getFactoryClassNamePackageName(resource);
String factoryClassName = classNamePackageName[0];
String packageName = classNamePackageName[1];
try {
final List<KiePMMLModel> toReturn = pmmlCompiler.getKiePMMLModelsWithSources(factoryClassName, packageName, resource.getInputStream(), getFileName(resource.getSourcePath()), new HasKnowledgeBuilderImpl(kbuilderImpl));
populateWithPMMLRuleMappers(toReturn, resource);
return toReturn;
} catch (IOException e) {
throw new ExternalException("ExternalException", e);
}
}
Aggregations