随笔 - 251  文章 - 504  trackbacks - 0
<2006年9月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

本博客系个人收集材料及学习记录之用,各类“大侠”勿扰!

留言簿(14)

随笔分类

收藏夹

My Favorite Web Sites

名Bloger

非著名Bloger

搜索

  •  

积分与排名

  • 积分 - 197522
  • 排名 - 289

最新评论

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/下面有配置文件,

则从该目录下读;否则,该文件可以被打包放到包里面了,那么从包中读取配置文件.

posted on 2006-09-14 16:32 matthew 阅读(381) 评论(0)  编辑  收藏 所属分类: Web Services and SOA

只有注册用户登录后才能发表评论。


网站导航: