Information Technology Reference
In-Depth Information
The KIE module
Any Maven dependency that contains a kmodule.xml file (like the one we showed at the
beginning of this section) is considered a KIE module. They can be loaded from the
classpath, dynamically from any knowledge resource, or can be built programmatically,
shown as follows:
//Create a virtual file system for our generated project
KieFileSystem kfs = ks.newKieFileSystem();
//Write content in a maven project structure
kfs.write("src/main/resources/my-process.bpmn2",
getFile("my-process.bpmn2"));
//Set a specific maven release ID for a pom.xml in the file
system
kfs.generateAndWritePomXML("com.wordpress.marianbuenosayres",
"test", "1.0-SNAPSHOT");
//Use a Kie Builder to generate a Kie Module
KieBuilder kbuilder = ks.newKieBuilder(kfs);
//build the content
kbuilder.buildAll();
KieModule kmodule = Kbuilder.getKieModule();
In the previous code, you first created a filesystem representation where you will write a
specific Maven module. This is pretty much the same method you should use when creat-
ing a new project using maven, but here you'll use the KIE API to do it for you. You then
add a BPMN2 file to it (whose content will be loaded from the getFile ( my-pro-
cess.bpmn2 ) invocation) and set the release ID of the project (composed of the group
ID, artefact ID, and version). Afterwards, a KieBuilder instance is used to build a spe-
cific KieModule object from that filesystem representation.
Search WWH ::




Custom Search