ActiveBpel的目录和文件配置策略
2004-09-09 19:00
387 查看
ActiveBpel有很多的目录和文件配置,它对配置的处理也非常巧妙,我们分析如下:
1)CATALINA_HOME配置
有些朋友对TOMCAT的CATALINA_HOME配置感觉奇怪,其实看看TOMCAT的代码我们就能够
明白;在ActiveBpel中也有同样的配置,它是怎么实现的呢?我们看看
org.activebpel.rt.tomcat.AeProcessEngineServlet的代码就知道了.
org.activebpel.rt.tomcat.AeProcessEngineServlet用来启动bpel服务器和axis服务
器,它是随着tomcat的发布自动装载的,它启动后能够启动线程,该线程能够监听业务流
程的发布.
org.activebpel.rt.tomcat.AeProcessEngineServlet有代码如下:
public static final String CATALINA_HOME = System.getProperties
().getProperty("catalina.home");
我想您已经知道怎么回事了.
2)ServletConfig配置
我们看看web.xml文件:
<init-param>
<param-name>bprDirectory</param-name>
<param-value>bpr</param-value>
</init-param>
<!-- Specify the engine configuration location, relative to bpr
directory -->
<init-param>
<param-name>aeEngineConfigFile</param-name>
<param-value>aeEngineConfig.xml</param-value>
</init-param>
我们再看看代码:
mBprDirectory = CATALINA_HOME + "/" + aConfig.getInitParameter
("bprDirectory");
String engineConfigFilename = aConfig.getInitParameter
("aeEngineConfigFile");
上面的aConfig就是在init(ServletConfig aConfig)中声明的,也就是,ActiveBpel启
动时直接从web.xml中读取目录和文件的配置
3)getResourceAsStream的使用
我们看看loadConfiguration方法的代码:
File file = new File(aConfigFilename);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if(file.exists())
{
// load the configuration xml
in = new FileInputStream(file);
}
else
{
log.info("File " + aConfigFilename + " doesn't exist loading
from default classpath " + DEFAULT_BPEL_ENGINE_CONFIG);
// load the default configuration file if not in bpr directory
in = cl.getResourceAsStream(DEFAULT_BPEL_ENGINE_CONFIG);
}
如果您对ClassLoader比较熟悉,应该不难看懂上面的代码.如果/bpr/下面有配置文件,
则从该目录下读;否则,该文件可以被打包放到包里面了,那么从包中读取配置文件.
怎么样,不错吧?
1)CATALINA_HOME配置
有些朋友对TOMCAT的CATALINA_HOME配置感觉奇怪,其实看看TOMCAT的代码我们就能够
明白;在ActiveBpel中也有同样的配置,它是怎么实现的呢?我们看看
org.activebpel.rt.tomcat.AeProcessEngineServlet的代码就知道了.
org.activebpel.rt.tomcat.AeProcessEngineServlet用来启动bpel服务器和axis服务
器,它是随着tomcat的发布自动装载的,它启动后能够启动线程,该线程能够监听业务流
程的发布.
org.activebpel.rt.tomcat.AeProcessEngineServlet有代码如下:
public static final String CATALINA_HOME = System.getProperties
().getProperty("catalina.home");
我想您已经知道怎么回事了.
2)ServletConfig配置
我们看看web.xml文件:
<init-param>
<param-name>bprDirectory</param-name>
<param-value>bpr</param-value>
</init-param>
<!-- Specify the engine configuration location, relative to bpr
directory -->
<init-param>
<param-name>aeEngineConfigFile</param-name>
<param-value>aeEngineConfig.xml</param-value>
</init-param>
我们再看看代码:
mBprDirectory = CATALINA_HOME + "/" + aConfig.getInitParameter
("bprDirectory");
String engineConfigFilename = aConfig.getInitParameter
("aeEngineConfigFile");
上面的aConfig就是在init(ServletConfig aConfig)中声明的,也就是,ActiveBpel启
动时直接从web.xml中读取目录和文件的配置
3)getResourceAsStream的使用
我们看看loadConfiguration方法的代码:
File file = new File(aConfigFilename);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if(file.exists())
{
// load the configuration xml
in = new FileInputStream(file);
}
else
{
log.info("File " + aConfigFilename + " doesn't exist loading
from default classpath " + DEFAULT_BPEL_ENGINE_CONFIG);
// load the default configuration file if not in bpr directory
in = cl.getResourceAsStream(DEFAULT_BPEL_ENGINE_CONFIG);
}
如果您对ClassLoader比较熟悉,应该不难看懂上面的代码.如果/bpr/下面有配置文件,
则从该目录下读;否则,该文件可以被打包放到包里面了,那么从包中读取配置文件.
怎么样,不错吧?
相关文章推荐
- ActiveBpel的目录和文件配置策略
- 不改ueditor源码,通过修改配置文件,实现图片放到工程外目录
- Java读取WEB-INF目录下的properties配置文件
- nagios 目录、文件简介及服务配置
- 使用.emacs.d目录管理Emacs配置文件
- Linux的文件权限与目录配置⑴
- Tomcat学习之二:tomcat安装、配置及目录文件说明
- php文件包含目录配置open_basedir的使用与性能分析
- Linux的文件权限与目录配置
- Java在src目录下加载配置文件的方法
- 2014-12-10:LINUX:文件权限与目录配置
- 《鸟哥的linux私房菜》笔记之文件权限与目录配置
- IIS7虚拟目录出现HTTP错误500.19(由于权限不足而无法读取配置文件)的问题
- Linux中配置文件的目录位置(一)
- WinCE6.0下目录结构及配置文件汇总---配置文件
- 《Linux学习系列》---之文件权限与目录配置
- C#使用单例模式类获取本地程序目录下XML文件中的配置信息
- windows系统中Emacs的HOME目录及配置文件的正确路径
- nginx 配置禁止访问目录或文件
- 【Puppet in action】 学习笔记之Puppet目录结构及配置文件说明