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}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先,Activity是Android系统中的四大组件之一,可以用于显示View。Activity是一个与用记交互的系统模块,几乎所有的Activity都是和用户进行交互的,但是如果这样就能说Activity主要是用来显示View就不太正确了。 在深入了解Activity之前,我们先要知道一下MVC设计模式,在JAVAEE 中MVC设计模式已经很经典了,而且分的也比较清晰了,但是在Android中,好多人对MVC在Android开发中的应用不是很清楚,下面我就先来介绍一下MVC在Android开发中的应用: M(Model 模型):Model是应用程序的主体部分,所有的业务逻辑都应该写在这里,在Android中Model层与JavaEE中的变化不大,如:对数据库的操作,对网络等的操作都放在该层(但不是说它们都放在同一个包中,可以分开放,但它们统称为Model层)。 V(View 视图):是应用程序中负责生成用户界面的部分,也是在整个MVC架构中用户唯一可以看到的一层,接收用户输入,显示处理结果;在Android应用中一般采用XML文件里德界面的描述,使用的时候可以非常方便的引入,当然也可以使用JavaScript+Html等方式作为View。 C(Controller控制层)android的控制层的重任就要落在众多的activity的肩上了,所以在这里就要建议大家不要在activity中写太多的代码,尽量能过activity交割Model业务逻辑层处理。 好了,在介绍过Android应用开发中的MVC架构后,我们就可以很明确的知道,在Android中Activity主要是用来做控制的,它可以选择要显示的View,也可以从View中获取数据然后把数据传给Model层进行处理,最后再来显示出处理结果。 介绍过Activity的主要作用后,那么我们就要详细说一下Activity了。 Activity生命周期图 Activity 的生命周期是被以下的函数控制的。 public class Activity extends ApplicationContext { protected void onCreate(Bundle icicle); protected void onStart(); protected void onRestart(); protected void onResume(); protected void onFreeze(Bundle outIcicle); protected void onPause(); protected void onStop(); protected void onDestroy(); } onCreate(Bundle) 函数是你进行初始化的地方,这个也是执行 setContentView(View)函数的地方,setContentView(View)函数可以传入一个由XML 编制的UI界面,可以使UI和具体实现完全分离。 onPause()函数是处理用户离开当前 Activity 的地方。更重要的是,任何在当前 Activity中的任何改变都要在这个函数中提交。 Activity有四种状态: 活动状态,当Activity处于Stack(栈)顶时,就是手机当前的现实屏幕,这是 Activity就 处于activity或者运行状态。 运行但是失去焦点,当Activity还处于运行状态时,但是屏幕是有另外一个Activity 处于文档处于焦点状态,当前的Activity就处于pause。 停止,当Activity被另一个Activity完全覆盖的时候,就被停止了,其实就是虽然在 运行,但是用户却看不见。 结束,当Activity处于pause或者stop时,系统可以结束 Activity,回收资源,这 是Activity就是处于结束状态了。 处于结束状态的是Activity,如果要使用户可见,只要重启才可以。 Activity的响应时间 当前Activity所在的线程为主线程,它的响应时间为5秒,如果在当前运行的Activity中进行耗时的操作且响应时间起过5秒,那么程序就会报ANR错误。所以,这也是不建议在Activity中写太多复杂代码的原因之一。 当然,有些代码只能写在Activity中,不然就运行不了(它们不是生命周期方法),比如你想要获得android系统或者硬件一的些信息,就必须在Activity中写出来,如果单独写一个工具类获得不了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值