Search in sources :

Example 1 with DialectRuntimeData

use of org.drools.core.rule.DialectRuntimeData in project drools by kiegroup.

the class KieBaseUpdaterImpl method run.

@Override
public void run() {
    InternalKnowledgeBuilder kbuilder = ctx.kbuilder;
    CompositeKnowledgeBuilder ckbuilder = kbuilder.batch();
    boolean shouldRebuild = applyResourceChanges(kbuilder, ckbuilder);
    removeResources(kbuilder);
    // remove all ObjectTypeNodes for the modified classes
    if (ctx.modifyingUsedClass) {
        for (Class<?> cls : ctx.modifiedClasses) {
            clearInstancesOfModifiedClass(cls);
        }
        for (InternalKnowledgePackage pkg : ctx.kBase.getPackagesMap().values()) {
            DialectRuntimeData mvel = pkg.getDialectRuntimeRegistry().getDialectData("mvel");
            if (mvel != null) {
                mvel.resetParserConfiguration();
            }
        }
    }
    if (shouldRebuild) {
        // readd unchanged dsl files to the kbuilder
        for (String dslFile : ctx.unchangedResources) {
            if (isFileInKBase(ctx.newKM, ctx.newKieBaseModel, dslFile)) {
                ctx.newKM.addResourceToCompiler(ckbuilder, ctx.newKieBaseModel, dslFile);
            }
        }
        KieBaseUpdate kieBaseUpdate = createKieBaseUpdate();
        ctx.kBase.beforeIncrementalUpdate(kieBaseUpdate);
        rebuildAll(kbuilder, ckbuilder);
        ctx.kBase.afterIncrementalUpdate(kieBaseUpdate);
    }
    ctx.kBase.setResolvedReleaseId(ctx.newReleaseId);
    for (InternalWorkingMemory wm : ctx.kBase.getWorkingMemories()) {
        wm.notifyWaitOnRest();
    }
}
Also used : InternalWorkingMemory(org.drools.core.common.InternalWorkingMemory) DialectRuntimeData(org.drools.core.rule.DialectRuntimeData) CompositeKnowledgeBuilder(org.kie.internal.builder.CompositeKnowledgeBuilder) InternalKnowledgeBuilder(org.drools.compiler.builder.InternalKnowledgeBuilder) KieBaseUpdate(org.drools.core.impl.KieBaseUpdate) InternalKnowledgePackage(org.drools.core.definitions.InternalKnowledgePackage)

Aggregations

InternalKnowledgeBuilder (org.drools.compiler.builder.InternalKnowledgeBuilder)1 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)1 InternalKnowledgePackage (org.drools.core.definitions.InternalKnowledgePackage)1 KieBaseUpdate (org.drools.core.impl.KieBaseUpdate)1 DialectRuntimeData (org.drools.core.rule.DialectRuntimeData)1 CompositeKnowledgeBuilder (org.kie.internal.builder.CompositeKnowledgeBuilder)1