《ssh+jbpm整合bapp.docx》由会员分享,可在线阅读,更多相关《ssh+jbpm整合bapp.docx(19页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Evaluation Warning: The document was created with Spire.Doc for .NET.简述 Jbbpm工作作流框架与与现有sssh框架的的集成工作作其实很简简单,但国国内外的资资料太小,所所以会在集集成时走入入太多误区区,本文是是在strruts11.2,ssprinng2.55,hibbernaate3.2上集成成成功的详详细步骤。其中解决决了,jbbpm的访访问数据库库sesssion与与原有hiibernnate的的sesssion不不同的问题题,strring-max大大字段问题题。完成了了流程部署署web及及后台程序序。利用sspr
2、inng-moodulees-0.8当中的的spriing311做为集成成的桥梁(其其实它已经经做好了集集成,但文文档和实例例实在是太太简单)。 使用jjbpm-starrterss-kitt-3.11.4生成成数据库表表及安装eeclippse图形形化配置插插件 1下下载jbppm-sttarteers-kkit-33.1.44到其网站站,包含所所有需要的的工具及jjar包。 2数据据库的安装装以oraacle为为例,其它它数据库可可按此例修修改。 22.1创建建所需用户户及表空间间,如果有有了用户和和表空间就就不需要了了。 2.2 找到到jbpmm-staarterrs-kiit-3.1.
3、4文文件夹,在在其下的jjbpm文文件夹的下下级文件夹夹lib中中加入orraclee的驱动包包ojdbbc14.jar. 2.33 在jbbpmssrcrresouurcess文件夹下下建立orraclee文件夹, 将jjbpmsrcresoourceeshssqldbb里的crreatee.db.hibeernatte.prroperrtiess和ideentitty.dbb.xmll文件coopy到刚刚刚建立的的oraccle文件件夹当中. 2.4 修改create.db.hibernate.properties文件,修改目标数据库的连接属性如下: # these properties
4、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 hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver hibernate.connection.url=jd
5、bc: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 修改jbpmsrcconfig.fileshibernate.cfg.xml文件,同样是配置数据库的连接属性如下: org.hibernate.dialect.OracleDialec
6、t 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 buildfile build.deploy.xml命令。 会有一些小错误的提示,没有关系数据库的表已经建立完成。 2.8 eclipse的图形化配置插件安装文件可以到jbpm-st
7、arters-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 spring-modules-jbpm31.jar jbpm-webapp-3.1.4.jar jbpm-identity-3.1.4.jar jbpm-3.1.4.jar 部署hbm文件到项目
8、 1 在jbpm文件夹中找到所有的*.hbm.xml数据库映射文件。放到项目的一个文件夹当中。本例放到comgresoftsecuritymodelhbm文件夹中。并且在hibernate的sessionfactory建立时,设置为相关路径配置。 2 此文件需在spring管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: org.hibernate.dialect.Oracle9Dialect true org.hibernate.cache.EhCacheProvider true classpath*:/com/gres
9、oft/security/model/hbm/ 设置大字段string-max 1 此文件需在spring管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: 配置configration、template 说明: jbpmConfiguration是根据springmodules所提供的 LocalJbpmConfigurationFactoryBean进行配置,其集成好对jbpmConfiguration的管理。在系统使用时JbpmConfiguration需调用jbpmTemplate的jbpmTemplate.getJb
10、pmConfiguration()方法得到。 1 此文件需在spring管理的hibernate配置文件下修改,本例为 dataAccessContext-hibernate.xml,如下: 2 增加类路径中jbpm.cfg.xml文件,可以根据 jbpm-starters-kit-3.1.4jbpmsrcjava.jbpmorgjbpmdefault.jbpm.cfg.xml 复制后修改。本例放到/datasql/jbpm.cfg.xml下。上面配置文件有相关配置。全部内容如下: ! - 增加如下内容 - !- 不再使用- 过滤器的设置与建立 过滤器的建立是为了保证一个session的正常工
11、作。 1 web.xml中的修改 本例中描述如下: JbpmContextFilter 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.FilterConfi
12、g; import javax.servlet.ServletException; 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 clas
13、s JbpmContextHolder implements Filter, 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 conf
14、iguration resource this.jbpmConfigurationResource = 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 = JbpmC
15、ontext.DEFAULT_JBPM_CONTEXT_NAME; / see if authentication is turned off String isAuthenticationEnabledText = filterConfig .getInitParameter(authentication); if (isAuthenticationEnabledText != null) & (disabled.equalsIgnoreCase(isAuthenticationEnabledText) isAuthenticationEnabled = false; public void
16、 doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException String actorId = null; / see if we can get the authenticated swimlaneActorId if (servletRequest instanceof HttpServletRequest) HttpServletRequest httpServletRequest
17、 = (HttpServletRequest) servletRequest; Principal userPrincipal = httpServletRequest.getUserPrincipal(); if (userPrincipal != null) actorId = userPrincipal.getName(); JbpmContext jbpmContext = getJbpmConfiguration(servletRequest) .createJbpmContext(jbpmContextName); try if (isAuthenticationEnabled)
18、jbpmContext.setActorId(actorId); filterChain.doFilter(servletRequest, servletResponse); finally jbpmContext.close(); /* * 从spring获取JbpmConfiguration的bean加载方式 */ protected JbpmConfiguration getJbpmConfiguration( ServletRequest servletRequest) WebApplicationContext webApplicationContext = (WebApplicat
19、ionContext) (HttpServletRequest) servletRequest) .getSession() .getServletContext() .getAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) webApplicationContext .getBean(jbpmConfiguration); / 得到业务Bean(在这里是你需要注入的bean) Sy
20、stem.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 * 版本: * 描述: * 版权所有: * /