快速业务通道

Spring-OSGI 1.0 M3中文手册 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-14
ing-OSGI 1.0 M3中文手册(2) 时间:2011-11-02 DIY部落

以下是 Spring-Context的相关内容和配置,主要意思如下:

1.如果在Spring-Context指定了配置文件,那么extender将忽略 META-INF/spring 中的配置文件,除 非明确指定。

2.可以用通配符,例如Spring-Context: osgi-*;

3.create-asynchronously=false(默认值是true) ,使用同步方式创建该bundle的application context。有一点需要注意,同步创建application context的过程是在OSGi的事件线程中进行的,它将阻 塞这个线程的事件发送,直到完成application context的初始化。如果这个过程中发生了错误,那么将 出现一个FrameworkEvent.ERROR,但是bundle的状态仍然还是ACTIVE。

4.wait-for-dependencies和timeout,从字面意思就能看出来了。

5.publish-context:=false(默认值是true),不将application context作为一个服务发布。

The Spring-Context manifest header may be used to specify an alternate set of configuration files. The resource paths are treated as relative resource paths and resolve to entries defined in the bundle and the set of attached fragments. When the Spring-Context header defines at least one configuration file location, any files in META-INF/spring are ignored unless directly referenced from the Spring-Context header.

The syntax for the Spring-Context header value is:

Spring-Context-Value ::= context ( '','' context ) * context ::= path ( '';'' path ) * ('';'' directive) *

This syntax is consistent with the OSGi Service Platform common header syntax defined in section 3.2.3 of the OSGi Service Platform Core Specification.

For example, the manifest entry:

Spring-Context: config/account-data-context.xml, config/account-security-context.xml

will cause an application context to be instantiated using the configuration found in the files account-data-context.xml and account-security-context.xml in the bundle jar file.

A number of directives are available for use with the Spring-Context header. These directives are:

create-asynchronously (false|true): controls whether the application context is created asynchronously (the default), or synchronously.

For example:

Spring-Context: *;create-asynchronously=false

Creates an application context synchronously, using all of the "*.xml" files contained in the META-INF/spring folder.

Spring-Context: config/account-data-context.xml;create-asynchrously:=false

Creates an application context synchronously using the config/account-data-context.xml configuration file. Care must be taken when specifying synchronous context creation as the application context will be created on the OSGi event thread, blocking further event delivery until the context is fully initialized. If an error occurs during the synchronous creation of the application context then a FrameworkEvent.ERROR event is raised. The bundle will still proceed to the ACTIVE state.

wait-for-dependencies (true|false): controls whether or not application context creation should wait for any mandatory service dependencies to be satisfied before proceeding (the default), or proceed immediately without waiting if dependencies are no

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号