当前位置: 首页>>代码示例>>Java>>正文


Java KieResources类代码示例

本文整理汇总了Java中org.kie.api.io.KieResources的典型用法代码示例。如果您正苦于以下问题:Java KieResources类的具体用法?Java KieResources怎么用?Java KieResources使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KieResources类属于org.kie.api.io包,在下文中一共展示了KieResources类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getKieSession

import org.kie.api.io.KieResources; //导入依赖的package包/类
/** create empty knowledge base */
private KieSession getKieSession() {
    KieServices ks = KieServices.Factory.get();
    KieFileSystem kfs = ks.newKieFileSystem();
    KieResources kieResources = ks.getResources();

    kfs.write(kieResources.newClassPathResource("getOlder.drl", getClass()).setResourceType(ResourceType.DRL));

    KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();

    List<Message> errors = kieBuilder.getResults().getMessages(Message.Level.ERROR);
    if (!errors.isEmpty()) {
        fail("" + errors);
    }

    return ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:18,代码来源:JsonQueryTest.java

示例2: registerKnowledgeRuntime

import org.kie.api.io.KieResources; //导入依赖的package包/类
protected KieSession registerKnowledgeRuntime(String identifier, String rule) {
    KieServices ks = KieServices.Factory.get();
    KieFileSystem kfs = ks.newKieFileSystem();
    KieResources kieResources = ks.getResources();

    if (rule != null && rule.length() > 0) {
        kfs.write("src/main/resources/rule.drl", rule);
    }

    KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();

    List<Message> errors = kieBuilder.getResults().getMessages(Message.Level.ERROR);
    if (!errors.isEmpty()) {
        fail("" + errors);
    }

    KieSession ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();

    try {
        jndiContext.bind(identifier, ksession);
    } catch (NamingException e) {
        throw new RuntimeException(e);
    }

    return ksession;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:27,代码来源:KieCamelTestSupport.java

示例3: registerKnowledgeRuntime

import org.kie.api.io.KieResources; //导入依赖的package包/类
@Override
protected KieSession registerKnowledgeRuntime(String identifier, String rule) {
    KieServices ks = KieServices.Factory.get();
    KieFileSystem kfs = ks.newKieFileSystem();
    KieResources kieResources = ks.getResources();

    Options xjcOpts = new Options();
    xjcOpts.setSchemaLanguage(Language.XMLSCHEMA);

    JaxbConfiguration jaxbConfiguration = KnowledgeBuilderFactory.newJaxbConfiguration(xjcOpts, "xsd");

    kfs.write(kieResources.newClassPathResource("person.xsd", getClass()).setResourceType(ResourceType.XSD).setConfiguration(jaxbConfiguration));

    if (rule != null && rule.length() > 0) {
        kfs.write("src/main/resources/rule.drl", rule);
    }

    KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();

    List<Message> errors = kieBuilder.getResults().getMessages(Message.Level.ERROR);
    if (!errors.isEmpty()) {
        fail("" + errors);
    }

    KieSession ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();
    classLoader = ((KnowledgeBaseImpl)ksession.getKieBase()).getRootClassLoader();

    try {
        jndiContext.bind(identifier, ksession);
    } catch (NamingException e) {
        throw new RuntimeException(e);
    }

    return ksession;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:36,代码来源:CamelEndpointWithJaxbXSDModelTest.java

示例4: registerKnowledgeRuntime

import org.kie.api.io.KieResources; //导入依赖的package包/类
@Override
protected KieSession registerKnowledgeRuntime(String identifier, String rule) {
    KieServices ks = KieServices.Factory.get();
    KieFileSystem kfs = ks.newKieFileSystem();
    KieResources kieResources = ks.getResources();

    Options xjcOpts = new Options();
    xjcOpts.setSchemaLanguage(Language.XMLSCHEMA);

    JaxbConfiguration jaxbConfiguration = KnowledgeBuilderFactory.newJaxbConfiguration(xjcOpts, "xsd");

    kfs.write(kieResources.newClassPathResource("person.xsd", getClass()).setResourceType(ResourceType.XSD).setConfiguration(jaxbConfiguration));

    if (rule != null && rule.length() > 0) {
        kfs.write("src/main/resources/rule.drl", rule);
    }

    KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();

    List<Message> errors = kieBuilder.getResults().getMessages(Message.Level.ERROR);
    if (!errors.isEmpty()) {
        fail("" + errors);
    }

    KieSession ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();

    try {
        jndiContext.bind(identifier, ksession);
    } catch (NamingException e) {
        throw new RuntimeException(e);
    }

    return ksession;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:35,代码来源:CamelEndpointWithJaxWrapperCollectionTest.java

示例5: getResources

import org.kie.api.io.KieResources; //导入依赖的package包/类
@Override
public KieResources getResources() {
    return kieServices.getResources();
}
 
开发者ID:deepu105,项目名称:drools-demo,代码行数:5,代码来源:DefaultKieServicesBean.java


注:本文中的org.kie.api.io.KieResources类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。