Package org.drools

Examples of org.drools.KnowledgeBaseConfiguration


    }

    @Test
    public void testStreamModeNoSerialization() throws IOException,
                                               ClassNotFoundException {
        final KnowledgeBaseConfiguration kbconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        kbconf.setOption( EventProcessingOption.STREAM );
        final KnowledgeBase kbase1 = loadKnowledgeBase( "test_CEP_StreamMode.drl",
                                                        kbconf,
                                                        false );

        KnowledgeBase kbase2 = (KnowledgeBase) DroolsStreamUtils.streamIn( DroolsStreamUtils.streamOut( kbase1 ),
View Full Code Here


        StockTickInterface st3 = new StockTick( 2,
                                                "RHT",
                                                15,
                                                20 );

        final KnowledgeBaseConfiguration kbconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        kbconf.setOption( EventProcessingOption.STREAM );
        kbconf.setOption( AssertBehaviorOption.IDENTITY );
        final KnowledgeBase kbase1 = loadKnowledgeBase( "test_CEP_AssertBehaviorOnEntryPoints.drl",
                                                        kbconf,
                                                        true );

        final StatefulKnowledgeSession ksession1 = kbase1.newStatefulKnowledgeSession();
View Full Code Here

        StockTickInterface st3 = new StockTick( 2,
                                                "RHT",
                                                15,
                                                20 );

        final KnowledgeBaseConfiguration kbconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        kbconf.setOption( EventProcessingOption.STREAM );
        kbconf.setOption( AssertBehaviorOption.EQUALITY );
        final KnowledgeBase kbase1 = loadKnowledgeBase( "test_CEP_AssertBehaviorOnEntryPoints.drl",
                                                        kbconf,
                                                        true );

        final StatefulKnowledgeSession ksession1 = kbase1.newStatefulKnowledgeSession();
View Full Code Here

                     "    A( $a : id ) over window:length( 1 )\n" +
                     "then\n" +
                     "    //System.out.println(\"BA: ( \"+$b+\", \"+$a+\" )\");\n" +
                     "end";

        KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        config.setOption( EventProcessingOption.STREAM );
        KnowledgeBase kbase = loadKnowledgeBase( new StringReader( str ),
                                                 config );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        AgendaEventListener ael = mock( AgendaEventListener.class );
View Full Code Here

            "        Event( value != null ) from entry-point X\n" +
            "        StockTick( company != null ) from entry-point X\n" +
            "    then\n" +
            "end";

        KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        config.setOption( EventProcessingOption.CLOUD );
        KnowledgeBase kbase = loadKnowledgeBase( new StringReader( str ),
                                                 config );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        WorkingMemoryEntryPoint ep = ksession.getWorkingMemoryEntryPoint("X");
View Full Code Here

    final DroolsRuleAgentHelper drah = new DroolsRuleAgentHelper(ruleInfo);
    final Properties properties = drah.getProperties();
    final ClassLoader classLoader = drah.getClassLoader();
    final String name = drah.getName();
    final ChangeSet changeSet = drah.getChangeSet();
    final KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties, classLoader);
    final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);
    final KnowledgeAgentConfiguration kagentConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(properties);
    final KnowledgeBuilderConfiguration kbuilderConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(properties, classLoader);
    final KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(name, kbase, kagentConfig, kbuilderConfig);
    kagent.setSystemEventListener(new LogAgentEventListener(name));
View Full Code Here

    // If we don't use this config, then all rules' LHS object conditions will not match on .esb redeploys!
    // (since objects are only equal if their ClassLoaders are also equal - and they're not on redeploys..)
    final Properties properties = new Properties();
    properties.setProperty(ClassLoaderCacheOption.PROPERTY_NAME, Boolean.FALSE.toString());
    final ClassLoader classLoader = new RulesClassLoader(ruleInfo.getRuleSource());
    KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties, classLoader);
   
    // CEP
    StringValue eventProcessingType = RULE_EVENT_PROCESSING_TYPE.getStringValue(ruleInfo.getEventProcessingType());
    if (STREAM.equals(eventProcessingType))
    {
      kbaseConfig.setOption(EventProcessingOption.STREAM);
    }
    else if (CLOUD.equals(eventProcessingType))
    {
      kbaseConfig.setOption(EventProcessingOption.CLOUD);
    }
    Boolean multithreadEvaluation = ruleInfo.getMultithreadEvaluation();
    if (multithreadEvaluation != null) {
      MultithreadEvaluationOption meo = multithreadEvaluation.booleanValue() ? MultithreadEvaluationOption.YES : MultithreadEvaluationOption.NO;
      kbaseConfig.setOption(meo);
      // only pertinent if multithreadEvaluation == true
      Integer maxThreads = ruleInfo.getMaxThreads();
      if (maxThreads != null) {
        kbaseConfig.setOption(MaxThreadsOption.get(maxThreads.intValue()));
      }
    }
   
    KnowledgeBase ruleBase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);
    try
View Full Code Here

  
   @Produces @ApplicationScoped @Security
   public KnowledgeBase createSecurityKnowledgeBase()
   {
      KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
      KnowledgeBaseConfiguration kBaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
     
      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);
     
      org.drools.io.Resource resource = ResourceFactory.newInputStreamResource(securityRules);
      kbuilder.add(resource, ResourceType.DRL);
View Full Code Here

public class DroolsBackendRuntimeFactory implements RuleBackendRuntimeFactory {

    public RuleBackendRuntime createRuleBackendRuntime(Map<String,
            PropertyDescription> descriptions, ClassLoader classLoader) {
        //TODO extractPayload and convert to properties
        KnowledgeBaseConfiguration knowledgeBaseConfiguration
                = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();

        KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(
                knowledgeBaseConfiguration);
        KnowledgeBuilderConfiguration builderConfiguration
View Full Code Here

public class FusionBackEndRuntimeFactory implements CEPBackEndRuntimeFactory {


    public CEPBackEndRuntime createCEPBackEndRuntime(String bucketName, List<Mapping> mappings, int tenantId) {
       
        KnowledgeBaseConfiguration knowledgeBaseConfiguration
                = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        knowledgeBaseConfiguration.setOption(EventProcessingOption.STREAM);

        KnowledgeBase knowledgeBase =
                KnowledgeBaseFactory.newKnowledgeBase(knowledgeBaseConfiguration);
        KnowledgeBuilderConfiguration builderConfiguration
                = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
View Full Code Here

TOP

Related Classes of org.drools.KnowledgeBaseConfiguration

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.