<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>蓝黑梅阿查</title>
    <description>耕地靠牛，点灯靠油，日复一日，娱乐靠球！</description>
    <link>http://liumingm.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
          <item>
        <title>一些表格的特效代码</title>
        <author>天空不空</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://liumingm.javaeye.com">天空不空</a>&nbsp;
                    链接：<a href="http://liumingm.javaeye.com/blog/238434" style="color:red;">http://liumingm.javaeye.com/blog/238434</a>&nbsp;
          发表时间: 2008年09月08日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          表格特效代码全集中 - - <br /><br />1. 两种细线表格做法 <br /><br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;table width="100%" border="1" bordercolor="#000000"> <br />&lt;tr bordercolor="#FFFFFF"> <br />&lt;td>表格边线为1，线色为黑，行线色为白。&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br />&lt;p> <br />&lt;table width="100%" border="0" cellspacing="1" bgcolor="#000000"> <br />&lt;tr> <br />&lt;td bgcolor="#FFFFFF">表格边线为0，间距为1，背景色为黑，行背景色为白。&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br /><br />　　2. 立体表格 <br /><br /><br />　　源码如下： <br /><br />&lt;table border=1 cellspacing=0 width=100% bordercolorlight=#333333 bordercolordark=#efefef> <br />&lt;tr bgcolor=#cccccc> <br />&lt;td>it365cn&lt;/td> <br />&lt;td>it365cn&lt;/td> <br />&lt;td>it365cn&lt;/td> <br />&lt;td>it365cn&lt;/td> <br />&lt;/tr> <br />&lt;tr bgcolor=#cccccc> <br />&lt;td>cnbruce&lt;/td> <br />&lt;td>cnbruce&lt;/td> <br />&lt;td>cnbruce&lt;/td> <br />&lt;td>cnbruce&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br />&lt;center>表格边线为1，间隔为0，左上为#333333，右下为#efefef,行背景色为#cccccc <br /><br />　　3. 另类圆角表格制作 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />　　源码如下： <br /><br />原图： <br />&lt;table cellpadding=0 cellspacing=0 border=0 width=282 align=center> <br />&lt;tr height=1> <br />&lt;td rowspan=4 width=1>&lt;/td> <br />&lt;td rowspan=3 width=1>&lt;/td> <br />&lt;td rowspan=2 width=1>&lt;/td> <br />&lt;td width=2>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td width=2>&lt;/td> <br />&lt;td rowspan=2 width=1>&lt;/td> <br />&lt;td rowspan=3 width=1>&lt;/td> <br />&lt;td rowspan=4 width=1>&lt;/td> <br />&lt;/tr> <br />&lt;tr height=1> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;/tr> <br />&lt;tr height=1> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td colspan=3 bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;/tr> <br />&lt;tr height=2> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td colspan=5 bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br />&lt;p>放大 <br />&lt;table cellpadding=0 cellspacing=0 border=1 width=282 align=center> <br />&lt;tr height=10> <br />&lt;td rowspan=4 width=10>&lt;/td> <br />&lt;td rowspan=3 width=10>&lt;/td> <br />&lt;td rowspan=2 width=10>&lt;/td> <br />&lt;td width=20>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td width=20>&lt;/td> <br />&lt;td rowspan=2 width=10>&lt;/td> <br />&lt;td rowspan=3 width=10>&lt;/td> <br />&lt;td rowspan=4 width=10>&lt;/td> <br />&lt;/tr> <br />&lt;tr height=10> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;/tr> <br />&lt;tr height=10> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td colspan=3 bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;/tr> <br />&lt;tr height=20> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;td colspan=5 bgcolor=#43B5C9>&lt;/td> <br />&lt;td bgcolor=#43B5C9>&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br /><br />4. 虚线边框表格 <br /><br /><br />　　源码如下： <br /><br />&lt;style type="text/css"> <br />.tb{BORDER-BOTTOM: #000000 1px dotted;BORDER-top: #000000 1px dotted;BORDER-LEFT: <br />#000000 1px dotted;BORDER-RIGHT: #000000 1px dotted;} <br />&lt;/style> <br />&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"> <br />&lt;tr> <br />&lt;td class="tb">&lt;center>www.blueidea.com&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br />&lt;p> <br />虚线直线1 <br />&lt;hr size=1 style="border:1px dotted #001403;"> <br />虚线直线2 <br />&lt;p size=1 style="border:1px dotted #001403;"> <br /><br />5. 分类型表格 <br /><br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;fieldset> <br />&lt;legend>item&lt;/legend> <br />content <br />&lt;/fieldset> <br /><br /><br />6. 变色的单元格1，通过a:hover做 <br /><br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;style> <br />a:link,a:visited,a:hover <br />{width:100%;text-decoration:none;font-family:verdana;font-size:10px;color:white} <br />a:hover{background:#0099ff;color:black} <br />td{background:#3366cc;color:white;padding:0px} <br />&lt;/style> <br /><br />&lt;TABLE width=100% cellspacing=1 bgcolor=black > <br />&lt;TR> <br />&lt;TD>&lt;a href="#">Blueidea <br />&lt;TD>&lt;a href="#">.com <br />&lt;TR> <br />&lt;TD>&lt;a href="#">CNBruce <br />&lt;TD>&lt;a href="#">.com <br />&lt;/TABLE> <br /><br />7. 变色的单元格2，已经做成了CSS，注意还有透明效果 <br /><br />　　源码如下： <br /><br />&lt;style type="text/css"> <br />.aa <br />{ background-color:#0000ff; color:#ff0000;filter: alpha(opacity=50)} <br />.bb <br />{ background-color:#3366cc; color:#ffffff} <br />&lt;/style> <br /><br /><br />&lt;table width="100%"> <br />&lt;tr> <br />&lt;td onmouseover="this.className='aa'" onmouseout="this.className='bb'" <br />class="bb">&lt;center>&lt;b>cnbruce&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br /><br /><br />8. 变色的单元格3，通过mouse事件做.有点微软的味道 <br /><br /><br /><br /><br /><br />　　源码如下： <br />&lt;table width="100%" border="1" cellpadding="3" cellspacing="0" <br />bordercolor="#efefef" bgcolor="#efefef"> <br />&lt;tr> <br />&lt;td onMouseOut="this.bgColor='#efefef';this.borderColor='#efefef'"; <br />onMouseOver="this.bgColor='#cccccc'; this.borderColor='#000033'">&lt;div align="left"> <br />Blueidea&lt;/div>&lt;/td> <br />&lt;/tr> <br />&lt;tr> <br />&lt;td <br />onMouseOut="this.bgColor='#efefef';this.borderColor='#efefef'"; onMouseOver="this.bgColor='#cccccc'; this.borderColor='#000033'"> <br />cnbruce&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br /><br />9. 透明表格 <br /><br />&lt;table bgcolor=#ececec style="filter:alpha(opacity=50)" width=200 height=100 border=0> <br />&lt;tr>&lt;td>&lt;center>cnbruce&lt;/td>&lt;/tr> <br />&lt;/table> <br /><br />10. 表格边框显示外阴影 <br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;table align=center width=200 height=100 bgcolor=#f3f3f3 <br />style="filter:progid:DXImageTransform.Microsoft.Shadow <br />(Color=#333333,Direction=120,strength=5)"> <br />&lt;tr> <br />&lt;td>&lt;center>www.cnbruce.com&lt;/td> <br />&lt;/tr> <br />&lt;/table> <br /><br />11. VML代码实现的圆角表格 <br />(1). <br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;html xmlns:v> <br />&lt;style> <br />v\:*{behavior:url(#default#VML)} <br />&lt;/style> <br />&lt;body> <br />&lt;v:RoundRect style="position:relative;width:150;height:240px"> <br />&lt;v:shadow on="T" type="single" color="#b3b3b3" offset="3px,3px"/> <br />&lt;v:TextBox style="font-size:10.2pt;">VML&lt;/v:TextBox> <br />&lt;/v:RoundRect> <br />&lt;/body> <br />&lt;/html> <br /><br />(2). <br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;html xmlns:v> <br />&lt;style> <br />v\:*{behavior:url(#default#VML)} <br />&lt;/style> <br />&lt;body> <br />&lt;v:RoundRect style="position:relative;width:150;height:240px"> <br />&lt;v:path textpathok="true" /> <br />&lt;v:textpath on="true" string="cnbrucecnbrucecnbrucecnbrucecnbruc <br />ecnbrucecnbrucecnbrucecnbrucecnbrucecnbrucecnbrucecnbrucecnbrucecnbruce" /> <br />&lt;v:shadow on="T" type="single" color="#b3b3b3" offset="3px,3px"/> <br />&lt;v:TextBox style="font-size:10.2pt;">VML&lt;/v:TextBox> <br />&lt;/v:RoundRect> <br />&lt;/body> <br />&lt;/html> <br /><br />(3). <br /><br /><br /><br /><br /><br />　　源码如下： <br /><br />&lt;html xmlns:v> <br />&lt;style> <br />v\:*{behavior:url(#default#VML)} <br />&lt;/style> <br />&lt;body> <br />&lt;v:RoundRect style="position:relative;width:150;height:240px" arcsize=0.5> <br />&lt;v:shadow on="T" type="single" color="#b3b3b3" offset="3px,3px"/> <br />&lt;v:TextBox style="font-size:10.2pt;">VML&lt;/v:TextBox> <br />&lt;/v:RoundRect> <br />&lt;/body> <br />&lt;/html> <br /><br /><br />本文引自：http://aliax.bokee.com/2371127.html
          <br/><br/>
          <span style="color:red;">
            <a href="http://liumingm.javaeye.com/blog/238434#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/138' target='_blank'><span style="color:red;font-weight:bold;">加入阿里巴巴，发展潜力无限</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 08 Sep 2008 10:15:57 +0800</pubDate>
        <link>http://liumingm.javaeye.com/blog/238434</link>
        <guid>http://liumingm.javaeye.com/blog/238434</guid>
      </item>
          <item>
        <title>传说中的1024：网络打手身后隐现亿元黑金</title>
        <author>天空不空</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://liumingm.javaeye.com">天空不空</a>&nbsp;
                    链接：<a href="http://liumingm.javaeye.com/blog/237742" style="color:red;">http://liumingm.javaeye.com/blog/237742</a>&nbsp;
          发表时间: 2008年09月05日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          　　哪有什么网络民意？网络民意已经捏在少数人的手里了……为了钱，这些人有能力把白说成黑，把黑说成白，能决定一个企业的生死，也能轻易让一个人身败名裂<br /><br /><br />　　“请不要发表攻击性的口水帖了，还论坛一个清净吧。”9月初的一天，喜欢泡网的小霍在某个业内论坛发帖表示抗议。很多人注意到他的声音。然而，攻击某个企业的帖子依然雨后春笋般层出不穷，令他目不暇接。小霍最后沮丧地说，他再也不上这个论坛了。<br /><br />　　实际上，“口水战”为何总是铺天盖地，历经数月也不能停息？是什么力量在背后推波助澜？到底又是什么在潜移默化影响网民的判断和想法？不仅是普通网民，就是一些网站管理者也对此大惑不解。<br /><br />　　一种常见的认识是：口水战不过是无聊网友的恶作剧，如同其他“网络暴力”一般，随着时间推移以及网民参与数量的增多或减少，“民意”将决定孰是孰非，事实真相也终将曝光于世。<br /><br />　　但在从事公关行业多年的谢贤(为保护受访者，此处用化名)看来，这类观点却未免有些无知和可笑。“你们根本不知道这里面的水有多深，有多浑。哪里还有网络民意？网络民意已经捏在少数人的手里了。”日前，在朝阳区的一个咖啡厅，谢先生在接受《财经时报》采访时声称。<br /><br />　　据谢先生透露说，最近3年来，国内互联网已经形成了庞大的势力群体，这个群体多以公关公司或营销公司的面目出现，他们明里打着“论坛营销”或“网络营销”的幌子，实际上却做着帮助某些企业打击异己的事情。仅在北京，从事“网络打手”生意的公关公司就多达数百家。<br /><br />　　更可怕的是，这股势力几乎控制了国内所有的主流论坛，在全国各地拥有数以万计的兼职员工，并收买了大量的论坛版主。“为了钱，他们有能力把白说成黑，把黑说成白，能决定一个企业的生死，也能轻易让一个人身败名裂。”<br /><br />　　“网络打手”由来<br /><br />　　“网络打手业务的出现，使原本前景无限的网络营销行业蒙上了阴影，也让这个行业背上了恶名。”谢先生透露说，除了那些“打手公司”自己外，大多数公关公司都对这一现象敢怒不敢言。<br /><br />　　据悉，“网络营销”这个词由来已久，形成行业规模却是近两年的事情。蓝色光标内部人士透露说，两年前蓝色光标还才刚开始涉足这个领域，去年营销收入达到700万元，今年上半年，网络营销收入更是超过3000万元。<br /><br />　　而整个北京地区，每年相关交易就可能多达数亿元。<br /><br />　　将目光转向互联网，也成为了几乎所有公关公司的共识。除了蓝色光标外，奥美、迪思等知名公关企业也在发力网络营销。玄鸟营销顾问CEO郭开森向《财经时报》透露，随着互联网影响力的提升，企业对网络营销的需求也在大幅提升，目前网络营销市场正风生水起，甚至还存在有价无市的局面。<br /><br />　　“一方面，要求在互联网做营销的企业越来越多，另一方面，真正有实力接单的公关公司却很少，要价很高。”郭开森说，现在网络营销比传统公关更吃香，不仅现金提前结算，而且利润更高。<br /><br />　　不过，正是由于暴利诱使，以及市场的不规范，再加上某些企业打击竞争对手的“需求”也相当旺盛，数量庞大的“打手公司”也由此应运而生。<br /><br />　　业内资深人士刘韧在博客里也透露说，并不是只有中小公司才雇佣“网络打手”。某知名跨国公司CEO在公开场合大声疾呼停止网络暴力，并声称深受其害，但私底下他也雇佣论坛打手回骂“骂他的人”。<br /><br />　　传说中的“1024”<br /><br />　　百度一下关键词“网络打手”，很容易搜索到一家名叫“1024”的公司。实际上，这家一直流传在IT圈的神秘公司，也是众多“打手公司”的奋斗楷模和发迹传奇。<br /><br />　　《财经时报》辗转了解到，传说中的“1024”真名为1024互动营销顾问(北京)有限公司，这家公司成立于2005年，位于北京朝阳区。据该知情人透露，“1024”在成立时，主要是为某市场份额最大的杀毒软件公司服务，后随业务增长迅速，其业务也扩展到其他互联网公司。<br /><br />　　该人士还透露说，“1024”的业务内容除了在各大论坛维护客户的正面形象之外，还参与攻击客户竞争对手的产品及形象。事实上，过去发生在杀毒企业之间的多起口水战中，“1024”就充当了很不光彩的角色，它还因攻击性而被指责为“网络打手”，并引起法律纠纷。<br /><br />　　但这些法律纠纷并不能影响“1024”的快速崛起。今年中旬，“1024”首席执行官童紫静就在艾瑞营销年会上公开宣称：“1024先后服务于100多家知名公司、相关行业的领军企业，拥有监控10万个论坛及维护言论的能力，拥有1000人的营销队伍，拥有独到的网络言论监控系统，可以第一时间提供网络言论的监控报告，同时对相关言论作出反应。”——所谓“作出反应”的言外之意，有需求的人士自然能够心领神会。<br /><br />　　一些传媒巨头的触角也开始伸向这个领域。有消息称，4月18日，分众传媒已秘密完成了对“1024”的收购，收购金额为1000万美元。“这还是网上流传的数字，实际据我所知出售价格远远超出1000万美元。”上述知情人士透露。不过截至发刊前，分众传媒并没有对此给予任何答复。<br /><br />　　另有人士还爆料称，在最近沸沸扬扬的一场口水战中，某杀毒软件企业用于打口水战的费用每月多达50万元，其中付给“1024”的费用就达30万元。而在过去3年，1024从该杀毒软件厂家手中获得市场营销费用多达千万元之巨。<br /><br />　　原文：http://tech.sina.com.cn/i/2008-09-05/10542438275.shtml
          <br/><br/>
          <span style="color:red;">
            <a href="http://liumingm.javaeye.com/blog/237742#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/138' target='_blank'><span style="color:red;font-weight:bold;">加入阿里巴巴，发展潜力无限</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 05 Sep 2008 17:54:47 +0800</pubDate>
        <link>http://liumingm.javaeye.com/blog/237742</link>
        <guid>http://liumingm.javaeye.com/blog/237742</guid>
      </item>
          <item>
        <title>JBPM入门例子</title>
        <author>天空不空</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://liumingm.javaeye.com">天空不空</a>&nbsp;
                    链接：<a href="http://liumingm.javaeye.com/blog/216239" style="color:red;">http://liumingm.javaeye.com/blog/216239</a>&nbsp;
          发表时间: 2008年07月18日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;"> jBPM </span>
