Examples of applyChangeSet()


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

  public DiagramInfo getDiagramInfo(String processId) {
    if (kbase == null) {
      try {
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Guvnor default");
        kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
        kagent.monitorResourceChangeEvents(false);
        kbase = kagent.getKnowledgeBase();
      } catch (Throwable t) {
        if (t instanceof RuntimeException
            && "KnowledgeAgent exception while trying to deserialize".equals(t.getMessage())) {
View Full Code Here

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

        ResourceFactory.getResourceChangeScannerService().start();
        ResourceFactory.getResourceChangeNotifierService().start();
        KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        aconf.setProperty("drools.agent.newInstance", "false");
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Guvnor default", aconf);
        kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
        kbase = kagent.getKnowledgeBase();
        for (Process process: kbase.getProcesses()) {
          System.out.println("Loading process from Guvnor: " + process.getId());
        }
      } catch (Throwable t) {
View Full Code Here

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

    return null;
  }

  public DiagramInfo getDiagramInfo(String processId) {
    KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Guvnor default");
    kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
    kagent.monitorResourceChangeEvents(false);
    KnowledgeBase kbase = kagent.getKnowledgeBase();
    Process process = kbase.getProcess(processId);
    if (process == null) {
      return null;
View Full Code Here

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

    private KnowledgeAgent createKnowledgeAgent(String packageName) {
        initChangeScanner();
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("KAgent for " + packageName, kbase, getConfig());
        kagent.applyChangeSet(ResourceFactory.newReaderResource(new StringReader(getChangeSet(packageName))));
        return kagent;
    }

    private String getChangeSet(String packageName) {
        // packageName=toCustomPackage(packageName, ".");
View Full Code Here

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

  private KnowledgeAgent createKnowledgeAgent(String packageName) {
    initChangeScanner();
    KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
    KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("KAgent for " + packageName, kbase, getConfig());
    kagent.applyChangeSet(ResourceFactory.newReaderResource(new StringReader(getChangeSet(packageName))));
    return kagent;
  }

  private String getChangeSet(String packageName) {
    // packageName=toCustomPackage(packageName, ".");
View Full Code Here

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

            }
        });
        KnowledgeAgent ka = KnowledgeAgentFactory.newKnowledgeAgent("test", conf);
        System.out.println("Applying changeset, round #1");
        Thread.sleep(1000);
        ka.applyChangeSet(res);
        for (KnowledgePackage pkg : ka.getKnowledgeBase().getKnowledgePackages()) {
            System.out.printf("  %s (%d)%n", pkg.getName(), pkg.getRules().size());
        }

        System.out.println("Applying changeset, round #2");
View Full Code Here

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

            System.out.printf("  %s (%d)%n", pkg.getName(), pkg.getRules().size());
        }

        System.out.println("Applying changeset, round #2");
        Thread.sleep(1000);
        ka.applyChangeSet(res);
        for (KnowledgePackage pkg : ka.getKnowledgeBase().getKnowledgePackages()) {
            System.out.printf("  %s (%d)%n", pkg.getName(), pkg.getRules().size());
        }
    }
View Full Code Here

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

                    .getResourceChangeScannerService()
                    .newResourceChangeScannerConfiguration();
            sconf.setProperty("drools.resource.scanner.interval", "5");
            ResourceFactory.getResourceChangeScannerService().configure(sconf);

            kagent.applyChangeSet(res);
            kbase = kagent.getKnowledgeBase();
            Thread.sleep(1000);
            assertEquals(2, kbase.getKnowledgePackages().iterator().next().getRules().size());
            System.out.println("BUGZILLA 733008 total rules: " + kbase.getKnowledgePackages().iterator().next().getRules().size());
            for (Rule r : kbase.getKnowledgePackages().iterator().next().getRules()) {
View Full Code Here

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

        ((InternalResource) res).setResourceType(ResourceType.BPMN2);
        //changeSet.setResourcesAdded(Arrays.asList(res));
        //@TODO: for some reason the Classpath resource when is sent to the grid node is loosing the
        // ResourceType, so I need to fix that.
        KnowledgeAgent kAgent = GridHelper.getInstance().getKnowledgeAgentRemoteClient( grid2, remoteN1.getId(), "ksession-rules" );
        kAgent.applyChangeSet(res);


        try {
            ksession.startProcess("Definition");
            System.out.println("Executed! :)");
View Full Code Here

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

        ( (InternalResource) changeSetRes ).setResourceType( ResourceType.CHANGE_SET );
       
       
       
        KnowledgeAgent kAgent = GridHelper.getInstance().getKnowledgeAgentRemoteClient( grid2, remoteN1.getId(), "ksession-rules" );
        kAgent.applyChangeSet( changeSetRes );

        Thread.sleep(5000);

        MyObject obj2 = new MyObject("obj2");
        ksession.insert(obj2);
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.