《试谈ssh+jbpm整合cmud.docx》由会员分享,可在线阅读,更多相关《试谈ssh+jbpm整合cmud.docx(37页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Evaluation Warning: The document was created with Spire.Doc for .NET.简述 Jbpmm工作流框架架与现有sssh框架的集集成工作其实实很简单,但但国内外的资资料太小,所所以会在集成成时走入太多多误区,本文文是在strruts1.2,sprring2.5,hibbernatte3.2上上集成成功的的详细步骤。其其中解决了,jbpm的的访问数据库库sessiion与原有有hiberrnate的的sessiion不同的的问题,sttring-max大字字段问题。完完成了流程部部署web及及后台程序。利利用spriing-moodul
2、ess-0.8当当中的sprring311做为集成的的桥梁(其实实它已经做好好了集成,但但文档和实例例实在是太简简单)。 使使用jbpmm-starrters-kit-33.1.4生生成数据库表表及安装ecclipsee图形化配置置插件 1下下载jbpmm-starrters-kit-33.1.4到到其网站,包包含所有需要要的工具及jjar包。 2数据库的的安装以orracle为为例,其它数数据库可按此此例修改。 2.1创建建所需用户及及表空间,如如果有了用户户和表空间就就不需要了。 2.2 找找到jbpmm-starrters-kit-33.1.4文文件夹,在其其下的jbppm文件夹的的下级
3、文件夹夹lib中加加入oraccle的驱动动包ojdbbc14.jjar. 22.3 在jjbpmssrcreesourcces文件夹夹下建立orracle文文件夹, 将将jbpmmsrcresouurceshsqlddb里的crreate.db.hiibernaate.prropertties和iidentiity.dbb.xml文文件copyy到刚刚建立立的oraccle文件夹夹当中. 22.4 修改改creatte.db.hiberrnate.propeertiess文件,修改改目标数据库库的连接属性性如下: # thesse proopertiies arre useed by the
4、 bbuild scrript tto creeate # a hyypersoonic ddatabaase inn the buildd/db ddirecttory tthat ccontaiins # the jjbpm ttabless and a proocess deplooyed iin theere hiibernaate.diialectt=org.hiberrnate.dialeect.OrracleDDialecct hibbernatte.connnectiion.drriver_classs=oraccle.jddbc.drriver.OraclleDrivver
5、hiibernaate.coonnecttion.uurl=jddbc:orracle:thin:10.662.1.112:15221:oraacle hhibernnate.cconnecction.usernname=ddpf hiibernaate.coonnecttion.ppasswoord=dppf hibbernatte.shoow_sqll=truee hibeernatee.cachhe.prooviderr_classs=orgg.hibeernatee.cachhe.HasshtablleCachheProvvider 2.5 修改改jbpmsrccconfigg.fil
6、eeshibbernatte.cfgg.xml文文件,同样是是配置数据库库的连接属性性如下: orrg.hibbernatte.diaalect.OraclleDiallect oraccle.jddbc.drriver.OraclleDrivver jdbc:oraclle:thiin:100.62.11.12:11521:ooraclee dppf ddpf orgg.hibeernatee.cachhe.HasshtablleCachheProvvider 2.6 修改jbppmbuiild.deeploy.xml文件件.找到crreate.db项并进进行如下修改改: 2.7 配配置an
7、t,在jbpmm目录执行 ant ccreatee.db builddfile buildd.deplloy.xmml命令。 会有一些小小错误的提示示,没有关系系数据库的表表已经建立完完成。 2.8 ecllipse的的图形化配置置插件安装文文件可以到jjbpm-sstarteers-kiit-3.11.4jbbpm-deesigneer jbbpm-gppd-feaatureeclippse下找到到,需注意版版本。 部署署jbpm的的jar包和和moudlle的jarr包 1 把把如下jarr包放入WWEB-INNFlibb文件夹下, spriing-mooduless-jbpmm31.ja
8、ar可以在 sprinng-moddules-0.8下找找到,其它的的都属于jbbpm工具包包。 bshh-1.3.0.jarr bsf.jar sspringg-moduules-jjbpm311.jar jbpm-webappp-3.11.4.jaar jbppm-ideentityy-3.1.4.jarr jbpmm-3.1.4.jarr 部署hbbm文件到项项目 1 在在jbpm文文件夹中找到到所有的*.hbm.xxml数据库库映射文件。放放到项目的一一个文件夹当当中。本例放放到commgressoftssecuriitymoodelhhbm文件夹夹中。并且在在hiberrnate的的
9、sessiionfacctory建建立时,设置置为相关路径径配置。 22 此文件需需在spriing管理的的hiberrnate配配置文件下修修改,本例为为 dataaAccesssConttext-hhibernnate.xxml,如下下: orgg.hibeernatee.diallect.OOraclee9Diallect truee oorg.hiibernaate.caache.EEhCachheProvvider true classspath*:/comm/gressoft/ssecuriity/moodel/hhbm/ 设置置大字段sttring-max 11 此文件需需在sp
10、riing管理的的hiberrnate配配置文件下修修改,本例为为 dataaAccesssConttext-hhibernnate.xxml,如下下: 配置configration、template 说明: jbpmConfiguration是根据springmodules所提供的 LocalJbpmConfigurationFactoryBean进行配置,其集成好对jbpmConfiguration的管理。在系统使用时JbpmConfiguration需调用jbpmTemplate的jbpmTemplate.getJbpmConfiguration()方法得到。 1 此文件需在spring
11、管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: 2 增加类路径中jbpm.cfg.xml文件,可以根据 jbpm-starters-kit-3.1.4jbpmsrcjava.jbpmorgjbpmdefault.jbpm.cfg.xml 复制后修改。本例放到/datasql/jbpm.cfg.xml下。上面配置文件有相关配置。全部内容如下: ! - 增加如下内容 - !- 不再使用- 过滤器的设置与建立 过滤器的建立是为了保证一个session的正常工作。 1 web.xml中的修改 本例中描述如下: JbpmContex
12、tFilter ponents.jbpm.JbpmContextHolder 2建立对应的类文件 本例中描述如下: package ponents.jbpm; import java.io.IOException; import java.io.Serializable; import java.security.Principal; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletExcep
13、tion; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import org.jbpm.JbpmConfiguration; import org.jbpm.JbpmContext; import org.springframework.web.context.WebApplicationContext; public class JbpmContextHolder implements Filte
14、r, Serializable private static final long serialVersionUID = 1L; String jbpmConfigurationResource = null; String jbpmContextName = null; boolean isAuthenticationEnabled = true; public void init(FilterConfig filterConfig) throws ServletException / get the jbpm configuration resource this.jbpmConfigur
15、ationResource = filterConfig .getInitParameter(jbpm.configuration.resource); / get the jbpm context to be used from the jbpm configuration this.jbpmContextName = filterConfig .getInitParameter(jbpm.context.name); if (jbpmContextName = null) jbpmContextName = JbpmContext.DEFAULT_JBPM_CONTEXT_NAME; /
16、see if authentication is turned off String isAuthenticationEnabledText = filterConfig .getInitParameter(authentication); if (isAuthenticationEnabledText != null) & (disabled.equalsIgnoreCase(isAuthenticationEnabledText) isAuthenticationEnabled = false; public void doFilter(ServletRequest servletRequ
17、est, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException String actorId = null; / see if we can get the authenticated swimlaneActorId if (servletRequest instanceof HttpServletRequest) HttpServletRequest httpServletRequest = (HttpServletRequest) servletReque
18、st; Principal userPrincipal = httpServletRequest.getUserPrincipal(); if (userPrincipal != null) actorId = userPrincipal.getName(); JbpmContext jbpmContext = getJbpmConfiguration(servletRequest) .createJbpmContext(jbpmContextName); try if (isAuthenticationEnabled) jbpmContext.setActorId(actorId); fil
19、terChain.doFilter(servletRequest, servletResponse); finally jbpmContext.close(); /* * 从spring获取JbpmConfiguration的bean加载方式 */ protected JbpmConfiguration getJbpmConfiguration( ServletRequest servletRequest) WebApplicationContext webApplicationContext = (WebApplicationContext) (HttpServletRequest) ser
20、vletRequest) .getSession() .getServletContext() .getAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) webApplicationContext .getBean(jbpmConfiguration); / 得到业务Bean(在这里是你需要注入的bean) System.out.println(-); System.out.println(jbpmconfiguration对象化= + jbpmConfiguration.toString(); System.out.println(-