<span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">之前是一个开源软件，后加入<span lang="EN-US"> JBoss </span>
组织。正好我们公司也是用<span lang="EN-US"> JBoss </span>
的。不过<span lang="EN-US"> jBPM </span>
并没有绑定在<span lang="EN-US"> JBOSS </span>
上，<span lang="EN-US"> Tomcat </span>
等也可以使用它。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;&nbsp;&nbsp; jBPM </span>
<span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">的正处在不断发展中，做为开源软件的特点，其设计变化往往很大。所以一些过去的资料可能已经不适用了。于是作者根据自己的使用经验，重新整理出这份文档，以备学习参考。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 楷体_GB2312;">注：本文使用的</span>
<span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;"> jBPM </span>
<span style="font-size: 12pt; line-height: 150%; font-family: 楷体_GB2312;">版本为</span>
<span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;"> 3.1.1 </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 3pt; line-height: 150%; text-align: left;"><strong><span style="line-height: 150%; font-family: 黑体;">环境准备</span>
</strong>
<strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</strong>
</p>
<div style="padding: 0cm; margin-left: 7.5pt; margin-right: 7.5pt; border: medium medium 1pt none none solid -moz-use-text-color -moz-use-text-color #aaaaaa;">
<p class="MsoNormal" align="left" style="border: medium none; margin: 0cm 0cm 0pt; padding: 0cm; line-height: 150%; text-align: left;"><strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;">1</span>
</strong>
<strong><span style="line-height: 150%; font-family: 宋体;">、安装</span>
</strong>
<strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;">JDK</span>
</strong>
</p>
</div>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">所有<span lang="EN-US"> JAVA </span>
开发第一个需要安装的，没什么好说的。记得把系统变量<span lang="EN-US"> JAVA_HOME </span>
设上。<span lang="EN-US"> </span>
</span>
</p>
<div style="padding: 0cm; margin-left: 7.5pt; margin-right: 7.5pt; border: medium medium 1pt none none solid -moz-use-text-color -moz-use-text-color #aaaaaa;">
<p class="MsoNormal" align="left" style="border: medium none; margin: 0cm 0cm 0pt; padding: 0cm; line-height: 150%; text-align: left;"><strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;">2</span>
</strong>
<strong><span style="line-height: 150%; font-family: 宋体;">、安装</span>
</strong>
<strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;">Ant</span>
</strong>
</p>
</div>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">Ant </span>
<span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">是使用<span lang="EN-US"> jBPM </span>
必须的一个工具。<span lang="EN-US"> jBPM </span>
中的很多操作都要用到<span lang="EN-US"> Ant </span>
。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">安装方法：<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">（<span lang="EN-US"> 1 </span>
）先下载： <span lang="EN-US"><a href="http://archive.apache.org/dist/ant/binaries/"><span style="color: #1d58d1; text-decoration: none;">http://archive.apache.org/dist/ant/binaries/</span>
</a>
 </span>
