English 中文(简体)
一个典型的OSGi生命周期是什么?
原标题:
  • 时间:2008-12-17 21:52:29
  •  标签:

I would like to gain some insight into the life cycle that is used in industry when developing and deploying OSGi based systems.
My main focus is on the deployment phases, after the development phase has created versioned and packaged a bundle. Specifically testing procedures that may be carried out, and method of integration.
A very high level account with some low level details would be very helpful.
Thank you.

问题回答

OSGi bundle可以在运行的OSGi引擎(如Equinox、Felix、dmServer等)中组合在一起。与其他代码一样,可能存在对特定平台行为的依赖(例如仅在Windows上运行的代码使用c:样式文件引用),与JNI一起工作并且仅适用于x86平台的代码等。在这些情况下,OSGi对软件测试没有帮助也没有妨碍。

在哪里可以增加复杂性是在运行捆绑包的组合爆炸中。不像Java应用程序可以很愉快地运行在单一的单块CLASSPATH上,你往往不会发现错误直到后来(比如在尝试加载JDBC驱动程序时遇到ClassNotFoundException)。 OSGi在这方面有所帮助,在确保您必须至少拥有捆绑包的必需包导出的同时; 但是即使如此,有些软件包可能是可选的,因此会遇到同样的问题。

作为OSGi捆绑程序,您确实需要进行测试:

  • Do these bundles actually all start, i.e. after installing into your favourite OSGi engine, does start n work properly? If you ve got all of your dependencies, then it should go from INSTALLED to RESOLVED to ACTIVE; if it stays around in INSTALLED then it means it s missing some dependencies
  • Does your application need certain bundles (like Declarative Services or Remote Services) started up when the OSGi VM starts?
  • Are there start-order issues between bundles? They should all Just Work but you may want to test what happens if Bundle A starts before Bundle B

这些是您在将一组捆绑包认证为彼此兼容时需要进行测试的额外事项。理想情况下,您可以运行 in-OSGi VM 测试,这就是 Eclipse 的 JUnit 插件测试运行的方式。

你可以学习Eclipse,因为这是我知道的最大的基于OSGi的系统之一。他们有许多关于版本控制和他们如何在Eclipse平台上使用测试的文档。

我建议阅读dmServer入门指南或查看来自SpringSource.org dmServer网站的其他信息

《入门指南》介绍了一个名为GreenPages的小型Web应用程序,该应用程序是从骨架项目结构逐步构建而成的。最终实现是一个模块化、多束应用程序。在此过程中,演示了在Eclipse中的单元和集成测试,以及独立的(Maven)构建。

尽管Eclipse很大,也是一个很好的例子,但我不认为它代表OSGi模块化系统的典型,也没有关于所采用的开发过程生命周期的解释。





相关问题
热门标签