没有合适的资源?快使用搜索试试~ 我知道了~
OSGi In Practice

温馨提示
<OSGi in Practice>英文版 一位“牛人”的作品 - NeilBartlett,讲解的深入浅出,不过该书还没完全完成。 可以浏览他的blog,http://neilbartlett.name/blog
资源推荐
资源详情
资源评论










OSGi In Practice
Neil Bartlett
January 11, 2009


Contents
Preface xiii
I Nuts and Bolts 1
1 Introduction 3
1.1 What is a Module? . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 The Problem(s) with JARs . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Class Loading and the Global Classpath . . . . . . . . . 6
1.2.2 Conflicting Classes . . . . . . . . . . . . . . . . . . . . . 8
1.2.3 Lack of Explicit Dependencies . . . . . . . . . . . . . . . 9
1.2.4 Lack of Version Information . . . . . . . . . . . . . . . . 10
1.2.5 Lack of Information Hiding Across JARs . . . . . . . . . 12
1.2.6 Recap: JARs Are Not Modules . . . . . . . . . . . . . . 12
1.3 J2EE Class Loading . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4 OSGi: A Simple Idea . . . . . . . . . . . . . . . . . . . . . . . . 15
1.4.1 From Trees to Graphs . . . . . . . . . . . . . . . . . . . 16
1.4.2 Information Hiding in OSGi Bundles . . . . . . . . . . . 18
1.4.3 Versioning and Side-by-Side Versions . . . . . . . . . . . 19
1.5 Dynamic Modules . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.6 The OSGi Alliance and Standards . . . . . . . . . . . . . . . . 20
1.7 OSGi Implementations . . . . . . . . . . . . . . . . . . . . . . . 21
1.8 Alternatives to OSGi . . . . . . . . . . . . . . . . . . . . . . . . 21
1.8.1 Build Tools: Maven and Ivy . . . . . . . . . . . . . . . . 22
1.8.2 Eclipse Plug-in System . . . . . . . . . . . . . . . . . . . 22
1.8.3 JSR 277 . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2 First Steps in OSGi 25
2.1 Bundle Construction . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 OSGi Development Tools . . . . . . . . . . . . . . . . . . . . . 26
2.2.1 Eclipse Plug-in Development Environment . . . . . . . . 26
2.2.2 Bnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Installing a Framework . . . . . . . . . . . . . . . . . . . . . . . 28
2.4 Setting up Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.5 Running Felix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.6 Installing bnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.7 Hello, World! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
DRAFT PREVIEW

iv Contents
2.8 Bundle Lifecycle . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.9 Incremental Development . . . . . . . . . . . . . . . . . . . . . 39
2.10 Interacting with the Framework . . . . . . . . . . . . . . . . . . 40
2.11 Starting and Stopping Threads . . . . . . . . . . . . . . . . . . 43
2.12 Manipulating Bundles . . . . . . . . . . . . . . . . . . . . . . . 43
2.13 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3 Bundle Dependencies 47
3.1 Introducing the Example Application . . . . . . . . . . . . . . . 48
3.2 Defining an API . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.3 Exporting the API . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.4 Importing the API . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.5 Interlude: How Bnd Works . . . . . . . . . . . . . . . . . . . . 57
3.6 Requiring a Bundle . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.7 Version Numbers and Ranges . . . . . . . . . . . . . . . . . . . 61
3.7.1 Version Numbers . . . . . . . . . . . . . . . . . . . . . . 62
3.7.2 Versioning Bundles . . . . . . . . . . . . . . . . . . . . . 63
3.7.3 Versioning Packages . . . . . . . . . . . . . . . . . . . . 63
3.7.4 Version Ranges . . . . . . . . . . . . . . . . . . . . . . . 64
3.7.5 Versioning Import-Package and Require-Bundle . . . 65
3.8 Class Loading in OSGi . . . . . . . . . . . . . . . . . . . . . . . 66
3.9 JRE Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.10 Execution Environments . . . . . . . . . . . . . . . . . . . . . . 70
3.11 Fragment Bundles . . . . . . . . . . . . . . . . . . . . . . . . . 72
3.12 Class Space Consistency and “Uses” Constraints . . . . . . . . 73
4 Introduction to Services 75
4.1 Late Binding in Java . . . . . . . . . . . . . . . . . . . . . . . . 75
4.1.1 Dependency Injection Frameworks . . . . . . . . . . . . 76
4.1.2 Dynamic Services . . . . . . . . . . . . . . . . . . . . . . 77
4.2 Registering a Service . . . . . . . . . . . . . . . . . . . . . . . . 79
4.3 Unregistering a Service . . . . . . . . . . . . . . . . . . . . . . . 81
4.4 Looking up a Service . . . . . . . . . . . . . . . . . . . . . . . . 84
4.5 Service Properties . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.6 Introduction to Service Trackers . . . . . . . . . . . . . . . . . 88
4.7 Listening to Services . . . . . . . . . . . . . . . . . . . . . . . . 90
4.8 Tracking Services . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.9 Filtering on Properties . . . . . . . . . . . . . . . . . . . . . . . 95
4.10 Cardinality and Selection Rules . . . . . . . . . . . . . . . . . . 96
4.10.1 Optional, Unary . . . . . . . . . . . . . . . . . . . . . . 98
4.10.2 Optional, Multiple . . . . . . . . . . . . . . . . . . . . . 101
4.10.3 Mandatory, Unary . . . . . . . . . . . . . . . . . . . . . 101
4.10.4 Mandatory, Multiple . . . . . . . . . . . . . . . . . . . . 101
5 Example: Mailbox Reader GUI 103
DRAFT PREVIEW