，选一个如：<span lang="EN-US"> apache-ant-1.6.5-bin.zip </span>
。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">（<span lang="EN-US"> 2 </span>
）解压到<span lang="EN-US"> D:\ant </span>
（当然其他目录也可以）。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">（<span lang="EN-US"> 3 </span>
）设置如下系统变量：<span lang="EN-US"> ANT_HOME=d:\ant </span>
。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">（<span lang="EN-US"> 4 </span>
）把<span lang="EN-US"> %ANT_HOME%\bin </span>
加入到系统变量<span lang="EN-US"> PATH </span>
中。<span lang="EN-US"> </span>
</span>
</p>
<div style="padding: 0cm; margin-left: 7.5pt; margin-right: 7.5pt; border: medium medium 1pt none none solid -moz-use-text-color -moz-use-text-color #aaaaaa;">
<p class="MsoNormal" align="left" style="border: medium none; margin: 0cm 0cm 0pt; padding: 0cm; line-height: 150%; text-align: left;"><strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;">3</span>
</strong>
<strong><span style="line-height: 150%; font-family: 宋体;">、安装</span>
</strong>
<strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;">Eclipse</span>
</strong>
</p>
</div>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">Eclipse </span>
<span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">不是开发<span lang="EN-US"> jBPM </span>
必须的工具，但它是对<span lang="EN-US"> jBPM </span>
开发很有帮助的工具，特别是<span lang="EN-US"> jBPM </span>
提供了一个<span lang="EN-US"> Eclipse </span>
插件用来辅助开发<span lang="EN-US"> jBPM </span>
。关于<span lang="EN-US"> Eclipse </span>
的安装不赘述了，本文用的版本是：<span lang="EN-US"> Eclipse3.2 </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 3pt; line-height: 150%; text-align: left;"><strong><span style="line-height: 150%; font-family: 黑体;">安装</span>
</strong>
<strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
</strong>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">jBPM </span>
<span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">的下载地址： <span lang="EN-US"><a href="http://www.jboss.com/products/jbpm/downloads"><span style="color: #1d58d1; text-decoration: none;">http://www.jboss.com/products/jbpm/downloads</span>
</a>
 </span>
　<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">JBoss jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">是</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">的软件包</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">JBoss jBPM Starters Kit </span>
<span style="line-height: 150%; font-family: 宋体;">　是一个综合包，它包括了</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">软件包、开发插件、一个配置好了的基于</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> JBoss </span>
<span style="line-height: 150%; font-family: 宋体;">的</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">示例、一些数据库配置文件示例。</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">JBoss jBPM Process Designer Plugin </span>
<span style="line-height: 150%; font-family: 宋体;">　是辅助开发</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">的</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> Eclipse </span>
<span style="line-height: 150%; font-family: 宋体;">插件。</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">JBoss jBPM BPEL Extension jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">关于</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> BPEL </span>
<span style="line-height: 150%; font-family: 宋体;">的扩展包</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="line-height: 150%; font-family: 宋体;">本指南选择下载：</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> JBoss jBPM Starters Kit </span>
<span style="line-height: 150%; font-family: 宋体;">。下载后解压到</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> D:\jbpm-starters-kit-3.1 </span>
<span style="line-height: 150%; font-family: 宋体;">，目录下含有五个子目录：</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">jbpm </span>
<span style="line-height: 150%; font-family: 宋体;">　</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">的软件包</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">jbpm-bpel </span>
<span style="line-height: 150%; font-family: 宋体;">只含有一个网页</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">jbpm-db </span>
<span style="line-height: 150%; font-family: 宋体;">各种数据库</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> hibernate </span>
<span style="line-height: 150%; font-family: 宋体;">配置文件示例，有些还包含了相应的</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jdbc </span>
<span style="line-height: 150%; font-family: 宋体;">驱动程序。</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">jbpm-designer </span>
<span style="line-height: 150%; font-family: 宋体;">　辅助开发</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">的</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> Eclipse </span>
<span style="line-height: 150%; font-family: 宋体;">插件，具体在</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jbpm-gpd-feature </span>
<span style="line-height: 150%; font-family: 宋体;">子目录中</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 7.5pt; line-height: 150%; font-family: Wingdings;">l</span>
<span lang="EN-US" style="font-size: 7pt; line-height: 150%;"><span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;">jbpm-server </span>
<span style="line-height: 150%; font-family: 宋体;">　一个已经配置好了的基于</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> JBoss </span>
<span style="line-height: 150%; font-family: 宋体;">的</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> jBPM </span>
<span style="line-height: 150%; font-family: 宋体;">示例</span>
<span lang="EN-US" style="line-height: 150%; font-family: Arial;"> . </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 3pt; line-height: 150%; text-align: left;"><strong><span style="line-height: 150%; font-family: 黑体;">感觉下工作流</span>
</strong>
<strong><span lang="EN-US" style="line-height: 150%; font-family: Arial;"> </span>
</strong>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">前面我们说了，在<span lang="EN-US"> JBoss jBPM Starters Kit </span>
的<span lang="EN-US"> jbpm-server </span>
目录是一个已经配置好的了<span lang="EN-US"> jBPM </span>
示例，那么让我们来感觉一下<span lang="EN-US"> jBPM </span>
做出的东西吧。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">双击<span lang="EN-US"> jbpm-server </span>
目录下的<span lang="EN-US"> start.bat </span>
文件，启动<span lang="EN-US"> JBoss </span>
服务。这时会打开一个<span lang="EN-US"> DOS </span>
窗口，启动完成后，日志会不断输出，其中最后一句是&ldquo;<span lang="EN-US"> 13:55:39,937 DEBUG [StaticNotifier] going to wait for (CMD_EXECUTOR, java.lang.Object@1df59bd) </span>
&rdquo;，这表示<span lang="EN-US"> jBPM </span>
在开始工作了，它不断进行轮询。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">打开网页： <span lang="EN-US"><a href="http://localhost:8080/jbpm/"><span style="color: #1d58d1; text-decoration: none;">http://localhost:8080/jbpm/</span>
</a>
 </span>
　得到如下画面<span lang="EN-US"> <img src="http://www.360doc.com/UserImage/2434/20060828090520397.bmp" border="0" height="189" hspace="5" alt="" width="554" />
</span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp; </span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">这是一个已经用<span lang="EN-US"> jBPM </span>
开发好的用户定单流程，具有下单、审核、估价等流程。它所用的数据库是一个内置的数据库。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">以<span lang="EN-US"> cookie monster </span>
用户登录，选择&ldquo;<span lang="EN-US"> create new web sale order </span>
&rdquo;可以创建一个定单。如下图所示，在图左边是填写的定单情况，右边一整个定货流程的示意图，红色框表示流程进行到哪一步了。填写好定单好，选择&ldquo;<span lang="EN-US"> Save and Close Task </span>
&rdquo;，完成定单提交。<span lang="EN-US"> <img src="http://www.360doc.com/UserImage/2434/jg/20060828090708101.bmp" border="0" hspace="5" alt="" />
</span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">选择右上角的&ldquo;<span lang="EN-US"> Login as another user </span>
&rdquo;以另外一个用户名<span lang="EN-US"> ernie </span>
登录。这时可以看到<span lang="EN-US"> ernie </span>
用户的任务列表中多了一项。<span lang="EN-US"> <img src="http://www.360doc.com/UserImage/2434/jg/20060828090807912.bmp" border="0" height="302" hspace="5" alt="" width="554" />
</span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">点进去后，显示如下画面。这个示例对中文的支持不好，全都显示成了<span lang="EN-US"> unicode </span>
码了。不管这什么多，反正知道是这么回事就行了。在<span lang="EN-US"> comment </span>
项填写意见，选<span lang="EN-US"> OK </span>
按钮，进入到下一步。如果选择 <span lang="EN-US">more info needed </span>
按钮，则打回给<span lang="EN-US"> cookie monster </span>
用户修改定单。<span lang="EN-US"> <img src="http://www.360doc.com/UserImage/2434/jg/20060828090908955.bmp" border="0" height="271" hspace="5" alt="" width="554" />
</span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span lang="EN-US" style="font-size: 12pt; line-height: 150%; font-family: 宋体;">&nbsp;</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">下面的流程，这里就不再赘述了。在这个很标准的工作流示例中，我们基本可以看到<span lang="EN-US"> jBPM </span>
的应用范围还是比较广的。而且从这个示例，我们是看不出有<span lang="EN-US"> jBPM </span>
的，也就是说 <span lang="EN-US">jBPM </span>
在后台起着作用。<span lang="EN-US"> </span>
</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">从这个例子，还看不出<span lang="EN-US"> jBPM </span>
的优势。不过，如果在一个流程不确定，经常需要变动的项目中，<span lang="EN-US"> jBPM </span>
的好处将会显然出来。应用<span lang="EN-US"> jBPM </span>
后，改变流程只需改变流程描述文件。</span>
</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;">原文：http://blog.csdn.net/hxirui/archive/2006/09/14/1221911.aspx</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://liumingm.javaeye.com/blog/216239#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/138' target='_blank'><span style="color:red;font-weight:bold;">加入阿里巴巴，发展潜力无限</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 18 Jul 2008 16:22:03 +0800</pubDate>
        <link>http://liumingm.javaeye.com/blog/216239</link>
        <guid>http://liumingm.javaeye.com/blog/216239</guid>
      </item>
          <item>
        <title>JBPM介绍</title>
        <author>天空不空</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://liumingm.javaeye.com">天空不空</a>&nbsp;
                    链接：<a href="http://liumingm.javaeye.com/blog/216233" style="color:red;">http://liumingm.javaeye.com/blog/216233</a>&nbsp;
          发表时间: 2008年07月18日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <h1><cite class="fav_csdnstylebykimi"><a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(saveit=window.open('http://wz.csdn.net/storeit.aspx?t='+escape(d.title)+'&amp;u='+escape(d.location.href)+'&amp;c='+escape(t),'saveit','scrollbars=no,width=590,height=300,left=75,top=20,status=no,resizable=yes'));saveit.focus();" title="收藏到我的网摘中，并分享给我的朋友" class="fav_csdnstylebykimi"></a>
