`
阅读更多
1.
jBPM Business Process Management (BPM) 套件:
     Runtime Engine         引擎
    Web-based Designer     基于WEB的设计器 Oryx Designer
    Eclipse Plugin        
    Management Console     管理控制台
    Miscellaneous          其它如流程仓库Guvnor

2.
执行流
流程描述 - 流程 - 活动 - 事务

流程实例
process instance

3.
jBPM5 基于BPMN 2.0流程语言

4.
安装eclipse jBPM 插件及使用教程
4.1
安装需求
     JDK 1.5+
    Ant 1.7+
4.2
下载 jBPM5 安装文件并解压
http://sourceforge.net/projects/jbpm/files/jBPM%205/jbpm-5.0-Final/

4.3
安装Demo
ant install.demo

将执行如下任务
------
下载 JBoss AS
下载 Eclipse
下载 Drools Guvnor into JBoss AS
下载 Oryx Designer
下载 jBPM gwt-console
下载 jBPM Eclipse plugin
下载 Drools Eclipse plugin
4.4
启动Demo
ant start.demo

将执行如下任务
------
启动  H2 database
启动 JBoss AS
启动 Eclipse
启动 Human Task Service

4.5
导入例子工程
http://people.redhat.com/kverlaen/install-eclipse-jbpm.swf

4.6
WEB 管理控制台
http://localhost:8080/jbpm-console

账号:
krisv / krisv

4.7
流程仓库
[url]http://localhost:8080/drools-guvnor [/url]

4.8
停止Demo
ant stop.demo

4.9 官方论坛
http://community.jboss.org/en/jbpm?view=discussions


5. 流程对象

Events
    Start Event (None, Conditional, Signal, Message, Timer)
    End Event (None, Terminate, Error, Escalation, Signal, Message, Compensation)
    Intermediate Catch Event (Signal, Timer, Conditional, Message)
    Intermediate Throw Event (None, Signal, Escalation, Message, Compensation)
    Non-interrupting Boundary Event (Escalation, Timer)
    Interrupting Boundary Event (Escalation, Error, Timer, Compensation)


Activities
    Script Task (Java or MVEL expression language)
    Task
    Service Task
    User Task
    Business Rule Task
    Manual Task
    Send Task
    Receive Task
    Reusable Sub-Process (Call Activity)
    Embedded Sub-Process
    Ad-Hoc Sub-Process
    Data-Object

Gateways
    Diverging
        Exclusive (Java, MVEL or XPath expression language)
        Inclusive (Java, MVEL or XPath expression language)
        Parallel
        Event-Based
    Converging
        Exclusive
        Parallel
    Lanes

Data
    Java type language
    Process properties
    Embedded Sub-Process properties
    Activity properties

Connecting objects
    Sequence flow


6.
WS-HT service
人工任务(非自动化任务)

生命周期
1.
创建 - 准备 - Reserved - 处理 - 完成|失败
2.
(准备 - Reserved - 处理) - 挂起
3.
(创建 - 准备 - Reserved - 处理) - 错误|退出|忽略

7.
流程上下文
kcontext
org.drools.runtime.process.ProcessContext

8.
Action

9.
Node

10.
流程变量及作用域

11.
约束
代码约束
规则约束

12.
事件
流程内部事件
外部事件


13.
定时器
Timer Event

14.
会话:流程实例通过会话与流程引擎交互,会话通过knowledge base的引用查询流程定义.通过会话可以启动流程实例.

创建knowledge base
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("MyProcess.bpmn"), ResourceType.BPMN2);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();



创建Session

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ProcessInstance processInstance = ksession.startProcess("com.sample.MyProcess");



添加或移除监听器

ProcessEventListener


15.
整合jBPM 和 MyEclipse8.6

1.
下载GEF
http://www.eclipse.org/downloads/download.php?file=/tools/gef/downloads/drops/3.5.2/R201002241200/GEF-ALL-3.5.2.zip&url=http://download.actuatechina.com/eclipse/tools/gef/downloads/drops/3.5.2/R201002241200/GEF-ALL-3.5.2.zip&mirror_id=385

2.
复制步骤4中已经下载的包
drools
---------
drools-5.2.0.M1-eclipse-all.zip

jbpm
---------
jbpm-5.0.0-eclipse-all.zip

3. 解压并安装插件-链接方式

Drools
---------
E:\bisoft\tools\myeclipse\myplugins\drools520\eclipse
E:\bisoft\tools\myeclipse\myplugins\drools520\eclipse\features
E:\bisoft\tools\myeclipse\myplugins\drools520\eclipse\plugins
E:\bisoft\tools\myeclipse\myplugins\drools520\eclipse\plugins\lib\*.jar

注意上面的lib目录下的包是安装目录下的lib目录及子目录下的所有JAR包.为了方便,我都放到lib目录下.为什么这样做?因为drools的包依赖这些包,所以必须的.

jbpm
-------
E:\bisoft\tools\myeclipse\myplugins\jbpm5\eclipse\plugins

gef
-------
E:\bisoft\tools\myeclipse\myplugins\gef\eclipse\features
E:\bisoft\tools\myeclipse\myplugins\gef\eclipse\plugins

注意这里的GEF不能用前面步骤4的GEF SDK包,因为MyEclipse使用Eclipse3.5,因此要下载3.5对应的GEF SDK包.

链接文件
-------
E:\bisoft\tools\myeclipse\dropins\drools520.link
path=E:\\bisoft\\tools\\myeclipse\\myplugins\\drools520

E:\bisoft\tools\myeclipse\dropins\gef.link
path=E:\\bisoft\\tools\\myeclipse\\myplugins\\gef

E:\bisoft\tools\myeclipse\dropins\jbpm5.link
path=E:\\bisoft\\tools\\myeclipse\\myplugins\\jbpm5

4. 配置JBPM运行时
指向runtime目录

5. 导入例子
sample\evaluation

6. 配置JBOSS_HOME
指向jboss-5.1.0.GA

7. 复制build.xml到工程下,并修改
<?xml version="1.0" encoding="UTF-8"?>

<project name="jBPM5">
	
  <property name="install.home" value="E:/bisoft/sharelib/jbpm-installer" />
  <property name="jboss.home" value="E:/bisoft/jboss-5.1.0.GA" />
  <property name="jboss.bind.address" value="localhost" />

  <!-- ############ START/STOP ############ -->

  <!-- Start H2 server -->
  <target name="start.h2">
    <java classname="org.h2.tools.Server" fork="true" spawn="true">
      <arg value="-tcp" />
      <classpath location="${install.home}/db/driver/h2.jar" />
    </java>
  </target>
  <!-- Stop H2 server -->
  <target name="stop.h2">
    <java classname="org.h2.tools.Server" fork="true">
      <classpath location="${install.home}/db/driver/h2.jar" />
      <arg value="-tcpShutdown" />
      <arg value="tcp://localhost:9092" />
    </java>
  </target>

  <!-- Start JBoss AS -->
  <target name="start.jboss">
    <property name="jboss.full.path.win" location="${jboss.home}/bin/run.bat" />
    <exec executable="${jboss.full.path.win}" spawn="on"
          os="Windows 7,Windows Vista,Windows XP,Windows 2000,Windows 2003">
      <env key="JAVA_OPTS" value="-XX:MaxPermSize=256m -Xms256m -Xmx512m" />
      <arg value="-b" />
      <arg value="${jboss.bind.address}" />
      <arg value="-Djbpm.console.directory=${install.home}/sample/evaluation/src/main/resources" />
    </exec>
    <waitfor maxwait="5" maxwaitunit="minute" checkevery="30"
             checkeveryunit="second" timeoutproperty="jboss.timeout">
      <socket server="${jboss.bind.address}" port="8080" />
    </waitfor>
    <fail if="jboss.timeout" message="jboss did not start within 5 minutes"/>
  </target>
  <!-- Stop JBoss AS -->
  <target name="stop.jboss">
    <exec executable="${jboss.home}/bin/shutdown.bat"
          os="Windows 7,Windows Vista,Windows XP,Windows 2000,Windows 2003">
      <arg value="-s" />
      <arg value="jnp://${jboss.bind.address}:1099" />
      <arg value="-S" />
    </exec>
  </target>

  <!-- Start Human Task Service -->
  <path id="classpath.human.task">
    <fileset dir="${install.home}/runtime" includes="**/*.jar"/>
    <fileset dir="${install.home}/db/driver" includes="**/*.jar"/>
  </path>
  <target name="start.human.task">
    <mkdir dir="${install.home}/task-service/target"/>
    <javac srcdir="${install.home}/task-service/src" destdir="${install.home}/task-service/target" classpathref="classpath.human.task">
      <compilerarg value="-Xlint:unchecked"/>
    </javac>
    <copy todir="${install.home}/task-service/target">
      <fileset dir="${install.home}/task-service/resources"/>
    </copy>
    <java classname="org.jbpm.DemoTaskService" fork="true">  
      <classpath>
        <pathelement path="${install.home}/task-service/target"/>
        <path refid="classpath.human.task" />
      </classpath>
    </java>
  </target>

  <!-- Start Demo -->
  <target name="start.demo" depends="start.h2,start.jboss,start.human.task" />
  <!-- Stop Demo -->
  <target name="stop.demo" depends="stop.h2,stop.jboss" />

</project>



前面的两个属性根据实际情况修改.

8. 启动H2数据库, JBOSS, 人工服务
start.demo


9. 运行或调试ProcessTest


10. 如果你的BPMN文件没有对应的编辑器,可以运行这个类并将输出的信息复制到
myeclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info的最后, 然后删除configuration/org.eclipse.update目录并重启MyEclipse.

package com.sample;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("unchecked")
public class CreatePluginsConfig {
	public CreatePluginsConfig() {
	}
	
	public static void main(String[] args) {
		// 插件位置
		String plugin = "E:\\bisoft\\tools\\myeclipse\\myplugins\\drools520";  
        new CreatePluginsConfig().print(plugin);  
	}
	
	
	public void print(String path) {
		List list = getFileList(path);
		if (list == null) {
			return;
		}

		int length = list.size();
		for (int i = 0; i < length; i++) {
			String result = "";
			String thePath = getFormatPath(getString(list.get(i)));
			File file = new File(thePath);
			if (file.isDirectory()) {
				String fileName = file.getName();
				if (fileName.indexOf("_") < 0) {
					print(thePath);
					continue;
				}
				String[] filenames = fileName.split("_");
				String filename1 = filenames[0];
				String filename2 = filenames[1];
				result = filename1 + "," + filename2 + ",file:/" + path + "\\"
						+ fileName + "\\,4,false";
				System.out.println(result);
			} else if (file.isFile()) {
				String fileName = file.getName();
				if (fileName.indexOf("_") < 0) {
					continue;
				}
				int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
				String filename1 = fileName.substring(0, last);
				String filename2 = fileName.substring(last + 1, fileName
						.length() - 4);
				result = filename1 + "," + filename2 + ",file:/" + path + "\\"
						+ fileName + ",4,false";
				System.out.println(result);
			}

		}
	}

	public List getFileList(String path) {
		path = getFormatPath(path);
		path = path + "/";
		File filePath = new File(path);
		if (!filePath.isDirectory()) {
			return null;
		}
		String[] filelist = filePath.list();
		List filelistFilter = new ArrayList();

		for (int i = 0; i < filelist.length; i++) {
			String tempfilename = getFormatPath(path + filelist[i]);
			filelistFilter.add(tempfilename);
		}
		return filelistFilter;
	}

	public String getString(Object object) {
		if (object == null) {
			return "";
		}
		return String.valueOf(object);
	}

	public String getFormatPath(String path) {
		path = path.replaceAll("\\\\", "/");
		path = path.replaceAll("//", "/");
		return path;
	}
}



11.
结果




12.
stop.demo

这里有个缺陷, 没有停止人工服务. 因此必须到任务管理器去结束进程.

13.
完成.



  • 大小: 485.5 KB
7
2
分享到:
评论
10 楼 Kevin_jiang2011 2012-12-18  
官网的文档写的不好。 简单的执行命令,又要重新下载一个eclipse,大多数人本来就有的。何必再下载一次呢。
9 楼 harbey 2012-04-14  
都是由ant执行的,ant里就有下载和安装路径的定义
8 楼 xian_hf 2012-03-20  
直接翻译的jbpm里的install.html
7 楼 flyChan 2011-11-16  
flyChan 写道
楼主能不能留个联系方式啊,感觉有好多地方都需要向您请教啊!感谢!

哈哈,我现在已经搞定了,不用留联系方式了,谢谢LZ呵呵
6 楼 flyChan 2011-11-16  
楼主能不能留个联系方式啊,感觉有好多地方都需要向您请教啊!感谢!
5 楼 amos_tl 2011-11-15  
4. 配置JBPM运行时  
指向runtime目录 

// 配置Eclipse 配置菜单下的 | JBPM | runtime
 
5. 导入例子  
sample\evaluation 

// sample 在安装时应该安装了, 直接导入工程应该还会吧...
 
6. 配置JBOSS_HOME  
指向jboss-5.1.0.GA 

// 与配置 JAVA_HOME 类似
4 楼 flyChan 2011-11-15  
楼主啊,你说的好简洁啊,对我们这些新人小P来说有些地方好难理解啊,比如:
4. 配置JBPM运行时 
指向runtime目录 

5. 导入例子 
sample\evaluation 

6. 配置JBOSS_HOME 
指向jboss-5.1.0.GA 


以上三步改具体该怎么做啊?楼主您好人就弄一个图文解说吧!我代表广大群众感谢您啊,您永垂不朽啊!
3 楼 zhuchao_ko 2011-08-10  
2 楼 trh3037 2011-06-15  
说的好简洁啊。。安装怎么装。。


下载 JBoss AS
下载 Eclipse
下载 Drools Guvnor into JBoss AS
下载 Oryx Designer
下载 jBPM gwt-console
下载 jBPM Eclipse plugin
下载 Drools Eclipse plugin


这些会安装到哪里?。
1 楼 hyj0903 2011-05-09  
在eclipse中不能直接查看bpmn的xml代码,而要右击才能查看。。。。

相关推荐

Global site tag (gtag.js) - Google Analytics