Contents v
5.1 The Mailbox Table Model and Panel . . . . . . . . . . . . . . . 103
5.2 The Mailbox Tracker . . . . . . . . . . . . . . . . . . . . . . . . 103
5.3 The Main Window . . . . . . . . . . . . . . . . . . . . . . . . . 106
5.4 The Bundle Activator . . . . . . . . . . . . . . . . . . . . . . . 109
5.5 Putting it Together . . . . . . . . . . . . . . . . . . . . . . . . . 111
6 Concurrency and OSGi 115
6.1 The Price of Freedom . . . . . . . . . . . . . . . . . . . . . . . 115
6.2 Shared Mutable State . . . . . . . . . . . . . . . . . . . . . . . 117
6.3 Safe Publication . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.3.1 Safe Publication in Services . . . . . . . . . . . . . . . . 121
6.3.2 Safe Publication in Framework Callbacks . . . . . . . . 124
6.4 Don’t Hold Locks when Calling Foreign Code . . . . . . . . . . 126
6.5 GUI Development . . . . . . . . . . . . . . . . . . . . . . . . . 129
6.6 Using Executors . . . . . . . . . . . . . . . . . . . . . . . . . . 131
6.7 Interrupting Threads . . . . . . . . . . . . . . . . . . . . . . . . 138
6.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7 The Whiteboard Pattern and Event Admin 143
7.1 The Classic Observer Pattern . . . . . . . . . . . . . . . . . . . 143
7.2 Problems with the Observer Pattern . . . . . . . . . . . . . . . 144
7.3 Fixing the Observer Pattern . . . . . . . . . . . . . . . . . . . . 145
7.4 Using the Whiteboard Pattern . . . . . . . . . . . . . . . . . . 146
7.4.1 Registering the Listener . . . . . . . . . . . . . . . . . . 149
7.4.2 Sending Events . . . . . . . . . . . . . . . . . . . . . . . 151
7.5 Event Admin . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.5.1 Sending Events . . . . . . . . . . . . . . . . . . . . . . . 154
7.5.2 The Event Object . . . . . . . . . . . . . . . . . . . . . 155
7.5.3 Receiving Events . . . . . . . . . . . . . . . . . . . . . . 158
7.5.4 Running the Example . . . . . . . . . . . . . . . . . . . 159
7.5.5 Synchronous versus Asynchronous Delivery . . . . . . . 161
7.5.6 Ordered Delivery . . . . . . . . . . . . . . . . . . . . . . 162
7.5.7 Reliable Delivery . . . . . . . . . . . . . . . . . . . . . . 162
7.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
8 The Extender Model 165
8.1 Looking for Bundle Entries . . . . . . . . . . . . . . . . . . . . 166
8.2 Inspecting Headers . . . . . . . . . . . . . . . . . . . . . . . . . 168
8.3 Tracking Bundles . . . . . . . . . . . . . . . . . . . . . . . . . . 169
8.4 Synchronous and Asynchronous Bundle Listeners . . . . . . . . 176
8.5 The Eclipse Extension Registry . . . . . . . . . . . . . . . . . . 181
8.6 Impersonating a Bundle . . . . . . . . . . . . . . . . . . . . . . 183
8.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
9 Configuration and Metadata 189
DRAFT PREVIEW
剩余228页未读,继续阅读
资源评论

- weiyongyin2012-10-25英文版!努力看吧!

gow
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 前端微信小程序rsa加密兼容处理
- 清华大学104页《DeepSeek:从入门到精通》
- 51单片机的实时操作系统(RTX51)示例代码
- wpDiscuz 高级版 v7.6.28 -WordPress 评论插件(+ 附加组件)
- 基于Java语言的程序员成长笔记与设计源码分享
- exe转window服务,带详细说明
- Android Studio Ladybug Feature Drop Patch 2(android-studio-2024.2.2.15-mac-arm.zip.002)
- IVMS-4200 3.11.1.5
- Android Studio Ladybug Feature Drop Patch 2(android-studio-2024.2.2.15-mac-arm.zip.001)
- Android Studio Ladybug Feature Drop Patch 2(android-studio-2024.2.2.15-windows-exe.zip.002)
- 基于EMD-ARMA算法的风光出力预测方法:分解重构原始数据,精准预测风光功率结果,基于EMD-ARMA算法的风光出力预测方法:分解重构原始数据,精准预测风光功率结果,基于EMD-ARMA的组合风光出
- centos7安装教程.docx
- 基于扩展卡尔曼滤波算法的锂电池SOC估计:在多种工况下的二阶等效电路模型应用,基于扩展卡尔曼滤波算法的锂电池SOC估计在多种工况下的应用研究-基于二阶等效电路模型,锂电池SOC估计 扩展卡尔曼滤波算
- “路网配电网与应急电源优化配置策略:提升系统抵抗力和恢复力研究”,基于极端事件双重破坏性的路网配电网应急电源优化配置模型与出行策略优化研究,路网配电网 应急电源 优化配置 以提升电力系统的抵抗力和
- Vue3 + Vite2 + Vue-Router4 + Element-Plus + Echarts + Axios 开发的后台管理系统 基于 Spring Boot 和 Vue 以及相关技术栈开发
- DeepSeek全方位使用技巧与应用指南
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
