Spring Dynamic Modules Reference Guide

Authors

Adrian M Colyer (SpringSource) , Hal Hildebrand (Oracle) , Costin Leau (SpringSource) , Andy Piper (BEA)

1.2.1

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.


Preface
I. Introduction
1. Why Spring Dynamic Modules?
2. Requirements
3. Getting Started
3.1. First Steps
3.1.1. Knowing Spring
3.1.2. Knowing OSGi
3.1.3. Trying Out The Samples
3.2. Need Help?
3.2.1. Community Support
3.2.2. Professional Support
3.3. Following Development
4. What is new?
4.1. 1.2.x
4.1.1. Java 2 Security Integration
4.1.2. Compendium Services Support
4.1.3. Changed Spring DM Symbolic Names
4.1.4. Usage of SpringSource Enterprise Bundle Repository (EBR)
4.2. 1.1.x
4.2.1. Web Support
4.2.1.1. Spring-MVC Integration
4.2.2. Classpath Resource Abstraction
4.2.3. Pluggable Extender Configuration
4.2.4. Improved Class Loading
II. Reference Documentation
5. Bundles and Application Contexts
5.1. The Spring Dynamic Modules Extender bundle
5.2. Application Context Creation
5.2.1. Mandatory Service Dependencies
5.2.2. Application Context Service Publication
5.3. Bundle Lifecycle
5.4. The Resource Abstraction
5.5. Accessing the BundleContext
5.6. Application Context Destruction
5.7. Stopping the Extender Bundle
6. Packaging and Deploying Spring-based OSGi applications
6.1. Bundle Format And Manifest Headers
6.2. Extender Configuration Options
6.2.1. Listening To Extender Events
6.3. Required Spring Framework And Spring Dynamic Modules Bundles
6.4. Spring XML Authoring Support
6.5. Importing and Exporting Packages
6.6. Considerations When Using External Libraries
6.7. Diagnosing Problems
7. The Service Registry
7.1. Exporting A Spring Bean As An OSGi Service
7.1.1. Controlling The Set Of Advertised Service Interfaces For An Exported Service
7.1.1.1. Detecting The Advertised Interfaces At Runtime
7.1.2. Controlling The Set Of Advertised Properties For An Exported Service
7.1.3. The depends-on Attribute
7.1.4. The context-class-loader Attribute
7.1.5. The ranking Attribute
7.1.6. service Element Attributes
7.1.7. Service Registration And Unregistration Lifecycle
7.1.7.1. Using OsgiServiceRegistrationListener Interface
7.2. Defining References To OSGi Services
7.2.1. Referencing An Individual Service
7.2.1.1. Controlling The Set Of Advertised Interfaces For The Imported Service
7.2.1.2. The filter Attribute
7.2.1.3. The bean-name Attribute
7.2.1.4. The cardinality Attribute
7.2.1.5. The depends-on Attribute
7.2.1.6. The context-class-loader Attribute
7.2.1.7. reference Element Attributes
7.2.1.8. reference And OSGi Service Dynamics
7.2.1.9. Getting A Hold Of The Managed Service Reference
7.2.2. Referencing A Collection Of Services
7.2.2.1. Greedy Proxying
7.2.2.2. Collection (list And set) Element Attributes
7.2.2.3. list / set And OSGi Service Dynamics
7.2.2.4. Iterator Contract And Service Collections
7.2.3. Dealing With The Dynamics Of OSGi Imported Services
7.2.4. Listener And Service Proxies
7.2.5. Accessing The Caller BundleContext
7.3. Exporter/Importer Listener Best Practices
7.3.1. Listener And Cyclic Dependencies
7.4. Service Importer Global Defaults
7.5. Relationship Between The Service Exporter And Service Importer
8. Working With Bundles
9. Web Support
9.1. Supported Web Containers
9.2. Web Support Usage
9.3. WAR Classpath In OSGi
9.3.1. Static Resources
9.3.2. Servlets
9.3.3. Java Server Pages
9.3.3.1. Tag Libraries
9.4. Configuring The Web Extender
9.4.1. Changing The War Deployer
9.5. Customizing The Standard Deployers
9.6. OSGi-ready Libraries And Web Development
9.6.1. Deploying Web Containers As OSGi Bundles
9.6.1.1. Tomcat 5.5.x/6.0.x
9.6.1.2. Jetty 6.1.8+/6.2.0
9.6.2. Common Libraries
9.7. Spring-MVC Integration
10. Compendium Services
10.1. Configuration Admin
10.1.1. Exposing Configuration Admin Entries As Properties
10.1.2. Managed Properties
10.1.2.1. Configuration Admin Runtime Updates
10.1.3. Managed Service Factories
10.1.4. Direct Access To Configuration Data
11. Testing OSGi based Applications
11.1. OSGi Mocks
11.2. Integration Testing
11.2.1. Creating A Simple OSGi Integration Test
11.2.2. Installing Test Prerequisites
11.2.3. Advanced Testing Framework Topics
11.2.3.1. Customizing The Test Manifest
11.2.3.2. Customizing Test Bundle Content
11.2.3.3. Understanding The MANIFEST.MF Generation
11.2.4. Creating An OSGi Application Context
11.2.5. Specifying The OSGi Platform To Use
11.2.6. Waiting For The Test Dependencies
11.2.7. Testing Framework Performance
III. Other Resources
12. Useful Links
IV. Appendixes
A. Extensions
A.1. Annotation-Based Injection
A.1.1. Enabling/Disabling Annotation Processing
B. Security Integration
C. Eclipse Plug-in Development integration
D. Spring Dynamic Modules Maven Archetype
D.1. Generated Project Features At-A-Glance
E. Useful OSGi tips
E.1. OSGi Fragments
F. Roadmap
F.1. Access to Service References for Collections
F.2. Start Level Integration
F.3. Web Library Integration
F.4. ORM/Persistence Support
F.5. OSGi Standards
G. Spring DM OSGi Repository
G.1. Spring DM Temporary OSGi Repository
G.1.1. Repository Conventions
G.1.2. Browsing The Repository Content
G.1.3. Using The Repository With Maven
G.1.4. Using The Repository With Ant/Ivy
H. Spring Dynamic Modules Schema
I. Acknowledgments