Activiti User Guide -- Activit 用户指南 Part05

Chapter 6. Deployment

第六章 部署

Table of Contents

Business archives

Deploying programmatically

Deploying with ant

Versioning of process definitions

Business archives

业务档案

To deploy processes, they have to be wrapped in a business archive. A business archive is the unit of deployment to an Activiti Engine. Basically a business archive is equivalent to a zip file. It can contain BPMN 2.0 processes, task forms, rules, java classes and any other type of file. In general, a business archive contains a collection of named resources.

为了部署一个流程,你必须将数据打包成一个业务档案。业务档案是Activiti引擎进行部署的一个单元。基本上一个业务档案相当于一个打包文件。它包含了BPMN2.0流程定义,任务表单,规则,java类和其它一些类型的文件。总的来说,一个业务档案包含了一组命名的资源文件。

 

When a business archive is deployed, it is scanned for BPMN files with a .bpmn20.xml extension. Each of those will be parsed and potentially contains multiple process definitions.

当一个业务档案被部署时,流程引擎将首先获取以.bpmn20.xml结尾的BPMN流程配置文件。然后它们会被逐个被解析,有可能它们包含了多个流程定义。

Deploying programmatically

基于程序进行部署

Deploying a business archive from a zip file can be done like this:

通过一个压缩文件来部署业务档案时,程序大概如下:

String barFileName = "path/to/process-one.bar";
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(barFileName));
    
repositoryService.createDeployment()
    .name("process-one.bar")
    .addZipInputStream(inputStream)
    .deploy();
  It's also possible to build a deployment from individual resources. See javadocs for more details.

也可以通过独立资源文件进行部署。详细可以参考javadoc

Deploying with ant

使用ant进行部署

To deploy a business archive with ant, first the deploy-bar task needs to be defined. Make sure that the configuration jar is on the classpath, as well as the Activiti jar and all its dependencies:

当时有ant进行业务档案部署时,你必须首先定义一个deploy-bartask,并确认配置文件打包成的jarActivitijar以及所依赖的包存在classpath目录下:

<taskdef name="deploy-bar" classname="org.activiti.engine.impl.ant.DeployBarTask">
  <classpath>
    <fileset dir="...">
      <include name="activiti-cfg.jar"/>
      <include name="your-db-driver.jar"/>
    </fileset>
    <fileset dir="${activiti.home}/lib">
      <include name="activiti-engine-${activiti.version}.jar"/>
      <include name="ibatis-sqlmap-*.jar"/>
    </fileset>
  </classpath>
</taskdef>
<deploy-bar file=".../yourprocess.bar" />
  Versioning of process definitions

流程定义的版本

BPMN doesn't have a notion of versioning. And that is good because the executable BPMN process file will probably live in an SVN repository as part of your development project. Versions of process definitions are created during deployment. During deployment, Activiti will assign a version to the ProcessDefinition before it is stored in the Activiti DB.

BPMN本身没有版本概念。这是因为可执行的BPMN流程定义文件或许作为你开发项目的一部分存在SVN仓库中。流程定义的版本是在部署时创建的。当进行流程部署时,Activiti将为ProcessDefinition分配一个版本,然后在存入到数据库中。

 

For each process definition in a business archive the following steps are performed to initialize the properties key, version, name and id:

业务档案中的每一个流程定义将按照下面的顺序对keyversionnameid等属性进行初始化:

  • The process id attribute is used as the process definition key property
  • 流程定义的key属性将作为流程id属性
  • The process name attribute is used as the process definition name property. If the name attribute is not specified, then id attribute is used as the name.
  • 流程定义的name属性作为流程name属性。如果name属性没有指定,那么流程的id值将被赋值给name
  • The first time a process with a particular key is deployed, version 1 is assigned. For all subsequent deployments of process definitions with the same key, the version will be set 1 higher then the max currently deployed version. The key property is used to distinct process definitions.
  • 当流程被首次部署时,version的值将被赋值为1。对于已经部署的流程定义,版本将设置为当前部署版本的最大值+1Key属性则是用来区分两个不同的流程定义。
  • The id property is set to {processDefinitionKey}:{processDefinitionVersion}
  • Id属性设置为:{processDefinitionKey}:{processDefinitionVersion}

你可能感兴趣的:(xml,ant,SVN,ibatis)