分享

Activiti源码分析一——源码架构及结构分析

 贾朋亮博客 2015-12-25

背景介绍

本系列文章是对Activiti-5.15.1的源码进行分析的结果,后面提到的Activiti均是指该版本。源码的下载地址是:https://github.com/Activiti/Activiti/archive/activiti-5.15.1.zip。请参考源码来阅读本文。

源码工程结构

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.

流程数据管理接口。提供对于流程中的各种数据的存取的相关接口。





接下来将继续研究ProcessEngineConfiguration的实现类,具体是如何实现的。


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多