试谈ssh+jbpm整合.docx

上传人:飞**** 文档编号:44054572 上传时间:2022-09-20 格式:DOCX 页数:19 大小:16.05KB
返回 下载 相关 举报
试谈ssh+jbpm整合.docx_第1页
第1页 / 共19页
试谈ssh+jbpm整合.docx_第2页
第2页 / 共19页
点击查看更多>>
资源描述

《试谈ssh+jbpm整合.docx》由会员分享,可在线阅读,更多相关《试谈ssh+jbpm整合.docx(19页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、简述 Jbpm工作流框架与现有ssh框架的集成工作其实很简单,但国内外的资料太小,所以会在集成时走入太多误区,本文是在struts1.2,spring2.5,hibernate3.2上集成成功的详细步骤。其中解决了,jbpm的访问数据库session与原有hibernate的session不同的问题,string-max大字段问题。完成了流程部署web及后台程序。利用spring-modules-0.8当中的spring31做为集成的桥梁(其实它已经做好了集成,但文档和实例实在是太简单)。 使用jbpm-starters-kit-3.1.4生成数据库表及安装eclipse图形化配置插件 1下载

2、jbpm-starters-kit-3.1.4到其网站,包含所有需要的工具及jar包。 2数据库的安装以oracle为例,其它数据库可按此例修改。 2.1创建所需用户及表空间,如果有了用户和表空间就不需要了。 2.2 找到jbpm-starters-kit-3.1.4文件夹,在其下的jbpm文件夹的下级文件夹lib中加入oracle的驱动包ojdbc14.jar. 2.3 在jbpmsrcresources文件夹下建立oracle文件夹, 将jbpmsrcresourceshsqldb里的create.db.hibernate.properties和identity.db.xml文件copy到

3、刚刚建立的oracle文件夹当中. 2.4 修改create.db.hibernate.properties文件,修改目标数据库的连接属性如下: # these properties are used by the build script to create # a hypersonic database in the build/db directory that contains # the jbpm tables and a process deployed in there hibernate.dialect=org.hibernate.dialect.OracleDialect h

4、ibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver hibernate.connection.url=jdbc:oracle:thin:10.62.1.12:1521:oracle hibernate.connection.username=dpf hibernate.connection.password=dpf hibernate.show_sql=true hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider 2.5

5、修改jbpmsrcconfig.fileshibernate.cfg.xml文件,同样是配置数据库的连接属性如下: org.hibernate.dialect.OracleDialect oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:10.62.1.12:1521:oracle dpf dpf org.hibernate.cache.HashtableCacheProvider 2.6 修改jbpmbuild.deploy.xml文件.找到create.db项并进行如下修改: 2.7 配置ant,在jbpm目录执行 ant create.db

6、 buildfile build.deploy.xml命令。 会有一些小错误的提示,没有关系数据库的表已经建立完成。 2.8 eclipse的图形化配置插件安装文件可以到jbpm-starters-kit-3.1.4jbpm-designer jbpm-gpd-featureeclipse下找到,需注意版本。 部署jbpm的jar包和moudle的jar包 1 把如下jar包放入WEB-INFlib文件夹下, spring-modules-jbpm31.jar可以在 spring-modules-0.8下找到,其它的都属于jbpm工具包。 bsh-1.3.0.jar bsf.jar sprin

7、g-modules-jbpm31.jar jbpm-webapp-3.1.4.jar jbpm-identity-3.1.4.jar jbpm-3.1.4.jar 部署hbm文件到项目 1 在jbpm文件夹中找到所有的*.hbm.xml数据库映射文件。放到项目的一个文件夹当中。本例放到comgresoftsecuritymodelhbm文件夹中。并且在hibernate的sessionfactory建立时,设置为相关路径配置。 2 此文件需在spring管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: org.hiberna

8、te.dialect.Oracle9Dialect true org.hibernate.cache.EhCacheProvider true classpath*:/com/gresoft/security/model/hbm/ 设置大字段string-max 1 此文件需在spring管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: 配置configration、template 说明: jbpmConfiguration是根据springmodules所提供的 LocalJbpmConfigurationFactory

9、Bean进行配置,其集成好对jbpmConfiguration的管理。在系统使用时JbpmConfiguration需调用jbpmTemplate的jbpmTemplate.getJbpmConfiguration()方法得到。 1 此文件需在spring管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: 2 增加类路径中jbpm.cfg.xml文件,可以根据 jbpm-starters-kit-3.1.4jbpmsrcjava.jbpmorgjbpmdefault.jbpm.cfg.xml 复制后修改。本例放到/datasq

10、l/jbpm.cfg.xml下。上面配置文件有相关配置。全部内容如下: ! - 增加如下内容 - !- 不再使用- 过滤器的设置与建立 过滤器的建立是为了保证一个session的正常工作。 1 web.xml中的修改 本例中描述如下: JbpmContextFilter ponents.jbpm.JbpmContextHolder 2建立对应的类文件 本例中描述如下: package ponents.jbpm; import java.io.IOException; import java.io.Serializable; import java.security.Principal; imp

11、ort javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import org.jbpm.JbpmConfiguration; import org

12、.jbpm.JbpmContext; import org.springframework.web.context.WebApplicationContext; public class JbpmContextHolder implements Filter, Serializable private static final long serialVersionUID = 1L; String jbpmConfigurationResource = null; String jbpmContextName = null; boolean isAuthenticationEnabled = t

13、rue; public void init(FilterConfig filterConfig) throws ServletException / get the jbpm configuration resource this.jbpmConfigurationResource = filterConfig .getInitParameter(jbpm.configuration.resource); / get the jbpm context to be used from the jbpm configuration this.jbpmContextName = filterConf

14、ig .getInitParameter(jbpm.context.name); if (jbpmContextName = null) jbpmContextName = JbpmContext.DEFAULT_JBPM_CONTEXT_NAME; / see if authentication is turned off String isAuthenticationEnabledText = filterConfig .getInitParameter(authentication); if (isAuthenticationEnabledText != null) & (disable

15、d.equalsIgnoreCase(isAuthenticationEnabledText) isAuthenticationEnabled = false; public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException String actorId = null; / see if we can get the authenticated swimlaneAct

16、orId if (servletRequest instanceof HttpServletRequest) HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; Principal userPrincipal = httpServletRequest.getUserPrincipal(); if (userPrincipal != null) actorId = userPrincipal.getName(); JbpmContext jbpmContext = getJbpmConfigur

17、ation(servletRequest) .createJbpmContext(jbpmContextName); try if (isAuthenticationEnabled) jbpmContext.setActorId(actorId); filterChain.doFilter(servletRequest, servletResponse); finally jbpmContext.close(); /* * 从spring获取JbpmConfiguration的bean加载方式 */ protected JbpmConfiguration getJbpmConfiguratio

18、n( ServletRequest servletRequest) WebApplicationContext webApplicationContext = (WebApplicationContext) (HttpServletRequest) servletRequest) .getSession() .getServletContext() .getAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); JbpmConfiguration jbpmConfiguration = (JbpmCon

19、figuration) webApplicationContext .getBean(jbpmConfiguration); / 得到业务Bean(在这里是你需要注入的bean) System.out.println(-); System.out.println(jbpmconfiguration对象化= + jbpmConfiguration.toString(); System.out.println(-); return jbpmConfiguration; public void destroy() 编写发布流程定义xml的人机页面及程序 1 JSP页面使用struts1.2,spring2.0,hibernate3.2框架。此为流程发布页面。 请选择要发布的流程文件 2 后台对应类 /* * 文件名: JbpmAction.java * 版本: * 描述: * 版权所有: * / * 创建者: 沙振中 * 创建日期: Dec 27, 2007 * 修改者: * 修改日期: * 修改说明: *

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作报告

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com