OSGi in Action
HIGHLIGHT OSGi in Action is the definitive guide to OSGi, the hottest technology available for creating modular enterprise Java applications. DESCRIPTION What is OSGi? Simply put, OSGi is a standardized technology that allows developers to create the highly modular Java applications that are requirebrief contentsPART 1 INTRODUCING OSGI MODULARITY LIFECYCLE AND SERVICES 1OSGi revealed 3Mastering modularity 248 Learning lifecycle 694 Studying services 117Delving deeper into modularity 154PART 2 OSGI IN PRACTICEe。oee@eoe。@。。eeee@0e。@@。@0。@。@0@@。。。0@e。0。@0。0。。1896 Moving toward bundles 1917 Testing applications 2308 Debugging applications 258Managing bundl92Managing applications 319Part 3 ADVANCED TOPICSComponent models and frameworks 34512 Advanced component frameworks 373BRIEF CONTENTS19 Launching and embedding an osGi framework 412Securing your appllications 43 815Web applications and web services 477contentspeface xunacknowledgments xixbout this book xxabout the authors xxvPART I INTRODUCING OSGI: MODULARITY, LIFECYCLE,AND SERVICESOSGi revealed 31 The what and why of osGi 4Java's modularity limitations 5. Can OSGi help you? 81.2 An architectural overview of OSgi gThe OsGi fran9· Putting itgall together 121.3Hello, world! examples 12Module layer example 12. Lifecycle layer example 14. servicelayer example 16. Setting the stage 18CONTENTS1.4 Putting OSGi in context 19Java Enterprise edition19·Jini20· Net beans20·JavaManagement Extensions 20. Lightweight containers 21.JavaBusiness Integration 21./SR 277 21./SR 294 22. ServiceComponent Architecture 22 a. NET 221.5 Summary 23Mastering modularity 242.1 What is modularity? 25Modularity vs. object orientation 252.2 Why modularize? 272.3 Modularizing a simple paint program 282.4 Introducing bundles 31The bundle's role in physical modularity 32 The bundle's role inlogical modularity 332.5 Defining bundles with metadata 34Human-readable information 35- Bundle identification 36Code visibility 39. Class-search order 482.6 Finalizing the paint program design 50Improving the paint program's modularization 51. Launchingthe new paint program 522.7 OSGi dependency resolution 53Resolving dependencies automatically53. Ensuring consistencywith uses constraints 592.8 Reviewing the benefits of the modular paint program 642.9 Summary 683Learning lifecycle 698.1 Introducing lifecycle management 70What is lifecycle management? 70. Why lifecycle management? 723.2 OSGi bundle lifecycle 72Introducing lifecycle to the paint program 73. The OsGiframework's role in the lifecycle 75. The bundle activator manifestentry 76. Introducing the lifecycle api 77. Lifecycle statediagram 83. Bundle cache and framework restarts 843.3 Using the lifecycle api in your bundles 85Configuring bundles 86. Deploying bundles 88. Inspectingframework state 92. Persisting bundle state 93: Listening forevents 96 Bundle suicide 99CoNTENTS8.4 Dynamically extending the paint program 1013.5 Lifecycle and modularity 108Resolving bundles 108 Refreshing bundles 110. Whenupdating isn't updated 1143.6 Summary 1154Studving services 1174.1 The what, why, and when of services 1l8What is a service? 118 Why use services 119- When to useservices 123. When not to use services 124- Still not sure? 1244.2 OSGi services in action 125Publishing a service 126. Finding and binding services 1284.3 Dealing with dynamics 132Avoiding common pitfalls 133: Listening for services 136Tracking services 1414.4 Using services in the paint example 148Defining a shape service 144. Publishing a shape service 144Tracking shape services I4.5 Relating services to modularity and lifecycle 146Why can't I see my service? 147. Can I provide a bundle-specificservice? 147. When should l unget a service? 148. Whenshould l unregister my service? 148. Should l bundle interfacesseparately? 1494.6 Standard services 149Core services 150. Compendium services 1514.7 Summary 152Dellving deeper into modularity 1545. 1 Managing your exports 155Importing your exports 155. Implicit export attributes 158Mandatory export attributes 160: Export filtering 167Duplicate exports 1625.2 Loosening your imports 164Optional imports 164: Dynamic imports 165, Optional usdynamic imports 166. Logging example 1675.3 Requiring bundles 171Declaring bundle dependencies 171 aggregating splitpackages 173. Issues with bundle dependencies 176CONTENTS5.4 Dividing bundles into fragments 177Understanding fragments 177. Using fragments forlocalization 1805.5 Dealing with your environment 183Requiring execution environments 184. Bundling nativelibraries 1855.6 Summary 187PaRT 2 OSGI IN PRACTICE1896 MoMoving toward bundles 1916.1 Turning JARs into bundles 192Choosing an identity 192. Exporting packages 195Discovering what to import 199. Embedding vs importing 203Adding lifecycle support 204. JAR file to bundle cheat sheet 2056.2 Splitting an application into bundles 206ng a mega bundle 206. Slicing code into bundles 216Loosening things up 221 To bundle or not to bundle? 2266.8 Summary 22Testing applications 2307.1 Migrating tests to OSGi 281In-container testing 231. Bundling tests 232. Covering allthe bases 2357.2 Mocking OSGi 297Testing expected behavior 237. Mocking in action 238Mocking unexpected situations 240. Coping with multithreadedtests 241. Exposing race conditions 2437. 9 Advanced OSGi testing 244OSGi test tools 245. Running tests on multiple frameworks 246Unit testing 250- Integration testing 251. Managementtestin1g7.4 Summary 2578Debugging applications 2588.1 Debugging bundles 259Debugging in action 261. Making things right with Hotswap 266CoNTENTS8.2 Solving class-loading issues 271ClassNotFoundException vs NoClassDefFoundError 272. Castingproblems 274. Using uses constraints 275. Staying clear ofClass forName( 278. Following the Thread Context ClassLoader 2808.3 Tracking down memory leaks 283Analyzing OsGi heap dumps 2838.4 Dangling services 287Finding a dangling service 287- Protecting against danglingservices 2888.5 Summary 2900 Managing bundles 2929.1 Versioning packages and bundles 298Meaningful versioning 293. Package versioning 295Bundle versioning 2979.2 Configuring bundles 299Configuration Admin Service 299. Metatype Service 309Preferences Service 3129.8 Starting bundles lazily 814Understanding activation policies 315. Using activationpolicies 3169.4 Summarry31710mManaging applications 31910.1 Deploying bundles 320Introducing management agents 320. OSGi Bundle repository 321Deployment Admin 33010.2 Ordering bundle activation 33 7Introducing the start Level service 338. Using the start levelService 33910.3 Summarry342PaRt 3 ADVANCED TOPICS343Component models and frameworks 3451.1 Understanding component orientation 346What are components? 346. Why do we want components? 348CONTENTS11.2 OSGi and components 349OSGis service-oriented component model 349 m Improving uponOSGi's component model 351- Painting with components 35511. 3 Declarative services 355Building Declarative Services components 356. Providing serviceswith Declarative services 357. Consuming services with declarativeServices 359. Declarative services component lifecycle 36411.4 Summary 37112Advanced component frameworks 37312.1 Blueprint Container 374Blueprint architecture 374- Providing services with blueprint 375Consuming services with blueprint 378. Blueprint componentlifecycle 382 Advanced Blueprint features 38712.2 Apache Felix iPOJo 391Building iPoo components 392. Providing services with iPo/o 393Consuming services with ipo/o 395. iPojO componentlifecycle 400. Instantiating components with iPo/o 40412.3 Mix and match 40812.4 Summary 41113Launching and embedding an OSGi framework 41218.1 Standard launching and embedding 418Framework API overview 413. Creating a frameworkinstance 415. Configuring a framework 417. Starting aframework instance 419. Stopping a framework instance 42018.2 Launching the framework 421Determining which bundles to install 422 Shutting downcleanly 422: Configuring, creating, and starting the framework 423Installing the bundles 424. Starting the bundles 424 starting themain bundle 425. Waiting for shutdown 42613.3 Embedding the framework 427Inside us. outside 427. who's in control 431- Embeddedframework example 43213. Summary 43714Securing your applications 43814.1 To secure or not to secure 439
暂无评论