Search in sources :

Example 1 with HasKnowledgeBuilderImpl

use of org.kie.pmml.evaluator.assembler.implementations.HasKnowledgeBuilderImpl 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);
    }
}
Also used : KiePMMLModel(org.kie.pmml.commons.model.KiePMMLModel) HasKnowledgeBuilderImpl(org.kie.pmml.evaluator.assembler.implementations.HasKnowledgeBuilderImpl) PMMLCompiler(org.kie.pmml.compiler.executor.PMMLCompiler) IOException(java.io.IOException) ExternalException(org.kie.pmml.api.exceptions.ExternalException)

Aggregations

IOException (java.io.IOException)1 ExternalException (org.kie.pmml.api.exceptions.ExternalException)1 KiePMMLModel (org.kie.pmml.commons.model.KiePMMLModel)1 PMMLCompiler (org.kie.pmml.compiler.executor.PMMLCompiler)1 HasKnowledgeBuilderImpl (org.kie.pmml.evaluator.assembler.implementations.HasKnowledgeBuilderImpl)1