您的位置:首页 > 编程语言 > Java开发

整合SSH(Struts2、Spring、Hibernate)和JBPM4.4

2014-02-22 14:39 513 查看
1、前提:ssh已经搭建好。

2、导入jbpm.jar   和mail.jar到lib目录中,并且build path

3、将juel-api.jar、juel-engine.jar、juel-impl.jar三个jar包放到tomcat安装目录下的lib文件夹下,并将其自带的el-api.jar删除

4、src目录下建立jbpm.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<process-engine-context>
<string name="spring.cfg" value="applicationContext.xml" />
</process-engine-context>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.spring.default.cfg.xml"/>
<!--
<import resource="jbpm.jobexecutor.cfg.xml" />
-->
</jbpm-configuration>


 

5、src目录下建立jbpm.spring.default.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

<process-engine-context>

<repository-service />
<repository-cache />
<execution-service />
<history-service />
<management-service />
<identity-service />
<task-service />
<!--
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
</hibernate-configuration>

<hibernate-session-factory />
-->
<script-manager default-expression-language="juel"
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
<script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>

<authentication />

<id-generator />
<types resource="jbpm.variable.types.xml" />

<address-resolver />

<business-calendar>
<monday    hours="9:00-12:00 and 12:30-17:00"/>
<tuesday   hours="9:00-12:00 and 12:30-17:00"/>
<wednesday hours="9:00-12:00 and 12:30-17:00"/>
<thursday  hours="9:00-12:00 and 12:30-17:00"/>
<friday    hours="9:00-12:00 and 12:30-17:00"/>
<holiday period="01/07/2008 - 31/08/2008"/>
</business-calendar>

<mail-template name='task-notification'>
<to users="${task.assignee}"/>
<subject>${task.name}</subject>
<text><![CDATA[Hi ${task.assignee},
Task "${task.name}" has been assigned to you.
${task.description}

Sent by JBoss jBPM
]]></text>
</mail-template>

<mail-template name='task-reminder'>
<to users="${task.assignee}"/>
<subject>${task.name}</subject>
<text><![CDATA[Hey ${task.assignee},
Do not forget about task "${task.name}".
${task.description}

Sent by JBoss jBPM
]]></text>
</mail-template>

</process-engine-context>

<transaction-context>
<repository-session />
<db-session />

<message-session />
<timer-session />
<history-session />
<mail-session>
<mail-server>
<session-properties resource="jbpm.mail.properties" />
</mail-server>
</mail-session>
</transaction-context>

</jbpm-configuration>


 

6、applicationContext.xml中加入springHelper配置,作为jbpm processEngine的factory bean

<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
<property name="jbpmCfg" value="jbpm.cfg.xml" />
</bean>


 

7、applicationContext.xml中加入processEngine配置,并以此为factory bean创建JBPM本身的各种Service

<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine"  />

<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"/>
<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService"/>
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>


 

8、applicationContext.xml的hibernate配置中加入jbpm所需的hbm.xml配置

<property name="mappingLocations">
<list>
<value>classpath:jbpm.execution.hbm.xml</value>
<value>classpath:jbpm.history.hbm.xml</value>
<value>classpath:jbpm.identity.hbm.xml</value>
<value>classpath:jbpm.repository.hbm.xml</value>
<value>classpath:jbpm.task.hbm.xml</value>
</list>
</property>


 

完成

 

我的eclipse项目目录:



 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: