Examples of KnowledgeAgentConfiguration


Examples of org.drools.agent.KnowledgeAgentConfiguration

        ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
        sconf.setProperty( "drools.resource.scanner.interval", "10" );
        ResourceFactory.getResourceChangeScannerService().configure( sconf );
        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());
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

//    }
//    changeScannerInitialised = true;
    }

    public KnowledgeAgentConfiguration getConfig() {
        KnowledgeAgentConfiguration c = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        c.setProperty("drools.agent.scanDirectories", "true");
        c.setProperty("drools.agent.scanResources", "true");
        c.setProperty("drools.agent.newInstance", "true");
        return c;
    }
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

//    }
//    changeScannerInitialised = true;
  }

  public KnowledgeAgentConfiguration getConfig() {
    KnowledgeAgentConfiguration c = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
    c.setProperty("drools.agent.scanDirectories", "true");
    c.setProperty("drools.agent.scanResources", "true");
    c.setProperty("drools.agent.newInstance", "true");
    return c;
  }
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

    @Test
    @RunAsClient
    public void applyChangeSetTwice(@ArquillianResource URL baseURL) throws Exception {
        URL url = new URL(baseURL, "org.drools.guvnor.Guvnor/package/applyChangeSetTwice/LATEST/ChangeSet.xml");
        Resource res = ResourceFactory.newUrlResource(url);
        KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication("admin", "admin".toCharArray());
            }
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

        // system event listener
        SystemEventListenerFactory.setSystemEventListener(new PrintStreamSystemEventListener(System.out));

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        // needs to be newInstance=true, bugzilla 733008 works fine with newInstance=false
        conf.setProperty("drools.agent.newInstance", "true");
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
                "agent", kbase, conf);

        try {
            ResourceFactory.getResourceChangeNotifierService().start();
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

    @RunAsClient
    public void downloadPackageWithHttpClientImpl(@ArquillianResource URL baseURL)
            throws IOException, ClassNotFoundException {
        URL url = new URL(baseURL, "org.drools.guvnor.Guvnor/package/downloadPackageWithHttpClientImpl/snapshotC1");
        Resource resource = ResourceFactory.newUrlResource(url);
        KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication("admin", "admin".toCharArray());
            }
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

    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));
    kagent.applyChangeSet(changeSet);
    return kagent;
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

        .newKnowledgeBaseConfiguration();
    kbconf.setOption(EventProcessingOption.STREAM);
    kbase = KnowledgeBaseFactory.newKnowledgeBase(kbconf);

    // Defining incremental resources to kbase
    KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
    kaconf.setProperty("drools.agent.newInstance", "false");

    kagent = KnowledgeAgentFactory.newKnowledgeAgent("theAgent", kbase, kaconf);
    kagent.applyChangeSet(ResourceFactory.newUrlResource(changeset.toURI().toURL()));
    kbase = kagent.getKnowledgeBase();
  }
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

        .newKnowledgeBaseConfiguration();
    kbconf.setOption(EventProcessingOption.STREAM);
    kbase = KnowledgeBaseFactory.newKnowledgeBase(kbconf);

    // Defining incremental resources to kbase
    KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
    kaconf.setProperty("drools.agent.newInstance", "false");

    KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("theAgent", kbase, kaconf);
    System.out.println(changeset.toURI().toURL());
    kagent.applyChangeSet(ResourceFactory.newUrlResource(changeset.toURI().toURL()));
    kagent.addEventListener( new KnowledgeAgentEventListener() {
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

       
    }

    public KnowledgeAgent execute( Context context ) {
        KnowledgeBase kbase = ( (KnowledgeCommandContext) context ).getKnowledgeBase();
        KnowledgeAgentConfiguration kaConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
            kaConfig.setProperty( "drools.agent.newInstance", "false" );
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( this.kAgentId, kbase, kaConfig );
        SystemEventListener systemEventListener = new SystemEventListener() {

            public void info(String string) {
                System.out.println("INFO: "+string);
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.