本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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();
}