Examples of KnowledgeAgentConfiguration


Examples of org.drools.agent.KnowledgeAgentConfiguration

       
    }

    public KnowledgeAgent execute( Context context ) {
        KnowledgeBase kbase = ( (KnowledgeCommandContext) context ).getKnowledgeBase();
        KnowledgeAgentConfiguration kaConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        kaConfig.setProperty( NewInstanceOption.PROPERTY_NAME, "false" );
        kaConfig.setProperty( UseKnowledgeBaseClassloaderOption.PROPERTY_NAME, "true" );
        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

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

    private KnowledgeAgent createKAgent(KnowledgeBase kbase) {
        ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
        sconf.setProperty("drools.resource.scanner.interval", "2");
        ResourceFactory.getResourceChangeScannerService().configure(sconf);

        KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        aconf.setProperty("drools.agent.scanDirectories", "true");
        aconf.setProperty("drools.agent.scanResources", "true");
        // Testing incremental build here
        aconf.setProperty("drools.agent.newInstance", "false");
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
                "test agent", kbase, aconf);

        kagent.addEventListener(new KnowledgeAgentEventListener() {
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);
    kagent.applyChangeSet(ResourceFactory.newUrlResource(changeset.toURI().toURL()));
    kbase = kagent.getKnowledgeBase();
  }
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

    public Class<KnowledgeAgent> getObjectType() {
        return KnowledgeAgent.class;
    }

    public void afterPropertiesSet() throws Exception {
        KnowledgeAgentConfiguration kagentConf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        if ( kbase == null ) {
            throw new RuntimeException( "kagent must reference an existing kbase" );
        }

        kagentConf.setProperty( "drools.agent.newInstance",
                                newInstance );

        this.kagent = KnowledgeAgentFactory.newKnowledgeAgent( this.id,
                                                               this.kbase,
                                                               kagentConf );
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

public class KnowledgeAgentExampleTest extends TestCase {

  private StatefulKnowledgeSession ksession;

  protected void setUp() throws Exception {
    KnowledgeAgentConfiguration configuration = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
    configuration.setProperty("drools.agent.scanDirectories", "true");
    ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
    sconf.setProperty( "drools.resource.scanner.interval", "1" );

    ResourceFactory.getResourceChangeScannerService().configure( sconf );
    ResourceFactory.getResourceChangeNotifierService().start();
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

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

        //System.setProperty(KnowledgeAgentFactory.PROVIDER_CLASS_NAME_PROPERTY_NAME, "org.drools.agent.impl.KnowledgeAgentProviderImpl");

        KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        aconf.setProperty("drools.agent.scanDirectories", "true");
        aconf.setProperty("drools.agent.scanResources", "true");
        // Testing incremental build here
        aconf.setProperty("drools.agent.newInstance", "" + newInstance);

        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
                "test agent", kbase, aconf);      

        final KnowledgeAgentAdvancedTest test = this;
View Full Code Here

Examples of org.drools.agent.KnowledgeAgentConfiguration

    public Class<KnowledgeAgent> getObjectType() {
        return KnowledgeAgent.class;
    }

    public void afterPropertiesSet() throws Exception {
        KnowledgeAgentConfiguration kagentConf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        if ( kbase == null ) {
            throw new RuntimeException( "kagent must reference an existing kbase" );
        }

        kagentConf.setProperty( "drools.agent.newInstance",
                                newInstance );

        this.kagent = KnowledgeAgentFactory.newKnowledgeAgent( this.id,
                                                               this.kbase,
                                                               kagentConf );
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.