`

OSGi

    博客分类:
  • J2EE
阅读更多
  

一个 web 项目,可以通过将各个 layer(prensentation - service - model - dao)的 classes,单独打成 jar, 实现 development time modularity. 但是,这些 module 最终还是需要作为 war 的依赖部署到web container 中,任何一个jar的变更,还是需要重新部署整个war。
OSGi带来的是,是 runtime module system.比如在不用重新部署整个web项目的情况单独升级某个dao jar。



An introduction to OSGi:
http://www.developerfusion.com/article/84923/an-introduction-to-osgi/


OSGi Modularity - Tutorial:
http://www.vogella.com/tutorials/OSGi/article.html
引用
使用 eclipse 的 export -> "deployable plugins and fragments" 导出 bundle jar 到 Felix 目录下,该 jar 会被放到一个叫 plugins 的目录下,而不是默认的 bundle 目录下。这两个目录,或者说在 osgi 环境下 bundle 与 plugin 有区别吗?答案是没有区别,只是 felix 将一个 osgi 服务叫做 bundle,而 eclipse 通常称其为 plugin 而已:
引用
1.2. Bundle vs. plug-in
In Eclipse the smallest unit of modularization is a plug-in. The terms plug-in and bundle are (almost) interchangeable. An Eclipse plug-in is also an OSGi bundle and vice versa.
所以在 osgi 的语境下我们认为:
bundle = Deployable service = plugin,一般就是个jar包。

All these restrictions are enforced via a specific OSGi classloader. Each bundle has its own classloader. Access to restricted classes is not possible.



Apache Felix Framework Usage Documentation:
http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-usage-documentation.html
引用

A bundle is the OSGi term for a component for the OSGi framework



OSGi and Class Loader:
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Managing_OSGi_Dependencies/files/BCL-ClassLoader.html
引用
In the context of OSGi, where a typical application depends on multiple class loaders (one for each bundle), it is important to understand that the fully-qualified class name—for example, org.foo.Hello—is not sufficient to identify a loaded class uniquely. In general, a loaded class is uniquely identified by combining the classloader identity with the fully-qualified class name.



Remote services(aka, Dosgi - distributed osgi):
http://blog.akquinet.de/2009/09/14/dynamokos-dealing-with-dynamism-in-osgi-distributed-web-applications/



eclipse 下 osgi 项目的创建与 deploy:
https://blogs.oracle.com/arungupta/entry/totd_126_creating_an_osgi


Introduction to the Apache Felix DependencyManager – part two
http://arnhem.luminis.eu/introduction-apache-felix-dependencymanager-part-2/


常见 OSGI MANIFEST.MF configs:
引用
Import-Package:the packages that it needs to run
Export-Package:the packages that it may export for other bundles to use
Bundle-RequiredExecutionEnvironment:the execution environment that it requires





引用
Chapter 5. Bundles and Application Contexts
The unit of deployment (and modularity) in OSGi is the bundle (see section 3.2 of the OSGi Service Platform Core Specification). A bundle known to the OSGi runtime is in one of three steady states: installed, resolved, or active. Bundles may export services (objects) to the OSGi service registry, and by so doing make these services available for other bundles to discover and to use. Bundles may also export Java packages, enabling other bundles to import the exported types.
In Spring the primary unit of modularity is an application context, which contains some number of beans (objects managed by the Spring application context). Application contexts can be configured in a hierarchy such that a child application context can see beans defined in a parent, but not vice-versa. The Spring concepts of exporters and factory beans are used to export references to beans to clients outside of the application context, and to inject references to services that are defined outside of the application context.
There is a natural affinity between an OSGi bundle and a Spring application context. Using Spring Dynamic Modules, an active bundle may contain a Spring application context, responsible for the instantiation, configuration, assembly, and decoration of the objects (beans) within the bundle. Some of these beans may optionally be exported as OSGi services and thus made available to other bundles, beans within the bundle may also be transparently injected with references to OSGi services.

After a refreshPackages operation, packages exported by older versions of updated bundles, or packages exported by uninstalled bundles, are no longer available.

When a Spring-powered bundle is stopped, the application context created for it is automatically destroyed.

If a Spring-powered bundle that has been stopped is subsequently re-started, a new application context will be created for it.

The Spring extender recognizes a bundle as "Spring-powered" and will create an associated application context when the bundle is started and one or both of the following conditions is true:
The bundle path contains a folder META-INF/spring with one or more files in that folder with a '.xml' extension.
META-INF/MANIFEST.MF contains a manifest header Spring-Context.



OSGi Specification, 6.0:
http://www.osgi.org/download/r6/osgi.core-6.0.0.pdf


The difference between a jar and a bundle:
http://konigsberg.blogspot.com/2009/04/difference-between-jar-and-bundle.html


Discovering the future of Java
http://javadepend.wordpress.com/2012/10/31/discovering-the-future-of-java/

SpringSource to move dmServer to Eclipse – OSGi not ready for mainstream?
http://www.theserverside.com/discussions/thread.tss?thread_id=59183
分享到:
评论

相关推荐

    OSGI 开发文档中文的

    OSGI(Open Services Gateway Initiative)是一种开放标准,用于创建可模块化的Java应用程序。它提供了一种灵活的框架,使得开发者可以构建、部署和管理模块化组件,这些组件被称为服务或bundle。OSGI的核心理念是将...

    OSGI 实例eclipse插件开发

    OSGI(Open Services Gateway Initiative)是一种模块化系统和Java服务框架,它允许应用程序由一系列可独立更新和替换的模块组成,这些模块称为“bundle”。在本实例中,我们将探讨如何利用OSGI技术来开发Eclipse...

    osgi学习笔记(一)

    OSGi(Open Services Gateway Initiative)学习笔记(一) 在IT领域,OSGi是一种模块化系统和Java服务平台,它提供了一种动态管理软件组件的能力。本文将深入探讨OSGi的基本概念、架构以及如何使用它来构建可扩展和...

    osgi-resource-locator-1.0.1-API文档-中文版.zip

    赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...

    org.eclipse.osgi_3.7.0.v20110613及源码

    《深入理解OSGi:以org.eclipse.osgi_3.7.0.v20110613及其源码为例》 OSGi(Open Services Gateway Initiative)是一种Java模块化系统,它为开发人员提供了动态模块化的解决方案,使得Java应用程序能够更好地管理和...

    osgi解决不同版本jar包冲突的demo

    OSGi(Open Services Gateway Initiative)是一种模块化系统和Java服务框架,它允许在单个JVM上运行多个版本的相同库或服务,从而解决了不同版本jar包冲突的问题。本示例通过一个名为“myself”的工程,展示了如何...

    Felix_OSGi实作

    OSGi(Open Services Gateway Initiative)是一个由OSGi联盟(OSGi Alliance)维护和发展的开放性规范,它定义了如何在Java平台的基础上实现模块化编程和服务动态化。OSGi规范使得Java程序可以被设计成一套小型的、...

    OSGi入门教程(OSGi Introduce)

    OSGi(Open Services Gateway Initiative)是一种Java平台上的模块化服务框架,它定义了一种标准,使得开发者能够构建可互操作的、动态的、模块化的软件系统。OSGi的核心概念是基于Java的模块化,它的主要目标是为...

    osgi介绍osgi介绍

    OSGi(Open Services Gateway Initiative)是一种Java模块化系统,它为开发人员提供了一种动态、模块化的运行时环境。在OSGi中,应用程序被分解为称为“bundle”的独立单元,这些bundle可以相互依赖并独立地加载、...

    OSGI整合Spring、Mybatis、Spring MVC实现一个登录应用案例

    OSGI(Open Services Gateway Initiative)是一种模块化系统和Java服务框架,它允许应用程序以模块化的方式构建,每个模块称为一个Bundle。在这个案例中,我们将探讨如何整合OSGI、Spring、Mybatis以及Spring MVC来...

    OSGI组件编程(osgi.component.programming)

    OSGI组件编程是一种在Java平台上构建模块化应用程序的方法,它由OSGi联盟制定标准,并被广泛应用于企业级软件开发,尤其是对于需要高度可扩展性和动态性的系统。在本教程中,我们将深入探讨如何使用Eclipse和Equinox...

    osgi,林昊写的osgi实战和进阶

    OSGI(Open Services Gateway Initiative)是一种Java模块化系统,它允许开发者将应用程序分解为一系列可独立部署、更新和交互的服务。林昊所著的《OSGI实战》与《OSGI进阶》是深入理解OSGI技术的重要参考资料,适合...

    osgi重要文档--osgi核心规范文档,osgi服务文档,osgi-最佳原理与实践(王昊编著,共79页)

    这个压缩包包含了关于OSGI的重要文档,分别是“OSGi R4核心规范文档”、“OSGi服务文档”以及“OSGi-最佳原理与实践”(王昊编著)。下面将详细介绍这些文档所涵盖的关键知识点。 首先,"OSGi R4核心规范文档"是...

    Enterprise OSGI in action

    《企业OSGi实战》一书是OSGi企业应用的权威指南,它不仅涵盖了OSGi在企业环境中的应用,还提供了Java企业版(Java EE)与OSGi特性的融合方法。本书详细介绍了模块化编程的重要性,以及OSGi如何强化Java的模块化能力...

    org.osgi.core-4.2.0

    标题 "org.osgi.core-4.2.0" 指的是一个特定版本的 OSGi(Open Services Gateway Initiative)核心框架库,版本号为 4.2.0。OSGi 是一个 Java 平台的模块化系统和服务平台,它提供了一种标准的方式来组织和管理 Java...

    OSGI规范中文版

    OSGi规范中文版是一本全面介绍OSGi技术的书籍,它不仅涵盖了OSGi技术的基础知识,还详细介绍了OSGi的内部结构和工作原理,对于想要深入学习和应用OSGi技术的开发者而言,是一本非常有价值的参考书。 ### OSGi规范的...

    OSGi原理与最佳实践(完整版)&OSGi_in_action

    OSGi(Open Services Gateway Initiative)是一种开放标准,用于创建模块化Java应用程序。它提供了一种动态的、可扩展的框架,使得开发人员可以构建、部署和管理软件组件。本资源包含两本书籍:“OSGi原理与最佳实践...

    OSGI原理与最佳实践

    资源名称:OSGI原理与最佳实践内容简介:国内第一本OSGi图书OSGi国内推广者林昊多年经验的结晶涵盖OSGi从入门到深入的知识体系引领OSGi国内研究和普及本书基于作者多年使用OSGi的经验而编写,涵盖了OSGi从入门到深入...

    OSGI 入门资料PDF

    OSGI(Open Services Gateway Initiative)是一种开放标准,用于创建模块化和动态的Java应用程序。它为Java开发人员提供了一个框架,使他们能够构建可热插拔的组件,从而实现更灵活、可扩展和可维护的软件系统。在本...

Global site tag (gtag.js) - Google Analytics