Package org.drools.agent

Examples of org.drools.agent.KnowledgeAgent.applyChangeSet()


    }

    @Test
    public void testCSVByKnowledgeAgent() {
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("csv agent");
        kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeSetTestCSV.xml", getClass()));
        KnowledgeBase kbase = kagent.getKnowledgeBase();
       
        assertEquals(1, kbase.getKnowledgePackages().size());
        assertEquals(3, kbase.getKnowledgePackages().iterator().next().getRules().size());
    }
View Full Code Here


     */
    private static KnowledgeBase readKnowledgeBase() {
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("MortgageAgent");
        Resource changeset = ResourceFactory.newClassPathResource(
                "org/drools/guvnor/examples/mortgage/mortgage-changeset.xml");
        kagent.applyChangeSet(changeset);
        KnowledgeBase kbase = kagent.getKnowledgeBase();
        kagent.dispose();
        return kbase;
    }

View Full Code Here

    public Void execute(Context context) {

        KnowledgeAgent agent = (KnowledgeAgent) context.getContextManager().getContext("__TEMP__").get( kbaseKagentId+"_kAgent" );
        if( this.res != null ) {
            System.out.println("Applying Resource: "+this.res);
            agent.applyChangeSet( this.res );
        }
        if( this.cs != null ) {
            System.out.println( "Applying Change-set: "+this.cs);
            agent.applyChangeSet( this.cs );
        }
View Full Code Here

            System.out.println("Applying Resource: "+this.res);
            agent.applyChangeSet( this.res );
        }
        if( this.cs != null ) {
            System.out.println( "Applying Change-set: "+this.cs);
            agent.applyChangeSet( this.cs );
        }
        return null;
    }

}
View Full Code Here

    KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();

    KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
    aconf.setProperty("drools.agent.newInstance", "false");
    KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("RuleAgent", kbase, aconf);    
    kagent.applyChangeSet(ResourceFactory.newClassPathResource(RULES_CHANGESET, getClass()));
    kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
    ksession = kbase.newStatefulKnowledgeSession();
       
    // activate notifications
    ResourceFactory.getResourceChangeNotifierService().start();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.