OSGi with Apache Felix Karaf 1/63 © 2010 – anova r&d bvba (c) 2010 anova r&d bvba This work is licensed under the Creative Commons Attribution 2.0 Belgium License. To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/be/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 2/63 © 2010 – anova r&d bvba Planning OSGi in a nutshell ● Apache Felix Karaf ● Blueprint ● (with exercise) 3/63 © 2010 – anova r&d bvba Planning OSGi in a nutshell ● Apache Felix Karaf ● Blueprint ● (with exercise) 4/63 © 2010 – anova r&d bvba OSGi in a Nutshell What is OSGi? ● OSGi Core ● OSGi Bundles ● OSGi Service Registry ● OSGi Compendium ● 5/63 © 2010 – anova r&d bvba What is OSGi? What is OSGi? ● OSGi Alliance (http://www.osgi.org) ● – initially focused on embedded/networked devices – standard for service-oriented, component-based Java applications Latest spec is R4.2 ● – Core specification – Compendium specification – Enterprise specification 6/63 © 2010 – anova r&d bvba Bundles What is (in) an OSGi bundle? ● JAR file containing classes and resources ● Extra manifest headers ● – Identification and description – Classloading – Activation 7/63 © 2010 – anova r&d bvba Bundles OSGi bundle manifest headers ● Identification and description ● – Bundle-SymbolicName – Bundle-Name – Bundle-Description Apache Felix Karaf :: Kitchen :: Mexican (39) -------------------------------- ... Bundle-ManifestVersion = 2 Bundle-Name = Apache Felix Karaf :: Kitchen :: Mexican Bundle-SymbolicName = be.anova.course.karaf.mexican Bundle-Version = 1.0 ... 8/63 © 2010 – anova r&d bvba Bundles Bundle classloading ● System bundle classloader ● – java.* classes – OSGi framework classes Every bundle has own classloader ● – Imported packages – Required bundles – Fragments – Bundle classes 9/63 © 2010 – anova r&d bvba Bundles Classloading headers in MANIFEST.MF ● Export-Package ● Required-Bundle ● Import-Package ● DynamicImport-Package ● TSSJS :: Kitchen :: Mexican (39) -------------------------------- Export-Package = be.anova.course.karaf.mexican Import-Package = be.anova.course.karaf,be.anova.course.karaf.mexican 10/63 © 2010 – anova r&d bvba
Description: