Package org.drools.grid

Examples of org.drools.grid.ExecutionNode


        throw new UnsupportedOperationException("Not supported yet.");
    }

    public ExecutionNode getExecutionNode(NodeSelectionStrategy strategy) {

        ExecutionNode node = new ExecutionNode();
        node.set(KnowledgeBuilderFactoryService.class, new KnowledgeBuilderProviderLocalClient() );
        node.set(KnowledgeBaseFactoryService.class, new KnowledgeBaseProviderLocalClient() );
        node.set(DirectoryLookupFactoryService.class, new DirectoryLookupProviderLocalClient());
       
        return node;
    }
View Full Code Here


  }

  public void test2() {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/drools/container/spring/beans.xml" );

    ExecutionNode node = (ExecutionNode) context.getBean("node1");
    List<String> list = new ArrayList<String>();
    StatelessKnowledgeSession kstateless = (StatelessKnowledgeSession) node.get(DirectoryLookupFactoryService.class).lookup("stateless1");
    assertNotNull("can't obtain session named: stateless1" , kstateless);
    kstateless.setGlobal("list", list);
    kstateless.execute(new Person("Darth", "Cheddar", 50));
    assertEquals(2, list.size());

    list = new ArrayList<String>();
    StatefulKnowledgeSession kstateful = (StatefulKnowledgeSession) node.get(DirectoryLookupFactoryService.class).lookup("ksession2");
    kstateful.setGlobal("list", list);
    kstateful.insert(new Person("Darth", "Cheddar", 50));
    kstateful.fireAllRules();  
    assertEquals(2, list.size());
  }
View Full Code Here

            XStream xstream = this.strategy.lookup(name);
            if (xstream == null) {
                throw new IllegalArgumentException("Unable to lookup XStream parser using name '" + name + "'");
            }
            ExecutionNodePipelineContextImpl executionNodeContext = (ExecutionNodePipelineContextImpl) context;
            ExecutionNode node = executionNodeContext.getExecutionNode();
            CommandExecutor executor = node.get(DirectoryLookupFactoryService.class).lookup(name);
            if (executor == null) {
                throw new IllegalArgumentException("Unable to lookup CommandExecutor using name '" + name + "'");
            }
            executionNodeContext.setCommandExecutor(executor);
            ClassLoader cl = null;
View Full Code Here

        inXml += "  </insert>";
        inXml += "  <fire-all-rules />";
        inXml += "</batch-execution>";

        LocalConnection connection = new LocalConnection();
        ExecutionNode node = connection.getExecutionNode(null);

        StatefulKnowledgeSession ksession = getExecutionNodeSessionStateful(node, ResourceFactory.newByteArrayResource( str.getBytes() ) );

        node.get(DirectoryLookupFactoryService.class).register("ksession1", ksession);

        XStreamResolverStrategy xstreamStrategy = new XStreamResolverStrategy() {
            public XStream lookup(String name) {
                return BatchExecutionHelper.newXStreamMarshaller();
            }
View Full Code Here

TOP

Related Classes of org.drools.grid.ExecutionNode

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.