Package org.drools.persistence

Examples of org.drools.persistence.SingleSessionCommandService


    new KnowledgeLogger(service.getKieSession());
    return service;
  }

  private SingleSessionCommandService createSingleSessionCommandService(KieBase ruleBase, SessionConfiguration conf, Environment env) {
    SingleSessionCommandService service = new SingleSessionCommandService(ruleBase, conf, env);
    service.addInterceptor(new ManualPersistInterceptor(service));
    service.addInterceptor(new ManualPersistProcessInterceptor(service));
    new KnowledgeLogger(service.getKieSession());
    return service;
  }
View Full Code Here


    new KnowledgeLogger(service.getKieSession());
    return service;
  }

  private SingleSessionCommandService createSingleSessionCommandService(int sessionId, KieBase ruleBase, SessionConfiguration conf, Environment env) {
    SingleSessionCommandService service = new SingleSessionCommandService(sessionId, ruleBase, conf, env);
    service.addInterceptor(new ManualPersistInterceptor(service));
    service.addInterceptor(new ManualPersistProcessInterceptor(service));
    new KnowledgeLogger(service.getKieSession());
    return service;
  }
View Full Code Here

           
        // Initialize drools environment stuff
        Environment env = createEnvironment(context);
        KnowledgeBase kbase = initializeKnowledgeBase(simpleRule);
        StatefulKnowledgeSession commandKSession = InfinispanKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
        SingleSessionCommandService commandService = (SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) commandKSession).getCommandService();
        InfinispanPersistenceContextManager jpm = (InfinispanPersistenceContextManager) getValueOfField("jpm", commandService);

        jpm.getApplicationScopedPersistenceContext();
        @SuppressWarnings("unchecked")
        Cache<String, EntityHolder> cache = (Cache<String, EntityHolder>) getValueOfField("appScopedCache", jpm);
View Full Code Here

    }

    private void validatePessimisticLockingUse(KieSession ksession) throws Exception {
        // do an ugly hack to get the info
       CommandBasedStatefulKnowledgeSession cmdBasedKsession = (CommandBasedStatefulKnowledgeSession) ksession;
       SingleSessionCommandService sscs = (SingleSessionCommandService) cmdBasedKsession.getCommandService();
       // yes, this will break some day, and when it does, just delete this entire test, which isn't that good anyways.. :/
       Field envField = SingleSessionCommandService.class.getDeclaredField("env");
       envField.setAccessible(true);
       Environment env = (Environment) envField.get(sscs);
      
View Full Code Here

        return configuration;
    }

    public long getStatefulKnowledgeSessionId(StatefulKnowledgeSession ksession) {
        if ( ksession instanceof CommandBasedStatefulKnowledgeSession ) {
            SingleSessionCommandService commandService = (SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) ksession).getCommandService();
            return commandService.getSessionId();
        }
        throw new IllegalArgumentException( "StatefulKnowledgeSession must be an a CommandBasedStatefulKnowledgeSession" );
    }
View Full Code Here

        }

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
        SingleSessionCommandService sscs = (SingleSessionCommandService)
            ((CommandBasedStatefulKnowledgeSession) ksession).getCommandService();
        sscs.addInterceptor(new LoggingInterceptor());
        sscs.addInterceptor(new FireAllRulesInterceptor());
        sscs.addInterceptor(new LoggingInterceptor());
        List<?> list = new ArrayList<Object>();
        ksession.setGlobal( "list", list );
        ksession.insert( 1 );
        ksession.insert( 2 );
        ksession.insert( 3 );
View Full Code Here

           
        // Initialize drools environment stuff
        Environment env = initializeEnvironment(emf);
        KnowledgeBase kbase = initializeKnowledgeBase(simpleRule);
        StatefulKnowledgeSession commandKSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
        SingleSessionCommandService commandService = (SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) commandKSession).getCommandService();
        JpaPersistenceContextManager jpm = (JpaPersistenceContextManager) getValueOfField("jpm", commandService);

        jpm.getApplicationScopedPersistenceContext();
        EntityManager em = (EntityManager) getValueOfField("appScopedEntityManager", jpm);
       
View Full Code Here

        return configuration;
    }

    public long getStatefulKnowledgeSessionId(StatefulKnowledgeSession ksession) {
        if ( ksession instanceof CommandBasedStatefulKnowledgeSession ) {
            SingleSessionCommandService commandService = (SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) ksession).getCommandService();
            return commandService.getSessionId();
        }
        throw new IllegalArgumentException( "StatefulKnowledgeSession must be an a CommandBasedStatefulKnowledgeSession" );
    }
View Full Code Here

        ks.newKieBuilder( kfs ).build();

        KieBase kbase = ks.getKieContainer(ks.getKieRepository().getDefaultGAV()).getKieBase();

        KieSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
        SingleSessionCommandService sscs = (SingleSessionCommandService)
            ((CommandBasedStatefulKnowledgeSession) ksession).getCommandService();
        sscs.addInterceptor(new LoggingInterceptor());
        sscs.addInterceptor(new FireAllRulesInterceptor());
        sscs.addInterceptor(new LoggingInterceptor());
        List<?> list = new ArrayList<Object>();
        ksession.setGlobal( "list", list );
        ksession.insert( 1 );
        ksession.insert( 2 );
        ksession.insert( 3 );
View Full Code Here

        }

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
        SingleSessionCommandService sscs = (SingleSessionCommandService)
            ((CommandBasedStatefulKnowledgeSession) ksession).getCommandService();
        sscs.addInterceptor(new LoggingInterceptor());
        sscs.addInterceptor(new FireAllRulesInterceptor());
        sscs.addInterceptor(new LoggingInterceptor());
        List<?> list = new ArrayList<Object>();
        ksession.setGlobal( "list", list );
        ksession.insert( 1 );
        ksession.insert( 2 );
        ksession.insert( 3 );
View Full Code Here

TOP

Related Classes of org.drools.persistence.SingleSessionCommandService

Copyright © 2018 www.massapicom. 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.