Package org.drools

Examples of org.drools.StatefulSession.addEventListener()


        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage( builder.getPackage() );

        final StatefulSession session = ruleBase.newStatefulSession();

        session.addEventListener( new DefaultAgendaEventListener() {
            public void afterActivationFired(final AfterActivationFiredEvent arg0) {
                super.afterActivationFired( arg0,
                                            session );
            }
        } );
View Full Code Here


        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage( builder.getPackage() );

        final StatefulSession session = ruleBase.newStatefulSession();

        session.addEventListener( new DefaultAgendaEventListener() {
            public void afterActivationFired(final AfterActivationFiredEvent arg0) {
                super.afterActivationFired( arg0,
                                            session );
            }
        } );
View Full Code Here

        monitor.subTask("Inserting initial model");
       
        final Map<EObject,FactHandle> factMemory = new HashMap<EObject,FactHandle>();
       
        // automatically insert new objects based on a given object
        workingMemory.addEventListener( new WorkingMemoryEventListener() {

          /**
           * When we insert a new element, we automatically insert
           * all of its children elements.
           *
 
View Full Code Here

        /*
         * This simply adds the Rule source for inserted elements
         * (where possible).
         */
        if (logRuleSource) {
          workingMemory.addEventListener(new DefaultWorkingMemoryEventListener() {
 
        @Override
        public void objectInserted(ObjectInsertedEvent event) {
          if (event.getObject() instanceof GeneratedElement) {
            GeneratedElement e = (GeneratedElement) event.getObject();
View Full Code Here

    StatefulSession session  = getWorkingMemory("test_rules.drl");

        TestingEventListener ls = new TestingEventListener();
        //TestingEventListener.stubOutRules(set, session.getRuleBase(), true);

        session.addEventListener(ls);

        session.insert(new Cheese());
        session.fireAllRules(ls.getAgendaFilter(set, true));

        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
View Full Code Here

    StatefulSession session  = getWorkingMemory("test_rules.drl");

        TestingEventListener ls = new TestingEventListener();
        //TestingEventListener.stubOutRules(set, session.getRuleBase(), false);

        session.addEventListener(ls);

        session.insert(new Cheese());
        session.fireAllRules(ls.getAgendaFilter(set, false));

        //assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
View Full Code Here

    StatefulSession session  = getWorkingMemory("test_rules.drl");

        TestingEventListener ls = new TestingEventListener();
        //TestingEventListener.stubOutRules(set, session.getRuleBase(), false);

        session.addEventListener(ls);

        session.insert(new Cheese());

        List<String> list = new ArrayList<String>();
        session.setGlobal("list", list);
View Full Code Here

        StatefulSession session  = getWorkingMemory("test_rules.drl");

        TestingEventListener ls = new TestingEventListener();
        //TestingEventListener.stubOutRules(set, session.getRuleBase(), true);

        session.addEventListener(ls);

        session.insert(new Cheese());
        session.fireAllRules(ls.getAgendaFilter(set, true));

        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
View Full Code Here

        StatefulSession session  = getWorkingMemory("test_rules.drl");

        TestingEventListener ls = new TestingEventListener();
        //TestingEventListener.stubOutRules(set, session.getRuleBase(), false);

        session.addEventListener(ls);

        session.insert(new Cheese());
        session.fireAllRules(ls.getAgendaFilter(set, false));

        //assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
View Full Code Here

        StatefulSession session  = getWorkingMemory("test_rules.drl");

        TestingEventListener ls = new TestingEventListener();
        //TestingEventListener.stubOutRules(set, session.getRuleBase(), false);

        session.addEventListener(ls);

        session.insert(new Cheese());

        List<String> list = new ArrayList<String>();
        session.setGlobal("list", list);
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.