Chapter 18. JBPM Migration(JBPM 遷移)
Table of Contents
目錄表
Database migration
數據遷移
Process conversion
流程轉換
Extend the migration logic
擴展遷移邏輯
The jBPM migration is considered [EXPERIMENTAL].
jBPM遷移僅作[EXPERIMENTAL]之用。
It is possible to migrate an existing installation of jBPM version 3 to Activiti. The migration includes both process definition conversion (ie. from JPDL 3 to BPMN 2.0) and data migration.
將一個已安裝的jBPM 版本3遷移到Activiti是有可能的。遷移包括流程定義轉換(例如從JPDL3到BPMN 2.0)和數據遷移。
The migration tool is currently offered as a 'preview' only! The migration coverage is at this point in time not sufficient to be usable on production process definitions and databases. Also note that the migration is a 'best effort', which means that you may need to extend the migration logic to cover all your use cases.
遷移工具目前只作為‘預覽’之用!當前遷移不能覆蓋到產品的流程定義和數據。也要注意遷移是‘最大的努力’,這意味著你可以需要‘擴展遷移邏輯’來控制你所有的用例。
The migration tool is separately availbale as a zip file from the activiti.org download site. Once you have unzipped this file, you will see following files and folders:
遷移工具從activiti.org下載站點以zip文件方式分開下載。一旦加壓這個文件,文件和文件夾如下所示:
- build.xml: This ant buildfile contains the targets to execute the process definition conversion and database migration.
- build.xml: 這個ant構建文件包含了執行流程定義轉換和數據庫遷移的目標。
- activiti.db.properties and jbpm3.db.properties: these properties files contain the database connection parameters for the jBPM 3 and Activiti database. These properties files must be changed when executing a database migration.
- activiti.db.properties and jbpm3.db.properties:這個特性文件包含了jBPM和Activiti數據庫的數據庫連接參數。當執行數據庫遷移時,必須改變這些特性文件。
- processes: when running a process definition conversion, the jBPM 3 process definition files must be placed in this folder.
- processes:當運行流程定義轉換時,jBPM3流程定義文件必須放置到這個文件夾。
- src: this folder contains the source code of the migration tool. Read the extension section if you want to tailor or extend the migration code to your needs.
- src:這個文件包含遷移工具的源代碼。如果希望裁剪或者擴展遷移代碼滿足你自己的需求,請閱讀擴展部分。
- lib: this folder contains all jars required to execute the migration logic.
- lib:這個文件夾包含執行遷移邏輯的全部jar包。
Database migration
數據庫遷移
It is possible to migrate the data in the jBPM 3 database tables to the Activiti database schema. To do this, following properties files must be changed to point at the right database:
將jBPM3數據庫表遷移到Activiti數據庫schema是有可能的。為了完成這個任務,必須改變下面的properties文件,指向正確的數據庫:
- jbpm3.db.properties: contains the parameters to connect to the jBPM 3 database. Also the Hibernate dialect must be provided.
- jbpm3.db.properties:包含了連接jBPM3數據庫的參數。也必須提供Hibernate方言。
- activiti.db.properties: contains the parameters to connect to database to which the migrated data will be written. This can be the same database schema as the jBPM schema (ie. there are no name-clashes between jBPM and Activiti tables, indexes, foreign keyes, etc).
- activiti.db.properties: 包含了遷移將要寫入數據庫的連接參數。這個可能是和jBPM相同數據庫schema(例如,在jBPM和Activiti數據庫表名,索引名,外鍵名等等沒有沖突).
The database migration will use the data in the jBPM 3 tables to:
數據遷移將使用jBPM3數據庫表的數據來做:
- Convert the process definition to the BPMN 2.0 counterpart. This means that the converted process definition will be deployed to the Activiti tables as part of the migration. As a side-effect, it will also produce the BPMN 2.0 XML files, similar to what happens when executing theprocess conversion.
- 轉換流程定義為BPMN 2.0對應物。這意味著轉換之后的流程定義將作為遷移的一部分被部署到Activiti的數據庫表。作為副作用,它也產生BPMN 2.0 XML文件,這和當執行流程轉換時所發生的事相似。
- Migrate runtime and history data of the processes to the Activiti tables. In this release, this is not yet implemented!
- 遷移流程的運行時和歷史數據到Activiti數據庫表。本次發布,這沒有實現!
The data is retrieved from the jBPM 3 tables using Hibernate queries and the Hibernate mappings of jBPM itself.
使用Hibernate查詢和jBPM自身的Hibernate映
射,可以從jBPM 3數據庫表里檢索到這些數據。
Process conversion
流程轉換
It is possible to only convert the process definitions xml from JPDL to BPMN 2.0 that can be executed on the Activiti engine. To do this, place the jBPM 3 processes inside the processes folder. There can be any number of (nested) subfolders, the tool will scan every (sub)folder inside processes to discover processdefinition.xml files (file name must be processdefinition.xml!).
只將JPDL的流程定義xml轉換為能在Activiti引擎執行的BPMN 2.0是有可能的。為了完成這個任務,請將jBPM 3放置到process 文件夾。可以有任何數量(內置)子文件夾,工具將掃描process每個(子)文件夾,來發現processdefinition.xml文件(文件名必須是processfinition.xml!)。
The discovered processes will be parsed and deployed to an in-memory databse, such that the logic of reverse engineering the process definition from the jBPM deployment tables contained in the database migration is used for both cases.
被發現的流程將被解析并部署到一個內存數據庫,以便對包含在數據庫遷移的jBPM部署數據庫表的流程定義進行反向工程,以為解析和部署之用。
Once the jBPM 3 processes are placed in the processes folder, execute the convert.processes target in the root of the unzipped migration tool folder:
一旦jBPM 3流程被放置到process文件夾,那么執行在解壓之后的遷移工具文件夾根目錄下的convert.processes目標。
ant convert.processes
During conversion, you will see plenty logging passing by describing where and how the process conversion is being executed. At the end of the conversion, you will see following logging appear:
在轉換過程中,通過描述流程轉換執行是何地和何時轉換的方式,可以觀察到大量的日志。在轉換的末尾,將觀察到下列日志出現:
As shown in the logging, the resulting BPMN 2.0 processes can be find in the converted-process-xxxx folder, where the xxxx is the timestamp of the conversion.
正如日志所示,BPMN 2.0流程的結果可以在converted-process-xxxx文件夾里找到,這里xxxx是轉換的時間戳。
In this release, only limited support for start, end, wait state and task-nodes is implemented. In the future, this coverage will expand.
在本次發布里,只實現了對開始,結束,等待和任務節點的有限支持。在將來,這個覆蓋范圍將要擴充。