We are migrating Drools from 5.5.0 to 6.2.0. I am not able to figure compatible usage of org.drools.compiler.lang.descr.PackageDescr
which is implementing org.kie.internal.definition.KnowledgeDescr
. We get an instance of PackageDescr
from DrlParser.parse
and then creating a org.drools.io.Resource
using org.drools.io.ResourceFactory.newDescrResource(KnowledgeDescr)
and argument here is of type org.drools.definition.KnowledgeDescr
which is not the same KnowledgeDescr
that PackageDescr
implemented above. We are not switching to KIE API as of now but using Knowledge Legacy Adapter only. What is the replacement for this issue to be fixed?
Usage example:
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderConfiguration;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.compiler.lang.descr.PackageDescr;
KnowledgeBuilderConfiguration builderConf = ...
PackageDescr pkg = ...
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(builderConf);
// Compilation error in this line
kbuilder.add(ResourceFactory.newDescrResource(pkg), ResourceType.DESCR);