文件名称:
OSGi实践(Neil Bartlett)OSGi In Practice (Neil Bartlett)
开发工具:
文件大小: 3mb
下载次数: 0
上传时间: 2019-10-31
详细说明:本书是OSGi的综合指南,有两个主要目标。 首先,它提供了对OSGi概念的清晰介绍,并提供了与架构师和开发人员都相关的示例。Contents
Preface
X
Nuts and bolts
1. Introduction
1.1. What is a Module
1.2. The Problem(s) with JARs
1.2.1. Class Loading and the Global Classpath
1. 2.2. Conflicting Classes
1345689
1.2.3. Lack of Explicit Dependencies
1.2. 4. Lack of version information
10
1.2.5. Lack of Information Hiding Across JARs
1.2.6. Recap: JARs Are Not Modules
12
1. 3. J2EE Class loading
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
1.5. Dynamic Modules
19
1.6. The OSGi Alliance and Standards
1.7. OSGi Implementations
21
1. 8. Alternatives to OSGi
21
1.8. 1. Build Tools: Maven and Iv
22
1.8.2. Eclipse Plug-in System
22
1.8.3.JSR277
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
2.3. Installing a Framework
2.4. Setting up Eclipse
29
2.5. Running Equinox
32
2.6. Installing bnd
33
2.7. Hello. World!
33
DRAFT PREVIEW prepared for Christopher Brind
Contents
2.8. Bundle Lifecycle
36
2.9. Incremental Development
38
2.10. Interacting with the Framework
39
2.11. Starting and Stopping Threads
42
2. 12. Manipulating Bundles
42
2.13. Exercises
3. Bundle Dependencies
45
3.1. Introducing the Example Application
3.2. Defining an aPI
46
3.3. Exporting the API
49
3.4. Importing the API
51
3.5. Interlude: How Bnd works
3.6. Requiring a Bundle
57
3.7. Version Numbers and Ranges
3. 7.1. Version Numbers
3.7.2. Versioning Bundles
3.7.3. Versioning Packages
3.7.4. Version Ranges
3.7.5. Versioning Import-Package and Require-Bundle
3.8. Class Loading in OSGi
3.9. JRE Packages
67
3.10. Execution Environments
3.11. Fragment Bundles
3. 12. Class Space Consistency and"Uses"Constraints
4. Services
75
4.1. Late Binding in Java
75
4.1.1. Dependency Injection Frameworks
76
4.1.2. Dynamic Services
4.2. Registering a Service
79
4.3. Unregistering a Service
4.4. Looking up a Service
84
4.5. Service Properties
86
4.6. Introduction to Service Trackers
4.7. Listening to services
4.8. Tracking Services
4.9. Filtering on Properties
95
4.10. Cardinality and Selection Rules
4.10.1. Optional, Unary
98
4.10.2. Optional, Multiple
98
4.10.3. Mandatory, Unary
102
4.10.4. Mandatory, Multiple
102
4.11. Service Factori
102
DRAFT PREVIEW prepared for Christopher Brind
Contents
5. Example: Mailbox Reader GUI
105
5.1. The Mailbox Table Model and panel
.105
5.2. The Mailbox Tracker
105
5.3. The main Window
108
5.4. The Bundle activator
5.5. Putting it Together
113
6. Concurrency and OSGi
17
6.1. The Price of Freedom
117
6.2. Shared Mutable State
119
6.3. Safe Publication
121
6.3. 1. Safe Publication in Services
123
6.3.2. Safe Publication in Framework Callbacks
126
6.4. Dont Hold Locks when Calling Foreign Code
128
6.5. GUI Development
131
6.6. USing Executors
133
6.7. Interrupting Threads
140
6.8. Exercises
143
7. The Whiteboard pattern and event admin
45
7.1. The Classic Observer Pattern
145
7. 2. Problems with the observer Pattern
146
7.3. Fixing the Observer Pattern
147
7.4. Using the Whiteboard Pattern
.148
7.4.1. Registering the Listener
151
7.4.2. Sending events
153
7.5. Event Admin
156
7.5.1. Sending events
156
7.5.2. The Event Object
157
7.5.3. Receiving Events
160
7.5.4. Running the Example
161
7.5.5. Synchronous versus Asynchronous Delivery
163
7.5.6. Ordered Delivery
164
7.5.7. Reliable Delivery
164
7.6. Exercises
165
8. The extender model
167
8.1. Looking for Bundle Entries
168
8.2. Inspecting Headers
170
8.3. Bundle states
171
8.4. Using a Bundle Tracker
174
8.4.1. Testing the Help Extender
176
8.5. Bundle Events and Asynchronous Listeners
177
8.6. The Eclipse Extension Registry
180
8.7. Impersonating a Bundle
183
DRAFT PREVIEW prepared for Christopher Brind
Contents
8. 8. Conclusion
186
9. Configuration and Metadata
187
9. 1. Configuration Admin
187
9.1.1. Audiences
189
9.2. Building Configurable Objects
190
9.2. 1. Configured Singletons
190
9.2.2. Running the Example with FileInstall
190
9.2.3. Configured Singleton Services
194
9. 2.4. Multiple Configured Objects
197
9.2.5. Multiple Configured Objects with Filelnstall
200
9. 2.6. A Common Mistake
202
9.2.7. Multiple Configured Service Objects
203
9.2.8. Configuration Binding
203
9.3. Describing Configuration Data
204
9.3.1. Metatype Concepts
9. 3.2. Creating a Metadata File
206
207
9.4. Building a Configuration Management Agent
9.4. 1. Listing and Viewing Configurations
208
9.4.2. Creating and Updating Configurations
211
9.4.3. Creating bound and Unbound Configurations
9.5. Creating a Simple Configuration Entry
213
II. Component Oriented Development
215
10. Introduction to Component Oriented Development
217
10.1. What is a Software Component?
218
11. Declarative services
219
11.1. The Goal: Declarative living
219
11.2. Introduction
220
11.2. 1. Summary of Declarative Services Features
220
11.2.2. A Note on Terminology and versions
221
11.3. Declaring a Minimal Component
222
11.4. Running the Example
223
11.5. Providing a Service
224
11.5. 1 Lazy Service Creation
226
11.5.2. Forcing Immediate Service Creation
228
11.5.3. Providing Service Properties
228
11.6. References to Services
230
11.6.1. Optional vs Mandatory References
234
11.6.2. Static vs Dynamic References
236
11.6.3. Minimising Churn
238
11.6.4. Implementing the Dynamic Policy
239
DRAFT PREVIEW prepared for Christopher Brind
Contents
VIl
11.6.5. Service Replacement
241
11.6.6. Running the Example
244
11.6.7. Minimising Churn with Dynamic References
245
11.6.8. Recap of Dynamic Reference Implementation
246
11.7. Component Lifecycle
246
11.7.1. Lifecycle and Service Binding/Unbinding
11.7.2. Handling Errors in Component Lifecycle Methods
249
11.8. Unary vs Multiple References
11.8. 1 Static Policy with Multiple References
251
11.8.2. Implementing Multiple references
251
11.9. Discussion: Are These True POJOs?
252
11.10Using Bnd to Generate XML Descriptors
254
11.10.1 Bnd headers for XML Generation
254
11.10.2XML Generation from Java Source Annotations
.256
11.10.3.Automatic Service Publication
259
11.11 Configured Components
259
11.11.1 Sources of Configuration Data
261
11.11.2.Testing with Filelnstall
.262
11.11. 3 Dealing with Bad Configuration Data
262
11.11. 4 Dynamically Changing Configuration
11.11.5.Configuration Policies
265
11.11.6. Example Usage of Required Configuration
266
11.12Singletons, Factories and Adapters
267
lL. Practical osGi
269
12. Using Third-Party Libraries
271
12.1. Step Zero: Dont Use That Library
271
12.2. Augmenting the Bundle Classpath
273
12.2.1. Embedding jaRs inside a Bundle
273
12.2.2. Problems with Augmenting the Bundle Classpath.... 274
12.3. Finding OSGi Bundles for Common Libraries
274
12.4. Transforming JARs into Bundles, Part I
275
12.4.1. Step 1: Obtain and Analyse Library
276
12.4.2. Step 2: Generate and Check
276
12.5. Transforming ARS into Bundles. Part II
277
12.5.1. Step 3: Correcting Imports
278
12.5.2. Step 4: Submit to Repository
12. 6. Runtime issues
282
12.6.1. Reflection-Based Dependencies
282
12.6.2. Hidden Static Dependencies
12.6.3. Dynamic Dependencies
283
12.7. Class Loader Shenanigans
283
DRAFT PREVIEW prepared for Christopher Brind
v】1
Contents
13. Testing OSGi Bundles
285
14. Building Web Applications
287
IV. Appendices
289
A. ANT Build System for Bnd
291
DRAFT PREVIEW prepared for Christopher Brind
List of Figures
1.1. The standard Java class loader hierarchy
1. 2. Example of an internal JAR dependency.
9
1.3. A broken internal JAR dependency.
10
1.4. Clashing Version Requirements
11
1.5. A typical J2EE class loader hierarchy.
14
1.6. The OSGi class loader graph
17
1.7. Different Versions of the same bundle
20
2.1. Adding Equinox as a User Library in Eclipse
30
2.2. Creating a new Java project in Eclipse: adding the Equinox
library
2. 3. Bundle Lifecycle
31
36
3.1. The runtime resolution of matching import and export
55
3.2. The runtime resolution of a Required Bundle
58
3.3. Refactoring with Import-Package:(Before)
59
3.4. Refactoring with Import-Package:(After)
59
3.5. Refactoring with Require-Bundle:(Before)
60
3.6. Refactoring with Require-Bundle:(After)
60
3.7. Simplified OSGi Class Search Order
66
3. 8. Full osGi search Order
4.1. Service Oriented Architecture
78
4.2. Updating a Service Registration in Response to Another Service 91
5. 1. The Mailbox GUI(Windows XP and Mac OS X)
114
5.2. The mailbox gui with a mailbox selected
115
6.1. Framework Calls and callbacks in OSGi
118
6.2. The Dining Philosophers Problem, Simplified
130
7.1. The classic Observer Pattern
146
7. 2. An Event Broker
148
7.3. A Listener Directory
149
7. 4. The event admin service
157
8.1. Inclusion Relationships of Bundle States
173
DRAFT PREVIEW prepared for Christopher Brind
List of figures
2. Synchronous Event Delivery when Starting a Bundle
179
8.3. Asynchronous Event Delivery after Starting a Bundle
..180
8.4. Editing an Extension Point in Eclipse PDE
182
8.5. Editing an Extension in Eclipse PDE
182
9.1. Overview of the Configuration Admin Service
189
11.1. Service Replacement, Before and After
243
11.2. Unary and Multiple Cardinalities in DS
268
11.3. One Component Per Service- Not Supported by DS
268
A.l. OSGi Project Structure
292
DRAFT PREVIEW prepared for Christopher Brind
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.