關(guān)于OSGi Opendoc附帶的EventAdmin代碼錯誤的糾正

          由于當(dāng)時匆忙的發(fā)布,沒有進(jìn)行仔細(xì)的校對,發(fā)布的EventAdmin部分的代碼中缺少了使用DS實現(xiàn)的示例,但同時在其中又提供了OSGI-INF/component.xml,導(dǎo)致了如果大家直接使用該Component.xml切換為使用DS來實現(xiàn)EventHandler的時候會出現(xiàn)運(yùn)行時沒反應(yīng)的現(xiàn)象,這里的錯誤在于component.xml中的
          <property name="event.topics" value="/*"/>
          EventAdmin在通知Event時是根據(jù)注冊為EventHandler服務(wù)的屬性來通知的,而這個屬性類型要求的為String[]型的,但采用上面的描述方法的話,就把event.topics的屬性注冊為了String類型,所以發(fā)布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的方式實現(xiàn),重新打包到了OSGi_Opendoc.rar中,如需要的同學(xué)請重新下載。

          ps: 多謝Jim@QAD,才發(fā)現(xiàn)了這個錯誤....:)

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

          評論

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

          Jim@QAD
          牛人啊  回復(fù)  更多評論   

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

          都很牛!  回復(fù)  更多評論   

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

          請教一哈我按照OSGI實戰(zhàn)DS發(fā)布的方式發(fā)布但注入近來的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啟動時的啟動級別已經(jīng)設(shè)置為1了但還是不行?請幫忙指點哈謝謝了
            回復(fù)  更多評論   

          # re: 關(guān)于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  回復(fù)  更多評論   

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

          @張波
          把equinox log實現(xiàn)的bundle加進(jìn)來,然后在console輸入log,看看是不是有什么錯誤..  回復(fù)  更多評論   

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

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

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

          @Keer
          在rar中已經(jīng)包含了代碼的...
            回復(fù)  更多評論   

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

          @BlueDavy


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

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

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

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

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

          MSN:hatalf@hotmail.com 正在用OSGI 高手請指導(dǎo)  回復(fù)  更多評論   

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

          最近天天混這里
          學(xué)習(xí)前輩們的成果  回復(fù)  更多評論   

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

          在運(yùn)行時找不服eventAdmin服務(wù)是怎么回事啊?  回復(fù)  更多評論   

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

          @李建敏
          請確認(rèn)安裝了EventAdmin的Bundle。
            回復(fù)  更多評論   

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

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

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

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

          公告

           









          feedsky
          抓蝦
          google reader
          鮮果

          導(dǎo)航

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

          統(tǒng)計

          隨筆分類

          隨筆檔案

          文章檔案

          Blogger's

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 清水河县| 青龙| 大邑县| 伊金霍洛旗| 醴陵市| 衡水市| 临桂县| 吴忠市| 乐亭县| 丰城市| 平利县| 湾仔区| 平顶山市| 腾冲县| 峨山| 民丰县| 阿拉善盟| 上高县| 五原县| 阿鲁科尔沁旗| 丽水市| 克拉玛依市| 烟台市| 屏东市| 潮安县| 河间市| 屏边| 神农架林区| 兴城市| 清远市| 乐平市| 英吉沙县| 铅山县| 祥云县| 滦平县| 鄂尔多斯市| 宣恩县| 长武县| 金沙县| 万宁市| 黄平县|