ActiveBpel的目录和文件配置策略

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文件:

         bprDirectory
         bpr

  

         aeEngineConfigFile
         aeEngineConfig.xml

我们再看看代码:
         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/下面有配置文件,

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

怎么样,不错吧?




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值