Mule部署描述符(Deployment Descriptor)

Deployment Descriptor

部署描述符能够做什么?

Mule的部署描述符是一个老的可用的属性配置,不过,一般的应用将很少会使用到,基本上都是默认的。

Mule将检查你应用的根目录是否存在mule-deploy.properties文件,如果存在则使用。(这是个可选的文件)

以下是这个文件能够支持的配置属性:

Name Description Default
domain

ClassLoader domain for this application. Typically used to share common libraries between

applications and/or to allow use of different library version in applications.

Maps directly to $MULE_HOME/lib/shared/<domain>.

E.g. stockDomain maps to $MULE_HOME/lib/shared/stockDomain.

"default"
config.resources

A Mule 2.x-style comma separated list of configuration files for this application.

Typical use is to support split configurations declaratively.

An alternative is to have a default mule-config.xml file import extra configuration pieces.

Note that the first config piece is considered to be a 'master' and will be monitored for redeployment, but not others.

mule-config.xml

from the app root

is used if nothing

else specified

redeployment.enabled

Allows to explicitly disable application hot-redeployment - configuration 'master' file will not be monitored for changes.

Dropping a new version of the application archive in the $MULE_HOME/apps will still redeploy the application.

Any values other than true, yes, on are treated as false and disable the config change monitor.

Enabled by default
encoding Default encoding, used throughout the application if none specified explicitly on e.g. a transformer UTF-8
config.builder Configuration builder to use for parsing the application config file. AutoConfigurationBuilder

选项(Options)

此外,一个应用程序的根目录可以包含mule-app.properties文件(放在mule-deploy.properties旁边),这是用来存放应用中的一些个性化属性配置,

Mule通过将其注册使其变得合法,并且可以通过以下两种方式进行访问:

1.在应用程序启动的时候在配置文件文件中添加占位符-$(foo)来查找foo值(或者其他在Mule中注册的表达式)

2.在代码中实现接口MuleContextAware,然后通过muleContext.getRegistry()使其得以访问,在之后的实例中可以通过合适的lookup方法访问到。

类加载器布局(Classloader layout)

下图描述了类加载器的层次图:

1.共享的类加载器域能够为不同应用集合提供同一个类库的不同版本

2.除非你特别指出,否则默认的域将被使用,客户化的域必须通过在部署描述符文件中指定domain属性值。

原文地址:http://www.mulesoft.org/documentation/display/MULE3USER/Deployment+Descriptor

posted @ 2011-04-02 11:19  wuwenyu  阅读(540)  评论(0)    收藏  举报