当前位置:编程学习 > 网站相关 >>

activiti配置

Creating a ProcessEngine(建立一个流程引擎)
ProcessEngineConfiguration bean
Database configuration(数据库配置)
Job executor activation(作业执行器激活)
Mail server configuration(邮件服务器配置)
History configuration(历史配置)
Supported databases(支持的数据库)
Changing the database(改变数据库)
Downloading the Oracle driver(下载Oracle)
Creating a ProcessEngine(建立一个流程引擎)
The Activiti process engine is configured through a xml file called activiti.cfg.xml. Note that this is not applicable if you're using the Spring style of building a process engine.

Activiti流程引擎通过一个叫做的xml文件来配置。注意你采用构建流程引擎的Spring风格的方式the Spring style of building a process engine,这种方式并不适合

The easiest way to obtain a ProcessEngine, is to use the org.activiti.engine.ProcessEngines class:

获取ProcessEngine最容易的方式是使用org.activiti.engine.ProcessEngines类:

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine()
This will look for an activiti.cfg.xml file on the classpath and construct an engine based on the configuration in that file. The following snippet shows an example configuration. The following sections will give a detailed overview of the configuration properties.

这将在classpath上寻找 activiti.cfg.xml文件,并在那个文件的配置之上构建一个引擎。下列片段显示了一个示例配置。下面部分将给出详细的配置特性的总体概观。

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="databaseType" value="h2" />
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
<property name="mailServerHost" value="mail.my-corp.com" />
<property name="mailServerPort" value="5025" />
</bean>
</beans>
Note that the configuration xml is in fact a Spring configuration. This does not mean that Activiti can only be used in a Spring environment! We are simply leveraging the parsing and dependency injection capabilitities of Spring internally for building up the engine.

注意配置文件事实上是一个Spring配置。这并不意味着Activiti只能在Spring环境下使用! 为了构建引擎,我们在内部简单地平衡了解析和Spring的依赖注入的能力。

The ProcessEngineConfiguration object can also be created programmatically using the configuration file. It is also possible to use a different bean id (eg. see line 3).

通过使用配置文件,也能通过编程方式建立ProcessEngineConfiguration对象。使用一个不同的bean id也是可能的。(例如,见第3行)。

ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(String resource);
ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(String resource, String beanName);
ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(InputStream inputStream);
ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(InputStream inputStream, String beanName);
It is also possible not to use a configuration file, and create a configuration based on defaults (see the different supported classes for more information).

不使用配置文件也是可能的,基于缺省建立一个配置(详情参见不同支持的类(the different supported classes))

ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
All these ProcessEngineConfiguration.createXXX() methods return a ProcessEngineConfiguration that can further be tweaked if needed. After calling thebuildProcessEngine() operation, aProcessEngine is created:

如果需要所有 ProcessEngineConfiguration.createXXX()的方法返回一个能进一步配置的ProcessEngineConfiguration 。在调用操作之后,建立一个ProcessEngine 。

ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
.setJobExecutorActivate(true)
.buildProcessEngine();
ProcessEngineConfiguration bean
The activiti.cfg.xml must contain a bean that has the id 'processEngineConfiguration'.

dd activiti.cfg.xml 必须包括具有id 'processEngineConfiguration'的bean。

 <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
This bean is then used to construct the ProcessEngine. There are multiple classes available that can be used to define the processEngineConfiguration. These classes represent different environments, and set defaults accordingly. It's a best practice to select the class the matches (the most) your environment, to minimalise the number of properties needed to configure the engine. Following classes are currently available (more will follow in future releases):

得到这个bean然后用来构建e ProcessEngine。可以定义processEngineConfiguration的类有多个。这些类表示不同的环境,响应地设置为缺省。为了减少需要配置引擎的属性数量,选择的类以匹配环境是最佳实践。当前可获得的类如下(将来的版本将推出新的类)


org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration: the process engine is used in a standalone way. Activiti will take care of the transactions. By default, the database will only be checked when the engine boots (and an exception is thrown if there is no Activiti schema or the schema version is incorrect).

org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration:以独立方式运行的流程引擎。Activiti将考虑事务。缺省地,只有在引擎引导时检查数据库(如果没有Activiti schema或者schema版本不正确,将抛出异常)。

org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration: this is a convience class for unit testing purposes. Activiti will take care of the transactions. An H2 in-memory database is used by default. The database will be created and dropped when the engine boots and shuts down. When using this, probably no additional configuration is needed (except when using for example the job executor or mail capabilities).

org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration: 这是一个针对单元测试目的的便捷类。Activiti将考虑事务。缺省使用H2内存数据库。当引擎引导并关闭时,数据库将被建立和删除。当使用时,可能需要额外的配置(当使用作业执行器或者邮件能力的示例除外)

org.activiti.spring.SpringProcessEngineConfiguration: To be used when the process engine is used in a Spring environment. See the Spring integration section for more information.

org.activiti.spring.SpringProcessEngineConfiguration: 当在Spring环境下使用流程引擎时使用。详情参见Spring集成部分the Spring integration section。

org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration: ([EXPERIMENTAL]) to be used when the engine runs in standalone mode, with JTA transa

补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,