</cite>
</h1>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><strong><span style="font-size: medium;"><span>1.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span>jBPM</span>
的简单介绍</span>
</strong>
</div>
<div style="text-indent: 24pt; line-height: 150%;">
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM是一个灵活的、可扩展的工作流管理系统。JBOSS jBPM拥有直观的流程语言，用任务、异步的等待状态、定时器、自动化动作&hellip;等来表示业务流程图，把这些操作绑定在一起，JBOSS jBPM就拥有了非常强大和可扩展的控制流机制。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM只有最小的依赖，可以象使用java库一样非常容易的使用它。另外，也可以通过把它部署在J2EE集群应用服务器中，用在吞吐量极为关键的环境中。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM可被配置为任何数据库，并且可以部署到任何应用服务器。</span>
</div>
</div>
<div><span>&nbsp;&nbsp; </span>
参考</div>
<div style="text-indent: 21pt;"><a href="http://www.jboss.com/products/jbpm">http://www.jboss.com/products/jbpm</a>
</div>
<div style="text-indent: 21pt;">
<div><span style="font-size: medium;"><strong><span>1.1 </span>
概述</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">核心工作流和BPM功能被打包为一个简单的java库，这个库包括一个存储到数据库、从数据库更新和获取流程信息的服务。</span>
</div>
<div><span style="font-size: small;"><img src="http://p.blog.csdn.net/images/p_blog_csdn_net/mrshan/565f334c9c4d42569c20a8bc5ccdf7ff.gif" alt="" />
</span>
</div>
<div><span style="font-size: small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 图 <span>1</span>
.<span>1</span>
 JBOSS jBPM组件概观</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.2 </span>
JBOSS jBPM入门套件</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">入门套件是一个包含了所有jBPM组件的下载包，包括：</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>Jbpm-server</strong>
，一个预配置好的jboss应用服务器。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>Jbpm-designer</strong>
，图形化设计jBPM流程的eclipse插件。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>Jbpm-db</strong>
，jBPM数据库兼容包（见下文）。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>Jbpm</strong>
，核心jbpm组件，包括库和本指南。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>Jbpm-bpel</strong>
，JBOSS jBPM BPEL扩展参考。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">预配置好的JBOSS应用服务器安装了下列组件：</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>核心的jBPM</strong>
<strong>组件</strong>
，被打包为了一个服务档案。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>一个包括jBPM</strong>
<strong>库表的集成数据库</strong>
：默认的hypersonic数据库包含了jBPM表，另外还包含一个流程。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>jBPM</strong>
<strong>控制台web</strong>
<strong>应用程序</strong>
，可以由流程参与者使用，也可以由jBPM管理员使用。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>jBPM</strong>
<strong>调度程序</strong>
，用于定时器执行。调度程序在入门套件中被配置为一个servlet，这个servlet将产生一个线程来监视和执行定时器。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>jBPM</strong>
<strong>命令执行器</strong>
，用于命令的异步执行。命令执行器也被配置为一个servlet，这个servlet将产生一个线程来监视和执行命令。</span>
</div>
<div style="margin-left: 73pt; text-indent: -21pt;"><span style="font-size: small;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<strong>一个流程实例</strong>
，已经被部署到了jBPM数据库中。</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.3 </span>
JBOSS jBPM图形化流程设计器</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM还包括一个图形化设计工具，这个设计器是一个创作业务流程的图形化工具。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM图形化流程设计器是一个eclipse插件，可以独立安装的设计器已经在开发目标中。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">图形化设计器非常重要的特性是它同时支持业务分析者和技术开发者，这使的业务流程建模可以平滑的转换到实际实现。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">插件可以被用作本地更新设置（普通的zip文件），通过标准的eclipse软件更新机制安装。另外还有一个包，你可以直接把它解压到eclipse主目录里。</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.4 </span>
JBOSS jBPM核心组件</strong>

</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM核心组件是普通java(J2SE)软件，用来管理流程定义和流程实例执行的运行时环境。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS
jBPM是一个java库，因此，它可以被用在任何java环境，例如web应用、swing应用、EJB、webservice&hellip;等，jBPM库还可以
被打包为无状态会话EJB，这允许被作为集群部署，并且适用于极高的吞吐量。无状态会话EJB按照J2EE1.3规范编写，因此它可以部署到任何应用服务
器。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM核心组件被打包为一个简单的java库文件，依赖于你所使用的功能，jbpm-3.0.jar库对第三方库有些依赖，如hibernate、dom4j和其他，这些在&ldquo;第5章 部署&rdquo;TODO中有清晰的说明。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">为了持久化，jBPM内部使用hibernate，除了传统的O/R影射之外，hibernate还解决了不同数据库之间的SQL方言（dialect）问题，使jBPM可以方便的在当前所有数据库上移植。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jPBM API可以从你的项目中任何定制的java软件中访问，例如你的web应用、你的EJB、你的webservice组件、你的消息驱动bean，或者其他java组件。</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.5 </span>
JBOSS jBPM控制台web应用程序</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">jBPM控制台web应用程序服务于两个目的。首先，它作为与由流程执行所产生的运行时任务相交互的一个重要的用户接口；其次，它是一个管理和监控控制台，允许检查和操纵运行时实例。</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.6 </span>
JBOSS jBPM身份组件</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS
jBPM可以与任何包含用户或其他组织信息目录的公司集成，但是对于没有组织信息组件可用的项目，JBOSS
jBPM包含了它自己的组件。身份组件所使用的模型比传统的servlet、ejb和portlet（译者注：portlet是portal中最重要的组
件，与servlet类似，portlet是部署在容器中用来生成动态内容的web组件。）模型更丰富。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">更多信息，请看&ldquo;11.11 身份组件&rdquo;。TODO</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.7 </span>
JBOSS jBPM调度程序</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM调度程序是一个用来监视和执行定时器的组件，它在流程执行期间被调度。</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">定时器组件软件被打包进核心的jbpm库，但是它需要被部署进下列环境之一：要么配置调度程序servlet去产生监视线程，要么用调度程序的main方法启动一个独立的JVM。</span>
</div>
<div><span style="font-size: medium;"><strong><span>1.8 </span>
JBOSS jBPM数据库兼容包</strong>
</span>
</div>
<div style="margin-left: 28pt; text-indent: 24pt;"><span style="font-size: small;">JBOSS jBPM数据库兼容包是一个包含能使jBPM在你所选择的数据库上运行的所有信息、驱动程序和脚本的下载包。</span>
</div>
<br />
</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><strong><span style="font-size: medium;"><span>2.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-weight: normal; font-size: 15pt; line-height: 150%;">jBPM</span>
和<span>myeclipse</span>
的冲突</span>
</strong>
</div>
<div style="text-indent: 24pt; line-height: 150%;"><span style="font-size: 12pt; line-height: 150%;">当eclipse安装了<span>myeclipse</span>
和<span>jBPM</span>
时候，可能有冲突，具体表现在<span>jBPM</span>
的流程设计器不能在eclipse中使用。</span>
</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><strong><span style="font-size: medium;"><span>3.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Hibernate连接<span>mysql</span>
数据库的一般参数</span>
</strong>
</div>
<div style="line-height: 150%;">下面的配置参数，根据需要可以修改：</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 12pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #993300;">jbpmtest</span>
<span style="font-size: 12pt; line-height: 150%; color: #993300;">是<span>mysql</span>
中的schema的名字；</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 12pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #993300;">GBK</span>
<span style="font-size: 12pt; line-height: 150%; color: #993300;">是字符集，可以根据需要修改；</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 12pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #993300;">username=root</span>
<span style="font-size: 12pt; line-height: 150%; color: #993300;">，<span>mysql</span>
数据库的用户名是<span style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root</span>
；</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 12pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #993300;">password=mysql</span>
<span style="font-size: 12pt; line-height: 150%; color: #993300;">，<span>mysql</span>
数据库的用户密码是<span style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">mysql</span>
；</span>
</div>
<div style="line-height: 150%;"><span style="color: #993300;">&nbsp;</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.dialect</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">org.hibernate.dialect.MySQLDialect</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.driver_class</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">com.mysql.jdbc.Driver</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.url=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">jdbc</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">:</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">mysql://localhost/jbpmtest?useUnicode=true&amp;characterEncoding=GBK</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.username</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">root</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.password</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">mysql</span>
</div>
<div style="line-height: 150%;"><span style="font-size: 10pt; line-height: 150%;">&nbsp;</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.show_sql</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">true</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.c3p0.min_size=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">1</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.c3p0.max_size=</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">3</span>
</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><strong><span style="font-size: medium;"><span>4.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Hibernate连接Oracle数据库的一般参数</span>
</strong>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.dialect</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="font-size: 10pt; line-height: 150%; color: #2a00ff;">org.hibernate.dialect.Oracle9Dialect</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.driver_class=</span>
<span style="font-size: 10pt; line-height: 150%; color: #2a00ff;">oracle.jdbc.driver.OracleDriver</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.url</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
 <span style="font-size: 10pt; line-height: 150%; color: black;">jdbc:oracle:thin:@</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: #2a00ff;">localhost</span>
<span style="font-size: 10pt; line-height: 150%; color: black;">:1521:orcl <span style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">hibernate.connection.username</span>
<span style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">=</span>
</span>
<span style="font-size: 10pt; line-height: 150%; color: #2a00ff;">jbpm</span>
</div>
<div style="line-height: 150%;"><span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">hibernate.connection.password</span>
<span style="background: white none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; color: black;">=</span>
<span style="font-size: 10pt; line-height: 150%; color: #2a00ff;">jbpm</span>
</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><strong><span style="font-size: medium;"><span>5.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
为<span>jBPM</span>
创建数据库表等内容</span>
</strong>
</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.1.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
为<span>mysql</span>
创建数据库以及数据内容</span>
</strong>
</div>
<div style="text-indent: 5.25pt; line-height: 150%;"><span><span>JbpmSessionFactory.buildJbpmSessionFactory</span>
</span>
<span>(</span>
).<span>getJbpmSchema().dropSchema();</span>
</div>
<div style="text-indent: 5.25pt; line-height: 150%;"><span><span>JbpmSessionFactory.buildJbpmSessionFactory</span>
</span>
<span>(</span>
).<span>getJbpmSchema().createSchema();</span>
</div>
<div style="text-indent: 6pt; line-height: 150%;"><span style="font-size: 12pt; line-height: 150%;">这<span>2个语针对</span>
<span>mysq</span>
有效.</span>
</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.2.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
为<span>oralce</span>
创建数据库以及数据内容</span>
</strong>
</div>
<div style="text-indent: 21pt; line-height: 150%;"><span><span>JbpmSessionFactory.buildJbpmSessionFactory</span>
</span>
<span>(</span>
).<span>getJbpmSchema().dropSchema();</span>
</div>
<div style="text-indent: 21pt; line-height: 150%;"><span><span>JbpmSessionFactory.buildJbpmSessionFactory</span>
</span>
<span>(</span>
).<span>getJbpmSchema().createSchema();</span>
</div>
<div style="line-height: 150%;">上面的语句对<span>oralce</span>
无效。</div>
<div style="text-indent: 21pt; line-height: 150%;">模型目录jBPM\jbpm_database\jBPM_oralce10g.pdm 是<span>jBPM</span>
的<span>Oralce</span>
模型,包含对应的Sequence的信息.</div>
<div style="text-indent: 21pt; line-height: 150%;">需要在数据库中创建 Sequence name=<span>hibernate_sequence</span>
</div>
<div style="text-indent: 21pt; line-height: 150%;"><a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JbpmOnOracle">http://wiki.jboss.org/wiki/Wiki.jsp?page=JbpmOnOracle</a>
 </div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.3.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
