Book Image

Mastering Eclipse Plug-in Development

By : Alex Blewitt, Bandlem Limited
Book Image

Mastering Eclipse Plug-in Development

By: Alex Blewitt, Bandlem Limited

Overview of this book

Table of Contents (18 chapters)
Mastering Eclipse Plug-in Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Plugging in to JFace and the Common Navigator Framework
Index

OSGi upgrade strategies


While many open source libraries already natively support OSGi, there are still some that do not have the required metadata added by default. Fortunately, there are a number of strategies that can be used to enable the libraries to be used in OSGi runtimes such as Eclipse, or repositories such as Eclipse Orbit (http://eclipse.org/orbit/) that contain corrected bundles.

Embedding the library directly

If the library is only needed in one bundle, then the most expedient mechanism is to embed the JAR(s) into that bundle. Since all libraries in a bundle share the same classpath, this allows the library to run without being aware of the fact that it is running in an OSGi environment. This can be done by embedding the JAR into the bundle and using a Bundle-ClassPath header that refers to the library:

Bundle-ClassPath: .,lib/example.jar

Note that the dot (.) must be present if the bundle itself contains classes, or to enable other resources to be loaded. This approach works well...