Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Preface

Acknowledgments

About this Book

About the Authors

About the Cover Illustration

1. Programming beyond Hello World

Chapter 1. OSGi and the enterprise—why now?

1.1. Java’s missing modularity

1.1.1. Thinking about modularity

1.1.2. Enterprise Java and modularity—even worse!

1.2. OSGi to the rescue

1.2.1. Modularity, versioning, and compatibility

1.2.2. Dynamism and lifecycle management

1.2.3. Why isn’t everyone using OSGi?

1.2.4. Why OSGi and Java EE don’t work together

1.3. Programming with enterprise OSGi

1.3.1. Enterprise OSGi and OSGi in the enterprise

1.3.2. Dependency injection

1.3.3. Java EE integration

1.4. Summary

Chapter 2. Developing a simple OSGi-based web application

2.1. The development sandbox

2.1.1. Introducing Apache Aries

2.1.2. My first enterprise OSGi runtime

2.2. Writing an OSGi web application

2.2.1. Building a simple OSGi web application bundle

2.2.2. Deploying and testing

2.2.3. A familiar feeling—and important differences

2.2.4. Spicing things up with fragments

2.3. Decoupling with dependency injection

2.3.1. Inversion of control

2.3.2. Introducing the Blueprint service

2.3.3. Coupling two components with Blueprint

2.4. Bridging JNDI and OSGi

2.5. Summary

Chapter 3. Persistence pays off

3.1. Java and persistence

3.1.1. Making persistence easy

3.1.2. The problems with traditional persistence in OSGi

3.2. Building a persistent application

3.2.1. Setting up a datasource

3.2.2. Creating a persistence bundle

3.2.3. Making use of the data

3.3. Transactions—the secret ingredient

3.3.1. What is a transaction?

3.3.2. Handling multipart transactions

3.4. Summary

Chapter 4. Packaging your enterprise OSGi applications

4.1. The need for more than modules

4.1.1. Java EE applications

4.1.2. Enterprise OSGi applications

4.2. Enterprise OSGi subsystems

4.2.1. ESA structure

4.2.2. Subsystem metadata

4.2.3. Provisioning and resolution

4.3. The Enterprise Bundle Archive (EBA)

4.3.1. Sharing and isolation

4.4. Alternative approaches

4.4.1. Spring plan and PAR files

4.4.2. Apache Karaf features

4.5. Developing an enterprise OSGi application

4.5.1. Building your metadata

4.6. Summary

2. Building better enterprise OSGi applications

Chapter 5. Best practices for enterprise applications

5.1. The benefits of sharing—and how to achieve them in your bundles

5.1.1. Versioning bundles and packages

5.1.2. Scoping your bundles

5.1.3. Why isolation is important to sharing

5.2. Structuring for flexibility

5.2.1. Separate interfaces from implementation

5.2.2. If you can’t separate out your API

5.2.3. Avoid static factory classes

5.2.4. Building a better listener with the whiteboard pattern

5.3. A better enterprise application architecture

5.3.1. Use small WABs

5.3.2. Make a persistence bundle

5.3.3. The rewards of well-written bundles

5.4. Summary

Chapter 6. Building dynamic applications with OSGi services

6.1. OSGi dynamism

6.2. Using OSGi services

6.2.1. Registering and looking up services the old-fashioned way

6.2.2. Blueprint

6.2.3. Declarative Services

6.2.4. iPojo

6.2.5. Google Guice and Peaberry

6.3. Getting the most out of Blueprint

6.3.1. Using Blueprint for things other than services

6.3.2. Values

6.3.3. Understanding bean scopes

6.3.4. Constructing beans

6.3.5. Lifecycle callbacks

6.3.6. Service ranking

6.3.7. Registering services under multiple interfaces

6.4. Blueprint and service dynamism

6.4.1. The remarkable appearing and disappearing services

6.4.2. Multiplicity and optionality

6.4.3. Monitoring the lifecycle

6.5. Summary

Chapter 7. Provisioning and resolution

7.1. Describing OSGi bundles

7.1.1. Describing bundles as resources

7.1.2. Requirements and capabilities

7.1.3. Directives affecting the resolver

7.1.4. Repositories

7.2. Provisioning bundles

7.2.1. Package-based provisioning

7.2.2. Service-based provisioning

7.3. Provisioning technologies

7.3.1. Apache Felix OBR

7.3.2. Equinox p2

7.3.3. Apache ACE

7.3.4. Standard OSGi repositories

7.4. Bundle repositories

7.4.1. Public bundle repositories

7.4.2. Building your own repository

7.4.3. Generating your repository

7.5. Summary

Chapter 8. Tools for building and testing

8.1. Manifest-first or code-first?

8.2. Building OSGi applications

8.2.1. Bnd

8.2.2. The Maven bundle plug-in

8.2.3. Ant and Eclipse PDE

8.2.4. Maven Tycho

8.2.5. The Maven EBA plug-in

8.3. Testing OSGi applications

8.3.1. Unit testing OSGi

8.3.2. Pax Exam

8.3.3. Tycho test

8.3.4. Rolling your own test framework

8.4. Collecting coverage data