流程信息保存到数据库</span>
</strong>
</div>
<div style="text-indent: 31.5pt; line-height: 150%;"><span><span>JbpmSessionFactory</span>
</span>
<span> &nbsp;factory</span>
 = &nbsp;<span>JbpmSessionFactory.buildJbpmSessionFactory();</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;JbpmSession session = <span>factory.openJbpmSession</span>
();</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;GraphSession graphSession = &nbsp;<span>session.getGraphSession</span>
();</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span>session.beginTransaction</span>
();</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;/// new ProcessDefinition </span>
实例</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;ProcessDefinition myProcessDefinition = null;</span>
</div>
<div style="text-indent: 10.5pt; line-height: 150%;"><span>&nbsp;&nbsp;&nbsp; ProcessInstance processInstance = new <span>ProcessInstance</span>
(processDefinition);</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span>processInstance.getContextInstance</span>
().setVariable(&quot;myvar&quot;,&quot;xxx&quot;);</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;///</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span>graphSession.saveProcessDefinition</span>
(myProcessDefinition);</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span>session.commitTransaction</span>
();</span>
</div>
<div style="text-indent: 31.5pt; line-height: 150%;"><span><span>session.close</span>
</span>
<span>(</span>
);</div>
<div style="margin-left: 21pt; line-height: 150%;"><span>jBPM</span>
和<span>Hibernate,MySQL</span>
的使用中会遇到字符集的问题.</div>
<div style="line-height: 150%;">需要注意几个地方。</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.4.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
在<span>Mysql</span>
安装过程指定字符集</span>
</strong>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp; </span>
在<span>Mysql</span>
安装过程中指定相应的默认字符集是GBK</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.5.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span>Hibernate.properties</span>
文件中的字符集设置</span>
</strong>
</div>
<div style="text-indent: 15.75pt; line-height: 150%;">hibernate.connection.url=jdbc:mysql://localhost/jbpmtest?useUnicode=true&amp;characterEncoding=GBK</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.6.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span>hibernate.cfg.xml</span>
 文件中的字符集设置</span>
</strong>
</div>
<div style="text-indent: 15.75pt; line-height: 150%;">&lt;<span>property name=&quot;hibernate.connection.url&quot;&gt;jdbc:mysql://192.168.1.2/jbpmtest&lt;/property&gt;</span>
</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>5.7.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span>MySQL</span>
的配置文件的修改:</span>
</strong>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp; my.ini</span>
中 default-character-set=GBK </div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp; </span>
注意有2处需要修改</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><strong><span style="font-size: medium;"><span>6.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
为流程定义变量</span>
</strong>
</div>
<div style="line-height: 150%;">分成3种流程变量</div>
<div style="line-height: 150%;">全局变量（全局流程变量）</div>
<div style="line-height: 150%;">全局临时变量（全局流程临时变量）</div>
<div style="line-height: 150%;">局部变量（流程某个接点内有效的变量）</div>
<div style="border: 1pt solid #cccccc; padding: 4pt; background: #f4f4f4 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<pre><span>@see <strong><span style="font-size: 12pt; line-height: 150%;">org.jbpm.context.exe.ContextInstance</span>




</strong>




</span>




</pre>
</div>
<div style="line-height: 150%;">目前还没有使用过局部变量（流程某个接点内有效的变量）</div>
<div style="line-height: 150%;">流程变量的定义</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.1.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
流程变量的类型</span>
</strong>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.String</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Boolean</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Character</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Float</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Double</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Long</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Byte</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Short</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.lang.Integer</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.util.Date</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">byte[]</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.io.Serializable</span>
</div>
<div style="margin-left: 36pt; text-indent: -18pt; line-height: 150%; text-align: left;"><span style="font-size: 10pt; line-height: 150%; color: black;">&middot;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">classes that are persistable with hibernate</span>
</div>
<div style="text-indent: 10.5pt; line-height: 150%;">&nbsp;所有基本类型的包裹类型，以及实现了<span style="font-size: 11pt; line-height: 150%; color: #111111;">Serializable</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">的类型都可以作为流程参数变量使用，注意参数类不能是一个类的内部类或者属性类（除非包含参数类的类实现了<span>Serializable</span>
接口）</span>
</div>
<div style="border: 1pt solid #cccccc; padding: 4pt; background: #f4f4f4 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<pre>参考 <strong><span style="font-size: 12pt; line-height: 150%;">org.jbpm.context.exe.VariableInstance</span>




</strong>




