Modular Java: Creating Flexible Applications with OSGi and Spring

Modular Java: Creating Flexible Applications with OSGi and Spring

by Craig Walls


$29.20 $34.95 Save 16% Current price is $29.2, Original price is $34.95. You Save 16%.


Attack complexity in your Java applications using Modular Java. This pragmatic guide introduces you to OSGi and Spring Dynamic Modules, two of the most compelling frameworks for Java modularization. Driven by real-world examples, this book will equip you with the know-how you need to develop Java applications that are composed of smaller, loosely coupled, highly cohesive modules.

The secret weapon for attacking complexity in any project is to break it down into smaller, cohesive, and more easily digestible pieces. With Modular Java, you can easily develop applications that are more flexible, testable, maintainable, and comprehensible.

Modular Java is a pragmatic guide to developing modular applications using OSGi, the framework for dynamic modularity in Java, and Spring Dynamic Modules, an OSGi extension to the Spring Framework. You'll start with the basics but quickly ramp up, creating loosely coupled modules that publish and consume services, and you'll see how to compose them into larger applications. Along the way, you'll apply what you learn as you build a complete web application that is made up of several OSGi modules, using Spring-DM to wire those modules together.

Modular Java is filled with tips and tricks that will make you a more proficient OSGi and Spring-DM developer. Equipped with the know-how gained from this book, you'll be able to develop applications that are more robust and agile.

Product Details

ISBN-13: 9781934356401
Publisher: Pragmatic Programmers, LLC, The
Publication date: 07/15/2009
Pages: 260
Product dimensions: 7.40(w) x 8.90(h) x 0.90(d)

About the Author

Craig Walls is a professional software developer with over 15 years of experience in several industries, including telecommunications, finance, retail, and education. He's currently involved in the development of a natural language business intelligence tool with an Addison, TX-based company. He is the author of Spring in Action and XDoclet in Action (published by Manning) and is an avid proponent of Spring, open-source, and agile development.

Table of Contents

1 Introduction 1

1.1 A New Set of Wheels 2

1.2 Modularity 2

1.3 Introducing OSGi 6

1.4 Road Map 10

1.5 Who is This Book For? 12

1.6 Acknowledgments 12

I OSGi Fundamentals 15

2 Getting Started 17

2.1 Getting to Know the OSGi Container 17

2.2 Hello, OSGi 23

2.3 A Hello World Service Bundle 29

3 Dude, Where's My Jar? 39

3.1 Searching for Jar Files 39

3.2 Designing the Application Components 40

3.3 Bundling the Application Components for OSGi 42

3.4 Setting Up the Project 44

4 Working with Bundle 53

4.1 Creating the Domain Bundle 53

4.2 Contending with Nonbundle Dependencies 63

4.3 Following the Bundle Life Cycle 72

5 OSGi Services 75

5.1 Creating an OSGi Service 75

5.2 Testing the Service 86

5.3 Consuming OSGi Services 95

II Spring Dynamic Modules and Web Bundles 105

6 Spring and OSGi 107

6.1 Introducing Spring-DM 108

6.2 Declaring Services 112

6.3 Injecting Services into Consumers 119

7 Creating Web Bundles 127

7.1 Assembling a Web Server 127

7.2 The Spring-DM Web Extender 135

7.3 Developing a Web Bundle 140

7.4 Deploying the Web Bundle 148

8 Extending Bundles 157

8.1 Introducing Fragments 157

8.2 Creating a UI Fragment 159

8.3 Trying It 165

III Finishing Touches 169

9 OSGi in Production 171

9.1 Distributing the Application 171

9.2 Adding an Administration Console 180

10 Configuring the Application 185

10.1 Installing Pax ConfMan 186

10.2 Configuring the Web Console 187

10.3 Adjusting Logging 189

10.4 Configuring Application Details 190

10.5 Configuring the Web Server 196

A Manifest Headers 201

A.1 OSGi R4 Headers 201

B Spring-DM Configuration 203

B.1 Spring-DM Core Configuration Elements203

B.2 Spring-DM Compendium Configuration Elements 211

C The OSGi Blueprint Service 215

C.1 Comparing the Blueprint Service with Spring-DM 215

C.2 OSGi Blueprint Services (RFC-124) Elements 216

C.3 OSGi Blueprint Services (RFC-124) Compendium Elements 225

D Resources 231

E Bibliography 233

Index 235

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews