Package org.kie.builder

Examples of org.kie.builder.KieBaseModel


            kfs.write("src/main/resources/KBase1/" + file, createDRL(rule));
        }

        KieModuleModel kproj = ks.newKieModuleModel();

        KieBaseModel kieBaseModel1 = kproj.newKieBaseModel("KBase1")
                .setEqualsBehavior( EqualityBehaviorOption.EQUALITY )
                .setEventProcessingMode( EventProcessingOption.STREAM );

        KieSessionModel ksession1 = kieBaseModel1.newKieSessionModel("KSession1")
                .setType(KieSessionType.STATEFUL)
                .setClockType( ClockTypeOption.get("realtime") );

        kfs.writeKModuleXML(kproj.toXML());
        kfs.writePomXML( getPom(releaseId) );
View Full Code Here


    private InternalKieModule createKieJarWithClass(KieServices ks, ReleaseId releaseId, int value, int factor) throws IOException {
        KieFileSystem kieFileSystem = ks.newKieFileSystem();

        KieModuleModel kproj = ks.newKieModuleModel();

        KieBaseModel kieBaseModel1 = kproj.newKieBaseModel("KBase1")
                .setEqualsBehavior( EqualityBehaviorOption.EQUALITY )
                .setEventProcessingMode( EventProcessingOption.STREAM );

        KieSessionModel ksession1 = kieBaseModel1.newKieSessionModel("KSession1")
                .setType(KieSessionType.STATEFUL)
                .setClockType( ClockTypeOption.get("realtime") );

        kieFileSystem
                .writeKModuleXML(kproj.toXML())
                .writePomXML(getPom(releaseId))
                .write("src/main/resources/" + kieBaseModel1.getName() + "/rule1.drl", createDRLForJavaSource(value))
                .write("src/main/java/org/kie/test/Bean.java", createJavaSource(factor));

        KieBuilder kieBuilder = ks.newKieBuilder(kieFileSystem);
        assertTrue(kieBuilder.buildAll().getResults().getMessages().isEmpty());
        return ( InternalKieModule ) kieBuilder.getKieModule();
View Full Code Here

           
            KieContainerImpl kContainer = new KieContainerImpl( kProject, null );
           
            if ( kBaseNames != null ) {
                for ( String kBaseQName : kBaseNames ) {
                    KieBaseModel kBaseModel = kProject.getKieBaseModel( kBaseQName );
                    if ( kBaseModel == null ) {
                        log.error( "Annotation @KBase({}) found, but no KieBaseModel exist.\nEither the required kproject.xml does not exist, was corrupted, or mising the KieBase entry",
                                   kBaseQName );
                        continue;
                    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.kie.kModule.KieProject#addKBase(org.kie.kModule.KieBaseModelImpl)
     */
    public KieBaseModel newKieBaseModel(String name) {
        KieBaseModel kbase = new KieBaseModelImpl(this, name);
        Map<String, KieBaseModel> newMap = new HashMap<String, KieBaseModel>();
        newMap.putAll( this.kBases );       
        newMap.put( kbase.getName(), kbase );
        setKBases( newMap );  
       
        return kbase;
    }
View Full Code Here

     * @see org.kie.kModule.KieProject#removeKieBaseModel(org.kie.kModule.KieBaseModel)
     */
    public void moveKBase(String oldQName, String newQName) {
        Map<String, KieBaseModel> newMap = new HashMap<String, KieBaseModel>();
        newMap.putAll( this.kBases );
        KieBaseModel kieBaseModel = newMap.remove( oldQName );
        newMap.put( newQName, kieBaseModel);
        setKBases( newMap );
    }       
View Full Code Here

            }
        }
        KieProject kProject = kieContainer.getKieProject();

        String kBaseQName = entry.getKieTypeName();
        KieBaseModel kBaseModel = kProject.getKieBaseModel( kBaseQName );
        if ( kBaseModel == null ) {
            log.error( "Annotation @KBase({}) found, but no KieBaseModel exist.\nEither the required kproject.xml does not exist, was corrupted, or mising the KieBase entry",
                       kBaseQName );
            return;
        }
        if ( !kBaseModel.getScope().trim().equals( entry.getScope().getClass().getName() ) ) {
            try {
                if ( kBaseModel.getScope().indexOf( '.' ) >= 0 ) {
                    entry.setScope( (Class< ? extends Annotation>) Class.forName( kBaseModel.getScope() ) );
                } else {
                    entry.setScope( (Class< ? extends Annotation>) Class.forName( "javax.enterprise.context." + kBaseModel.getScope() ) );
                }
            } catch ( ClassNotFoundException e ) {
                log.error( "KieBaseModule {} overrides default annotation, but it was not able to find it {}\n{}",
                           new String[]{kBaseQName, kBaseModel.getScope(), e.getMessage()} );
            }
        }
        KBaseBean bean = new KBaseBean( kBaseModel,
                                        kieContainer,
                                        entry.getScope(),
View Full Code Here

    /* (non-Javadoc)
     * @see org.kie.kModule.KieProject#addKBase(org.kie.kModule.KieBaseModelImpl)
     */
    public KieBaseModel newKieBaseModel(String name) {
        KieBaseModel kbase = new KieBaseModelImpl(this, name);
        Map<String, KieBaseModel> newMap = new HashMap<String, KieBaseModel>();
        newMap.putAll( this.kBases );       
        newMap.put( kbase.getName(), kbase );
        setKBases( newMap );  
       
        return kbase;
    }
View Full Code Here

     * @see org.kie.kModule.KieProject#removeKieBaseModel(org.kie.kModule.KieBaseModel)
     */
    public void moveKBase(String oldQName, String newQName) {
        Map<String, KieBaseModel> newMap = new HashMap<String, KieBaseModel>();
        newMap.putAll( this.kBases );
        KieBaseModel kieBaseModel = newMap.remove( oldQName );
        newMap.put( newQName, kieBaseModel);
        setKBases( newMap );
    }       
View Full Code Here

            }
        }
        KieProject kProject = kieContainer.getKieProject();

        String kBaseQName = entry.getKieTypeName();
        KieBaseModel kBaseModel = kProject.getKieBaseModel( kBaseQName );
        if ( kBaseModel == null ) {
            log.error( "Annotation @KBase({}) found, but no KieBaseModel exist.\nEither the required kproject.xml does not exist, was corrupted, or mising the KieBase entry",
                       kBaseQName );
            return;
        }
        if ( !kBaseModel.getScope().trim().equals( entry.getScope().getClass().getName() ) ) {
            try {
                if ( kBaseModel.getScope().indexOf( '.' ) >= 0 ) {
                    entry.setScope( (Class< ? extends Annotation>) Class.forName( kBaseModel.getScope() ) );
                } else {
                    entry.setScope( (Class< ? extends Annotation>) Class.forName( "javax.enterprise.context." + kBaseModel.getScope() ) );
                }
            } catch ( ClassNotFoundException e ) {
                log.error( "KieBaseModule {} overrides default annotation, but it was not able to find it {}\n{}",
                           new String[]{kBaseQName, kBaseModel.getScope(), e.getMessage()} );
            }
        }
        KBaseBean bean = new KBaseBean( kBaseModel,
                                        kieContainer,
                                        entry.getScope(),
View Full Code Here

    /* (non-Javadoc)
     * @see org.kie.kModule.KieProject#addKBase(org.kie.kModule.KieBaseModelImpl)
     */
    public KieBaseModel newKieBaseModel(String name) {
        KieBaseModel kbase = new KieBaseModelImpl(this, name);
        Map<String, KieBaseModel> newMap = new HashMap<String, KieBaseModel>();
        newMap.putAll( this.kBases );       
        newMap.put( kbase.getName(), kbase );
        setKBases( newMap );  
       
        return kbase;
    }
View Full Code Here

TOP

Related Classes of org.kie.builder.KieBaseModel

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.