Package org.drools.io.impl

Examples of org.drools.io.impl.ByteArrayResource


                                          byte[] cb) {
        ResourceChangeSet pkgcs = new ResourceChangeSet( file, ChangeType.UPDATED );
        ResourceType type = ResourceType.determineResourceType( file );
        if( ResourceType.DRL.equals( type ) ) {
            try {
                PackageDescr opkg = new DrlParser().parse( new ByteArrayResource( ob ) );
                PackageDescr cpkg = new DrlParser().parse( new ByteArrayResource( cb ) );
               
                List<RuleDescr> orules = new ArrayList<RuleDescr>( opkg.getRules() ); // needs to be cloned
                List<RuleDescr> crules = cpkg.getRules();
               
                for( RuleDescr crd : crules ) {
View Full Code Here


                if (compiler != null) {

                    String theory = compiler.compile( resource.getInputStream(),
                                                      getPackageRegistry() );

                    addKnowledgeResource( new ByteArrayResource( theory.getBytes() ),
                                          ResourceType.DRL,
                                          configuration );
                } else {
                    throw new RuntimeException( "Unknown resource type: " + type );
                }
View Full Code Here

        if (compiler != null) {

            String theory = compiler.compile( resource.getInputStream(),
                                              getPackageRegistry() );

            addKnowledgeResource( new ByteArrayResource( theory.getBytes() ),
                                  ResourceType.DRL,
                                  configuration );
        } else {
            throw new RuntimeException( "Unknown resource type: " + type );
        }
View Full Code Here

        if (compiler != null) {

            String theory = compiler.compile( resource.getInputStream(),
                                              getPackageRegistry() );

            addKnowledgeResource( new ByteArrayResource( theory.getBytes() ),
                                  ResourceType.DRL,
                                  configuration );
        } else {
            throw new RuntimeException( "Unknown resource type: " + type );
        }
View Full Code Here

                      + "  when"
                      + "  then"
                      + "      System.out.println(\"Rule Fired!\");"
                      + " end";

        kbuilder.add( new ByteArrayResource( rule.getBytes() ),
                      ResourceType.DRL );

        KnowledgeBuilderErrors errors = kbuilder.getErrors();
        if ( errors != null && errors.size() > 0 ) {
            for ( KnowledgeBuilderError error : errors ) {
View Full Code Here

                 + "  then"
                 + "      System.out.println(\"My Global Object -> \"+myGlobalObj.getName());"
                 + "      System.out.println(\"Rule Fired! ->\"+$o.getName());"
                 + " end";

        kbuilder.add( new ByteArrayResource( rule.getBytes() ),
                      ResourceType.DRL );

        KnowledgeBuilderErrors errors = kbuilder.getErrors();
        if ( errors != null && errors.size() > 0 ) {
            for ( KnowledgeBuilderError error : errors ) {
View Full Code Here

                 + "  then"
                 + "      System.out.println(\"My Global Object -> \"+myGlobalObj.getName());"
                 + "      System.out.println(\"Rule Fired! ->\"+$o.getName());"
                 + " end";

        kbuilder.add( new ByteArrayResource( rule.getBytes() ),
                      ResourceType.DRL );
     
        KnowledgeBuilderErrors errors = kbuilder.getErrors();
        if ( errors != null && errors.size() > 0 ) {
            for ( KnowledgeBuilderError error : errors ) {
View Full Code Here

                +   "</endEvent>"
                + "</process>"
                + "</definitions>";
        System.out.println("Process = "+process);
        
        kbuilder.add( new ByteArrayResource( process.getBytes() ),
                      ResourceType.BPMN2 );
       
        KnowledgeBuilderErrors errors = kbuilder.getErrors();
        if ( errors != null && errors.size() > 0 ) {
            for ( KnowledgeBuilderError error : errors ) {
View Full Code Here

                + "<add>"
                + "<resource type=\"DRL\" source=\"classpath:simple.drl\" />"
                + "</add>"
                + "</change-set>"
                + "";
        Resource changeSetRes = new ByteArrayResource(changeSetString.getBytes());
        ((InternalResource) changeSetRes).setResourceType(ResourceType.CHANGE_SET);
       
       
       
        KnowledgeAgent kAgent = GridHelper.getKnowledgeAgentRemoteClientGridHelper.createGrid(), remoteN1.getId(), "ksession-rules" );
View Full Code Here

                "  list.add( -5 ); \n" +
                "end \n"
                ;
       
        final PackageBuilder builder = new PackageBuilder();
        builder.addPackageFromDrl( new ByteArrayResource( drl.getBytes() ) );
        final Package pkg = builder.getPackage();

        RuleBase ruleBase = getRuleBase();
        ruleBase.addPackage( pkg );
        ruleBase = SerializationHelper.serializeObject( ruleBase );
View Full Code Here

TOP

Related Classes of org.drools.io.impl.ByteArrayResource

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.