8.4.1. Getting coverage tools onto the classpath

8.5. Summary

Chapter 9. IDE development tools

9.1. Eclipse-based OSGi development

9.1.1. Eclipse Plug-in Development Environment

9.1.2. Extending bnd into the GUI world with bndtools

9.2. OSGi support in other IDEs

9.2.1. NetBeans

9.2.2. Osmorc and IntelliJ IDEA

9.2.3. Do you need OSGi support in your IDE?

9.3. Tools for the enterprise OSGi extensions

9.3.1. IBM Rational Development Tools for OSGi Applications

9.3.2. Eclipse Libra

9.4. Testing OSGi applications inside IDEs

9.4.1. Testing with Eclipse PDE

9.4.2. Testing with bndtools

9.4.3. Pax Exam

9.5. Summary

3. Integrating enterprise OSGi with everything else

Chapter 10. Hooking up remote systems with distributed OSGi

10.1. The principles of remoting

10.1.1. The benefits of remoting

10.1.2. The drawbacks of remoting

10.1.3. Good practices and the fallacies of remoting

10.2. The Remote Services Specification

10.2.1. Exposing endpoints

10.2.2. Discovering endpoints

10.3. Writing a remotable service

10.3.1. Coding a special offer service

10.4. Adding in your remote service using Apache CXF

10.4.1. Making your service available

10.4.2. Discovering remote services from your superstore

10.5. Using your remote application

10.5.1. Setting up your remote database connections

10.6. Using SCA for remoting

10.6.1. Apache Tuscany

10.6.2. Importing a remote service

10.6.3. Exporting remote services

10.6.4. Interfaces and services

10.7. Summary

Chapter 11. Migration and integration

11.1. Managing heterogeneous applications

11.1.1. Using SCA to integrate heterogeneous systems

11.1.2. Integrating using an ESB

11.2. Migrating from Java EE

11.2.1. Moving from WARs to WABs

11.2.2. Using persistence bundles

11.2.3. EJBs in OSGi

11.2.4. Moving to Blueprint from the Spring Framework

11.3. Summary

Chapter 12. Coping with the non-OSGi world

12.1. Turning normal JARs into OSGi bundles

12.1.1. Finding bundled libraries

12.1.2. Building your own bundles

12.1.3. Generating bundles automatically

12.2. Common problems for OSGi-unaware libraries

12.2.1. Reflection in OSGi

12.2.2. Using and abusing the thread context ClassLoader

12.2.3. META-INF services

12.2.4. Serialization and deserialization

12.3. An example library conversion—logging frameworks in OSGi

12.3.1. Common problems with loggers in OSGi

12.3.2. Avoiding problems in OSGi

12.3.3. DynamicImport-Package—a saving grace?

12.3.4. Other problems that are more difficult to fix

12.4. Summary

Chapter 13. Choosing a stack

13.1. What’s in what server?

13.2. Apache Karaf

13.2.1. Karaf features

13.2.2. Installing Aries into Karaf

13.2.3. Handling non-OSGi bundles

13.2.4. Blueprint-aware console

13.3. Apache Geronimo

13.4. WebSphere Application Server

13.4.1. Provisioning and bundle repositories

13.4.2. Module granularity

13.4.3. Managed application update and extension

13.4.4. SCA

13.5. Eclipse Virgo and Gemini

13.5.1. Debug support

13.5.2. Application isolation

13.6. GlassFish

13.6.1. Dependency injection

13.6.2. EJBs

13.6.3. Administration

13.7. JBoss

13.8. Paremus Nimble and Paremus Service Fabric

13.8.1. Provisioning and deployment

13.8.2. Remote services

13.8.3. Console

13.8.4. Installing Aries

13.9. Summary

Appendix A. OSGi—the basics

A.1. Where did OSGi come from, and where is it going?

A.2. Versions

A.2.1. The semantic versioning scheme

A.2.2. Guarantees of compatibility

A.2.3. Coexistence of implementations

A.2.4. Why everything has a version

A.2.5. Consumers and providers, not clients and implementors

A.2.6. Semantic versions and marketing versions

A.3. Bundles

A.3.1. Manifest headers

A.3.2. The bundle context

A.3.3. Dependency management

A.3.4. Classloading

A.3.5. Fragments

A.4. Bundle lifecycles

A.4.1. Activation policies

A.4.2. Bundle activators

A.4.3. Installation and resolution

A.4.4. Starting and stopping bundles

A.4.5. Uninstalling and updating bundles

A.4.6. Managing dependencies in a dynamic system

A.5. Services

A.5.1. The Service Registry

A.5.2. Accessing services

A.5.3. Filters

A.6. OSGi frameworks

A.7. The OSGi console

A.8. Summary

Appendix B. The OSGi ecosystem

B.1. The OSGi Alliance

The Core Platform Expert Group

The Enterprise Expert Group

B.2. OSGi specifications

B.2.1. The Core Specification

B.2.2. The Compendium Specification

B.2.3. The Enterprise Specification

B.2.4. Other specifications

B.3. OSGi—future frontiers

B.3.1. OSGi and Jigsaw

Index

List of Figures

List of Tables

List of Listings

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset