flowable EngineConfiguration的作用和继承关系(1)

来源:互联网 发布:巨人网络借壳辽宁成大 编辑:程序博客网 时间:2024/06/03 20:43

EngineConfiguration 是flowable引擎的核心部件。
在 flowable 中,实现引擎配置的顶层类是 AbstractEngineConfiguration 这是一个抽象类。

一、作用

1、第一个作用是配置引擎使用的数据库信息。

protected String databaseType;    protected String jdbcDriver = "org.h2.Driver";    protected String jdbcUrl = "jdbc:h2:tcp://localhost/~/flowable";    protected String jdbcUsername = "sa";    protected String jdbcPassword = "";    protected String dataSourceJndiName;    protected int jdbcMaxActiveConnections;    protected int jdbcMaxIdleConnections;    protected int jdbcMaxCheckoutTime;    protected int jdbcMaxWaitTime;    protected boolean jdbcPingEnabled;    protected String jdbcPingQuery;    protected int jdbcPingConnectionNotUsedFor;    protected int jdbcDefaultTransactionIsolationLevel;    protected DataSource dataSource;    protected DbSchemaManager dbSchemaManager;

2、第二个作用是提供 数据库表结构初始化状态的行为定义。

 public static final String DB_SCHEMA_UPDATE_FALSE = "false";    public static final String DB_SCHEMA_UPDATE_CREATE = "create";    public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";    public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create";    public static final String DB_SCHEMA_UPDATE_TRUE = "true";

3、第三个作用是对mybatis进行封装,提供数据库操作入口

 protected DbSqlSessionFactory dbSqlSessionFactory;    protected SqlSessionFactory sqlSessionFactory;    protected TransactionFactory transactionFactory;    protected TransactionContextFactory transactionContextFactory;    protected Set<Class<?>> customMybatisMappers;    protected Set<String> customMybatisXMLMappers;    protected Set<String> dependentEngineMyBatisXmlMappers;    protected List<CustomMybatisTypeAliasConfig> dependentEngineMybatisTypeAliasConfigs;    protected List<CustomMyBatisTypeHandlerConfig> dependentEngineMybatisTypeHandlerConfigs;    protected List<SessionFactory> customSessionFactories;    protected Map<Class<?>, SessionFactory> sessionFactories;    protected boolean enableEventDispatcher = true;    protected FlowableEventDispatcher eventDispatcher;    protected List<FlowableEventListener> eventListeners;    protected Map<String, List<FlowableEventListener>> typedEventListeners;    protected List<EventDispatchAction> additionalEventDispatchActions;    protected boolean transactionsExternallyManaged;

4、第四个作用 是提供sql执行上下文环境和执行队列

 protected CommandExecutor commandExecutor;    protected Collection<? extends CommandInterceptor> defaultCommandInterceptors;    protected CommandConfig defaultCommandConfig;    protected CommandConfig schemaCommandConfig;    protected CommandContextFactory commandContextFactory;    protected CommandInterceptor commandInvoker;    protected List<CommandInterceptor> customPreCommandInterceptors;    protected List<CommandInterceptor> customPostCommandInterceptors;    protected List<CommandInterceptor> commandInterceptors;

5、第五个作用是完成引擎内部服务的配置和初始化,并构建引擎实例

通过调用相应的方法,获得每个引擎。

formEngineConfiguration.buildFormEngine();idmEngineConfiguration.buildIdmEngine();dmnEngineConfiguration.buildDmnEngine();contentEngineConfiguration.buildContentEngine();processEngineConfiguration.buildProcessEngine();

当然,在调用这个方法之前,需要进行设定适当的参数。

二、继承关系

这里写图片描述

这里写图片描述

三、分类

根据用途分为五类:

1、内容引擎配置

ContentEngineConfiguration

2、流程引擎配置

ProcessEngineConfiguration

3、身份引擎配置

IdmEngineConfiguration

4、决策引擎配置

DmnEngineConfiguration

5、表单引擎配置

FormEngineConfiguration

这里写图片描述

除了流程引擎配置外,其他的引擎配置类都提供了两种不同的配置,包括支持Spring的引擎配置类和独立的引擎配置类。

独立的引擎配置类又被扩展支持内存类型的引擎配置类。

这里写图片描述

这些继承了 AbstractEngineConfig 类的引擎配置类,定制不同的数据库使用模式(单租户、多租户、单数据库、多数据库)、mybatis配置文件、事务的处理、资源的获取等。