这是Jboss 的jBPM3.12框架的用户指南的中文翻译。我的翻译风格是中英文对照,只翻译部分我认为重要的,不翻译简单的英文,以免浪费你我的时间。 同时,对于其中的部分内容,我会在翻译中做出解释和写上我的理解。
这里先提供最后一章的译文。其它章节,以后有时间时,在整理一下放上来。
Chapter 19. Pluggable architecture可插式架构
The functionality of jBPM is split into modules. Each module has a definition and an execution (or runtime) part. The central module is the graph module, made up of the ProcessDefinition and the ProcessInstance. The process definition contains a graph and the process instance represents one execution of the graph. All other functionalities of jBPM are grouped into optional modules. Optional modules can extend the graph module with extra features like context (process variables), task management, timers, ...
jBPM的功能是划分成模块的。每一个模块有一个定义和一个执行(运行时)部分。中央模块式图表模块,由业务程序定义和业务程序实例组成。业务程序定义包含一个图表和代表这个图表的执行的业务程序实例。所有其它的jBPM功能组成了可选的模块。可选模块能够通过提供额外的特性扩展图表模块,如上下文(业务程序变量),任务管理,定时器等。
Figure 19.1. The pluggable architecture可插式架构
The pluggable architecture in jBPM is also a unique mechanism to add custom capabilities to the jBPM engine. Custom process definition information can be added by adding a ModuleDefinition implementation to the process definition. When the ProcessInstance is created, it will create an instance for every ModuleDefinition in the ProcessDefinition. The ModuleDefinition is used as a factory for ModuleInstances.
jBPM中可插式架构也是唯一的向jBPM引擎加入定制功能的机制。
当业务程序实例创建时,将为在业务程序定义内的每一个模块定义创建一个实例。模块定义是模块实例的一个工厂。
The most integrated way to extend the process definition information is by adding the information to the process archive and implementing a ProcessArchiveParser. The ProcessArchiveParser can parse the information added to the process archive, create your custom ModuleDefinition and add it to the ProcessDefinition.
最好的集成方案是,通过向业务程序定义存档文件添加信息的方式扩展业务程序定义的信息,这需要你自己实现一个ProcessArchiveParser业务程序存档文件解析器。ProcessArchiveParser业务程序存档文件解析器能够解析你加到业务程序存档文件上的信息,创建你自己的模块定义和把它增加到业务程序定义上!
public interface ProcessArchiveParser {
void writeToArchive(ProcessDefinition processDefinition, ProcessArchive archive);
ProcessDefinition readFromArchive(ProcessArchive archive, ProcessDefinition processDefinition);
}
To do its work, the custom ModuleInstance must be notified of relevant events during process execution. The custom ModuleDefinition might add ActionHandler implementations upon events in the process that serve as callback handlers for these process events.
要做这项工作,定制的模块实例在业务程序执行期间必须得到相关的事件通知。定制的模块定义可能在业务程序中增加ActionHandler实现来处理事件。这些ActionHandler接口实现类为这些业务程序事件作为回调处理器服务。
Alternatively, a custom module might use AOP to bind the custom instance into the process execution. JBoss AOP is very well suited for this job since it is mature, easy to learn and also part of the JBoss stack.
可选的,一个定制模块可能使用AOP把定制实例绑定到业务程序实例的执行上。Jboss AOP非常适合这个工作。