`
salever
  • 浏览: 258787 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

OSGI MANIFEST.MF Header 小结

    博客分类:
  • RCP
 
阅读更多

1 MANIFEST 文件

Bundle Manifest Headers, META-INF/MANIFEST.MF

1.1 Java JAR format:

http://download.oracle.com/javase/1.4.2/docs/guide/jar/jar.html#JAR%20Manifest

Manifest Specification :

1.        manifest-file:                    main-section newline *individual-section

2.        main-section:                    version-info newline *main-attribute

3.        version-info:                      Manifest-Version : version-number

4.        version-number :               digit+{.digit+}*

5.        main-attribute:                 (any legitimate main attribute) newline

6.        individual-section:             Name : value newline *perentry-attribute

7.        perentry-attribute:            (any legitimate perentry attribute) newline

 

1.2 Bundle-ActivationPolicy: lazy

The Bundle-ActivationPolicy specifies how the framework should activate the bundle once started.

If the activation fails because the Bundle Activator start method has thrown an exception, the bundle must be stopped without calling the Bundle Activator stop method.

1.2.1 Lazy Activation Policy

A lazy activation policy indicates that the bundle, once started, must not be activated until it receives the first request to load a class.

Step to activate:

• A Bundle Context is created for the bundle.

• The bundle state is moved to the STARTING state.

• The LAZY_ACTIVATION event is fired.

• The system waits for a class load from the bundle to occur.

• The normal STARTING event is fired.

• The bundle is activated.

• The bundle state is moved to ACTIVE .

• The STARTED event is fired.

 

Starting with eager activation versus lazy activation


 

1.2.2 Activate Rule:

By default, any class loaded from the bundle can trigger the lazy activation, however, resource loads must not trigger the activation. The lazy activation policy can define which classes cause the activation with the following directives:

include – A list of package names that must trigger the activation when a class is loaded from any of these packages. The default is all package names present in the bundle.

exclude – A list of package names that must not trigger the activation of the bundle when a class is loaded from any of these packages. The default is no package names.

For example:

Bundle-ActivationPolicy: lazy; «

include:="com.acme.service.base,com.acme.service.help"

1.3 Bundle-Activator

The Bundle-Activator header specifies the name of the class used to start and stop the bundle.

A bundle is activated by calling its Bundle Activator object, if one exists. The BundleActivator interface defines methods that the Framework invokes when it starts and stops the bundle.

To inform the OSGi environment of the fully qualified class name serving as its Bundle Activator, a bundle developer must declare a Bundle-Activator manifest header in the bundle’s manifest file. The Framework must instantiate a new object of this class and cast it to a BundleActivator instance. It must then call the BundleActivator.start method to start the bundle

Activator 可有可无,在一些 Library bundle 里面可以没有 activator

1.4 Bundle-Category:

The Bundle-Category header holds a comma-separated list of category names.

1.5 Bundle-ClassPath

The Bundle-ClassPath header defines a comma-separated list of JAR file path names or directories (inside the bundle) containing classes and resources. The period (’.’) specifies the root directory of the bundle’s JAR. The period is also the default.

Container entries search order entry path bundle class path

Example

Bundle-ClassPath : lib/ant-antlr.jar,

  lib/ant-apache-log4j.jar,

  lib/ant.jar,

  .

1.6 Fragment-Host

The Fragment-Host header defines the host bundles for this fragment

Fragment-Host ::= bundle-description

bundle-description ::= symbolic-name

(';' parameter ) *

 

When a fragment bundle is attached to a host bundle, it logically becomes part of it. All classes and resources within the fragment bundle must be loaded using the class loader (or Bunde object) of its host bundle. The fragment bundles of a host bundle must be attached to a host bundle in the order that the fragment bundles are installed, which is in ascending bundle ID order.

 

About Fragment

All class or resource loading of a fragment is handled through the host’s class loader or Bundle object, a fragment must never have its own class loader, it therefore fails the class and resource loading methods of the Bundle object. Fragment bundles are treated as if they are an intrinsic part of their hosts.

Though a fragment bundle does not have its own class loader, it still must have a separate Protection Domain when it is not an extension fragment. Each fragment can have its own permissions linked to the fragment bundle’s location and signer.

A host bundle’s class path is searched before a fragment’s class path. This implies that packages can be split over the host and any of its fragments. Searching the fragments must be done in ascending bundle ID order. This is the order that the fragment bundles were installed.

1.7 Bundle-Name

1.8 Bundle-SymbolicName

引用名

The Bundle-SymbolicName manifest header is a mandatory header. The bundle symbolic name and bundle version identify a unique bundle.

 

1.        singleton – Indicates that the bundle can only have a single version resolved. A value of true indicates that the bundle is a singleton bundle . The default value is false . The Framework must resolve at most one bundle when multiple versions of a singleton bundle with the same symbolic name are installed. Singleton bundles do not affect the resolution of non-singleton bundles with the same symbolic name.

2.        fragment-attachment – Defines how fragments are allowed to be attached, see the fragments in Fragment Bundles on page 69. The following values are valid for this directive:

Ø  always – (Default) Fragments can attach at any time while the host is resolved or during the process of resolving.

Ø  never – No fragments are allowed.

Ø  resolve-time – Fragments must only be attached during resolving.

 

1.9 Bundle-RequiredExecutionEnvironment

1.10 Require-Bundle

The Require-Bundle header specifies that all exported packages from another bundle must be imported, effectively requiring the public interface of another bundle.

1.11 Bundle-Version

1.12 Provided-Capability

1.13 Require-Capability

1.14 Bundle-Localization

国际化相关

1.15 Export-Package

The Export-Package header contains a declaration of exported packages.

The header allows many packages to be exported. An export definition is the description of a single package export for a bundle.

 

Export directives are:

uses – A comma-separated list of package names that are used by the exported package. Note that the use of a comma in the value requires it to be enclosed in double quotes. If this exported package is chosen as an export, then the resolver must ensure that importers of this package wire to the same versions of the package in this list. See Package Constraints on page 46.

mandatory - A comma-separated list of attribute names. Note that the use of a comma in the value requires it to be enclosed in double quotes. A bundle importing the package must specify the mandatory attributes, with a value that matches, to resolve to the exported package.

include – A comma-separated list of class names that must be visible to an importer. Note that the use of a comma in the value requires it to be enclosed in double quotes.

exclude -A comma-separated list of class names that must be invisible to an importer. Note that the use of a comma in the value

1.16 Import-Package

The Import-Package header declares the imported packages for this bundle.

The header allows many packages to be imported. An import definition is the description of a single package for a bundle. The syntax permits multiple package names, separated by semi-colons, to be described in a short form.

An error aborts an installation or update when:

• A directive or attribute appears multiple times, or

• There are multiple import definitions for the same package, or

• The version and specification-version attributes do not match.

1.17 Bundle-ContactAddress

1.18 Bundle-Copyright

1.19 Bundle-Description

1.20 Bundle-DocURL:

1.21 Bundle-Icon

1.22 Bundle-License

1.23 Bundle-ManifestVersion: 2

1.24 Bundle-NativeCode

1.25 Bundle-UpdateLocation

1.26 Bundle-Vendor

1.27 DynamicImport-Package

1.28 Export-Service

1.29 Import-Service

1.30 其他

1.30.1 Custom Headers

The manifest an excellent place to provide metadata belonging to a bundle. This is true for the OSGi Alliance but it is also valid for other organizations. For historic reasons, the OSGi Alliance claims the default name space, specifically headers that indicate OSGi related matters like names that contain Bundle, Import, Export, etc. Organizations that want to use headers that do not clash with OSGi Alliance defined names or bundle header names from other organizations should prefix custom headerswith x- , for example x-LazyStart .

Example

Eclipse-SourceBundle: org.eclipse.ui.ide;version="3.6.2.M20101201-0800

  ";roots:="."

1.30.2 Common Header Syntax

Many Manifest header values share a common syntax. This syntax consists of:

header ::= clause ( ’,’ clause ) *

clause ::= path ( ’;’ path ) *( ’;’ parameter ) *

A parameter can be either a directive or an attribute . A directive is an instruction that has some implied

1.30.3 Version

version ::=

major( '.' minor ( '.' micro ( '.' qualifier )? )? )?

major ::= number // See 1.3.2

minor ::= number

micro ::= number

qualifier ::= ( alphanum | ’_’ | '-' )+

A version must not contain any white space. The default value for a version is 0.0.0.

1.30.4 Version Ranges

The syntax of a version range is:

version-range ::= interval | atleast

interval ::= ( '[' | '(' ) floor ',' ceiling ( ']' | ')' )

atleast ::= version

floor ::= version

ceiling ::= version

 

Example

Predicate

[1.2.3, 4.5.6)

1.2.3 <= x < 4.5.6

[1.2.3, 4.5.6]

1.2.3 <= x <= 4.5.6

(1.2.3, 4.5.6)

1.2.3 < x < 4.5.6

(1.2.3, 4.5.6]

1.2.3 < x <= 4.5.6

1.2.3     

1.2.3 <= x

 

分享到:
评论

相关推荐

    declarative

    3. **解析Manifest Header**:`org.eclipse.equinox.ds.parser.Parser`用于解析Bundle的MANIFEST.MF文件,特别是查找`Service-Component`属性,该属性指定了要加载的XML配置文件。例如,下面的MANIFEST.MF片段展示了...

    在校大学生网络购物情况调查报告.doc

    在校大学生网络购物情况调查报告.doc

    【扩频通信】基于matlab m序列、Gold序列和Kasami序列扩频通信【含Matlab源码 13376期】.zip

    Matlab领域上传的视频是由对应的完整代码运行得来的,完整代码皆可运行,亲测可用,适合小白; 1、从视频里可见完整代码的内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作

    训练导控系统设计.zip

    训练导控系统设计.zip

    员工出差流程参照网络.doc

    员工出差流程参照网络.doc

    NX建模实例-USB小风扇外形建模.pdf

    NX建模实例-USB小风扇外形建模.pdf

    基于滑模观测器(SMO)的永磁同步电机(PMSM)负载转矩扰动控制策略研究

    内容概要:本文深入探讨了基于滑模观测器(SMO)的永磁同步电机(PMSM)负载转矩扰动控制策略。首先介绍了传统观测器在面对参数变化和外部干扰时的局限性,然后详细讲解了滑模观测器的设计与实现,包括滑模面构造、切换函数设计以及防止抖振的方法。接着,重点讨论了负载转矩估计的具体实现方法,并提供了完整的MATLAB代码示例。最后,通过仿真实验展示了滑模观测器在突加负载情况下的性能表现及其调整技巧。 适合人群:从事电机控制系统设计的研究人员和技术工程师,尤其是对永磁同步电机负载转矩扰动感兴趣的读者。 使用场景及目标:适用于需要提高永磁同步电机抗负载转矩扰动能力的实际工程项目中,帮助工程师理解和掌握滑模观测器的工作原理及应用方法,从而优化电机控制系统性能。 其他说明:文中不仅提供了理论分析,还给出了详细的MATLAB代码实现,便于读者进行实验验证。同时强调了硬件因素如传感器精度和采样频率对控制效果的影响,提醒读者综合考虑软硬件条件。

    PDM在汽车产品开发中的应用.pdf

    PDM在汽车产品开发中的应用.pdf

    工业监控数据通讯读写时序分析和优化.pdf

    工业监控数据通讯读写时序分析和优化.pdf

    金融第八次实践作业(期末)股票交易策略Python编写(注释详细)

    # 计算收益率 df['daily_return'] = df['close'].pct_change() self.data = df.dropna() return self.data def generate_signals(self): """生成交易信号""" if self.data is None: raise ValueError("请先预处理数据") df = self.data.copy().reset_index(drop=True) # 确保索引是从0开始的连续整数 df['signal'] = 0 # 0表示无信号,1表示买入,-1表示卖出 # 金叉买入,死叉卖出 df['MA_cross'] = np.where(df['MA5'] > df['MA20'], 1, 0) df['MA_cross_signal'] = df['MA_cross'].diff() # 生成买入信号(金叉) df.loc[df['MA_cross_signal'] == 1, 'signal'] = 1 # 生成卖出信号(死叉) df.loc[df['MA_cross_signal'] == -1, 'signal'] = -1 # 添加止损止盈逻辑 in_position = False entry_price = 0 stop_loss = 0 take_pr

    商业银行立体教学平台软件项目三次.doc

    商业银行立体教学平台软件项目三次.doc

    工业运动控制器的应用:自动追剪、飞剪和旋切,在流水线追随工作方式下的电子凸轮插补跟踪控制系统与移栽装配机械手的视觉定位功能

    内容概要:本文详细介绍了工业运动控制器在自动化流水线中的应用及其核心技术。首先阐述了工业运动控制器作为‘大脑’的角色,能够精确控制各种机械设备的运动,如移栽装配机械手和电子凸轮插补跟踪控制系统。接着重点讲解了自动追剪、飞剪和旋切技术的具体实现方法及其带来的生产效率提升和产品质量改善。此外,文章还探讨了流水线追随工作方式和电子凸轮插补跟踪控制系统的作用,强调了它们在确保生产线顺畅运行方面的重要意义。最后,介绍了视觉定位功能的应用,展示了其在提高生产效率和产品质量方面的巨大潜力。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是对运动控制器和视觉定位感兴趣的读者。 使用场景及目标:适用于希望深入了解工业运动控制器及其相关技术在自动化流水线中具体应用的专业人士。目标是帮助读者掌握这些关键技术,从而优化生产线的设计和管理。 阅读建议:建议读者重点关注文中提到的各种技术和应用场景之间的关联,理解工业运动控制器如何通过不同技术手段实现对机械设备的精确控制,并思考如何将这些技术应用于实际工作中。

    基于Java技术的学生选课管理平台设计

    本数据库主要面向学生用户,经过对用户需求的调研与分析,明确了以下用户对数据库的要求: 学生信息:需包含学号、姓名、性别、专业等字段。 登录信息:应涵盖账号和密码。 课程信息:包括课程号、课程名、选课人数、选课容量以及任课老师等内容。 选课信息:涉及课程号与学生学号。 登录信息:包含账号和密码。 身份验证与登录:系统需为学生创建登录信息,学生在进入系统时,必须通过身份验证,只有当输入的用户名和密码均正确时,才能登录进入系统。 信息查看与操作:学生登录系统后,可以在界面中查看自己的基本信息,同时能够查看课程信息表和个人选课信息表,并且可以进行选课操作。 数据存储与读取:系统采用数据库来存储和读取数据内容。

    TRIZ理论在插齿机翻转型工作台上的应用.pdf

    TRIZ理论在插齿机翻转型工作台上的应用.pdf

    单片机实验四报告-外中断实验.doc

    单片机实验四报告-外中断实验.doc

    SAP R-3系统在一汽大众的应用与研究.pdf

    SAP R-3系统在一汽大众的应用与研究.pdf

    汽车工程中预瞄跟踪控制算法与驾驶员模型的MATLAB Simulink联合仿真及应用 - MATLAB 2024版

    内容概要:本文详细介绍了预瞄跟踪控制算法及其在单点和多点驾驶员模型中的应用,重点讲解了如何利用MATLAB Simulink和Carsim进行联合仿真。文章首先解释了单点预瞄模型的基本原理和实现方法,接着讨论了多点预瞄模型的优势以及其实现方式。文中强调了坐标系转换的重要性,并提供了动态调整预瞄距离的经验公式。此外,文章还探讨了Stanley控制器和Pure Pursuit混合策略的应用效果,特别是在复杂路况下的表现。最后分享了一些实用的调参技巧和注意事项,如转向角单位转换等问题。 适合人群:从事汽车工程、自动驾驶研究的技术人员,尤其是对车辆动力学仿真感兴趣的工程师。 使用场景及目标:适用于需要深入了解预瞄跟踪控制算法原理并掌握其具体实现方法的研究人员和技术开发者。目标是提高车辆在不同驾驶条件下的稳定性和操控性能。 其他说明:文中不仅包含了详细的理论推导和代码实现,还有许多基于实践经验得出的小贴士,有助于读者更好地理解和应用相关技术。

    微电网优化技术及其算法研究:从Yalmip+Cplex到粒子群与遗传算法的应用 - 多目标优化

    内容概要:本文详细探讨了微电网优化技术及其相关算法的研究,涵盖多种优化方法和技术手段。主要内容包括:(1)使用Yalmip+Cplex进行微电网优化,涉及光伏、风电、蓄电池和电网的协调配置;(2)采用粒子群算法优化微电网及综合能源系统,通过模拟群体行为来提高能源分配效率;(3)运用多目标算法和遗传算法优化综合能源系统,兼顾经济性和环保性;(4)基于遗传算法的光伏出力预测以及风光负荷典型场景生成程序;(5)介绍拉丁超立方抽样方法及其在场景生成中的应用。每部分均配有详细的代码示例,帮助读者深入理解各算法的具体实现。 适合人群:对微电网优化技术和算法感兴趣的科研人员、工程师及相关领域的学生。 使用场景及目标:适用于希望深入了解并掌握微电网优化技术的人士,旨在提供理论指导和实际操作经验,促进可持续能源的发展。 其他说明:文中提供的代码和案例有助于读者在实践中验证所学知识,提升解决问题的能力。

    基于ANSYS的拨叉的有限元分析及拓扑优化.zip

    基于ANSYS的拨叉的有限元分析及拓扑优化.zip

    单片机课程设计实训报告.doc

    单片机课程设计实训报告.doc

Global site tag (gtag.js) - Google Analytics