gembin

          OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

          HBase, Hadoop, ZooKeeper, Cassandra

          Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

          There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

          About Me

           

          OSGi Service Platform Core Specification Release 4 - Package Admin Service Specification

          7.1 Introduction

          Bundles can export packages to other bundles. This exporting creates a dependency between the bundle exporting a package and the bundle using the package. When the exporting bundle is uninstalled or updated, a decision must be taken regarding any shared packages.
          The Package Admin service provides an interface to let the Management Agent make this decision.
          Bundles能輸出包到其他bundles,這個輸出將會在輸出bundle與引入bundle間發生一個依賴關系,當輸出bundle被卸載或更新 時,對相關的共享包必須做出一個決定(相應動作)。包管理服務提供了一個接口讓Management Agent來做這個決定。

          7.1.1 Essentials

          • Information – The Package Admin service must provide the sharing status of all packages. This should include information about the importing bundles and exporting bundle.
          • Policy – The Package Admin service must allow a management agent to provide a policy for package sharing when bundles are updated and uninstalled.
          • Minimal update – Only bundles that depend on the package that needs to be resolved should have to be restarted when packages are forced to be refreshed.

          • Information – 包管理服務必須提供所有包的共享狀態,這應該包括輸出bundle和引入bundle的相關信息。
          • Minimal update – 依賴于需要被解析的包的bundles應該在這些包被強制刷新的時候被重啟

          7.1.2 Entities

          • PackageAdmin – The interface that provides access to the internal Framework package sharing mechanism.
          • ExportedPackage – The interface provides package information and its sharing status.
          • RequiredBundle – The interfaces provides information about the bindings of required bundles.
          • Management Agent – A bundle that is provided by the Operator to implement an Operator specific policy.

          • PackageAdmin – 接口,提供了對框架內部包共享機制的訪問。
          • ExportedPackage – 接口,提供包的信息和包的共享狀態。
          • RequiredBundle – 接口,提供required bundles的綁定相關的信息
          • Management Agent – 一個bundle,由操作人員提供,用于實現操作人員指定的策略。



          7.1.3 Operation

          The Framework’s system bundle should provide a Package Admin service for the Management Agent. The Package Admin service must be registered under the org.osgi.service.packageadmin.PackageAdmin interface by the system bundle. It provides access to the internal structures of the Framework related to package sharing, fragments and required bundles. This is an optional singleton service, so at most one Package Admin service must be
          registered at any moment in time.
          框架的系統bundle應該為Management Agent提供一個包管理服務,包管理服務必須由系統bundle注冊在 org.osgi.service.packageadmin.PackageAdmin的接口名下,它提供對框架內部結構中關于包共享,片段和 required bundles的訪問。這是一個可選的單例服務,因此最多只有一個包管理服務被注冊。

          The Framework must always leave the package sharing intact for packages exported by a bundle that is uninstalled or updated. A Management Agent can then choose to force the framework to refresh these packages using the Package Admin service. A policy of always using the most current packages exported by installed bundles can be implemented with a Management Agent that watches Framework events for bundles being uninstalled or updated, and then refreshes the packages of those bundles using the Package Admin service.
          一個卸載或更新的bundle輸出的包,框架必須總是保證這些包沒有被使用,這時Management Agent就可以使用包管理服務選擇強制框架刷新這些包??偸鞘褂冒惭bbundle輸出的通用包的策略可以被一個監聽卸載或更新bundle的框架事件的 Management Agent實現,然后使用包管理服務刷新那些bundles的包。

          7.2 Package Admin

          The Package Admin service is intended to allow a Management Agent to define the policy for managing package sharing. It provides methods for examining the status of the shared packages. It also allows the Management Agent to refresh the packages and stop and restart bundles as necessary.
          包管理服務允許一個Management Agent定義管理包共享的策略,它提供了檢查共享包的狀態的方法,也允許Management Agent刷新包,并在需要的時候停止和重啟bundles

          7.2.1 Package Sharing

          The PackageAdmin class provides the following methods:
          • getExportedPackage(String) – Returns an ExportedPackage object that provides information about the requested package. This information can be used to make the decision to refresh the package.
          • getExportedPackages(Bundle) – Returns a list of ExportedPackage objects for each package that the given bundle exports.
          • refreshPackages(Bundle[]) – The management agent may call this method to refresh the exported packages of the specified bundles. The actual work must happen asynchronously. The Framework must send a Framework.PACKAGES_REFRESHED when all packages have been refreshed.
          • resolveBundles(Bundle[]) – The Framework must attempt to resolve the given bundles.

          類PackageAdmin提供了一下方法:
          • getExportedPackage(String) – 返回一個提供了與requested package相關的信息的ExportedPackage對象,這個信息可以決定是否需要刷新包。
          • getExportedPackages(Bundle) – 返回一個ExportedPackage對象的列表,給定的bundle所輸出的包
          • refreshPackages(Bundle[]) – management agent可以調用這個方法去刷新指定的bundle輸出的包,這個動作必須是同步的。當所有包都被刷新后,框架必須發出一個 Framework.PACKAGES_REFRESHED事件。
          • resolveBundles(Bundle[]) – 框架必須嘗試解析給定的bundles

          7.2.2 Bundle Information

          There is only the Bundle interface in the Framework API while bundles can perform different roles in the Framework. The Package Admin service provides access to this structural information.
          • getBundle(Class) – Answer the bundle with the class loader that loaded the given class.
          • getBundles(String,String)– Find a the set of bundles with the given bundle symbolic name and that fall within the given version. If the version is null, all bundles with the given bundle symbolic name are returned.
          • getBundleType(Bundle) – Answer the type of the bundle. This is a bitmap of the different types. The following type is defined:
            • BUNDLE_TYPE_FRAGMENT– The bundle is a fragment.

          bundles可以在框架中扮演不同的角色,但是這些bundle都在來自一個接口Bundle,包管理服務提供了對這個結構信息的訪問:
          • getBundle(Class) – 查找一個bundle,這個bundle的classloader加載了這個給定的類
          • getBundles(String,String)– 查找一個bundle集合,通過給定的標記名和版本號,如果版本號是null,那么將返回給定的標記名的bundles
          • getBundleType(Bundle) – 查詢bundle的類型。定義了以下類型
            • BUNDLE_TYPE_FRAGMENT–bundle是個片段

          7.2.3 Fragments and Required Bundles

          The Package Admin service provides access to the network that is created by by requiring bundles and hosting fragments.
          • getFragments(Bundle) – Return an array of bundles that currently act as fragment to the given bundle. If there are no fragments attached, null must be returned.
          • getHosts(Bundle) – Return the bundle that acts as host to this fragment bundle. The given bundle should be an attached fragment bundle, otherwise null is returned.
          • getRequiredBundles(String) – Return an array of RequiredBundle objects that match the given name (or all of the given name is null). The RequiredBundle object provides structural information about a required bundle.

          包管理服務提供了對由需求bundle和主片段形成的關系網的訪問。
          • getFragments(Bundle) – 返回一個bundles的集合,這個集合中的bundles是給定bundle的片段,如果沒有片段,返回null
          • getHosts(Bundle) – 返回給定bundle的宿主bundle。這個給定的bundle應該是個片段,否則返回null。
          • getRequiredBundles(String) – 返回RequiredBundle對象的集合,這個集合匹配了給定的名字(bundle標記名),如果給定的名字是null,將返回所有required 的bundles。每一個RequiredBundle對象提供了對一個required的bundle的結構信息的描述。

          7.2.4 Exported Package

          Information about the shared packages is provided by the ExportedPackage objects. These objects provide detailed information about the bundles that import and export the package. This information can be used by a Management Agent to guide its decisions.
          與共享包相關的信息是由ExportedPackage對象提供的,這些ExportedPackage對象提供了引入包或輸出包的bundles的細節信息,這些信息可以被Management Agent用于參考它的決定。

          7.2.5 Refreshing Packages and Start Level Service

          Bundles may be stopped and later started when the refreshPackages(Bundle[]) method is called. If the Start Level Service is present, the stopping and starting of bundles must not violate the start level constraints. This implies that bundles with a higher start level must be stopped before bundles with a lower start level are stopped. Vice versa, bundles should not be started
          before all the bundles with a lower start level are started. See Startup Sequence on page 207.

          當調用refreshPackages(Bundle[])方法時,bundles可能會先停止,然后又啟動,如果設置了啟動級別服務,那么 bundles的停止和啟動必須不能違反啟動級別的限制,也就是說高啟動級別的bundles必須比低啟動級別的bundles先停止,低啟動級別的 bundles比高啟動級別的bundles先啟動。

          posted on 2008-05-09 18:00 gembin 閱讀(660) 評論(0)  編輯  收藏 所屬分類: OSGi

          導航

          統計

          常用鏈接

          留言簿(6)

          隨筆分類(440)

          隨筆檔案(378)

          文章檔案(6)

          新聞檔案(1)

          相冊

          收藏夾(9)

          Adobe

          Android

          AS3

          Blog-Links

          Build

          Design Pattern

          Eclipse

          Favorite Links

          Flickr

          Game Dev

          HBase

          Identity Management

          IT resources

          JEE

          Language

          OpenID

          OSGi

          SOA

          Version Control

          最新隨筆

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          free counters
          主站蜘蛛池模板: 泰安市| 台东县| 唐山市| 安康市| 广东省| 乌鲁木齐县| 朔州市| 江孜县| 万全县| 怀化市| 昂仁县| 西乌珠穆沁旗| 宜兰市| 安溪县| 休宁县| 马公市| 中宁县| 嘉义县| 额敏县| 屏东县| 本溪市| 焦作市| 廉江市| 广丰县| 南澳县| 永泰县| 调兵山市| 五寨县| 砚山县| 微山县| 静海县| 德江县| 霍邱县| 林周县| 如皋市| 塘沽区| 邵武市| 易门县| 家居| 大足县| 尼玛县|