</pre>
</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.2.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
流程变量的使用</span>
</strong>
</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%;"><span>l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
变量的定义和获取</div>
<div style="line-height: 150%;"><span style="font-size: 12pt; line-height: 150%; color: black;">void</span>
<span style="font-size: 12pt; line-height: 150%; color: black;"> ContextInstance.setVariable(String variableName, Object value);</span>
</div>
<div style="line-height: 150%;"><span style="font-size: 12pt; line-height: 150%; color: black;">void</span>
<span style="font-size: 12pt; line-height: 150%; color: black;"> ContextInstance.setVariable(String variableName, Object value, Token token);</span>
</div>
<div style="line-height: 150%;"><span style="font-size: 12pt; line-height: 150%; color: black;">Object <span>ContextInstance.getVariable</span>
(String variableName);</span>
</div>
<div style="line-height: 150%;"><span style="font-size: 12pt; line-height: 150%; color: black;">Object <span>ContextInstance.getVariable</span>
(String variableName, Token token);</span>
</div>
<div style="margin-left: 21pt; text-indent: -21pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%; color: black;">l<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
<span style="font-size: 12pt; line-height: 150%; color: black;">Variables can be deleted with</span>
</div>
<div style="border: 1pt solid #cccccc; padding: 4pt; background: #f4f4f4 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<div style="border: medium none; padding: 0cm; background: #f4f4f4 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; text-align: left;"><span><span style="font-size: 12pt; line-height: 150%; color: black;">ContextInstance.deleteVariable</span>
</span>
<span style="font-size: 12pt; line-height: 150%; color: black;">(</span>
<span style="font-size: 12pt; line-height: 150%; color: black;">String variableName);</span>
</div>
<div style="border: medium none; padding: 0cm; background: #f4f4f4 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 150%; text-align: left;"><span><span style="font-size: 12pt; line-height: 150%; color: black;">ContextInstance.deleteVariable</span>
</span>
<span style="font-size: 12pt; line-height: 150%; color: black;">(</span>
<span style="font-size: 12pt; line-height: 150%; color: black;">String variableName, Token token);</span>
</div>
</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.3.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Variable lifetime</span>
</strong>
</div>
<div style="line-height: 150%;">&nbsp;<span>&nbsp;&nbsp;</span>
一个变量在被定义后，在变量从<span style="font-size: 12pt; line-height: 150%; color: black;">ContextInstance</span>
<span style="font-size: 12pt; line-height: 150%; color: black;">删除前，都可以被访问。当变量被删除后，去获取该变量将返回为空。</span>
</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.4.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
自定义类的实例作为流程变量</span>
</strong>
</div>
<div style="line-height: 150%;">&nbsp;&nbsp;&nbsp;如果一个类的实例要作为流程变量使用,该类需要实现<span style="font-size: 11pt; line-height: 150%; color: #111111;">java.io.Serializable</span>
<span style="font-size: 11pt; line-height: 150%; color: #111111;">接口,并且定义序列化版本.</span>
</div>
<div style="text-indent: 5.25pt; line-height: 150%;">&nbsp;</div>
<div style="text-indent: 5.25pt; line-height: 150%;">//一个可以作为流程变量使用的类</div>
<div style="line-height: 150%;"><span>class</span>
 <span>Wdz implements Serializable{</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp; //</span>
为类指定序列化版本号</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp; private static final long serialVersionUID = 1L;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private String name=&quot;wdz&quot;;</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private int age=10;</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public String toString(){</span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;name=&quot;+name+&quot;,age=&quot;+age;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</div>
<div style="line-height: 150%;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp; </span>
</div>
<div style="line-height: 150%;">}</div>
<div style="text-indent: 15.75pt; line-height: 150%;">上面的例子中,如果把类<span>Wdz</span>
作为类<span>WdzParent</span>
内部类使用,然后当成流程变量使用,那类<span>WdzParent</span>
必须 也实现<span>Serializable</span>
接口,否则会有问题.</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.5.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Transient variables</span>
</strong>
</div>
<div style="line-height: 150%;">流程的历史变量是不能持久化的，作用范围是对整个流程全局有效的。</div>
<div style="line-height: 150%;">在<span>ContextInstance</span>
类内部，采用的是一个Map来存储<strong><span style="line-height: 150%;">TransientVariable</span>
的信息</strong>
</div>
<div style="line-height: 150%;">参考代码 </div>
<div style="text-indent: 15.75pt; line-height: 150%;"><span>org.jbpm.context.exe.ContextInstance</span>
 的源代码。</div>
<div style="line-height: 150%;">主要的相关方法</div>
<div style="text-indent: 10.5pt; line-height: 150%;"><span style="line-height: 150%;">public</span>
<span style="line-height: 150%;"> void <strong>deleteTransientVariable</strong>
(java.lang.String&nbsp;name)</span>
</div>
<div style="text-indent: 10.5pt; line-height: 150%; text-align: left;"><span style="line-height: 150%;">public</span>
<span style="line-height: 150%;"> void <strong>setTransientVariable</strong>
(java.lang.String&nbsp;name,</span>
</div>
<div style="text-indent: 10.5pt; line-height: 150%;"><span style="line-height: 150%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<span>java.lang.Object</span>
&nbsp;value)</span>
</div>
<div style="text-indent: 10.5pt; line-height: 150%; text-align: left;"><span style="line-height: 150%;">public</span>
<strong><span style="line-height: 150%;"> java.lang.Object getTransientVariable(</span>
</strong>
<span style="line-height: 150%;">java.lang.String</span>
<span style="line-height: 150%;">&nbsp;name<strong>)</strong>
</span>
</div>
<div style="text-indent: 21pt; line-height: 150%;">&nbsp;</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.6.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Variables overloading</span>
</strong>
</div>
<div style="text-indent: 15.75pt; line-height: 150%;">&nbsp;当一个变量和流实例关联(变量名字=<span>&rdquo;wdz<span>&rdquo;,value</span>
=&rdquo;test&rdquo;)</span>
，如果在设置一个变量</div>
<div style="line-height: 150%;">(变量名字=<span>&rdquo;wdz<span>&rdquo;,value</span>
= new Integer(10)) ,</span>
那最后变量（变量名字=<span>&rdquo;wdz</span>
）的值是Integer(10)。</div>
<div style="line-height: 150%;">这称之为overload.</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.7.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Variables overriding</span>
</strong>
</div>
<div style="text-indent: 10.5pt; line-height: 150%;">&nbsp;如果父流程有变量A(值=<span>&rdquo;value1&rdquo;),</span>
子流程又定义了变量A值=<span>&rdquo;value2&rdquo;,</span>
那在子流程范围内，获取变量A的值，那结果是值=<span>&rdquo;value2&rdquo;</span>
。这是遵循一般语言的局部变量在它的局部范围内override上级变量。</div>
<div style="line-height: 150%;">&nbsp;</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.8.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
流程变量的持久化</span>
</strong>
</div>
<div style="text-indent: 21pt; line-height: 150%;">它依赖于流程实例的持久化，非<strong><span style="line-height: 150%;">TransientVariable</span>
<span style="line-height: 150%;">随</span>
流程实例的持久<span>化一起被保存。</span>
</strong>
</div>
<div style="text-indent: 21pt; line-height: 150%;">保存在数据表<span>jbpm_variableinstance</span>
 </div>
<div style="border: 1pt solid #cccccc; padding: 4pt; background: #f4f4f4 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-left: 17.95pt; margin-right: 0cm;">
<pre>参考 <strong><span style="font-size: 12pt; line-height: 150%;">org.jbpm.context.exe.VariableInstance</span>




</strong>




</pre>
</div>
<div style="margin-left: 42.55pt; text-indent: -42.55pt; line-height: 150%;"><strong><span style="font-size: small;"><span>6.9.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</span>
Customizing variable persistence (可以进一步了解)</span>
</strong>
</div>
<div style="text-indent: 12pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%;">User&nbsp;java</span>
<span style="font-size: 12pt; line-height: 150%;"> object &lt;---&gt; converter &lt;---&gt; &nbsp;variable instance </span>
</div>
<div style="text-indent: 12.05pt; line-height: 150%; text-align: left;"><strong><span style="font-size: 12pt; line-height: 150%;">也就是自定义类的持久化需要定义自己的</span>
</strong>
<span style="font-size: 12pt; line-height: 150%;">converter</span>
<span style="font-size: 12pt; line-height: 150%;">和变量实例类</span>
</div>
<div style="text-indent: 11.75pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%;">converter</span>
<span style="font-size: 12pt; line-height: 150%;">和变量实例类需要继承</span>
<strong><span style="font-size: 12pt; line-height: 150%;">org.jbpm.context.exe.VariableInstance</span>
</strong>
</div>
<div style="text-indent: 12pt; line-height: 150%; text-align: left;"><span style="font-size: 12pt; line-height: 150%;">converter</span>
<span style="font-size: 12pt; line-height: 150%;">需要实现</span>
<span style="font-size: 12pt; line-height: 150%;">org.jbpm.context.exe.Converter</span>
<span style="font-size: 12pt; line-height: 150%;">接口</span>
</div>
<p>&nbsp;</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 10.5pt; line-height: 150%; text-align: left;">&nbsp;</p>
<p class="MsoNormal" align="left" style="margin: 0cm 0cm 3pt; line-height: 150%; text-align: left;">&nbsp;</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://liumingm.javaeye.com/blog/216233#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/138' target='_blank'><span style="color:red;font-weight:bold;">加入阿里巴巴，发展潜力无限</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 18 Jul 2008 16:07:24 +0800</pubDate>
        <link>http://liumingm.javaeye.com/blog/216233</link>
        <guid>http://liumingm.javaeye.com/blog/216233</guid>
      </item>
          <item>
        <title>在应用中加入全文检索功能——基于Java的全文索引引擎Lucene简介</title>
        <author>天空不空</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://liumingm.javaeye.com">天空不空</a>&nbsp;
                    链接：<a href="http://liumingm.javaeye.com/blog/213140" style="color:red;">http://liumingm.javaeye.com/blog/213140</a>&nbsp;
          发表时间: 2008年07月09日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><strong>Lucene的概述：</strong></p>
<p>　　Lucene(发音为 <span style="color: #800000;">['lusen]</span> )是一个非常优秀的开源的全文搜索引擎,我们可以在它的上面开发出各种全文搜索的应用来。Lucene在国外有很高的知名度，现在已经是Apache的顶级项目，在国内，Lucene的应用也越来越多。</p>
<p>&nbsp;</p>
<p><strong>Lucene的算法原理：</strong></p>
<p>　　Lucene是一个高性能的java全文检索工具包，它使用的是倒排文件索引结构。该结构及相应的生成算法如下： </p>
<p>　0）设有两篇文章1和2 <br />　　 文章1的内容为：Tom lives in Guangzhou,I live in Guangzhou too. <br />　　 文章2的内容为：He once lived in Shanghai. </p>
<p>　1)<span style="color: #800000;">全文分析</span>：由于lucene是基于关键词索引和查询的，首先我们要取得这两篇文章的关键词，通常我们需要如下处理措施 <br />　　a.我们现在有的是文章内容，即一个字符串，我们先要找出字符串中的所有单词，即分词。英文单词由于用空格分隔，比较好处理。中文单词间是连在一起的需要特殊的分词处理。 <br />　　b.文章中的&rdquo;in&rdquo;, &ldquo;once&rdquo; &ldquo;too&rdquo;等词没有什么实际意义，中文中的&ldquo;的&rdquo;&ldquo;是&rdquo;等字通常也无具体含义，这些不代表概念的词可以过滤掉 <br />　　c.用户通常希望查&ldquo;He&rdquo;时能把含&ldquo;he&rdquo;，&ldquo;HE&rdquo;的文章也找出来，所以所有单词需要统一大小写。 <br />　　d.用户通常希望查&ldquo;live&rdquo;时能把含&ldquo;lives&rdquo;，&ldquo;lived&rdquo;的文章也找出来，所以需要把&ldquo;lives&rdquo;，&ldquo;lived&rdquo;还原成&ldquo;live&rdquo; <br />　　e.文章中的标点符号通常不表示某种概念，也可以过滤掉 <br />　<span style="color: #008080;">在lucene中以上措施由Analyzer类完成</span> </p>
<p>　经过上面处理后 <br />　　文章1的所有关键词为：[tom] [live] [guangzhou] [i] [live] [guangzhou] <br />　　文章2的所有关键词为：[he] [live] [shanghai] </p>
<p>　2) <span style="color: #800000;">倒排索引</span>：有了关键词后，我们就可以建立倒排索引了。上面的对应关系是：&ldquo;文章号&rdquo;对&ldquo;文章中所有关键词&rdquo;。倒排索引把这个关系倒过来，变成<span style="color: #008080;">：&ldquo;关键词&rdquo;对&ldquo;拥有该关键词的所有文章号&rdquo;。</span>文章1，2经过倒排后变成 <br />关键词 文章号 <br />　　guangzhou 1 <br />　　he 2 <br />　　i 1 <br />　　live 1,2 <br />　　shanghai 2 <br />　　tom 1 </p>
<p>　　通常仅知道关键词在哪些文章中出现还不够，我们还需要知道关键词在文章中出现次数和出现的位置，通常有两种位置：a)字符位置，即记录该词是文章中第几个字符（优点是关键词亮显时定位快）；b)关键词位置，即记录该词是文章中第几个关键词（优点是节约索引空间、词组（phase）查询快），lucene中记录的就是这种位置。 </p>
<p>加上&ldquo;出现频率&rdquo;和&ldquo;出现位置&rdquo;信息后，我们的索引结构变为：&nbsp;</p>
<p>&nbsp;</p>
<p>
<table cellspacing="1" border="1" align="center" width="100%" cellpadding="1" style="height: 226px;">
<tbody>
<tr>
<td>&nbsp;关键词</td>
<td>&nbsp;文章号</td>
<td>&nbsp;[出现频率]</td>
<td>&nbsp;出现位置</td>
</tr>
<tr>
<td>&nbsp;guangzhou</td>
<td>&nbsp;1</td>
<td>&nbsp;[2]</td>
<td>&nbsp;3，6</td>
</tr>
<tr>
<td>&nbsp;he</td>
<td>&nbsp;2</td>
<td>&nbsp;[1] </td>
<td>&nbsp;1</td>
</tr>
<tr>
<td>&nbsp;i </td>
<td>&nbsp;1</td>
<td>&nbsp;[1]</td>
<td>&nbsp;4</td>
</tr>
<tr>
<td>&nbsp;live </td>
<td>&nbsp;1</td>
<td>&nbsp;[2]</td>
<td>&nbsp;2，5</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;2</td>
<td>&nbsp;[1]</td>
<td>&nbsp;2</td>
</tr>
<tr>
<td>&nbsp;shanghai</td>
<td>&nbsp;2</td>
<td>&nbsp;[1] </td>
<td>&nbsp;3</td>
</tr>
<tr>
<td>&nbsp;tom </td>
<td>&nbsp;1</td>
<td>&nbsp;[1]</td>
<td>&nbsp;1</td>
</tr>
</tbody>
</table>
</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以live 这行为例我们说明一下该结构：live在文章1中出现了2次，文章2中出现了一次，它的出现位置为&ldquo;2,5,2&rdquo;这表示什么呢？我们需要结合文章号和出现频率来分析，文章1中出现了2次，那么&ldquo;2,5&rdquo;就表示live在文章1中出现的两个位置，文章2中出现了一次，剩下的&ldquo;2&rdquo;就表示live是文章2中第 2个关键字。 <br />　　以上就是lucene索引结构中最核心的部分。我们注意到关键字是<span style="color: #008080;">按字符顺序排列的（lucene没有使用B树结构），</span>因此lucene可以用<span style="color: #008080;">二元搜索算法</span>快速定位关键词。 <br />　　实现时 lucene将上面三列分别作为<span style="color: #800000;">词典文件</span>（Term Dictionary）、<span style="color: #800000;">频率文件</span>(frequencies)、<span style="color: #800000;">位置文件</span> (positions)保存。其中<span style="color: #008080;">词典文件不仅保存有每个关键词，还保留了指向频率文件和位置文件的指针，</span>通过指针可以找到该关键字的频率信息和位置信息。 </p>
<p>　　Lucene中使用了<span style="color: #800000;">field</span>的概念，用于<span style="color: #008080;">表达信息所在位置（如标题中，文章中，url中），</span>在建索引中，该<span style="color: #008080;">field信息也记录在词典文件中</span>，每个关键词都有一个field信息(因为每个关键字一定属于一个或多个field)。 <br />　　为了减小索引文件的大小，Lucene对索引还使用了<span style="color: #800000;">压缩技术</span>。首先，对词典文件中的关键词进行了压缩，关键词压缩为&lt;前缀长度，后缀&gt;，例如：当前词为&ldquo;阿拉伯语&rdquo;，上一个词为&ldquo;阿拉伯&rdquo;，那么&ldquo;阿拉伯语&rdquo;压缩为&lt;3，语&gt;。其次大量用到的是对数字的压缩，数字只保存与上一个值的差值（这样可以减小数字的长度，进而减少保存该数字需要的字节数）。例如当前文章号是16389（不压缩要用3个字节保存），上一文章号是16382，压缩后保存7（只用一个字节）。 <span style="color: #008080;">注意是&ldquo;上一个词&rdquo;。由于词典是按顺序排列的，这种压缩方法的效果会非常显著。</span></p>
<p>　　下面我们可以通过对该索引的查询来解释一下为什么要建立索引。 <br />假设要查询单词 &ldquo;live&rdquo;，lucene先对词典二元查找、找到该词，通过指向频率文件的指针读出所有文章号，然后返回结果。词典通常非常小，因而，整个过程的时间是毫秒级的。 <br />而用普通的顺序匹配算法，不建索引，而是对所有文章的内容进行字符串匹配，这个过程将会相当缓慢，当文章数目很大时，时间往往是无法忍受的。</p>
<p>&nbsp;</p>
<p><a name="intro"><strong>基于Java的全文索引/检索引擎&mdash;&mdash;Lucene</strong></a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lucene不是一个完整的全文索引应用，而是是一个用Java写的全文索引引擎工具包，它可以方便的嵌入到各种应用中实现针对应用的全文索引/检索功能。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lucene的作者：Lucene的贡献者<a href="http://www.nutch.org/blog/cutting.html">Doug Cutting</a>是一位资深全文索引/检索专家，曾经是V-Twin搜索引擎(Apple的Copland操作系统的成就之一)的主要开发者，后在Excite担任高级系统架构设计师，目前从事于一些INTERNET底层架构的研究。他贡献出的Lucene的目标是为各种中小型应用程序加入全文检索功能。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lucene的发展历程：早先发布在作者自己的<a href="http://www.lucene.com/">http://www.lucene.com/</a>，后来发布在<a href="http://sourceforge.net/projects/lucene/">SourceForge</a>，2001年年底成为APACHE基金会jakarta的一个子项目：<a href="http://jakarta.apache.org/lucene/">http://jakarta.apache.org/lucene/</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 已经有很多Java项目都使用了Lucene作为其后台的全文索引引擎，比较著名的有：</p>
<ul>
<li><a href="http://www.jivesoftware.com/">J</a><a href="http://www.jivesoftware.com/">ive</a>：WEB论坛系统； </li>
<li><a href="http://eyebrowse.tigris.org/">Eyebrows</a>：邮件列表HTML归档/浏览/查询系统，本文的主要参考文档&ldquo;<a href="http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-lucene_p.html">TheLucene search engine: Powerful, flexible, and free</a>&rdquo;作者就是EyeBrows系统的主要开发者之一，而EyeBrows已经成为目前APACHE项目的主要邮件列表归档系统。 </li>
<li><a href="http://xml.apache.org/cocoon/index.html">Cocoon</a>:基于XML的web发布框架，全文检索部分使用了Lucene </li>
<li>
<p align="left"><a href="http://www.eclipse.org/">Eclipse</a>:基于Java的开放开发平台，帮助部分的全文索引使用了Lucene</p>
</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对于中文用户来说，最关心的问题是其是否支持中文的全文检索。但通过后面对于Lucene的结构的介绍，你会了解到由于Lucene良好架构设计，对中文的支持只需对其语言词法分析接口进行扩展就能实现对中文检索的支持。</p>
<p>&nbsp;</p>
<p><strong></strong></p>
<p><strong>全文检索框架的实现机制：</strong></p>
<p><strong></strong>　　Lucene的API接口设计的比较通用，输入输出结构都很像数据库的表==&gt;记录==&gt;字段，所以很多传统的应用的文件、数据库等都可以比较方便的映射到Lucene的存储结构/接口中。总体上看：可以先把Lucene当成一个支持全文索引的数据库系统。</p>
<p>比较一下Lucene和数据库：</p>
<p>
<table cellspacing="1" border="1" align="center" width="100%" cellpadding="1">
<tbody>
<tr>
<td>&nbsp;Lucene</td>
<td>&nbsp;数据库</td>
</tr>
<tr>
<td>
<p>&nbsp;索引数据源：doc(field1,field2...) doc(field1,field2...)&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\&nbsp; indexer /<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;_____________<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| Lucene Index |<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ searcher \</p>
<p>结果输出：Hits(doc(field1,field2) doc(field1...))</p>
</td>
<td>
<p>&nbsp;索引数据源：record(field1,field2...) record(field1..)&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \&nbsp; SQL: insert/&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_____________<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp; DB&nbsp; Index&nbsp;&nbsp; |<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -------------&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; / SQL: select \</p>
<p>结果输出：results(record(field1,field2..) record(field1...))</p>
</td>
</tr>
<tr>
<td>
<p>&nbsp;Document：一个需要进行索引的&ldquo;单元,一个Document由多个字段组成 </p>
</td>
<td>
<p>&nbsp;Record：记录，包含多个字段</p>
</td>
</tr>
<tr>
<td>
<p>Field：字段</p>
</td>
<td>Field：字段</td>
</tr>
<tr>
<td>
<p>Hits：查询结果集，由匹配的Document组成</p>
</td>
<td>&nbsp;RecordSet：查询结果集，由多个Record组成</td>
</tr>
</tbody>
</table>
</p>
<p>&nbsp;</p>
<p><strong></strong></p>
<p><strong>全文检索 &ne; like "%keyword%"</strong></p>
<p>　　由于数据库索引不是为全文索引设计的，因此，使用like "%keyword%"时，数据库索引是不起作用的，在使用like查询时，搜索过程又变成类似于一页页翻书的遍历过程了，所以对于含有模糊查询的数据库服务来说，LIKE对性能的危害是极大的。如果是需要对多个关键词进行模糊匹配：like"%keyword1%" and like "%keyword2%" ...其效率也就可想而知了。</p>
<p>　　通常比较厚的书籍后面常常附关键词索引表（比如：北京：12, 34页，上海：3,77页&hellip;&hellip;），它能够帮助读者比较快地找到相关内容的页码。而数据库索引能够大大提高查询的速度原理也是一样，想像一下通过书后面的索引查找的速度要比一页一页地翻内容高多少倍&hellip;&hellip;而索引之所以效率高，另外一个原因是它是排好序的。对于检索系统来说核心是一个排序问题。</p>
<p>　　所以建立一个高效检索系统的关键是建立一个类似于科技索引一样的反向索引机制，将数据源（比如多篇文章）排序顺序存储的同时，有另外一个排好序的关键词列表，用于存储关键词==&gt;文章映射关系，利用这样的映射关系索引：[关键词==&gt;出现关键词的文章编号，出现次数（甚至包括位置：起始偏移量，结束偏移量），出现频率]，检索过程就是把模糊查询变成多个可以利用索引的精确查询的逻辑组合的过程。从而大大提高了多关键词查询的效率，所以，全文检索问题归结到最后是一个排序问题。</p>
<p>　　由此可以看出模糊查询相对数据库的精确查询是一个非常不确定的问题，这也是大部分数据库对全文检索支持有限的原因。Lucene最核心的特征是通过特殊的索引结构实现了传统数据库不擅长的全文索引机制，并提供了扩展接口，以方便针对不同应用的定制。</p>
<p>　　可以通过一下表格对比一下数据库的模糊查询：</p>
<p>
<table cellspacing="1" border="1" align="center" width="100%" cellpadding="1">
<tbody>
<tr>
<td>&nbsp;</td>
<td>&nbsp;Lucene全文索引引擎</td>
<td>&nbsp;数据库</td>
</tr>
<tr>
<td>&nbsp;索引</td>
<td>&nbsp;将数据源中的数据都通过全文索引一一建立反向索引</td>
<td>&nbsp;对于LIKE查询来说，数据传统的索引是根本用不上的。数据需要逐个便利记录进行GREP式的模糊匹配，比有索引的搜索速度要有多个数量级的下降。</td>
</tr>
<tr>
<td>&nbsp;匹配效果</td>
<td>&nbsp;通过词元(term)进行匹配，通过语言分析接口的实现，可以实现对中文等非英语的支持。</td>
<td>&nbsp;使用：like "%net%" 会把netherlands也匹配出来，<br />多个关键词的模糊匹配：使用like "%com%net%"：就不能匹配词序颠倒的xxx.net..xxx.com</td>
</tr>
<tr>
<td>&nbsp;匹配度</td>
<td>&nbsp;有匹配度算法，将匹配程度（相似度）比较高的结果排在前面。</td>
<td>&nbsp;没有匹配程度的控制：比如有记录中net出现5词和出现1次的，结果是一样的</td>
</tr>
<tr>
<td>&nbsp;结果输出</td>
<td>&nbsp;通过特别的算法，将最匹配度最高的头100条结果输出，结果集是缓冲式的小批量读取的。</td>
<td>&nbsp;返回所有的结果集，在匹配条目非常多的时候（比如上万条）需要大量的内存存放这些临时结果集。</td>
</tr>
<tr>
<td>&nbsp;可定制性</td>
<td>&nbsp;通过不同的语言分析接口实现，可以方便的定制出符合应用需要的索引规则（包括对中文的支持）</td>
<td>&nbsp;没有接口或接口复杂，无法定制</td>
</tr>
<tr>
<td>&nbsp;结论</td>
<td>&nbsp;高负载的模糊查询应用，需要负责的模糊查询的规则，索引的资料量比较大</td>
<td>&nbsp;使用率低，模糊匹配规则简单或者需要模糊查询的资料量少</td>
</tr>
</tbody>
</table>
</p>
<p><span style="color: #008080;"><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="color: #008080;">全文检索和数据库应用最大的不同在于：让<span style="font-weight: bold;">最相关的</span></span><span style="color: #008080;">头100条结果满足98%以上用户的需求。</span></span></span></span></p>
<p><span style="color: #008080;"><span style="font-weight: bold;"></span></span><span style="font-weight: bold;"><br />Lucene的创新之处：</span></p>
<p>　　大部分的搜索（数据库）引擎都是用B树结构来维护索引，索引的更新会导致大量的IO操作，Lucene在实现中，对此稍微有所改进：不是维护一个索引文件，而是在扩展索引的时候不断创建新的索引文件，然后定期的把这些新的小索引文件合并到原先的大索引中（针对不同的更新策略，批次的大小可以调整），这样在不影响检索的效率的前提下，提高了索引的效率。</p>
<p>Lucene和其他一些全文检索系统/应用的比较：</p>
<p>
<table cellspacing="1" border="1" align="center" width="100%" cellpadding="1">
<tbody>
<tr>
<td>&nbsp;</td>
<td>&nbsp;Lucene</td>
<td>&nbsp;其他开源全文检索系统</td>
</tr>
<tr>
<td>&nbsp;增量索引和批量索引</td>
<td>&nbsp;可以进行增量的索引(Append)，可以对于大量数据进行批量索引，并且接口设计用于优化批量索引和小批量的增量索引。</td>
<td>&nbsp;很多系统只支持批量的索引，有时数据源有一点增加也需要重建索引。</td>
</tr>
<tr>
<td>&nbsp;数据源</td>
<td>&nbsp;Lucene没有定义具体的数据源，而是一个文档的结构，因此可以非常灵活的适应各种应用（只要前端有合适的转换器把数据源转换成相应结构）。</td>
<td>&nbsp;很多系统只针对网页，缺乏其他格式文档的灵活性。</td>
</tr>
<tr>
<td>&nbsp;索引内容抓取</td>
<td>&nbsp;Lucene的文档是由多个字段组成的，甚至可以控制那些字段需要进行索引，那些字段不需要索引，近一步索引的字段也分为需要分词和不需要分词的类型：<br />&nbsp;&nbsp; 需要进行分词的索引，比如：标题，文章内容字段<br />&nbsp;&nbsp; 不需要进行分词的索引，比如：作者/日期字段</td>
<td>&nbsp;缺乏通用性，往往将文档整个索引了</td>
</tr>
<tr>
<td>&nbsp;语言分析</td>
<td>&nbsp;通过语言分析器的不同扩展实现：<br />可以过滤掉不需要的词：an the of 等，<br />西文语法分析：将jumps jumped jumper都归结成jump进行索引/检索<br />非英文支持：对亚洲语言，阿拉伯语言的索引支持</td>
<td>&nbsp;缺乏通用接口实现</td>
</tr>
<tr>
<td>&nbsp;查询分析</td>
<td>&nbsp;通过查询分析接口的实现，可以定制自己的查询语法规则：<br />比如： 多个关键词之间的 + - and or关系等</td>
<td>&nbsp;功能较强大</td>
</tr>
<tr>
<td>&nbsp;并发访问</td>
<td>&nbsp;能够支持多用户的使用</td>
<td>&nbsp;功能较强大</td>
</tr>
</tbody>
</table>
</p>
<p>&nbsp;</p>
<p><strong>关于亚洲语言的的切分词问题(Word Segment)</strong><br />　　对于中文来说，全文索引首先还要解决一个语言分析的问题，对于英文来说，语句中单词之间是天然通过空格分开的，但亚洲语言的中日韩文语句中的字是一个字挨一个，所有，首先要把语句中按&ldquo;词&rdquo;进行索引的话，这个词如何切分出来就是一个很大的问题。<br />　　首先，肯定不能用单个字符作(si-gram)为索引单元，否则查&ldquo;上海&rdquo;时，不能让含有&ldquo;海上&rdquo;也匹配。<br />但一句话：&ldquo;北京天安门&rdquo;，计算机如何按照中文的语言习惯进行切分呢？<br />　　&ldquo;北京 天安门&rdquo; 还是&ldquo;北 京 天安门&rdquo;？让计算机能够按照语言习惯进行切分，往往需要机器有一个比较丰富的词库才能够比较准确的识别出语句中的单词。<br />　　另外一个解决的办法是采用自动切分算法：将单词按照2元语法(bigram)方式切分出来，比如：<br />　　　　"北京天安门" ==&gt; "北京 京天 天安 安门"。<br />这样，在查询的时候，无论是查询"北京" 还是查询"天安门"，将查询词组按同样的规则进行切分："北京"，"天安安门"，多个关键词之间按与"and"的关系组合，同样能够正确地映射到相应的索引中。这种方式对于其他亚洲语言：韩文，日文都是通用的。<br />　　基于自动切分的最大优点是没有词表维护成本，实现简单，缺点是索引效率低，但对于中小型应用来说，基于2元语法的切分还是够用的。基于2元切分后的索引一般大小和源文件差不多，而对于英文，索引文件一般只有原文件的30%-40%不同。 
<table cellspacing="1" border="1" align="center" width="100%" cellpadding="1">
<tbody>
<tr>
<td>&nbsp;</td>
<td>&nbsp;自动切分</td>
<td>&nbsp;词表切分</td>
</tr>
<tr>
<td>&nbsp;实现</td>
<td>&nbsp;实现非常简单</td>
<td>&nbsp;实现复杂</td>
</tr>
<tr>
<td>&nbsp;查询</td>
<td>&nbsp;增加了查询分析的复杂程度</td>
<td>&nbsp;适于实现比较复杂的查询语法规则</td>
</tr>
<tr>
<td>&nbsp;存储效率</td>
<td>&nbsp;索引冗余大，索引几乎和原文一样大</td>
<td>&nbsp;索引效率高，为原文大小的30％左右</td>
</tr>
<tr>
<td>&nbsp;维护成本</td>
<td>&nbsp;无词表维护成本</td>
<td>&nbsp;词表维护成本非常高：中日韩等语言需要分别维护。<br />还需要包括词频统计等内容</td>
</tr>
<tr>
<td>&nbsp;适用领域</td>
<td>&nbsp;嵌入式系统：运行环境资源有限<br />分布式系统：无词表同步问题<br />多语言环境：无词表维护成本</td>
<td>&nbsp;对查询和存储效率要求高的专业搜索引擎<br /></td>
</tr>
</tbody>
</table>
</p>
<p>目前比较大的搜索引擎的语言分析算法一般是基于以上2个机制的结合。关于中文的语言分析算法，大家可以在Google查关键词"wordsegment search"能找到更多相关的资料。</p>
<p>Lucene的结构框架：<br />　　注意：Lucene中的一些比较复杂的词法分析是用JavaCC生成的（JavaCC：JavaCompilerCompiler，纯Java的词法分析生成器），所以如果从源代码编译或需要修改其中的QueryParser、定制自己的词法分析器，还需要从<a href="https://javacc.dev.java.net/">https://javacc.dev.java.net/</a>下载javacc。<br />　　lucene的组成结构：对于外部应用来说索引模块(index)和检索模块(search)是主要的外部应用入口。 </p>
<p>
<table cellspacing="1" border="1" align="center" width="100%" cellpadding="1">
<tbody>
<tr>
<td>&nbsp;org.apache.Lucene.search/</td>
<td>&nbsp;搜索入口</td>
</tr>
<tr>
<td>&nbsp;org.apache.Lucene.index/</td>
<td>&nbsp;索引入口</td>
</tr>
<tr>
<td>&nbsp;org.apache.Lucene.analysis/</td>
<td>&nbsp;语言分析器</td>
</tr>
<tr>
<td>&nbsp;org.apache.Lucene.queryParser/</td>
<td>查询分析器</td>
</tr>
<tr>
<td>&nbsp;org.apache.Lucene.document/</td>
<td>&nbsp;存储结构</td>
</tr>
<tr>
<td>&nbsp;org.apache.Lucene.store/&nbsp;</td>
<td>&nbsp;底层IO/存储结构</td>
</tr>
<tr>
<td>&nbsp;org.apache.Lucene.util/</td>
<td>&nbsp;一些公用的数据结构</td>
</tr>
</tbody>
</table>
</p>
<p>&nbsp;</p>
<p><strong></strong></p>
<p><strong></strong></p>
<p><strong>从Lucene学到更多：</strong><br />　　Luene的确是一个面对对象设计的典范。</p>
<ol>
<li>所有的问题都通过一个额外抽象层来方便以后的扩展和重用：你可以通过重新实现来达到自己的目的，而对其他模块而不需要； </li>
<li>简单的应用入口Searcher, Indexer，并调用底层一系列组件协同的完成搜索任务； </li>
<li>所有的对象的任务都非常专一：比如搜索过程：QueryParser分析将查询语句转换成一系列的精确查询的组合(Query),通过底层的索引读取结构IndexReader进行索引的读取，并用相应的打分器给搜索结果进行打分/排序等。所有的功能模块原子化程度非常高，因此可以通过重新实现