知识大全 Spring-OSGI 1.0 M3 中文手册

Posted 文件

篇首语:落花踏尽游何处,笑入胡姬酒肆中。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 Spring-OSGI 1.0 M3 中文手册相关的知识,希望对你有一定的参考价值。

Spring-OSGI 1.0 M3 中文手册  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

  关于headers的细节参见OSGi规范中的 节 一些OSGi实现框架可能会支持一些与众不同的jar包 但是这些jar包关于OSGi的格式还是不变的

  The Spring extender recognizes a bundle as Spring powered and will create an associated application context when the bundle is started if one or both of the following conditions is true:

  如果满足以下两个条件 Spring extender会通过一个bundle的具有 Spring powered 的验证 当这个bundle启动时会为其创建一个相关联的application context

  The bundle classpath contains a folder META INF/spring with one or more files in that folder with a xml extension

  这个bundle的classpath包含一个目录META INF/spring 这个目录中有一个或多个扩展名为 xml 的文件

  META INF/MANIFEST MF contains a manifest header Spring Context

  这个bundle中的META INF/MANIFEST MF文件包含一个名为Spring Context的header In addition if the optional SpringExtender Version header is declared in the bundle manifest then the extender will only recognize bundles where the specified version constraints are satisfied by the version of the extender bundle (Bundle Version) The value of the SpringExtender Version header must follow the syntax for a version range as specified in section of the OSGi Service Platform Core Specification

  另外 如果bundle的manifest声明了可选header SpringExtender Version 那么extender将仅仅认可与之版本相符的指定版本约束的bundle(bundle的Bundle Version) SpringExtender Version的值必须遵循OSGi规范 节中指定的版本范围

  In the absence of the Spring Context header the extender expects every xml file in the META INF/spring folder to be a valid Spring configuration file and all directives (see below) take on their default values

  在缺少Spring Context的情况下 spring extender仍然认为所有META INF/spring中 xml 的文件都是spring的配置文件 所有的header都是默认值

  An application context is constructed from this set of files A suggested practice is to split the application context configuration into at least o files named by convention modulename context xml and modulename osgi context xml The modulename context xml file contains regular bean definitions independent of any knowledge of OSGi The modulename osgi context xml file contains the bean definitions for importing and exporting OSGi services It may (but is not required to) use the Spring Dynamic Modules OSGi schema as the top level namespace instead of the Spring beans namespace

  application context就是根据这些文件(META INF/spring中 xml 的文件)构造的 一个推荐的做法是将application context配置文件至少分割成 个文件 习惯上命名为 [模块名-context xml] 和[模块名 osgi context xml] modulename context xml文件包含了不依赖与OSGi相关的bean的定义(可以理解为普通bean定义) modulename osgi context xml文件则定义那些引入或输出OSGi服务的bean 这可能需要使用Spring Dynamic Modules的OSGi schema做为顶级命名空间 取代spring的 bean 命名空间 但这不是必须的

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

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

   可以用通配符 例如Spring Context: osgi *;

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

   wait for dependencies和timeout 从字面意思就能看出来了

   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 mon header syntax defined in section 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=falseCreates 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 not satisfied upon startup For example:

  Spring Context: config/osgi * xml;wait for dependencies:=falseCreates an application context using all the files matching osgi * xml in the config directory Context creation will begin immediately even if dependencies are not satisfied This essentially means that mandatory service references are treated as though they were optional clients will be injected with a service object that may not be backed by an actual service in the registry initially See section for more details

  timeout ( ): the time to wait (in seconds) for mandatory dependencies to be satisfied before giving up and failing application context creation This setting is ignored if wait for dependencies:=false is specified The default is minutes ( seconds) For example:

  Spring Context: *;timeout:= publish context (true|false): controls whether or not the application context object itself should be published in the OSGi service registry The default is to publish the context For example:

  Spring Context: *;publish context:=falseIf there is no Spring Context manifest entry or no value is specified for a given directive in that entry then the directive takes on its default value

   Required Spring Framework and Spring Dynamic Modules Bundles

  The Spring Dynamic Modules project provides an number of bundle artifacts that must be installed in your OSGi platform in order for the Spring extender to function correctly:

  Spring Dynamic Modules提供了很多现成的bundle 要使用Spring extender必须将这些bundle安装到OSGi平台中:

  The extender bundle itself springframework osgi extenderThe core implementation bundle for the Spring Dynamic Modules support sprireThe Spring Dynamic Modules i/o support library bundle springframework osgi ioIn addition the Spring Framework provides a number of bundles that are required to be installed As of release of the Spring Framework the Spring jars included in the Spring distribution are valid OSGi bundles and can be installed directly into an OSGi platform The minimum required set of bundles is:

  另外spring还提供了很多它自己的bundle 这些bundle可以直接被安装到OSGi平台中 要使用spring的最低要求需要以下几个bundle:

  spring core jar (bundle symbolic name re)spring context jar (bundle symbolic name ntext)spring beans jar (bundle symbolic name springframework beans)spring aop jar (bundle symbolic name springframework aop)In additional the following supporting library bundles are required OSGi ready versions of these libraries are shipped with the Spring Dynamic Modules distribution

  以下几个bundle是spring的依赖bundle 可以在Spring Dynamic Modules的分发包中找到它们:

  aopalliancebackport util (for JDK )cglib nodepmons logging (SLF J version highly remended)

   Importing and Exporting packages

  Refer to the OSGi Service Platform for details of the Import Package and Export Package manifest headers Your bundle will need an Import Package entry for every external package that the bundle depends on If your bundle provides types that other bundles need access to you will need Export Package entries for every package that should be available from outside of the bundle

cha138/Article/program/Java/ky/201311/28456

相关参考

知识大全 Linux Kernel核心中文手册 (3)

LinuxKernel核心中文手册(3)  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  Memo

知识大全 Linux Kernel核心中文手册 (12)

LinuxKernel核心中文手册(12)  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  Mod

知识大全 Linux Kernel核心中文手册 (13)

LinuxKernel核心中文手册(13)  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  The

知识大全 MySQL中文参考手册---MySQL 文件系统

MySQL中文参考手册---MySQL文件系统  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  这

知识大全 MySQL中文参考手册-- 常用查询的例子

MySQL中文参考手册--常用查询的例子  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  下面是一

知识大全 MySQL中文参考手册-- 创造并使用一个数据库

MySQL中文参考手册--创造并使用一个数据库  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  既

知识大全 MySQL中文参考手册---MySQL与标准的兼容性

MySQL中文参考手册---MySQL与标准的兼容性  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

知识大全 MySQL中文参考手册--- MySQL与标准的兼容性

MySQL中文参考手册---MySQL与标准的兼容性  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

污水处理站构筑物简单计算参考实例

1、隔油池表面负荷q=1.0m3/m2..h每小时处理的水量Q=7/24=0.29m3/h S表面积=0.29/1=0.29m2调节一天的水量v=7m3设计尺寸为V=5×2×1.8=18m3

污水处理站构筑物简单计算参考实例

1、隔油池表面负荷q=1.0m3/m2..h每小时处理的水量Q=7/24=0.29m3/h S表面积=0.29/1=0.29m2调节一天的水量v=7m3设计尺寸为V=5×2×1.8=18m3