成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Spring-OSGI 1.0 M3 中文手冊

開發 后端
Spring-OSGI 1.0 M3 中文手冊(Spring Dynamic Modules Reference Guide for OSGi(tm) Service Platforms)。

關于headers的細節參見OSGi規范中的3.2節。一些OSGi實現框架可能會支持一些與眾不同的jar包,但是這些jar包關于OSGi的格式還是不變的。

51CTO編輯推薦: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 3.2.5 of the OSGi Service Platform Core Specification.

另外,如果bundle的manifest聲明了可選header - SpringExtender-Version,那么extender將僅僅認可與之版本相符的指定版本約束的bundle(bundle的Bundle-Version)。SpringExtender-Version的值必須遵循OSGi規范3.2.5節中指定的版本范圍。

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 two 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配置文件至少分割成2個文件,習慣上命名為 [模塊名-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的相關內容和配置,主要意思如下:

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 not satisfied upon startup.
For example:

Spring-Context: config/osgi-*.xml;wait-for-dependencies:=false
Creates 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 4.2 for more details.

timeout (300): 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 5 minutes (300 seconds).
For example:

Spring-Context: *;timeout:=60
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:=false
If 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.

3.2 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, org.springframework.osgi.extender
The core implementation bundle for the Spring Dynamic Modules support, org.springframework.osgi.core
The Spring Dynamic Modules i/o support library bundle, ' org.springframework.osgi.io
In addition the Spring Framework provides a number of bundles that are required to be installed. As of release 2.5 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 org.springframework.core)
spring-context.jar (bundle symbolic name org.springframework.context)
spring-beans.jar (bundle symbolic name org.springframework.beans)
spring-aop.jar (bundle symbolic name org.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的分發包中找到它們:

aopalliance
backport-util (for JDK 1.4)
cglib-nodep
commons-logging (SLF4J version highly recommended)

3.3 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.

這部份是關于OSGi平臺MANIFEST中Import-Package和Export-Package的細節描述。

您正在閱讀:Spring-OSGI 1.0 M3 中文手冊

【編輯推薦】

  1. OSGi與Spring的整合
  2. 實例說明如何集成Spring和Struts
  3. 如何在Java Web應用中獲取Spring的ApplicationContext
責任編輯:張攀 來源: DIY部落
相關推薦

2023-08-07 06:59:10

M3工藝A17

2023-08-08 06:46:43

M3芯片蘋果

2011-04-15 09:19:46

Windows 8 M視頻

2009-05-07 11:15:40

Spring 3.0factory方法Spring

2011-05-03 12:54:39

Windows 8 M

2011-05-19 09:20:33

Windows 8win8

2011-05-07 10:07:41

Windows 8激活

2009-06-15 14:53:00

NetBeans 6.

2009-06-18 15:24:08

Spring OSGi

2010-07-16 14:34:09

MySQL

2012-05-15 20:10:58

IBM x3650 M

2011-03-02 10:23:37

Windows 8 M

2011-08-08 09:54:11

Windows 8 M開發者會議

2018-08-21 10:45:00

柏譜自由M3

2009-06-01 10:28:03

SpringOSGi整合

2009-10-09 13:42:56

Spring DataSpring DM

2012-03-21 13:50:57

筆記本評測

2009-09-28 13:13:16

設置Spring DM

2018-08-23 18:25:00

京東智能音箱

2010-04-13 17:44:52

MySQL
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 亚洲小说图片 | 欧美一区二区大片 | 国产激情免费视频 | 免费黄色录像视频 | 国产午夜精品一区二区三区在线观看 | 国产伦精品| 成av人电影在线 | 久久精品超碰 | 久久精品国产一区 | 国产农村妇女精品一二区 | 黄色一级大片在线免费看产 | 黄色片在线观看网址 | 综合久久99| 九九综合九九 | 日韩成人免费视频 | 91亚洲国产亚洲国产 | 国产女人与拘做受视频 | 亚洲欧美综合 | 天天草视频 | 99re热精品视频 | 超碰97人人人人人蜜桃 | 国产午夜精品久久久 | 精品国产一区二区三区性色 | 日韩久久综合网 | 精品一区在线 | 97avcc| 欧美在线a| 午夜爽爽爽男女免费观看 | 久久国产高清 | 99视频免费在线 | 精品视频一区二区三区四区 | 亚洲国产成人精品女人 | 日韩精品在线观看视频 | 欧美在线一区二区三区四区 | 国产一区二区 | 欧美日韩免费一区二区三区 | 国产一区2区 | 精品一区二区在线观看 | 日本亚洲精品成人欧美一区 | 国产精品久久久久久妇女6080 | 成人精品一区二区三区 |