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

          本博客系個(gè)人收集材料及學(xué)習(xí)記錄之用,各類“大俠”勿擾!

          留言簿(14)

          隨筆分類

          收藏夾

          My Favorite Web Sites

          名Bloger

          非著名Bloger

          搜索

          •  

          積分與排名

          • 積分 - 202865
          • 排名 - 284

          最新評(píng)論

          ActiveBpel有很多的目錄和文件配置,它對(duì)配置的處理也非常巧妙,我們分析如下:

          1)CATALINA_HOME配置
          有些朋友對(duì)TOMCAT的CATALINA_HOME配置感覺奇怪,其實(shí)看看TOMCAT的代碼我們就能夠

          明白;在ActiveBpel中也有同樣的配置,它是怎么實(shí)現(xiàn)的呢?我們看看

          org.activebpel.rt.tomcat.AeProcessEngineServlet的代碼就知道了.
          org.activebpel.rt.tomcat.AeProcessEngineServlet用來啟動(dòng)bpel服務(wù)器和axis服務(wù)

          器,它是隨著tomcat的發(fā)布自動(dòng)裝載的,它啟動(dòng)后能夠啟動(dòng)線程,該線程能夠監(jiān)聽業(yè)務(wù)流

          程的發(fā)布.
          org.activebpel.rt.tomcat.AeProcessEngineServlet有代碼如下:

          ??????? public static final String CATALINA_HOME = System.getProperties????

          ?? ().getProperty("catalina.home");
          我想您已經(jīng)知道怎么回事了.

          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>
          我們?cè)倏纯创a:
          ???????? mBprDirectory = CATALINA_HOME + "/" + aConfig.getInitParameter

          ("bprDirectory");
          ???????? String engineConfigFilename = aConfig.getInitParameter

          ("aeEngineConfigFile");
          上面的aConfig就是在init(ServletConfig aConfig)中聲明的,也就是,ActiveBpel啟

          動(dòng)時(shí)直接從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);
          ???????? }
          如果您對(duì)ClassLoader比較熟悉,應(yīng)該不難看懂上面的代碼.如果/bpr/下面有配置文件,

          則從該目錄下讀;否則,該文件可以被打包放到包里面了,那么從包中讀取配置文件.

          posted on 2006-09-14 16:32 matthew 閱讀(408) 評(píng)論(0)  編輯  收藏 所屬分類: Web Services and SOA
          主站蜘蛛池模板: 青海省| 二连浩特市| 蒲江县| 贵定县| 太谷县| 乐至县| 新干县| 昌邑市| 定襄县| 大连市| 耒阳市| 新丰县| 尼玛县| 德昌县| 灵武市| 常宁市| 滁州市| 宁夏| 江华| 长阳| 商水县| 苏州市| 海兴县| 华池县| 东至县| 礼泉县| 平潭县| 万盛区| 西盟| 漳浦县| 宜都市| 灵台县| 南开区| 上高县| 深圳市| 金沙县| 视频| 宁晋县| 牙克石市| 黄浦区| 海安县|