源码工程结构
Activiti使用maven来管理源码工程。它是一个maven项目群组成的。这些项目群中的子模块之间的关系如下所示。
上图体现了各项目之间的集成和依赖关系。
下面是各项目的说明。说明,省略了所有相同的groupId的值org.activiti
项目名称 | 项目内容 |
activiti-bpmn-model | 该项目中包含了Activiti实现的BPMN的模型定义的类,实现了BPMN2.0的标准,参考BPMN2.0去理解比较容易些。 |
activiti-process-validation | 该项目中包含了工作流的校验相关的代码。 |
activiti-bpmn-converter | 该项目中包含了对XML格式定义的流程进行解析和转换的类。 |
activiti-engine | 该项目是工作流引擎的核心工程,该工程可以独立部署提供服务,集成了其它几个子工程。 |
因此可以看出来核心的工程是activiti-engine,该工程主要实现了Activiti工作流引擎的核心逻辑。接下来的代码分析主要从该工程代码入手。
activiti-engine工程结构
从上图可以看出来,目前activiti-engine是用到了spring和mybatis两个组件的,另外使用了一些通用的包,主要是common-*,测试用到了junit4.
activiti-engine抽象接口类图
上述类图是activiti的几个抽象接口,这些接口也是暴露给应用程序最终的几个接口,了解这些接口非常重要。
接口名称 | 接口含义 |
EngineServices | Interface implemented by all classes that expose the Activiti services. 该接口表示是工作流引擎,通过该接口暴露出工作流引擎的核心服务,其它主要接口的实例通过该接口获取。 |
RepositoryService | Service providing access to the repository of process definitions and deployments. 该接口是提供了流程定义和部署的服务。 |
RuntimeService | 流程运行时接口,该接口提供了流程实例的各种处理服务。 |
FormService | Access to form data and rendered forms for starting new process instances and completing tasks. 动态表单服务,提供了表单的数据获取、表单生成等服务接口。 |
TaskService | Service which provides access to {@link Task} and form related operations. 任务相关服务,提供了对任务的各种处理接口。 |
HistoryService | Service exposing information about ongoing and past process instances. This is different * from the runtime information in the sense that this runtime information only contains * the actual runtime state at any given moment and it is optimized for runtime * process execution performance. The history information is optimized for easy * querying and remains permanent in the persistent storage. 历史服务,主要提供了查询历史的流程实例的相关数据的接口。
|
IdentityService | Service to manage {@link User}s and {@link Group}s. 用户和用户组的接口。若想实现与本地用户的集成,可以重新实现该接口。
|
ManagementService | Service for admin and maintenance operations on the process engine. * * These operations will typically not be used in a workflow driven application, * but are used in for example the operational console. 流程数据管理接口。提供对于流程中的各种数据的存取的相关接口。
|