Spring Dynamic Modules Reference Guide

Adrian M Colyer

SpringSource

Hal Hildebrand

Oracle

Costin Leau

SpringSource

Andy Piper

BEA

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


Table of Contents

Preface
I. Introduction
1. Why Spring Dynamic Modules?
2. Requirements
II. Reference Documentation
3. Bundles and Application Contexts
The Spring Dynamic Modules Extender bundle
Application Context Creation
Mandatory Service Dependencies
Application Context Service Publication
Bundle Lifecycle
The Resource abstraction
Accessing the BundleContext
Application Context Destruction
Stopping the extender bundle
4. Packaging and Deploying Spring-based OSGi applications
Bundle format and Manifest headers
Required Spring Framework and Spring Dynamic Modules Bundles
Importing and Exporting packages
Considerations when using external libraries
Diagnosing problems
5. The Service Registry
Exporting a Spring bean as an OSGi service
Controlling the set of advertised service interfaces for an exported service
Controlling the set of advertised properties for an exported service
The depends-on attribute
The context-class-loader attribute
The ranking attribute
service element attribute
Service registration and unregistration lifecycle
Defining references to OSGi services
Referencing an individual service
Referencing a collection of services
Dealing with the dynamics of OSGi imported services
Listener and service proxies
Accessing the caller BundleContext
Exporter/Importer listener best practices
Listener and cyclic dependencies
Service importer global defaults
Relationship between the service exporter and service importer
6. Working with Bundles
7. Testing OSGi based Applications
OSGi Mocks
Integration Testing
Creating a simple OSGi integration test
Installing test prerequisites
Advanced testing framework topics
Creating an OSGi application context
Specifying the OSGi platform to use
Waiting for the test dependencies
Testing framework performance
III. Appendixes
A. Compendium Services
Configuration Admin
Property placeholder support
Configuration Dictionaries
B. Extensions
Annotation-based injection
C. Eclipse Plug-in Development integration
D. Roadmap
Enhanced Configuration Admin Support
Managed Services
Managed Service Factories
Direct access to configuration data
Publishing configuration administration properties with exported services
Access to Service References for Collections
Start level integration
Web application support
ORM/Persistence support
OSGi standards
E. Spring Dynamic Modules Schema
F. Acknowledgments
IV. Other Resources
8. Useful links

List of Tables

3.1. OSGi resource search strategies
5.1. OSGi <service> attributes
5.2. OSGi <reference> attributes
5.3. <list>/<set> attributes
5.4. collection <comparator> attributes
5.5. Dynamic service collection Iterator contract
5.6. OSGi <listener> attributes
6.1. <bundle> action values
6.2. <bundle> attributes
7.1. Default test jar content settings