Created
March 5, 2013 07:14
-
-
Save ooharak/5088567 to your computer and use it in GitHub Desktop.
a wild helloworld of jBPM References: http://sourceforge.net/projects/jbpm/files/jBPM%205/jbpm-5.4.0.Final/jbpm-5.4.0.Final-bin.zip/download http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-api.html#d0e1175 http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e1298
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <definitions id="Definition" targetNamespace="http://www.jboss.org/drools" | |
| typeLanguage="http://www.java.com/javaTypes" expressionLanguage="http://www.mvel.org/2.0" | |
| xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" | |
| xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
| <process processType="Private" isExecutable="true" id="com.sample.hello" name="Hello Process"> | |
| <startEvent id="_1" name="Start" /> | |
| <scriptTask id="_2" name="Hello"> | |
| <script>System.out.println("Hello World");</script> | |
| </scriptTask> | |
| <endEvent id="_3" name="End"> | |
| <terminateEventDefinition /> | |
| </endEvent> | |
| <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" /> | |
| <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" /> | |
| </process> | |
| </definitions> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package example.jbpm; | |
| import org.drools.KnowledgeBase; | |
| import org.drools.builder.KnowledgeBuilder; | |
| import org.drools.builder.KnowledgeBuilderFactory; | |
| import org.drools.builder.ResourceType; | |
| import org.drools.io.ResourceFactory; | |
| import org.drools.runtime.StatefulKnowledgeSession; | |
| import org.drools.runtime.process.ProcessInstance; | |
| /** | |
| * jBPM client example | |
| * | |
| */ | |
| public class Main { | |
| /** | |
| * @param args | |
| */ | |
| public static void main(String[] args) { | |
| String basedir = System.getProperty("user.dir"); | |
| KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); | |
| kbuilder.add(ResourceFactory.newFileResource(basedir+"/example-bpmn.xml"), ResourceType.BPMN2); | |
| KnowledgeBase kbase = kbuilder.newKnowledgeBase(); | |
| StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); | |
| ProcessInstance processInstance = ksession.startProcess("com.sample.hello"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment