關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正

          由于當時匆忙的發布,沒有進行仔細的校對,發布的EventAdmin部分的代碼中缺少了使用DS實現的示例,但同時在其中又提供了OSGI-INF/component.xml,導致了如果大家直接使用該Component.xml切換為使用DS來實現EventHandler的時候會出現運行時沒反應的現象,這里的錯誤在于component.xml中的
          <property name="event.topics" value="/*"/>
          EventAdmin在通知Event時是根據注冊為EventHandler服務的屬性來通知的,而這個屬性類型要求的為String[]型的,但采用上面的描述方法的話,就把event.topics的屬性注冊為了String類型,所以發布Event后EventAdmin是無法通知到這個EventHandler的,在DS中,要將注冊的屬性換成String[]型,非常的簡單,就把上面一句改為:
          <property name="event.topics">
             org/riawork/EQUINOXEVENT
          </property>
          如需要捕捉多個事件,則可以寫為:
          <property name="event.topics">
             org/riawork/EQUINOXEVENT
             org/riawork/OSGIEVENT
          </property>
          同樣,這里也是支持通配符的,也就是可以這么寫
          <property name="event.topics">
             org/riawork/*
          </property>

          修正后的EventHandler project采用了DS的方式實現,重新打包到了OSGi_Opendoc.rar中,如需要的同學請重新下載。

          ps: 多謝Jim@QAD,才發現了這個錯誤....:)

          posted on 2007-04-04 15:55 BlueDavy 閱讀(2955) 評論(15)  編輯  收藏 所屬分類: OSGi、SOA、SCA

          評論

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-04-04 17:24 sbdwhj

          Jim@QAD
          牛人啊  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-04-11 16:55 笨人

          都很牛!  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-04-25 13:09 張波

          請教一哈我按照OSGI實戰DS發布的方式發布但注入近來的validate卻是空的?
          MANIFEST.MF:
          Manifest-Version: 1.0
          Bundle-ManifestVersion: 2
          Bundle-Name: UserValidateWebBundle Plug-in
          Bundle-SymbolicName: UserValidateWebBundleDS
          Bundle-Version: 1.0.0
          Bundle-ClassPath: bin/
          Service-Component: OSGI-INF/component.xml
          Bundle-Vendor: 張波
          Bundle-Localization: plugin
          Import-Package: com.osgi.user,
          org.osgi.framework;version="1.3.0"
          Require-Bundle: org.eclipse.equinox.servlet.api,
          org.eclipse.equinox.http,
          org.eclipse.osgi.services

          component.xml:
          <?xml version="1.0" encoding="UTF-8"?>
          <component name="LoginServlet">
          <implementation class="com.osgi.web.LoginServlet"/>
          <reference name="UserValidateBundleDS" interface="com.osgi.user.Validate" bind="setValidate" unbind="unsetValidate" policy="dynamic" cardinality="0..1"/>
          <reference name="HttpService" interface="org.osgi.service.http.HttpService" bind="setHttpService" unbind="unsetHttpService" policy="dynamic"/>
          </component>
          我在DS啟動時的啟動級別已經設置為1了但還是不行?請幫忙指點哈謝謝了
            回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-04-25 13:11 張波

          id State Bundle
          0 ACTIVE system.bundle_3.2.0.v20060601
          1 ACTIVE DBValidateBundleDS_1.0.0
          2 ACTIVE LDAPValidateBundleDS_1.0.0
          4 ACTIVE UserValidateWebBundleDS_1.0.0
          5 ACTIVE org.eclipse.equinox.ds_1.0.0.v20060601a
          6 ACTIVE org.eclipse.equinox.http_1.0.2.R32x_v20061218
          7 ACTIVE org.eclipse.equinox.servlet.api_1.0.0.200605182220
          8 ACTIVE org.eclipse.osgi.services_3.1.100.v20060601
          10 ACTIVE UserValidateBundleDS_1.0.0  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-04-25 13:43 BlueDavy

          @張波
          把equinox log實現的bundle加進來,然后在console輸入log,看看是不是有什么錯誤..  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正[未登錄] 2007-05-10 11:09 Keer

          BlueDavy,你好!我是新手,剛接觸OSGI,然后下載到了你的那個OSGI實戰文檔,可惜的是未能得到里面的代碼,冒昧的請求一下,你能發份里面的樣例code給我嗎?謝謝!我的email是:wang_ke@126.com。感謝……! 感謝……!感謝……!  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-05-10 14:04 BlueDavy

          @Keer
          在rar中已經包含了代碼的...
            回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正[未登錄] 2007-05-11 15:45 Keer

          @BlueDavy


          呵呵,發現了。。。 謝謝! BlueDavy, 您熟悉CNF(Common Navigator Framework)嗎? 熟悉的話給點這方面的指導啊!期待……  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正[未登錄] 2007-05-11 16:11 Keer

          BlueDavy,你好,我把您的代碼弄來試了一下,在按照《OSGI實戰》中步驟全部弄好以后,然后我在web browser中敲http://localhost:8080/demo/page/login.htm的時候,頁面上仍然是沒有任何東西啊? 頁面上顯示:The page can not be displayed. 請不吝賜教!謝謝!  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-07-02 17:36 hata

          我按照<實戰>寫的例子也運行不鳥,不知道是沒有web容器還是怎么回事.

          MSN:hatalf@hotmail.com 正在用OSGI 高手請指導  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2007-08-29 16:52 giggs

          最近天天混這里
          學習前輩們的成果  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2008-01-17 15:30 李建敏

          在運行時找不服eventAdmin服務是怎么回事啊?  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2008-01-17 22:37 BlueDavy

          @李建敏
          請確認安裝了EventAdmin的Bundle。
            回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2008-08-14 09:56 xfzhu

          怎么裝EventAdmin的bundle?我每次get下來都是null  回復  更多評論   

          # re: 關于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正 2008-12-25 21:38 劉旭林

          @Keer
          一個是要確定端口號是不是8080,還有就是Import-Package:里面是不是導入了 org.osgi.framework;version="1.3.0",
          org.osgi.service.http;version="1.2.0"
            回復  更多評論   

          公告

           









          feedsky
          抓蝦
          google reader
          鮮果

          導航

          <2007年5月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          統計

          隨筆分類

          隨筆檔案

          文章檔案

          Blogger's

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 贺州市| 油尖旺区| 界首市| 含山县| 南溪县| 绥滨县| 黎川县| 通道| 宁明县| 博客| 黄石市| 邮箱| 左权县| 星子县| 延津县| 佛冈县| 精河县| 太谷县| 磐石市| 新乐市| 马公市| 绿春县| 巴中市| 利津县| 嫩江县| 定结县| 内黄县| 石柱| 韶关市| 项城市| 措美县| 益阳市| 金华市| 安新县| 连州市| 贡嘎县| 伊吾县| 赣州市| 栖霞市| 宜州市| 佛冈县|