1.Overwiew
jPDL Conversion tool takes a jpdl3 process file , convert and generate to a jpdl4 process file. The input jpdl3 process file must be a valid one. This conversion tool will validate this process file first , then continue the conversion work . The generated file name ends with converted.jpdl.xml.
The syntax of this tool :
java org.jbpm.jpdl.internal.convert.JpdlConverterTool -v -o <outputfile> <processfile>
you can also simply use the following command to use this tool:
java -jar jbpm-migration-4.0-SNAPSHOT.jar -v -o <outputfile> <processfile>
2 Arguments
-v : Verbose mode. The tool will print the detail message when convert the process file. When this argument is enabled , it will also print the error stacktrace if there is errors cocurred.
-o output-filename : Specifies the output file name. The tool will generate the name ends with converted.jpdl.xml and base file name will derive from input process base file name. The output-filename can be an absolute file name path or a relative file name path.
3 Example
java org.jbpm.jpdl.internal.convert.JpdlConverterTool simple.jpdl
java org.jbpm.jpdl.internal.convert.JpdlConverterTool -v simple.jpdl
java org.jbpm.jpdl.internal.convert.JpdlConverterTool -o /home/scott/simple.converted.xml simple.jpdl
4 Integrate with other tools
The conversion tool provides apis to integrate with other tools , for example eclipse IDE , maven or ant . The following code example shows how to call the internal api to convert the process file:
URL url = new URL(“simple.jpdl”);
Jpdl3ConverterReader jpdlConverter = new Jpdl3ConverterReader(url);
Document jpdl4Doc = jpdlConverter.readAndConvert();
//check if there are problems when read and convert
for (Problem problem : jpdlConverter.problems) {
//do something to handle the proble
}
//write the converted dom4j document to a file or other writer.
Writer fileWriter = new FileWriter(outputFile);
OutputFormat format = OutputFormat.createPrettyPrint();
XMLWriter writer = new XMLWriter( fileWriter, format );
writer.write(jpdl4Doc);
writer.close();
Comments