Package org.drools.compiler.builder.impl

Examples of org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackageFromDrl()


        StringReader    reader  = new StringReader(generateRules(ruleCount));
       
        System.out.println("Generating packages");
        KnowledgeBuilderImpl pkgBuilder = new KnowledgeBuilderImpl();
        try {
            pkgBuilder.addPackageFromDrl( reader );
        } catch ( IOException e ) {
            fail( "Unable to parse rules\n" + e.getMessage());
        }

        if ( pkgBuilder.hasErrors() ) {
View Full Code Here


           
            if ( dsrl == null ) {
                if ( source.equals( Constants.RES_SOURCE_TYPE_XML ) || source.equals( "xml" ) ) {
                    builder.addPackageFromXml( ruleExecutionSetReader );
                } else {
                    builder.addPackageFromDrl( ruleExecutionSetReader );
                }
            } else {
                if ( source.equals( Constants.RES_SOURCE_TYPE_XML ) || source.equals( "xml" ) ) {
                    // xml cannot specify a dsl
                    builder.addPackageFromXml( ruleExecutionSetReader );
View Full Code Here

                if ( source.equals( Constants.RES_SOURCE_TYPE_XML ) || source.equals( "xml" ) ) {
                    // xml cannot specify a dsl
                    builder.addPackageFromXml( ruleExecutionSetReader );
                } else {
                    if  ( dsrl instanceof Reader ) {
                        builder.addPackageFromDrl( ruleExecutionSetReader,
                                                   (Reader) dsrl );
                    } else {
                        builder.addPackageFromDrl( ruleExecutionSetReader,
                                                   new StringReader( (String) dsrl ) );
                    }
View Full Code Here

                } else {
                    if  ( dsrl instanceof Reader ) {
                        builder.addPackageFromDrl( ruleExecutionSetReader,
                                                   (Reader) dsrl );
                    } else {
                        builder.addPackageFromDrl( ruleExecutionSetReader,
                                                   new StringReader( (String) dsrl ) );
                    }
                }
            }
View Full Code Here

   
    @Test
    public void testApplicationDataView() throws Exception {
        Reader source = new InputStreamReader(DebugViewsTest.class.getResourceAsStream("/debug.drl"));
        KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
        builder.addPackageFromDrl(source);
        KnowledgeBaseImpl ruleBase = (KnowledgeBaseImpl) KnowledgeBaseFactory.newKnowledgeBase();
        ruleBase.addPackage(builder.getPackage());
        StatefulKnowledgeSession session = ruleBase.newStatefulKnowledgeSession();
        session.setGlobal("s", "String");
        List list = new ArrayList();
View Full Code Here

   
    @Test @Ignore
    public void testAgendaView() throws Exception {
        Reader source = new InputStreamReader(DebugViewsTest.class.getResourceAsStream("/debug.drl"));
        KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
        builder.addPackageFromDrl(source);
        KnowledgeBaseImpl ruleBase = (KnowledgeBaseImpl) KnowledgeBaseFactory.newKnowledgeBase();
        ruleBase.addPackage(builder.getPackage());
        StatefulKnowledgeSession session = ruleBase.newStatefulSession();
        List list = new ArrayList();
        session.setGlobal("list", list);
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.