jBPM 5 Guvnor Build Binary Package for KnowledgeAgent
byungwoojun Apr 15, 2011 4:11 PMI am using Guvnor as a resource repository system for my jBPM 5-based application. Using Eclipse BPMN2, I defined some custom drools rulebased work item defintions. In the definitions, I used my custom POJO class objects (e.g., com.mycompany.Xyz, com.mycompany.XyzResult) for service task parameters.
e.g.,
[
"name" : "Create XYZ task",
"parameters" : [
"interface" : new StringDataType(),
"xyz" : new ObjectDataType("com.mycompany.Xyz")
],
"results" : [
"result" : new ObjectDataType("com.mycompany.XyzResult")
],
"displayName" : "Create XYZ"
]
- Using Eclipse BPMN2 designer, I applied the above service task into my process definition.
- Then, I exported the resource to the Guvnor to store it in Guvnor.
- Then, my following code (using KnowledgeAgent) gets the resources from Guvnor. I used the KnowledgeAgent becuase I do NOT want to change code whenever I add new resources, which is not practical!!!
private final static String KNOWLEDGE_RESOURCE_URL = "http://localhost:7001/drools-guvnor/org.drools.guvnor.Guvnor/package/";
private final static String KNOWLEDGE_RESOURCE_PACKAGE = "defaultPackage/LATEST/ChangeSet.xml";
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Guvnor default");
kagent.applyChangeSet(ResourceFactory
.newUrlResource(AutomationProperties.getInstance().getProperty("KNOWLEDGE_RESOURCE_URL") +
AutomationProperties.getInstance().getProperty("KNOWLEDGE_RESOURCE_PACKAGE")));
kagent.monitorResourceChangeEvents(false);
KnowledgeBase kbase = kagent.getKnowledgeBase();
return kbase;
}
I realized that I needed to do one more step from Guvnor before I run my code. That is I need to build a biniary package. So, I clicked the Build Package button from my package. Then, I got an error message, saying that it does not resolve the com.mycompany.Xyz and com.mycompany.XyzResult. It looks like Guvnor was compiling to build a package. Then, I learned there is a menu "Upload POJO Model jar" in Guvnor, and I need to configure the import pacakge for building a binary package, etc....
Here are my questions.
- Is it a normal procedure (adding POJO Jars into Guvnor, etc.) to include custom POJO classes in the Service task definitions?
- Do I really have to build a binary package for KnowledgeAgent. I want to use Guvnor just for repository system, without those compilations. Since all the jars and classes are alreay defined in the classpath in Eclipse and JEE app server. When I used resourceFactory add, it just needs to bring in resources as resources, instead of bindary packages.
Any suggestions will be appreciated.
Thanks,
bwj