<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5377918349766062036</id><updated>2011-09-01T18:43:12.437+02:00</updated><category term='jboss'/><category term='felix'/><category term='osgi'/><category term='knopflerfish'/><category term='equinox'/><title type='text'>JBoss OSGi Diary</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-1744302031708685711</id><published>2011-08-04T11:25:00.004+02:00</published><updated>2011-08-04T11:41:52.878+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBoss AS7 OSGi Presentation + Demo</title><content type='html'>I am happy to announce that the JBoss AS7 OSGi &lt;a href="http://www.jboss.org/webinars"&gt;webinar&lt;/a&gt; recording is now available on &lt;a href="http://vimeo.com/"&gt;vimeo&lt;/a&gt;.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://vimeo.com/27155228"&gt;JBoss AS7 OSGi Presentation + Demo&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://vimeo.com/26722637"&gt;JBoss AS7 OSGi Demo&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://www.jboss.org/as7"&gt;JBoss AS7&lt;/a&gt; is a game-changer for both Java EE developers as well as application  server administrators. And while JBoss is best known for being a Java EE  container, in this session, we will focus on the OSGi capabilities of  the new JBoss AS7.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Starting with background information on OSGi in general, Thomas Diesler  introduces the main objectives of this technology and explains the  unique JBoss OSGi vision. Combining the best of two worlds we show how  modern Java EE applications on AS7 can use the OSGi component model and  vice versa.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Presenters: Thomas Diesler and David Bosschaert&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Thomas is the OSGi Project Lead at JBoss. As the Red Hat representative  in the OSGi Enterprise Expert Group he is involved in the  standardization effort of various OSGi technologies that are relevant to  the enterprise space.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;David, principal software engineer at Red Hat, is a co-chair of the OSGi  Enterprise Expert Group and spends the majority of his time on the  JBoss OSGi framework and other open source projects. Before joining  JBoss/Red Hat in 2010, David worked for IONA Technologies and Progress  Software in Dublin, Ireland.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The demo code is available &lt;a href="https://github.com/tdiesler/jbosgi/tree/1.0.0/testsuite/jbossas"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-1744302031708685711?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/1744302031708685711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2011/08/jboss-as7-osgi-presentation-demo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1744302031708685711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1744302031708685711'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2011/08/jboss-as7-osgi-presentation-demo.html' title='JBoss AS7 OSGi Presentation + Demo'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-4842442329194321045</id><published>2011-07-26T13:24:00.004+02:00</published><updated>2011-07-26T13:48:27.172+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi-1.0.0 Final Released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0 Final.&lt;br /&gt;&amp;nbsp; &lt;br /&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0/jboss-osgi-installer-1.0.0.jar/download"&gt;jboss-osgi-installer-1.0.0.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is our first OSGi Core 4.2. Framework compliant release. It also comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Integration with &lt;a href="http://www.jboss.org/jbossas/"&gt;JBoss AS7&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Pass the Core 4.2&amp;nbsp; Compliance Testsuite from the &lt;a href="http://www.osgi.org/Main/HomePage"&gt;OSGi Alliance&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Add Declarative Services (DS) example&lt;/li&gt;&lt;li&gt;&lt;a href="https://docs.jboss.org/author/display/JBOSGI"&gt;Documentation&lt;/a&gt; now available in Confluence&lt;/li&gt;&lt;li&gt;OSGi service invocation from EJB3 and Webap&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Migration to the &lt;a href="http://www.jboss.org/arquillian"&gt;Arquillian&lt;/a&gt; test framework&lt;/li&gt;&lt;li&gt;Better support for execution environments&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="https://docs.jboss.org/author/display/JBOSGI/User+Guide"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;h1&gt;&lt;span style="font-size: small;"&gt;JBossOSGi 1.0.0&lt;/span&gt;&lt;/h1&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;Bug&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-438"&gt;JBOSGI-438&lt;/a&gt;] -         Exception when starting Blueprint component&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-443"&gt;JBOSGI-443&lt;/a&gt;] -         Intermittent WebAppNegativeTestCase failure&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-458"&gt;JBOSGI-458&lt;/a&gt;] -         Warning from webconsole at first access&lt;/li&gt;&lt;/ul&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;Feature Request&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-192"&gt;JBOSGI-192&lt;/a&gt;] -         Access an OSGi service from EJB3&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-313"&gt;JBOSGI-313&lt;/a&gt;] -         OSGi service invocation from EE6 WebApp&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-474"&gt;JBOSGI-474&lt;/a&gt;] -         Add Dynamic Services to examples and distro&lt;/li&gt;&lt;/ul&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;Task&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-434"&gt;JBOSGI-434&lt;/a&gt;] -         Release 1.0.0 Final&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-448"&gt;JBOSGI-448&lt;/a&gt;] -         Run OSGi integration tests as part of the AS7 Hudson job&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-461"&gt;JBOSGI-461&lt;/a&gt;] -         Update user guide with OSGi in AS7 usage&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-463"&gt;JBOSGI-463&lt;/a&gt;] -         Create OSGi in AS7 QuickStart guide&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-468"&gt;JBOSGI-468&lt;/a&gt;] -         Update to Arquillian 1.0.0.CR1 or later&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-469"&gt;JBOSGI-469&lt;/a&gt;] -         Migrate performance tests to new Arquillian API&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-471"&gt;JBOSGI-471&lt;/a&gt;] -         Remove JTA support for standalone Runtime&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-472"&gt;JBOSGI-472&lt;/a&gt;] -         Migrate documentation to confluence&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-481"&gt;JBOSGI-481&lt;/a&gt;] -         Fix Equinox performance tests&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;&lt;span style="font-size: small;"&gt;Core Framework 1.0.0&lt;/span&gt;&lt;/h1&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;Bug&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-433"&gt;JBOSGI-433&lt;/a&gt;] -         [TCK] Intermittent StartLevelControl failure&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-439"&gt;JBOSGI-439&lt;/a&gt;] -         Bundle resolution error should provide reason&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-442"&gt;JBOSGI-442&lt;/a&gt;] -         Circular class load issue on lazy activation&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-444"&gt;JBOSGI-444&lt;/a&gt;] -         Service event failure on Runtime shutdown&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-450"&gt;JBOSGI-450&lt;/a&gt;] -         Bundle containing a BundleTracker causes subsequent bundle install/starts to fail&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-451"&gt;JBOSGI-451&lt;/a&gt;] -         Timeout starting Framework after shutdown&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-452"&gt;JBOSGI-452&lt;/a&gt;] -         ConcurrentModificationException in BundleManager.getBundles()&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-456"&gt;JBOSGI-456&lt;/a&gt;] -         Framework events may get delivered out of order&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-465"&gt;JBOSGI-465&lt;/a&gt;] -         Framework sets service mode while Container is shutting down&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-473"&gt;JBOSGI-473&lt;/a&gt;] -         Unsupported execution environment [OSGi/Minimum-1.2, CDC-1.1/Foundation-1.1, J2SE-1.4] we have [J2SE-1.5, , JavaSE-1.6]&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-476"&gt;JBOSGI-476&lt;/a&gt;] -         Cannot acquire start/stop lock for lazy bundles&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-477"&gt;JBOSGI-477&lt;/a&gt;] -         Unsupported execution environment OSGi/Minimum-1.1&lt;/li&gt;&lt;/ul&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;Feature Request&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-441"&gt;JBOSGI-441&lt;/a&gt;] -         Allow for OSGi style Class Filtering&lt;/li&gt;&lt;/ul&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;Task&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-238"&gt;JBOSGI-238&lt;/a&gt;] -         [TCK] Framework core functionality&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-255"&gt;JBOSGI-255&lt;/a&gt;] -         [TCK] Core Framework&lt;/li&gt;&lt;li&gt;[&lt;a href="https://issues.jboss.org/browse/JBOSGI-455"&gt;JBOSGI-455&lt;/a&gt;] -         Add services that represent the RESOLVED and ACTIVE states&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Enjoy&amp;nbsp; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-4842442329194321045?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/4842442329194321045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2011/07/jbossosgi-100-final-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4842442329194321045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4842442329194321045'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2011/07/jbossosgi-100-final-released.html' title='JBossOSGi-1.0.0 Final Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-1900276059033177138</id><published>2010-11-11T17:50:00.014+01:00</published><updated>2010-11-12T13:38:35.717+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBoss AS7 OSGi Integration</title><content type='html'>Now that &lt;a href="http://www.jboss.org/jbossas/downloads/"&gt;JBossAS-7.0.0.Alpha1&lt;/a&gt; has come out I'd like to talk about how JBoss OSGi integrates with it and what benefits our community will gain from the OSGi integration. In this post I'll show how non-OSGi components like EJB3, Servlet, CDI Beans, ManagedBeans, MBeans, etc. can access OSGi services and vice versa.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;OSGi in the EE Landscape&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Generally I believe that OSGi is very much an all-or-nothing technology. If your application is  an OSGi bundle (or many of them) you must run within an OSGi Framework  and can only have access to services that are provided by other OSGi bundles.  In todays EE appplication landscape where folks take (standard)  functionality like JPA, Servlet3, CDI, EJB3, JCA, JMS, etc for granted  they would need a container that offers these services not only to EE  applications but also to OSGi bundles.&lt;br /&gt;&lt;br /&gt;In Mar-2010 the &lt;a href="http://www.osgi.org/EEG/HomePage"&gt;OSGi Enterprise Expert Group&lt;/a&gt;, has come up  with its first EE OSGi specification, which IMHO offers a fraction  of what we currently see in modern EE applications. There is no JSP,  EJB3, JCA, JMS, CDI not even Annotation processing. The EEG is working  on completing the picture, but this is unlikely to become generally  available in the near future. David and I are members of this group, so its partially also our call.&lt;br /&gt;&lt;br /&gt;Of course, if your application  is such that it only requires what is available in OSGi Core, Compendium and Enterprise already (and many of todays larger  OSGi applications do) OSGi is a good candidate to solve general  modularity and service integration issues.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;The JBoss approach to OSGi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;At JBoss we take a different approach. With the upcoming AS7 the  basic building block is a "&lt;a href="http://relation.to/16904.lace"&gt;module&lt;/a&gt;" which can have dependencies on other  modules. There are services with basic lifecycle that can also have  dependencies on each other. Our &lt;a href="https://github.com/jbosgi/jbosgi-framework"&gt;OSGi Framework&lt;/a&gt; implementation builds on  top of this basic infrastructure like any other JBoss subsystem. We  integrate at the lowest possible level. Such it becomes possible to  access an OSGi service from a non-OSGi component and vice versa. &lt;br /&gt;&lt;br /&gt;The questions about the suitability of OSGi is at the very heart of  these integration issues IMHO. If EJB3, CDI, etc. offer value-add then it  must be possible to leverage that value from an OSGi application.  Otherwise you have an either/or situation where you gain benefits from one technology but at the same time loose benefits from another technology that cannot be accessed any more. &lt;br /&gt;&lt;br /&gt;You can think of this in terms of two intersecting sets of technology  (i.e. EE6, OSGi). I'm interested in the superset of the two and not so  much in the smaller individual sets. The aim is that JBoss users who already write great and non  trivial EE applications can now "also" use OSGi to address modularity issues in these very applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;The Theory behind JBoss OSGi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Any deployment, and in-fact any jar you see in AS7, is a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/modules/Module.html"&gt;Module&lt;/a&gt;. A Module may have &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/modules/DependencySpec.html"&gt;dependencies&lt;/a&gt; and a number of attached &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/modules/ResourceLoader.html"&gt;ResourceLoaders&lt;/a&gt;. A ResourceLoader is typically backed by a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/vfs/VirtualFile.html"&gt;VirtualFile&lt;/a&gt;. A Module can choose to export a subset of the resource paths from its attached ResourceLoaders. This is equivalent to the Export-Package notion in OSGi. The dependencies on other Modules are equivalent to Require-Bundle. A module can choose which paths to import from a given dependency. A Module can choose to re-export the paths that it imports from a dependency.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;An OSGi Bundle is a jar with a set of metadata in it's Manifest. To name a few, we have&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt; &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#BUNDLE_SYMBOLICNAME"&gt;Bundle-SymbolicName&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#BUNDLE_VERSION"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Bundle-Version&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#EXPORT_PACKAGE"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Export-Package&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#IMPORT_PACKAGE"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Import-Package&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#REQUIRE_BUNDLE"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Require-Bundle&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Generally speaking however, these are &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XRequirement.html"&gt;Requirements&lt;/a&gt; and &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XCapability.html"&gt;Capabilities&lt;/a&gt; that a &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html"&gt;Bundle&lt;/a&gt; may have. In JBoss OSGi we translate the OSGi metadata to these general &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Requirements and Capabilities and feed the &lt;a href="http://jbossosgi.blogspot.com/2010/07/standalone-osgi-resolver.html"&gt;Standalone Resolver&lt;/a&gt; with it. At bundle resolution time, the &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XResolver.html"&gt;Resolver&lt;/a&gt; tries to find a consistent set of &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XWire.html"&gt;Wires&lt;/a&gt;, such that every non-optional Requirement is wired to a Capability. This is a non-trivial process that leads to consistent class spaces. If successful, the Bundle is said to be &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html#RESOLVED"&gt;RESOLVED&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;At the end of the day, every OSGi Framework conceptually creates dependencies between the installed bundles and limits the set of paths at the exporting and importing side of the wires.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;So we get the set of Requirements and Capabilities from somewhere, feed them to our &lt;a href="http://jbossosgi.blogspot.com/2010/07/standalone-osgi-resolver.html"&gt;resolver abstraction&lt;/a&gt; and finally use the resulting Wires to setup the &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/modules/ModuleSpec.html"&gt;ModuleSpec&lt;/a&gt;. The source for our &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Requirements and Capabilities is not limited to the OSGi manifest. Any AS7 deployment can generate &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XModule.html"&gt;resolver metadata&lt;/a&gt; and make itself known to the OSGi layer.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;At deploy time every Bundle becomes an AS7 Module and every AS7 Module may become an OSGi Bundle when its provides it's set of &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XModule.html"&gt;resolver metadata&lt;/a&gt; and registers with the OSGi layer.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;OSGi bundles are therefore a subset of the modules that exist in the AS7 module layer.&lt;br /&gt;&lt;br /&gt;Lets look at some code ... &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Bundle accessing a Non-OSGi Module&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In a &lt;a href="https://github.com/jbosgi/jbosgi/blob/master/testsuite/example/src/test/java/org/jboss/test/osgi/example/xservice/BundleAccessesModuleServiceTestCase.java"&gt;test case&lt;/a&gt; we construct and deploy a module that provides a simple &lt;a href="https://github.com/jbosgi/jbosgi/blob/master/testsuite/example/src/test/java/org/jboss/test/osgi/example/xservice/api/Echo.java"&gt;Echo&lt;/a&gt; service to the running AS7.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "example-xservice-target-module");&lt;br /&gt;archive.addClasses(Echo.class, EchoService.class, TargetModuleActivator.class);&lt;br /&gt;String activatorPath = "META-INF/services/" + ServiceActivator.class.getName();&lt;br /&gt;archive.addResource(getResourceFile("xservice/target-module/" + activatorPath), activatorPath);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The module contains a few classes and a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/msc/service/ServiceActivator.html"&gt;ServiceActivator&lt;/a&gt;. The ServiceActivator is the equivalent of a &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleActivator.html"&gt;BundleActivator&lt;/a&gt;. When the module gets activated we register a simple &lt;a href="https://github.com/jbosgi/jbosgi/blob/master/testsuite/example/src/test/java/org/jboss/test/osgi/example/xservice/module/EchoService.java"&gt;EchoService&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;public static void addService(BatchBuilder batchBuilder)&lt;br /&gt;{&lt;br /&gt;  serviceBuilder = batchBuilder.addService(SERVICE_NAME, new EchoService());&lt;br /&gt;  serviceBuilder.addAliases(ServiceName.of(Constants.JBOSGI_PREFIX, Echo.class.getName()));&lt;br /&gt;  serviceBuilder.setInitialMode(Mode.ACTIVE);&lt;br /&gt;  log.infof("Service added: %s", SERVICE_NAME);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Please note, that the service is also registered with an alias. The JBoss OSGi service registry uses the &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/msc/service/ServiceContainer.html"&gt;ServiceContainer&lt;/a&gt; that contains all services that exist in AS7. For service lookup the OSGi API uses the FQN of an interface that the requested service implements. The alias is needed for this OSGi API call to succeed&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;ServiceReference sref = context.getServiceReference(Echo.class.getName());&lt;br /&gt;Echo service = (Echo)context.getService(sref);&lt;br /&gt;service.echo("hello world");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When the module is deployed, it is not automatically registered with the OSGi layer. A bundle that imports the package of the &lt;a href="https://github.com/jbosgi/jbosgi/blob/master/testsuite/example/src/test/java/org/jboss/test/osgi/example/xservice/api/Echo.java"&gt;Echo&lt;/a&gt; interface would not resolve.&lt;br /&gt;&lt;br /&gt;Any module can however be registered with the OSGi layer.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;ModuleIdentifier moduleId = ModuleIdentifier.create("deployment.example-xservice-target-module");&lt;br /&gt;registerModuleWithBundleManager(moduleId);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Currently this must be done explicitly - there is no automatic registration. In our case the module does not provide resolver metadata explicitly, so it will be generated. We add a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XPackageCapability.html"&gt;PackageCapability&lt;/a&gt; for every exported path.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;ResolverPlugin resolverPlugin = getPlugin(ResolverPlugin.class);&lt;br /&gt;XModuleBuilder builder = resolverPlugin.getModuleBuilder();&lt;br /&gt;builder.createModule(symbolicName, version, 0);&lt;br /&gt;builder.addBundleCapability(symbolicName, version);&lt;br /&gt;for (String path : module.getExportedPaths())&lt;br /&gt;{&lt;br /&gt;  if (path.startsWith("META-INF"))&lt;br /&gt;    continue;&lt;br /&gt;&lt;br /&gt;  String packageName = path.replace('/', '.');&lt;br /&gt;  builder.addPackageCapability(packageName, null, null);&lt;br /&gt;}&lt;br /&gt;XModule resModule = builder.getModule();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now that the module is known to the OSGi layer. The resolver can use the module's capabilities for bundle resolution. We can now install and start a real OSGi bundle that imports the echo package and calls the Echo service in its BundleActivator. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;mvn -Dtarget.container=jboss70x -Dtest=BundleAccessesModuleServiceTestCase test&lt;br /&gt;&lt;br /&gt;Running org.jboss.test.osgi.example.xservice.BundleAccessesModuleServiceTestCase&lt;br /&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.009 sec&lt;br /&gt;&lt;br /&gt;17:21:16,469 INFO  Activating deployment: example-xservice-target-module&lt;br /&gt;17:21:16,732 INFO  Service added: service jboss.osgi.xservice.target&lt;br /&gt;17:21:16,733 INFO  ModuleIdentifier: module:deployment.example-xservice-target-module:main&lt;br /&gt;17:21:16,854 INFO  Install bundle: deployment.example-xservice-target-module:0.0.0&lt;br /&gt;17:21:18,135 INFO  Install bundle: example-xservice-client-bundle:1.0.0&lt;br /&gt;17:21:18,196 INFO  Echo: hello world&lt;br /&gt;17:21:18,199 INFO  Bundle started: example-xservice-client-bundle:1.0.0&lt;br /&gt;17:21:18,222 INFO  Bundle uninstalled: example-xservice-client-bundle:1.0.0&lt;br /&gt;17:21:18,235 INFO  Bundle uninstalled: deployment.example-xservice-target-module:0.0.0&lt;br /&gt;17:21:18,292 INFO  Undeployed example-xservice-target-module&amp;nbsp;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Going forward, we can now define a set of rules for every possible AS7 deployment on whether or not it gets registered with the OSGi layer and how it generates it's caps/reqs.&lt;br /&gt;&lt;br /&gt;A possible question could be:&lt;br /&gt;&lt;blockquote&gt;"Why isn't the target module a real OSGi bundle in the first place? In other words, why does it not define its capabilities in a standard way in the OSGi manifest" &lt;/blockquote&gt;The target module may have dependencies on other services that are not available in the OSGi layer. Or simply because the folks that provide the target module do not feel sufficiently familiar with OSGi. The important thing here is that with AS7 we have a migration path to and from OSGi.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Module accessing an OSGi Service&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This scenario requires a little more thought. Let's first explore the seemingly obvious approach.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The target bundle contains the Echo interface&lt;/li&gt;&lt;li&gt;The client module has a dependency on the target bundle&lt;/li&gt;&lt;/ul&gt;Every Module has a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/modules/ModuleIdentifier.html"&gt;ModuleIdentifier&lt;/a&gt;, which in case of an OSGi bundle is constructed according to the following pattern&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;jbosgi.[bundle-symbolic-name]:[bundle-version]&lt;/b&gt;&lt;/blockquote&gt;In case of the target bundle that is used in this &lt;a href="https://github.com/jbosgi/jbosgi/blob/master/testsuite/example/src/test/java/org/jboss/test/osgi/example/xservice/ModuleAccessesBundleServiceTestCase.java"&gt;test case&lt;/a&gt;, we would have&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;jbosgi.example-xservice-target-bundle:1.0.0&lt;/b&gt;&lt;/blockquote&gt;This is the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#REQUIRE_BUNDLE"&gt;Require-Bundle&lt;/a&gt; semantic, which is generally considered bad practise in OSGi. In the OSGi core spec we find the following chapter&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3.12.3 Issues With Requiring Bundles&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The preferred way of wiring bundles is to use the Import-Package and&lt;br /&gt;Export-Package headers because they couple the importer and exporter to a&lt;br /&gt;much lesser extent. Bundles can be refactored to have a different package&lt;br /&gt;composition without causing other bundles to fail.&lt;br /&gt;&lt;br /&gt;The Require-Bundle header provides a way for a bundle to bind to all the&lt;br /&gt;exports of another bundle, regardless of what those exports are. Though this&lt;br /&gt;can seem convenient at first, it has a number of drawbacks:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Split Packages&lt;/b&gt; – Classes from the same package can come from different bundles with Require bundle, such a package is called a split package. Split packages have the following drawbacks:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;Completeness&lt;/i&gt; – Split packages are open ended, it is difficult to guarantee that all the intended pieces of a split package have actually been included.&lt;/li&gt;&lt;li&gt;&lt;i&gt;Ordering&lt;/i&gt; – If the same classes are present in more than one required bundle, then the ordering of Require-Bundle is significant. A wrong ordering can cause hard to trace errors, similar to the traditional class path model of Java.&lt;/li&gt;&lt;li&gt;&lt;i&gt;Performance&lt;/i&gt; – A class must be searched in all providers when packages are split. This potentially increases the number of times that a ClassNotFoundException must be thrown which can potentially introduce a significant overhead.&lt;/li&gt;&lt;li&gt;&lt;i&gt;Confusing&lt;/i&gt; – It is easy to find a setup where there is lots of potential for confusion. For example, the following setup is non-intuitive.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;A: Export-Package: p;uses:=q&lt;br /&gt;   Import-Package: q&lt;br /&gt;B: Export-Package: q&lt;br /&gt;C: Export-Package: q&lt;br /&gt;D: Require-Bundle: B, C&lt;br /&gt;   Import-Package: p&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MTTbr2TxHjA/TN0YQNpBP7I/AAAAAAAAD_A/6CYQ5id2RaA/s1600/osgi-split-package.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="175" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/TN0YQNpBP7I/AAAAAAAAD_A/6CYQ5id2RaA/s320/osgi-split-package.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;In this example, bundle D merges the split package q from bundles B and&lt;br /&gt;bundle C, however, importing package p from bundle A puts a uses constraint on package p for package q. This implies that bundle D can see the valid package q from bundle B but also the invalid package q from bundle C. This wiring is allowed because in almost all cases there will be no problem. However, the consistency can be violated in the rare case when package C.q contains classes that are also in package B.q.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Mutable Exports&lt;/b&gt; – The feature of visibility:=reexport that the export signature of the requiring bundle can unexpectedly change depending on the export signature of the required bundle.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Shadowing&lt;/b&gt; – The classes in the requiring bundle that are shadowed by those in a required bundle depend on the export signature of the required bundle and the classes the required bundle contains. (By contrast, Import-Package, except with resolution:=optional, shadows whole packages regardless of the exporter.)&lt;br /&gt;&lt;br /&gt;Good practise is to use &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#EXPORT_PACKAGE"&gt;Export-Package&lt;/a&gt; to declare a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XPackageCapability.html"&gt;PackageCapability&lt;/a&gt; and &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#IMPORT_PACKAGE"&gt;Import-Package&lt;/a&gt; to declare a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XPackageRequirement.html"&gt;PackageRequirement&lt;/a&gt;. In this way importer does not need to care where a package comes from and the provider of the exported package is free to move the package around from one bundle to another without breaking the importer.&lt;br /&gt;&lt;br /&gt;OSGi supports the notion of bundle revisions. This does not show up in the public API. However, every time a bundle is updated (i.e. the bytes change) the framework creates a new revision with potentially the same Bundle-SymbolicName and Bundle-Version. Internally we append the revision suffix to the ModuleIdentifier. As a consequence, binding to a particular ModuleIdentifier identifier ultimately means binding to a particular revision, which negates the purpose update.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Having said all this, we decide against&amp;nbsp; putting the Echo interface (i.e. the API)&amp;nbsp; in the target bundle. Instead we put it in a Module which can be registered with the OSGi layer as described above.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;JavaArchive getAPIModuleArchive() throws Exception&lt;br /&gt;{&lt;br /&gt;  JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "example-xservice-api-module");&lt;br /&gt;  archive.addClasses(Echo.class);&lt;br /&gt;  archive.addDirectory("META-INF");&lt;br /&gt;  return archive;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Deploy the module that contains the API&lt;br /&gt;String apiDeploymentName = getRemoteRuntime().deploy(getAPIModuleArchive());&lt;br /&gt;&lt;br /&gt;// Register the API module with the OSGi layer&lt;br /&gt;ModuleIdentifier apiModuleId = ModuleIdentifier.create("deployment." + apiDeploymentName);&lt;br /&gt;registerModuleWithBundleManager(apiModuleId);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The target bundle is a plain OSGi bundle that imports the package of the Echo service and registers an instance of that service with the OSGi service registry.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;@Override&lt;br /&gt;   public void start(final BundleContext context) throws Exception&lt;br /&gt;   {&lt;br /&gt;      context.registerService(Echo.class.getName(), new EchoImpl(), null);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   static class EchoImpl implements Echo&lt;br /&gt;   {&lt;br /&gt;      @Override&lt;br /&gt;      public String echo(String message)&lt;br /&gt;      {&lt;br /&gt;         log.infof("Echo: %s", message);&lt;br /&gt;         return message;&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The client module needs to define a dependency on the API module. In JBoss AS module dependencies can be defined in the manifest like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;Manifest-Version: 1.0&lt;br /&gt;Dependencies: org.osgi.core,deployment.example-xservice-api-module&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Ouch, this uses an AS7 proprietary manifest header as well as Require-Bundle semantics. For AS7 internal modules (i.e. the ones that we control) this direct and hard coded approach is key to bootstrap performance. It should however be carefully considered before putting in user deployments.&lt;br /&gt;&lt;br /&gt;Never mind, for sake of this exercise we continue. When the client module activates it registers a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/msc/service/Service.html"&gt;Service&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;public class EchoInvokerService implements Service&amp;lt;Void&amp;gt;&lt;br /&gt;{&lt;br /&gt;   InjectedValue&amp;lt;BundleContext&amp;gt; injectedBundleContext = new InjectedValue&amp;lt;BundleContext&amp;gt;();&lt;br /&gt;&lt;br /&gt;   static void addService(BatchBuilder batchBuilder)&lt;br /&gt;   {&lt;br /&gt;      EchoInvokerService service = new EchoInvokerService();&lt;br /&gt;      BatchServiceBuilder serviceBuilder = batchBuilder.addService(SERVICE_NAME, service);&lt;br /&gt;      serviceBuilder.addDependency(ServiceName.parse("jboss.osgi.context"), BundleContext.class, service.injectedBundleContext);&lt;br /&gt;      serviceBuilder.setInitialMode(Mode.ACTIVE);&lt;br /&gt;      log.infof("Service added: %s", SERVICE_NAME);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   @Override&lt;br /&gt;   public void start(StartContext context) throws StartException&lt;br /&gt;   {&lt;br /&gt;      BundleContext systemContext = injectedBundleContext.getValue();&lt;br /&gt;      ServiceReference sref = systemContext.getServiceReference(Echo.class.getName());&lt;br /&gt;      Echo service = (Echo)systemContext.getService(sref);&lt;br /&gt;      service.echo("hello world");&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   @Override&lt;br /&gt;   public void stop(StopContext context)&lt;br /&gt;   {&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   @Override&lt;br /&gt;   public Void getValue() throws IllegalStateException&lt;br /&gt;   {&lt;br /&gt;      return null;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is a native AS7 service that gets the OSGi system BundleContext injected before it is started. Currently, when you download and try &lt;a href="http://download.jboss.org/jbossas/7.0/jboss-7.0.0.Alpha1/jboss-7.0.0.Alpha1.zip"&gt;jboss-7.0.0.Alpha1&lt;/a&gt; you will see that it bootstraps in very little time (i.e. less than 3sec). This is also because the OSGi subsystem is activated lazily. Installing a service like the one above with initial mode ACTIVE would cause all services that it depends on also to become ACTIVE. The OSGi subsystem would activate and the framework would start.&lt;br /&gt;&lt;br /&gt;In the &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/msc/service/Service.html#start%28org.jboss.msc.service.StartContext%29"&gt;start method&lt;/a&gt; of the &lt;a href="https://github.com/jbosgi/jbosgi/blob/master/testsuite/example/src/test/java/org/jboss/test/osgi/example/xservice/module/EchoInvokerService.java"&gt;EchoInvokerService&lt;/a&gt; you see the usage of OSGi API that calls the target service.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;mvn -Dtarget.container=jboss70x -Dtest=ModuleAccessesBundleServiceTestCase test&lt;br /&gt;&lt;br /&gt;Running org.jboss.test.osgi.example.xservice.ModuleAccessesBundleServiceTestCase&lt;br /&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.009 sec&lt;br /&gt;&lt;br /&gt;11:10:22,040 INFO  Activating deployment: example-xservice-api-module&lt;br /&gt;11:10:22,228 INFO  Install bundle: deployment.example-xservice-api-module:0.0.0&lt;br /&gt;11:10:23,140 INFO  Install bundle: example-xservice-target-bundle:1.0.0&lt;br /&gt;11:10:23,251 INFO  ModuleIdentifier: module:jbosgi.example-xservice-target-bundle:1.0.0&lt;br /&gt;11:10:23,252 INFO  Bundle started: example-xservice-target-bundle:1.0.0&lt;br /&gt;11:10:23,413 INFO  Activating deployment: example-xservice-client-module&lt;br /&gt;11:10:23,516 INFO  Service added: service jboss.osgi.xservice.invoker&lt;br /&gt;11:10:23,518 INFO  ModuleIdentifier: module:deployment.example-xservice-client-module:main&lt;br /&gt;11:10:23,520 INFO  Echo: hello world&lt;br /&gt;11:10:23,602 INFO  Undeployed example-xservice-client-module&lt;br /&gt;11:10:23,661 INFO  Bundle uninstalled: example-xservice-target-bundle:1.0.0&lt;br /&gt;11:10:23,687 INFO  Bundle uninstalled: deployment.example-xservice-api-module:0.0.0&lt;br /&gt;11:10:23,739 INFO  Undeployed example-xservice-api-module&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have shown how in principle an OSGi bundle can access an arbitrary AS7 service and vice versa. With this distribution we have reached about 80% OSGi Core TCK compliance, which we hope to complete by Q2/2011. The final version of AS7 is currently scheduled for May/2011.&lt;br /&gt;&lt;br /&gt;I am hopeful that by the time AS7 goes final we have examples of various EE components interacting with OSGi and vice versa. The aim is that you can use the benefits of OSGi modularity and its service layer in non-trivial applications that make use of AS7 middle ware.&lt;br /&gt;&lt;br /&gt;You may also want to check out David's post on "&lt;a href="http://coderthoughts.blogspot.com/2010/11/using-osgi-in-jboss-as7.html"&gt;Using OSGi in JBoss AS7&lt;/a&gt;". &lt;br /&gt;&lt;br /&gt;May this be useful&lt;br /&gt;-thomas&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-1900276059033177138?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/1900276059033177138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/11/jboss-as7-osgi-integration.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1900276059033177138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1900276059033177138'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/11/jboss-as7-osgi-integration.html' title='JBoss AS7 OSGi Integration'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MTTbr2TxHjA/TN0YQNpBP7I/AAAAAAAAD_A/6CYQ5id2RaA/s72-c/osgi-split-package.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-6957063918859824533</id><published>2010-10-26T11:35:00.014+02:00</published><updated>2010-11-11T20:57:57.187+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi Hudson on Amazon Elastic Cloud</title><content type='html'>Following Amazons announcement for an &lt;a href="http://aws.amazon.com/free/"&gt;AWS Free Usage Tier&lt;/a&gt;, I thought I would give it a try. Here my account.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Creating the Instance&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;If you are new to &lt;a href="http://aws.amazon.com/ec2/"&gt;Amazon EC2&lt;/a&gt; you need to create an account and sign in. Once you are in the AWS Management Console, you can create a key pair like this&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_MTTbr2TxHjA/TMWKOo4_hbI/AAAAAAAAD9U/znDrTunoTN0/s1600/ec2-create-key-pair.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/TMWKOo4_hbI/AAAAAAAAD9U/znDrTunoTN0/s640/ec2-create-key-pair.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;I like to have control over the connection ports that are accessible on my instance, so I create a new &lt;a href="https://console.aws.amazon.com/ec2/home#c=EC2&amp;amp;s=SecurityGroups"&gt;Security Group&lt;/a&gt;, which I can later use with my instance.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MTTbr2TxHjA/TMWMYkilQpI/AAAAAAAAD9c/XlLHdTWHjPE/s1600/ec2-security-group.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="166" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/TMWMYkilQpI/AAAAAAAAD9c/XlLHdTWHjPE/s640/ec2-security-group.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Next, you navigate to &lt;a href="https://console.aws.amazon.com/ec2/home#c=EC2&amp;amp;s=Instanceshttps://console.aws.amazon.com/ec2/home#c=EC2&amp;amp;s=Instances"&gt;Instances&lt;/a&gt; and launch an new Amazon Linux Micro instance. Basic 32-bit Amazon Linux is a good choice because it can be upgraded to &lt;a href="http://aws.amazon.com/ec2/instance-types/"&gt;small&lt;/a&gt;. A 64-bit instance can only be upgraded to &lt;a href="http://aws.amazon.com/ec2/instance-types/"&gt;large&lt;/a&gt; and above.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_MTTbr2TxHjA/TMWLSxSSkQI/AAAAAAAAD9Y/7XZghYyddbU/s1600/ec2-launch-instance.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="115" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/TMWLSxSSkQI/AAAAAAAAD9Y/7XZghYyddbU/s640/ec2-launch-instance.png" width="640" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Select the key and security group that you created earlier, hit launch and your Linux Micro instance should be up and running.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span style="font-size: large;"&gt;Accessing you Linux Instance&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;When you created your keypair you were offered to download and save the private key to a secure location. You can now ssh into you newly created instance like this&lt;/div&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;chmod 600 .ssh/tdiesler-ec2.pem&lt;br /&gt;ssh -i .ssh/tdiesler-ec2.pem ec2-user@ec2-50-16-7-151.compute-1.amazonaws.com&lt;br /&gt;Last login: Mon Oct 25 13:32:07 2010 from p5b04e10a.dip.t-dialin.net&lt;br /&gt;&lt;br /&gt;       __|  __|_  )  Amazon Linux AMI&lt;br /&gt;       _|  (     /     Beta&lt;br /&gt;      ___|\___|___|&lt;br /&gt;&lt;br /&gt;See /etc/image-release-notes for latest release notes. :-)&lt;br /&gt;[ec2-user@ip-10-112-99-96 ~]$ &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Installing Hudson on Tomcat&lt;br /&gt;&lt;br /&gt;Amazon Liunx supports the &lt;a href="http://yum.baseurl.org/"&gt;Yum Package Manager&lt;/a&gt;, which I happen to know quite well because I run &lt;a href="http://fedoraproject.org/"&gt;Fedora&lt;/a&gt;. Lets first check if &lt;a href="http://tomcat.apache.org/"&gt;Tomcat&lt;/a&gt; is there&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ yum list installed | grep tomcat&lt;br /&gt;$ &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Ok, that's not the case, so see what's available.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ yum list available | grep tomcat&lt;br /&gt;...&lt;br /&gt;tomcat6.noarch                               6.0.24-8.12.amzn1 &lt;br /&gt;tomcat6-admin-webapps.noarch                 6.0.24-8.12.amzn1 &lt;br /&gt;tomcat6-docs-webapp.noarch                   6.0.24-8.12.amzn1 &lt;br /&gt;tomcat6-javadoc.noarch                       6.0.24-8.12.amzn1 &lt;br /&gt;tomcat6-log4j.noarch                         6.0.24-8.12.amzn1 &lt;br /&gt;tomcat6-webapps.noarch                       6.0.24-8.12.amzn1 &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Let's install tomcat6&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;[ec2-user@ip-10-112-99-96 ~]$ &lt;br /&gt;$ sudo yum install tomcat6&lt;br /&gt;...&lt;br /&gt;Installed:&lt;br /&gt;  tomcat6.noarch 0:6.0.24-8.12.amzn1&lt;br /&gt;...&lt;br /&gt;Complete!&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Furthermore, we need &lt;a href="http://git-scm.com/"&gt;Git&lt;/a&gt;, &lt;a href="http://ant.apache.org/"&gt;Ant&lt;/a&gt; and &lt;a href="http://maven.apache.org/"&gt;Maven&lt;/a&gt;. Git and Ant we can install with yum like above. Maven however does not seem to be available in yum. So lets get it from the Apache Maven &lt;a href="http://maven.apache.org/download.html"&gt;download&lt;/a&gt; page.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ wget http://apache.linux-mirror.org/maven/binaries/apache-maven-3.0-bin.zip&lt;br /&gt;...&lt;br /&gt;2010-10-25 14:40:23 (44.4 KB/s) - “apache-maven-3.0-bin.zip” saved [2919967/2919967]&lt;br /&gt;$ unzip apache-maven-3.0-bin.zip&lt;br /&gt;$ sudo mkdir /usr/java&lt;br /&gt;$ sudo mv apache-maven-3.0 /usr/java&lt;br /&gt;$ sudo ln -s /usr/java/apache-maven-3.0 /usr/java/apache-maven&lt;br /&gt;$ mkdir bin&lt;br /&gt;$ ln -s /usr/java/apache-maven/bin/mvn bin/mvn&lt;br /&gt;$ mvn&lt;br /&gt;[INFO] Scanning for projects...&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] BUILD FAILURE&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Total time: 0.108s&lt;br /&gt;[INFO] Finished at: Mon Oct 25 14:44:26 UTC 2010&lt;br /&gt;[INFO] Final Memory: 2M/7M&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Amazon Linux comes with &lt;a href="http://openjdk.java.net/projects/jdk6/"&gt;openjdk&lt;/a&gt;, which is fine for most purposes.&amp;nbsp; At the time of this writing however, I saw issues with the maven build and &lt;a href="http://issues.hudson-ci.org/browse/HUDSON-7907"&gt;Hudson Captcha&lt;/a&gt;. So lets install the &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"&gt;Oracle JDK&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ cd /usr/java&lt;br /&gt;$ sudo wget http://cds.sun.com/is-bi/...jdk-6u22-linux-i586.bin&lt;br /&gt;$ sudo chmod +x jdk-6u22-linux-i586.bin &lt;br /&gt;$ sudo ./jdk-6u22-linux-i586.bin &lt;br /&gt;$ sudo ln -s jdk1.6.0_22 jdk1.6&lt;br /&gt;$ sudo rm jdk-6u22-linux-i586.bin&lt;br /&gt;&lt;br /&gt;$ vi ~/.bash_profile&lt;br /&gt;...&lt;br /&gt;export JAVA_HOME="/usr/java/jdk1.6"&lt;br /&gt;export PATH=$HOME/bin:$JAVA_HOME/bin:$PATH&lt;br /&gt;&lt;br /&gt;$ java -version&lt;br /&gt;java version "1.6.0_22"&lt;br /&gt;Java(TM) SE Runtime Environment (build 1.6.0_22-b04)&lt;br /&gt;Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Building JBoss OSGi &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The JBoss OSGi umbrella project that holds the Hudson setup as an integral part of the code base is hosted on GitHub.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ mkdir git; cd git&lt;br /&gt;$ git clone git://github.com/jbosgi/jbosgi.git; cd jbosgi&lt;br /&gt;$ git submodule init&lt;br /&gt;$ git submodule update&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;JBoss community projects often do not contain the JBoss Nexus Configuration. Follow the instructions on &lt;a href="http://community.jboss.org/wiki/MavenGettingStarted-Users"&gt;Maven Getting Started - Users&lt;/a&gt; to setup your ~/.m2/settings.xml&lt;br /&gt;&lt;br /&gt;Now, lets build the umbrella for the first time&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ mvn install&lt;br /&gt;...&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Reactor Summary:&lt;br /&gt;[INFO] &lt;br /&gt;[INFO] JBossOSGi JMX ..................................... SUCCESS [1:00.822s]&lt;br /&gt;[INFO] JBossOSGi JMX API ................................. SUCCESS [1:44.154s]&lt;br /&gt;[INFO] JBossOSGi VFS ..................................... SUCCESS [0.008s]&lt;br /&gt;[INFO] JBossOSGi VFS API ................................. SUCCESS [5.442s]&lt;br /&gt;[INFO] JBossOSGi SPI ..................................... SUCCESS [24.504s]&lt;br /&gt;[INFO] JBossOSGi JMX Bundle .............................. SUCCESS [15.142s]&lt;br /&gt;[INFO] JBossOSGi JMX iTests .............................. SUCCESS [2:37.160s]&lt;br /&gt;[INFO] JBossOSGi VFS VFS30 ............................... SUCCESS [9.390s]&lt;br /&gt;[INFO] JBossOSGi Deployment .............................. SUCCESS [12.598s]&lt;br /&gt;[INFO] JBossOSGi Framework ............................... SUCCESS [0.047s]&lt;br /&gt;[INFO] JBossOSGi Framework Core .......................... SUCCESS [32.110s]&lt;br /&gt;[INFO] JBossOSGi Framework iTest ......................... SUCCESS [2:33.963s]&lt;br /&gt;[INFO] JBossOSGi ......................................... SUCCESS [0.026s]&lt;br /&gt;[INFO] JBossOSGi Reactor ................................. SUCCESS [0.006s]&lt;br /&gt;[INFO] JBossOSGi Testsuite ............................... SUCCESS [0.017s]&lt;br /&gt;[INFO] JBossOSGi Testsuite Examples ...................... SUCCESS [3:39.319s]&lt;br /&gt;[INFO] JBossOSGi Testsuite Functional .................... SUCCESS [1:40.045s]&lt;br /&gt;[INFO] JBossOSGi Testsuite Performance ................... SUCCESS [19.179s]&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] BUILD SUCCESS&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Total time: 16:48.812s&lt;br /&gt;[INFO] Finished at: Tue Oct 26 12:30:18 UTC 2010&lt;br /&gt;[INFO] Final Memory: 22M/68M&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will take a while, so lets continue with Tomcat and Hudson.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Installing Hudson&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In our security group we opened port 8280. Tomcat however runs on 8080 by default. Lets change that.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ sudo vi /etc/tomcat6/server.xml &lt;br /&gt;...&lt;br /&gt;    &amp;lt;connector port="8280" connectiontimeout="20000" &lt;br /&gt;        protocol="HTTP/1.1" redirectport="8443"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we configure tomcat to run as the ec2-user, which allows Hudson to reuse the ec2-user's maven repository. HUDSON-HOME can also be set in the same config file.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ sudo vi /etc/tomcat6/tomcat6.conf&lt;br /&gt;...&lt;br /&gt;# Where your java installation lives&lt;br /&gt;JAVA_HOME="/usr/java/jdk1.6"&lt;br /&gt;&lt;br /&gt;# Where HUDSON has its home&lt;br /&gt;HUDSON_HOME=/usr/share/tomcat6/workspace/hudson-home&lt;br /&gt;&lt;br /&gt;# What user should run tomcat&lt;br /&gt;TOMCAT_USER=ec2-user&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Make sure the ec2-user is in the 'tomcat' group so it can write files to HUDSON_HOME during setup.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ sudo usermod -g tomcat ec2-user&lt;br /&gt;$ mkdir -p /usr/share/tomcat6/workspace/hudson-home&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You might need to re-login for the initial login group change to take effect.&lt;br /&gt;&lt;br /&gt;JBossOSGi simplifies Hudson setup a great deal, by including configuration and jobs in it codebase. This also allows us to recreate the QA environment for any given version by running a simple Ant task.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ cd git/jbosgi/hudson&lt;br /&gt;$ cp ant.properties.example ant.properties&lt;br /&gt;$ ant hudson-setup&lt;br /&gt;...&lt;br /&gt;init-hudson:&lt;br /&gt;     [echo] hudson.home = /usr/share/tomcat6/workspace/hudson-home&lt;br /&gt;...&lt;br /&gt;get-hudson:&lt;br /&gt;      [get] Getting: http://hudson-ci.org/download/war/1.382/hudson.war&lt;br /&gt;      [get] Getting: http://hudson-ci.org/download/plugins/github/0.2/github.hpi&lt;br /&gt;      [get] Getting: http://hudson-ci.org/download/plugins/git/1.1/git.hpi&lt;br /&gt;...&lt;br /&gt;hudson-tomcat-setup:&lt;br /&gt;     [copy] Copying 1 file to /usr/share/tomcat6/workspace/hudson-home/plugins&lt;br /&gt;     [copy] Copying 1 file to /usr/share/tomcat6/workspace/hudson-home/plugins&lt;br /&gt;&lt;br /&gt;hudson-setup:&lt;br /&gt;     [copy] Copying 2 files to /usr/share/tomcat6/workspace/hudson-home&lt;br /&gt;     [copy] Copying 9 files to /usr/share/tomcat6/workspace/hudson-home/jobs&lt;br /&gt;     [echo] &lt;br /&gt;     [echo] *************************************&lt;br /&gt;     [echo] * Hudson setup successfully          &lt;br /&gt;     [echo] * sudo service tomcat6 restart       &lt;br /&gt;     [echo] *************************************&lt;br /&gt;&lt;br /&gt;$ sudo service tomcat6 restart&lt;br /&gt;Stopping tomcat6:                                          [  OK  ]&lt;br /&gt;Starting tomcat6:                                          [  OK  ]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we should be able to connect to the running Hudson instance.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_MTTbr2TxHjA/TMaLw6LGYmI/AAAAAAAAD9k/zJ9dlwCQ_54/s1600/ec2-hudson-welcome.png" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="364" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/TMaLw6LGYmI/AAAAAAAAD9k/zJ9dlwCQ_54/s640/ec2-hudson-welcome.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Hudson Security&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;By default, Hudson is setup with strict project based security. Only the 'ec2-user' or whoever you configured in ${hudson.admin} can modify the configuration and run the jobs. Lets sign-up as ec2-user&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MTTbr2TxHjA/TMaeS8wpHXI/AAAAAAAAD9o/0b52lzfXwv0/s1600/ec2-sign-up.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/_MTTbr2TxHjA/TMaeS8wpHXI/AAAAAAAAD9o/0b52lzfXwv0/s200/ec2-sign-up.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You should now be able to run the jobs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Upgrading the Instance Type&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Amazon free offer is limited to &lt;a href="http://aws.amazon.com/ec2/instance-types/"&gt;Micro&lt;/a&gt; instances. With it's 613MB of RAM not surprisingly it turns out that this is not sufficient to run the JBossOSGi QA in an acceptable time.&lt;br /&gt;&lt;br /&gt;This is however not a problem, because the instance can be stopped and it's type can be changed to m1.small or m1.large depending on what you are willing to pay.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;$ ec2-stop-instances i-10429a7d&lt;br /&gt;$ ec2-modify-instance-attribute --instance-type=m1.large i-10429a7d&lt;br /&gt;$ ec2-start-instances i-10429a7d&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note, that this can only be done with instances that are backed by the &lt;a href="http://aws.amazon.com/ec2/#features"&gt;Elastic Block Store&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Creating an Elastic IP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Every time you stop/start an EC2 instance it's public DNS entry changes. Amazon's solution to this is the &lt;a href="http://aws.amazon.com/articles/1346"&gt;Elastic IP&lt;/a&gt;. You pay for the IP when your instance is &lt;b&gt;not&lt;/b&gt; connected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MTTbr2TxHjA/TMbvl1kN1OI/AAAAAAAAD9s/_RwwhPkFVWQ/s1600/ec2-elastic-ip.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MTTbr2TxHjA/TMbvl1kN1OI/AAAAAAAAD9s/_RwwhPkFVWQ/s1600/ec2-elastic-ip.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;This IP address can be associated with your favorite domain name. In our case its a &lt;a href="http://dyndns.org/"&gt;dyndns.org&lt;/a&gt; forward. So what was formerly known as&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;a href="http://jbmuc.dyndns.org:8280/hudson"&gt;http://jbmuc.dyndns.org:8280/hudson&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;now points to the EC2 instance that we've just setup.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;May this be useful&lt;br /&gt;-thomas&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-6957063918859824533?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/6957063918859824533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/10/jbossosgi-hudson-on-amazon-elastic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/6957063918859824533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/6957063918859824533'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/10/jbossosgi-hudson-on-amazon-elastic.html' title='JBossOSGi Hudson on Amazon Elastic Cloud'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MTTbr2TxHjA/TMWKOo4_hbI/AAAAAAAAD9U/znDrTunoTN0/s72-c/ec2-create-key-pair.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-1595312494859829351</id><published>2010-09-27T10:47:00.003+02:00</published><updated>2010-11-11T20:57:57.187+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta9 released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta9.&lt;br /&gt;&amp;nbsp; &lt;br /&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta9/jboss-osgi-installer-1.0.0.Beta9.jar/download"&gt;jboss-osgi-installer-1.0.0.Beta9.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Uses the new &lt;a href="http://relation.to/16904.lace"&gt;JBoss Modules&lt;/a&gt; modularity layer, which is also the basis of AS7&lt;/li&gt;&lt;li&gt;Performance increase by approximately 2000%&lt;/li&gt;&lt;li&gt;Integration with upcoming &lt;a href="http://www.jboss.org/jbossas/"&gt;JBoss Application Server 7&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Support for update bundles and refresh packages&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improved resolver abstraction/integration&lt;/li&gt;&lt;li&gt;Migration to the &lt;a href="http://www.jboss.org/arquillian"&gt;Arquillian&lt;/a&gt; test framework&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://docs.jboss.org/osgi/jboss-osgi-1.0.0.Beta9/userguide/html/"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bug&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-331"&gt;JBOSGI-331&lt;/a&gt;] -         Activator cannot change bundle start level&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-339"&gt;JBOSGI-339&lt;/a&gt;] -         Fragment failures in functional runtime tests&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-346"&gt;JBOSGI-346&lt;/a&gt;] -         Attached fragment hides private package in host &lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-354"&gt;JBOSGI-354&lt;/a&gt;] -         Initial Bundle Start Level initialization is done in the wrong place.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-356"&gt;JBOSGI-356&lt;/a&gt;] -         JBoss OSGi has implicit imports&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-367"&gt;JBOSGI-367&lt;/a&gt;] -         JTA BundleActivator cannot find DocumentBuilderFactory&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-373"&gt;JBOSGI-373&lt;/a&gt;] -         Cannot load service through java.util.ServiceLoader&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-383"&gt;JBOSGI-383&lt;/a&gt;] -         Cannot refresh uninstalled bundle through FrameworkMBean&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-387"&gt;JBOSGI-387&lt;/a&gt;] -         Potential problem with refreshing uninstalled bundles via JMX&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2&gt;&lt;span style="font-size: small;"&gt;Feature Request&lt;/span&gt; &lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-209"&gt;JBOSGI-209&lt;/a&gt;] -         Implement resolver preferences&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-376"&gt;JBOSGI-376&lt;/a&gt;] -         Initial OSGi / Modules dependency implementation&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-380"&gt;JBOSGI-380&lt;/a&gt;] -         Initial Arquillian test integration&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-386"&gt;JBOSGI-386&lt;/a&gt;] -         Invoking Refresh Packages on the framework from Web Console causes issues&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Task&lt;/b&gt;&lt;/span&gt; &lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-258"&gt;JBOSGI-258&lt;/a&gt;] -         [TCK] Start Level&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-336"&gt;JBOSGI-336&lt;/a&gt;] -         Implement PackageAdmin.refreshPackages(Bundle[])&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-343"&gt;JBOSGI-343&lt;/a&gt;] -         Comprehensive PackageAdmin test coverage&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-359"&gt;JBOSGI-359&lt;/a&gt;] -         Comprehensive Bundle API test coverage&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-360"&gt;JBOSGI-360&lt;/a&gt;] -         Integrate jbosgi-container into jbosgi umbrella&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-361"&gt;JBOSGI-361&lt;/a&gt;] -         TCK setup for MSC Core Framework&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-362"&gt;JBOSGI-362&lt;/a&gt;] -         Integrate the MSC Framework with the Installer&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-363"&gt;JBOSGI-363&lt;/a&gt;] -         Update resolver to Apache Felix-3.0.x&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-369"&gt;JBOSGI-369&lt;/a&gt;] -         Add support for fragments to Package Admin&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-374"&gt;JBOSGI-374&lt;/a&gt;] -         Release 1.0.0.Beta9&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-375"&gt;JBOSGI-375&lt;/a&gt;] -         Restore fragment, native code, service hook support&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-378"&gt;JBOSGI-378&lt;/a&gt;] -         OSGi Performance Analysis&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-379"&gt;JBOSGI-379&lt;/a&gt;] -         Implement Bundle.update()&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-388"&gt;JBOSGI-388&lt;/a&gt;] -         Migrate all remaining Husky tests to Arquillian&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2&gt;&lt;span style="font-size: small;"&gt;Sub-task&lt;/span&gt; &lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-241"&gt;JBOSGI-241&lt;/a&gt;] -         [TCK] Framework classpath&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-244"&gt;JBOSGI-244&lt;/a&gt;] -         [TCK] Framework filter&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-247"&gt;JBOSGI-247&lt;/a&gt;] -         [TCK] Framework service hooks&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-248"&gt;JBOSGI-248&lt;/a&gt;] -         [TCK] Framework lifecycle&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-251"&gt;JBOSGI-251&lt;/a&gt;] -         [TCK] Framework services&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-252"&gt;JBOSGI-252&lt;/a&gt;] -         [TCK] Framework bundle listener&lt;/li&gt;&lt;/ul&gt;Enjoy&amp;nbsp; &lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-1595312494859829351?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/1595312494859829351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/09/jbossosgi-100beta9-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1595312494859829351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1595312494859829351'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/09/jbossosgi-100beta9-released.html' title='JBossOSGi 1.0.0.Beta9 released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-4916533518073360893</id><published>2010-07-27T02:56:00.006+02:00</published><updated>2010-08-24T08:57:19.183+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>Standalone OSGi Resolver</title><content type='html'>When designing complex software system, modularity in one of the key aspects that folks have in mind. When I say "complex" I mean more than a handful of subsystems that evolve with individual life cycles and are developed by possibly geographically disconnected teams. Key to success are well defined integration points that also have the flexibility to evolve.&lt;br /&gt;&lt;br /&gt;Naturally you separate API from implementation and have some way or another to discover/load the implementation for a given API. If your chosen infrastructure is worth telling your friends about, it supports multiple versions of any API and can dynamically start/stop/update the services that your subsystems use to collaborate with each other. The installed pieces form consistent class spaces with the same class possibly loaded multiple times in different versions and wired such that shared types are loaded from the same source. Any container environment that supports user defined plugins would have requirements similar to these. Take &lt;a href="http://www.eclipse.org/downloads/compare.php"&gt;Eclipse&lt;/a&gt;, or a J2EE &lt;a href="http://jboss.org/jbossas"&gt;application server&lt;/a&gt; for example.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;As my colleague Hal puts it &lt;br /&gt;&lt;blockquote&gt;"&lt;i&gt;OSGi is like toilet paper, sooner or later you are going to want to use it.&lt;/i&gt;"&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Capabilities and Requirements&amp;nbsp;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;An OSGi &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html"&gt;bundle&lt;/a&gt; is an ordinary jar with a couple of standard headers in its Manifest. Here I list a few important ones as a reference. The exhaustive set can be found in the OSGi Core Specification.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bundle-SymbolicName:&lt;/b&gt; com.acme.daffy&lt;br /&gt;&lt;blockquote&gt;The &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#BUNDLE_SYMBOLICNAME"&gt;Bundle-SymbolicName&lt;/a&gt; header specifies a non-localizable name for this bundle. The bundle symbolic name together with a version must identify a unique bundle.&lt;/blockquote&gt;&lt;b&gt;Bundle-Version:&lt;/b&gt; 1.1&lt;br /&gt;&lt;blockquote&gt;The &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#BUNDLE_VERSION"&gt;Bundle-Version&lt;/a&gt; header specifies the version of this bundle&lt;/blockquote&gt;&lt;b&gt;Export-Package:&lt;/b&gt; org.osgi.util.tracker;version=1.3&lt;br /&gt;&lt;blockquote&gt;The &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#EXPORT_PACKAGE"&gt;Export-Package&lt;/a&gt; header contains a declaration of exported packages. &lt;/blockquote&gt;&lt;b&gt;Import-Package:&lt;/b&gt; org.osgi.util.tracker,org.osgi.service.io;version=1.4&lt;br /&gt;&lt;blockquote&gt;The &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#IMPORT_PACKAGE"&gt;Import-Package&lt;/a&gt; header declares the imported packages for this bundle.&lt;/blockquote&gt;&lt;b&gt;Require-Bundle:&lt;/b&gt; com.acme.chess&lt;br /&gt;&lt;blockquote&gt;The &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#REQUIRE_BUNDLE"&gt;Require-Bundle&lt;/a&gt; header specifies that all exported packages from another bundle must be imported, effectively requiring the public interface of another bundle.&lt;/blockquote&gt;In an abstract way, the bundle headers form a set of &lt;i&gt;Capabilities&lt;/i&gt; that a bundle provides and another set of &lt;i&gt;Requirements &lt;/i&gt;that a bundle has on the environment or other bundles. In most cases &lt;i&gt;Requirements &lt;/i&gt;can be mandatory or optional and in some cases &lt;i&gt;Requirements &lt;/i&gt;can be satisfied by &lt;i&gt;Capabilities &lt;/i&gt;from the same bundle&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;When the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/Framework.html"&gt;Framework&lt;/a&gt; makes a connection between a &lt;i&gt;Requirement &lt;/i&gt;and a &lt;i&gt;Capability&lt;/i&gt; it is said to have established a &lt;i&gt;Wire&lt;/i&gt;. This happens at the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html#RESOLVED"&gt;RESOLVE&lt;/a&gt; phase of a bundle. The details of how an OSGi Framework works out the wires between the bundles is not our subject. Instead it is sufficient to know that every OSGi Framework implements this non-trivial, non-linear OSGi resolution algorithm in one way or another. Some Frameworks do this more successful than others and a distinguishing metric would be the success/error response time and ability to form consistent class spaces that include if not all but most of the installed bundles.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Why use a standalone Resolver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For most use cases the OSGi resolution algorithm is an implementation detail at the Framework level that you don't need to worry about. You install a few Bundles, start them or trigger a class load on an installed bundle and the Framework resolves the installed bundles transparently. Although there is an API method on the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/packageadmin/PackageAdmin.html"&gt;PackageAdmin&lt;/a&gt; to &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/packageadmin/PackageAdmin.html#resolveBundles%28org.osgi.framework.Bundle[]%29"&gt;resolve bundles&lt;/a&gt; explicitly it is not what you would do normally.&lt;br /&gt;&lt;br /&gt;The need for a resolver comes into the game when you want to do impact analysis or provide a smart repository. Impact analysis is when you have a running system and want to know if a set of bundles would resolve on that system without actually modifying the system. With a smart repository you can say, if have these requirements, give me the bundles that I need to install to provide the needed capabilities.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;The Apache Felix Resolver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Every other month, when we both can make it, I meet Richard at the &lt;a href="http://www.osgi.org/EEG/HomePage"&gt;Enterprise Expert Group&lt;/a&gt; (EEG) meetings. Richard rewrote &lt;a href="http://felix.apache.org/site/index.html"&gt;Felix&lt;/a&gt; resolver to work on the general notion of capabilities and requirements. This is part of &lt;a href="http://apache.mirror.iweb.ca/felix/org.apache.felix.framework-3.0.1-project.tar.gz"&gt;felix-framework-3.0.1&lt;/a&gt; and forms the foundation of what comes next.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Standalone Resolver Requirements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We had a number of requirements on an OSGi Resolver that I'd like to share with you here:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Independent of Core Framework implementation&lt;/li&gt;&lt;li&gt;Not bound to the Manifest as the meta data provider&lt;/li&gt;&lt;li&gt;Works on abstract notion of &lt;i&gt;Module, Capability, Requirement, Wire &lt;/i&gt;&lt;/li&gt;&lt;li&gt;Explicit wiring for all mandatory requirements&lt;/li&gt;&lt;li&gt;Easy and intuitive user API&lt;/li&gt;&lt;li&gt;Extensible SPI for Resolver providers&lt;/li&gt;&lt;li&gt;Sensible default implementation stubs for Resolver providers&lt;/li&gt;&lt;li&gt;Callbacks for framework integration and resolved modules&lt;/li&gt;&lt;li&gt;Attachment support on various resolver atrifacts&lt;/li&gt;&lt;/ul&gt;Every framework parses/validates and caches the Manifest. So we did not want the resolver to do this again. Instead we provide a resolver meta data model that can be constructed in memory (i.e. mapped to from whatever the framework uses internally). Additionally, we provide an OSGi meta data model that can also be constructed in memory or from the Manifest.&lt;br /&gt;&lt;br /&gt;In the&lt;a href="http://jboss.org/jbossas"&gt; JBoss Application Server&lt;/a&gt; we provide an OSGi view for non-OSGi deployments and the ability to access/inject OSGi services in other component models. For example &lt;a href="http://seamframework.org/Weld"&gt;CDI&lt;/a&gt; components can have OSGi services injected and vice versa. You will see this functionality in AS7. For that reason the resolver needs to work on the abstract notion of &lt;i&gt;Module, Capability, Requirement &lt;/i&gt;which may come from non-OSGi deployments that nevertheless take part in OSGi resolution.&lt;br /&gt;&lt;br /&gt;If a module is resolved, it is guaranteed that every mandatory &lt;i&gt;Requirement &lt;/i&gt;has a &lt;i&gt;Wire &lt;/i&gt;to a &lt;i&gt;Capability.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Resolver clients can register callbacks to get informed when the Resolver changes the wiring for a Module.&lt;br /&gt;&lt;br /&gt;The Resolver object model can have &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XAttachmentSupport.html"&gt;arbitrary state attached&lt;/a&gt; to it, which removes the need to map client state to resolver state and vice versa. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Working with the Resolver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The &lt;a href="http://github.com/jbosgi/jbosgi-resolver"&gt;jbosgi-resolver&lt;/a&gt; project is hosted on &lt;a href="https://github.com/"&gt;GitHub&lt;/a&gt; together with all the other &lt;a href="http://community.jboss.org/wiki/JBossOSGi"&gt;JBoss OSGi&lt;/a&gt; projects that we currently work on.&amp;nbsp; When you use &lt;a href="http://maven.apache.org/"&gt;Maven&lt;/a&gt;, you can declare a dependency on the resolver like this:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:xml"&gt;&amp;lt;dependency&amp;gt;&lt;br /&gt;  &amp;lt;groupId&amp;gt;org.jboss.osgi.resolver&amp;lt;/groupId&amp;gt;&lt;br /&gt;  &amp;lt;artifactId&amp;gt;jbosgi-resolver-api&amp;lt;/artifactId&amp;gt;&lt;br /&gt;  &amp;lt;version&amp;gt;1.0.0&amp;lt;/version&amp;gt;&lt;br /&gt;&amp;lt;/dependency&amp;gt;&lt;br /&gt;&amp;lt;dependency&amp;gt;&lt;br /&gt;  &amp;lt;groupId&amp;gt;org.jboss.osgi.resolver&amp;lt;/groupId&amp;gt;&lt;br /&gt;  &amp;lt;artifactId&amp;gt;jbosgi-resolver-felix&amp;lt;/artifactId&amp;gt;&lt;br /&gt;  &amp;lt;version&amp;gt;3.0.1&amp;lt;/version&amp;gt;&lt;br /&gt;&amp;lt;/dependency&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;repository&amp;gt;&lt;br /&gt;  &amp;lt;id&amp;gt;jboss-public-repository-group&amp;lt;/id&amp;gt;&lt;br /&gt;  &amp;lt;name&amp;gt;JBoss Public Maven Repository Group&amp;lt;/name&amp;gt;&lt;br /&gt;  &amp;lt;url&amp;gt;https://repository.jboss.org/nexus/content/groups/public/&amp;lt;/url&amp;gt;&lt;br /&gt;  &amp;lt;layout&amp;gt;default&amp;lt;/layout&amp;gt;&lt;br /&gt;  &amp;lt;releases&amp;gt;&lt;br /&gt;    &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;    &amp;lt;updatePolicy&amp;gt;never&amp;lt;/updatePolicy&amp;gt;&lt;br /&gt;  &amp;lt;/releases&amp;gt;&lt;br /&gt;  &amp;lt;snapshots&amp;gt;&lt;br /&gt;    &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;    &amp;lt;updatePolicy&amp;gt;never&amp;lt;/updatePolicy&amp;gt;&lt;br /&gt;  &amp;lt;/snapshots&amp;gt;&lt;br /&gt;&amp;lt;/repository&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Lets start by creating a Resolver instance and add a Module to it that has its Capabilities and Requirements populated from Manifest.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Create a resolver instance&lt;br /&gt;XResolver resolver = XResolverFactory.getResolver();&lt;br /&gt;&lt;br /&gt;// Create the resolver module&lt;br /&gt;XModuleBuilder builder = XResolverFactory.getModuleBuilder();&lt;br /&gt;XModule module = builder.createModule(1, manifest);&lt;br /&gt;&lt;br /&gt;// Add the module to the resolver&lt;br /&gt;resolver.addModule(module); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Now you would create and add a few more modules until you actually trigger the resolve process&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Resolve the modules and report resolver errors&lt;br /&gt;Set resolved = resolver.resolveAll(unresolved);&lt;br /&gt;for (XModule resModule : unresolved)&lt;br /&gt;{&lt;br /&gt;   if (resModule.isResolved() == false)&lt;br /&gt;   {&lt;br /&gt;      Exception ex = resModule.getAttachment(XResolverException.class);&lt;br /&gt;      log.error("Cannot resolve: " + resModule, ex);&lt;br /&gt;   }&lt;br /&gt;} &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The resolver uses the above mentioned &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XAttachmentSupport.html"&gt;Attachement&lt;/a&gt; API to feed back the individual resolve exceptions. You can also register a &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbosgi-remote/ws/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/resolver/XResolverCallback.html"&gt;ResolverCallback&lt;/a&gt; when you need to do locking or want to get informed about resolver progress.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;A few changes were necessary to &lt;/span&gt;&lt;a href="http://apache.mirror.iweb.ca/felix/org.apache.felix.framework-3.0.1-project.tar.gz"&gt;felix-framework-3.0.1&lt;/a&gt; to abstract resolver dependencies on actual framework implementation. These can be picked up &lt;a href="http://github.com/jbosgi/felix-framework/tree/jbosgi363"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;May this be useful&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-4916533518073360893?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/4916533518073360893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/07/standalone-osgi-resolver.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4916533518073360893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4916533518073360893'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/07/standalone-osgi-resolver.html' title='Standalone OSGi Resolver'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-4830650300543416576</id><published>2010-06-28T16:57:00.004+02:00</published><updated>2010-07-01T08:54:07.837+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta8 released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta8.&lt;br /&gt;&lt;br /&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta8/jboss-osgi-installer-1.0.0.Beta8.jar/download"&gt;jboss-osgi-installer-1.0.0.Beta8.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Integrate Apache Felix resolver&lt;/li&gt;&lt;li&gt;Added support for DynamicImport-Package&lt;/li&gt;&lt;li&gt;Implementation of the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/startlevel/StartLevel.html"&gt;StartLevel&lt;/a&gt; Service&lt;/li&gt;&lt;li&gt;Remove Felix and Equinox from the Installer (JBoss Framework reached acceptance threshold)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://docs.jboss.org/osgi/jboss-osgi-1.0.0.Beta8/userguide/html/"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;h2 style="font-weight: bold;"&gt;&lt;span style="font-size: 130%;"&gt;Bug&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-151"&gt;JBOSGI-151&lt;/a&gt;] -         Cannot resolve circular dependencies&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-213"&gt;JBOSGI-213&lt;/a&gt;] -         Unexpected dependee state changes&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-317"&gt;JBOSGI-317&lt;/a&gt;] -         Context is already registered in domain DefaultDomain&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-318"&gt;JBOSGI-318&lt;/a&gt;] -         Linkage error for javax.servlet.Servlet in AS600&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-319"&gt;JBOSGI-319&lt;/a&gt;] -         LinkageError for the type javax/servlet/Servlet&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-323"&gt;JBOSGI-323&lt;/a&gt;] -         DynamicImport-Package takes presendence over embedded classes&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-324"&gt;JBOSGI-324&lt;/a&gt;] -         Cannot start EventAdmin service in AS&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-326"&gt;JBOSGI-326&lt;/a&gt;] -         MC service does not maintain properties&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-334"&gt;JBOSGI-334&lt;/a&gt;] -         Fix Start Level Support from the webconsole&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-338"&gt;JBOSGI-338&lt;/a&gt;] -         Cannot obtain EventAdmin service&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-341"&gt;JBOSGI-341&lt;/a&gt;] -         Endless loop at AS server startup&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-342"&gt;JBOSGI-342&lt;/a&gt;] -         Bundle resolution depends on install order&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-344"&gt;JBOSGI-344&lt;/a&gt;] -         When stopping the framework, bundles need to be taken down in reverse startlevel order&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-348"&gt;JBOSGI-348&lt;/a&gt;] -         EventAdmin unexpectedly unregistered in Runtime&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;Feature Request&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-138"&gt;JBOSGI-138&lt;/a&gt;] -         Proper system BundleContext implementation&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-143"&gt;JBOSGI-143&lt;/a&gt;] -         Add support for DynamicImport-Package&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-184"&gt;JBOSGI-184&lt;/a&gt;] -         Allow for overlay of jboss-osgi-bootstrap.xml&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-311"&gt;JBOSGI-311&lt;/a&gt;] -         Provide access to org.osgi.jmx API in OSGiFrameworkTest&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-320"&gt;JBOSGI-320&lt;/a&gt;] -         Integrate Apache Felix resolver&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-332"&gt;JBOSGI-332&lt;/a&gt;] -         Enhance the StartLevel plugin to support specification of start level&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-333"&gt;JBOSGI-333&lt;/a&gt;] -         Make it possible to specify the initial start level of the system&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;Task&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-94"&gt;JBOSGI-94&lt;/a&gt;] -           Remove DeploymentProvidedDeploymentUnitFilter&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-235"&gt;JBOSGI-235&lt;/a&gt;] -         Verify system classpath access&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-301"&gt;JBOSGI-301&lt;/a&gt;] -         Enable VFS3 leak detection in runtime&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-310"&gt;JBOSGI-310&lt;/a&gt;] -         Link generated javadoc to org.osgi API&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-314"&gt;JBOSGI-314&lt;/a&gt;] -         Change Hudson QA setup to work with Git&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-315"&gt;JBOSGI-315&lt;/a&gt;] -         Integrate jboss-osgi-http in distribution&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-316"&gt;JBOSGI-316&lt;/a&gt;] -         Verify integrity of the jboss-osgi-framework-all.jar&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-327"&gt;JBOSGI-327&lt;/a&gt;] -         Add support for JBossAS-6.0.0.M3&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-328"&gt;JBOSGI-328&lt;/a&gt;] -         Merge framework vfs30 support with core&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-335"&gt;JBOSGI-335&lt;/a&gt;] -         Ensure that start levels are supported via JMX&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-349"&gt;JBOSGI-349&lt;/a&gt;] -         Remove Felix and Equinox from the Installer &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-350"&gt;JBOSGI-350&lt;/a&gt;] -         Add OSGi Alliance trade mark to images in userguide&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-351"&gt;JBOSGI-351&lt;/a&gt;] -         Release jboss-osgi-1.0.0.Beta8&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-352"&gt;JBOSGI-352&lt;/a&gt;] -         Remove dependency on osgi deployers project&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-139"&gt;JBOSGI-139&lt;/a&gt;] -         Implement system BundleContext.loadClass()&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/browse/JBOSGI-278"&gt;JBOSGI-278&lt;/a&gt;] -         Revisit ControllerContext handling&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-4830650300543416576?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/4830650300543416576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/06/jbossosgi-100beta8-released.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4830650300543416576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4830650300543416576'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/06/jbossosgi-100beta8-released.html' title='JBossOSGi 1.0.0.Beta8 released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-4439544296917777542</id><published>2010-04-15T14:30:00.005+02:00</published><updated>2010-06-28T16:51:16.382+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta7 released</title><content type='html'>&lt;p&gt;I am happy to announce the release of JBossOSGi-1.0.0.Beta7.&lt;/p&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta7/jboss-osgi-installer-1.0.0.Beta7.jar/download"&gt;jboss-osgi-installer-1.0.0.Beta7.jar&lt;/a&gt;&lt;p&gt;The release comes with improvements in the following areas&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Enterprise OSGi bundle management (JMX)&lt;/li&gt;&lt;li&gt;JSR160 compliant JMXConnector&lt;/li&gt;&lt;li&gt;Integrate JBoss OSGi with AS 6.0.0.M3&lt;/li&gt;&lt;li&gt;Framework service hooks&lt;/li&gt;&lt;li&gt;OSGi core TCK compliance 40%&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta7/userguide/html/"&gt;User Guide&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Here are the change log details&lt;/p&gt;&lt;h2 style="font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;Bug&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-292"&gt;JBOSGI-292&lt;/a&gt;] -     PackageAdmin cannot obtain classloading metadata&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-295"&gt;JBOSGI-295&lt;/a&gt;] -         NullPointerException in ExportedPackageHelper constructor&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-297"&gt;JBOSGI-297&lt;/a&gt;] -         OSGiBootstrapBean spinning on System.in read&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-299"&gt;JBOSGI-299&lt;/a&gt;] -         WebConsole does not display on jbossas/trunk&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-300"&gt;JBOSGI-300&lt;/a&gt;] -         Felix integration breaks jbossas/trunk bootstrap&lt;/li&gt;&lt;/ul&gt;   &lt;br /&gt;&lt;h2 style="font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;Feature Request&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-126"&gt;JBOSGI-126&lt;/a&gt;] -         Replace the SPI JMX functionality  by RFC-139 API&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-307"&gt;JBOSGI-307&lt;/a&gt;] -         JSR160 compliant JMXConnector&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-267"&gt;JBOSGI-267&lt;/a&gt;] -         Allow multiple bundles to change state at once&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;                    &lt;h2 style="font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;Task&lt;/span&gt;&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-83"&gt;JBOSGI-83&lt;/a&gt;] -           Enterprise OSGi JMX&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-289"&gt;JBOSGI-289&lt;/a&gt;] -         Migrate all components to jboss-logging&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-290"&gt;JBOSGI-290&lt;/a&gt;] -         Use LifecycleInterceptor with Aries Blueprint&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-303"&gt;JBOSGI-303&lt;/a&gt;] -         Upgrade to equinox-3.5.2&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-304"&gt;JBOSGI-304&lt;/a&gt;] -         Upgrade to felix-2.0.4&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-302"&gt;JBOSGI-302&lt;/a&gt;] -         Add support for service hooks&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-312"&gt;JBOSGI-312&lt;/a&gt;] -         Integrate JBoss OSGi with AS 6.0.0.M3&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Errata&lt;/p&gt;&lt;p&gt;Due to the recent migration of the JBoss Maven Repositories to Nexus, you might need to &lt;a href="http://community.jboss.org/thread/151044"&gt;make adjustments&lt;/a&gt; to your ~/.m2/settings.xml&lt;br /&gt;&lt;br /&gt;Enjoy&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-4439544296917777542?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/4439544296917777542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/04/jbossosgi-100beta7-released.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4439544296917777542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4439544296917777542'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/04/jbossosgi-100beta7-released.html' title='JBossOSGi 1.0.0.Beta7 released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-3511854474861258251</id><published>2010-02-08T16:26:00.004+01:00</published><updated>2010-02-08T16:52:27.226+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta6 Released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta6.&lt;br /&gt;&lt;br /&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta6/jboss-osgi-installer-1.0.0.Beta6.jar/download"&gt;jboss-osgi-installer-1.0.0.Beta6.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Initial support for fragments.&lt;/li&gt;&lt;li&gt;Initial support for Bundle.update().&lt;/li&gt;&lt;li&gt;Initial support for native code libraries.&lt;/li&gt;&lt;li&gt;Support for R3 bundles.&lt;/li&gt;&lt;li&gt;Support for bundle header localization.&lt;/li&gt;&lt;li&gt;Improved Blueprint support, using Apache Aries Blueprint.&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta6/userguide/html/"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;b&gt;&lt;span style="font-size:small;"&gt;&lt;br /&gt;&lt;br /&gt;Bug&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-210"&gt;JBOSGI-210&lt;/a&gt;] -         Bundle installed but not started with hot deploy&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-283"&gt;JBOSGI-283&lt;/a&gt;] -         WebApp extender not installed by default&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-145"&gt;JBOSGI-145&lt;/a&gt;] -         JAXB classes are loaded from the system classpath&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-204"&gt;JBOSGI-204&lt;/a&gt;] -         Failure in Bundle.start() uninstalls the bundle&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-286"&gt;JBOSGI-286&lt;/a&gt;] -         Investigate classloading of javax.* classes&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-287"&gt;JBOSGI-287&lt;/a&gt;] -         Optional import loaded from system classloader&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;font-size:small;" &gt;Feature Request&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-269"&gt;JBOSGI-269&lt;/a&gt;] -         Add initial support for Bundle.update()&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-271"&gt;JBOSGI-271&lt;/a&gt;] -         Initial support for R3 bundles&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-272"&gt;JBOSGI-272&lt;/a&gt;] -         Implement bundle header localization&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-273"&gt;JBOSGI-273&lt;/a&gt;] -         Differenciate R3/R4 bundle validation&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-274"&gt;JBOSGI-274&lt;/a&gt;] -         Cache bundle header for default locale&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-275"&gt;JBOSGI-275&lt;/a&gt;] -         Add support for Bundle.update() from original location&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-276"&gt;JBOSGI-276&lt;/a&gt;] -         Add initial support for native code libraries&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-277"&gt;JBOSGI-277&lt;/a&gt;] -         Add initial bundle fragment support&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;font-size:small;" &gt;Task&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-263"&gt;JBOSGI-263&lt;/a&gt;] -         Integrate Aries Blueprint implementation&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-265"&gt;JBOSGI-265&lt;/a&gt;] -         Update to jboss-osgi-framework-1.0.0.Alpha3&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-281"&gt;JBOSGI-281&lt;/a&gt;] -         Release JBoss OSGi 1.0.0.Beta6&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-264"&gt;JBOSGI-264&lt;/a&gt;] -         Update to jboss-kernel-2.2.x stable release&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-279"&gt;JBOSGI-279&lt;/a&gt;] -         Update to jboss-cl-2.2.x stable release&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-284"&gt;JBOSGI-284&lt;/a&gt;] -         Investigate version numbering scheme&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-3511854474861258251?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/3511854474861258251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/02/jbossosgi-100beta6-released.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/3511854474861258251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/3511854474861258251'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/02/jbossosgi-100beta6-released.html' title='JBossOSGi 1.0.0.Beta6 Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-5869208512646093615</id><published>2010-01-27T15:54:00.027+01:00</published><updated>2010-01-27T17:53:31.808+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>ServiceLoader and how it relates to OSGi</title><content type='html'>An important aspect of good software architecture is that clients of your components can interact with well defined and stable APIs. The concept of &lt;a href="http://java.sun.com/docs/books/tutorial/java/concepts/interface.html"&gt;interfaces&lt;/a&gt; is an inherent part of the Java programming language and also central to the OSGi Service Layer.&lt;br /&gt;&lt;br /&gt;Lets have a look at a simple service that I want to migrate from a plain Java programming model to OSGi.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;public interface AccountService&lt;br /&gt;{   &lt;br /&gt;   /** Get the current balance */   &lt;br /&gt;   long getBalance();   &lt;br /&gt;&lt;br /&gt;   /** Credit the given amount and return the current balance */   &lt;br /&gt;   long credit(long amount);   &lt;br /&gt;&lt;br /&gt;   /** Withdraw the given amount and return the current balance */   &lt;br /&gt;   long withdraw(long amount);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This interface would be part of the API jar (i.e. serviceloader-api.jar) that I package and distribute to the clients of my AccountService implementation. I have another jar that contains the implementation (i.e. serviceloader-impl.jar) and also a file in META-INF/services that names the implementation class&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_MTTbr2TxHjA/S2AnMdWWTtI/AAAAAAAADv0/hzjmlvd7wdo/s1600-h/META-INF-services-AccountService.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="56" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/S2AnMdWWTtI/AAAAAAAADv0/hzjmlvd7wdo/s400/META-INF-services-AccountService.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The implementation of my AccountService would be in a different package than the interface, for example something like '...serviceloader.service.internal'. Clients would be encouraged never to import anything from '*.internal'&lt;br /&gt;&lt;br /&gt;A Java client could obtain an instance of the AccountService by using the well known &lt;a href="http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html"&gt;ServiceLoader&lt;/a&gt; that is part of JDK1.6.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;ServiceLoader loader = ServiceLoader.load(AccountService.class);&lt;br /&gt;AccountService service = loader.iterator().next();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So far so good, but there are a number of issues with this approach. The most obvious one is that of the potential availability of more than one implementation of the same interface. The ServiceLoader uses the  current thread's &lt;a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#getContextClassLoader%28%29"&gt;context class loader&lt;/a&gt; to discover all available service implementations. It then uses the same class loader to load the service instances.&lt;br /&gt;&lt;br /&gt;The client gets presented with an iterator of available service implemenations, but what are the criteria does the client use to choose the specific implementation it really needs? We could add something like getVersion(), getVendor(), getSomeOtherProp() to our AccountService, which the client could then use to pick the implementation it needs, but this approach would pollute our AccountService with concerns that are not about accounting.&lt;br /&gt;&lt;br /&gt;Another potential problem is that the client could directly instantiate or cast the service instance to gain access to internal functionality, which bypasses the fundamentals of abstraction and modularity that motivated us to use a service interface in the first place.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How does OSGi solve this problem?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In OSGi, a bundles can define the transitive closure of the API that it wants to make publicly available. In case of our API bundle the OSGi manifest could look like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;Bundle-ManifestVersion: 2&lt;br /&gt;Bundle-SymbolicName: example-serviceloader-api&lt;br /&gt;Export-Package: example.serviceloader.service;version="1.0"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Please note, that we associate a specific version with the package that contains the service interfaces. This is the version of our public contract. The package is versioned, not the API bundle. This allows us to rethink and change our packaging strategy in the future.&lt;br /&gt;&lt;br /&gt;The bundle that contains the implementation could have a manifest like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;Bundle-ManifestVersion: 2&lt;br /&gt;Bundle-SymbolicName: example-serviceloader-impl&lt;br /&gt;Bundle-Vendor: JBoss, a division of RedHat&lt;br /&gt;Bundle-Version: 1.0.0&lt;br /&gt;Import-Package: example.serviceloader.service;version="[1.0,1.1)"&lt;br /&gt;Private-Package: example.serviceloader.service.internal&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The implementation explicitly states that it is valid for API version greater and equal to 1.0 up until but not including 1.1. Please also note, that the '*.internal' package is declared private, which prevents any other bundle from seeing the contents of that package even though the individual classes may be public. A client running in an OSGi environment cannot instantiate the implementation directly, nor can it cast to it.&lt;br /&gt;&lt;br /&gt;The implementation bundle could register the AccountService with the framework in BundleActivator.start() like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;Hashtable props = new Hashtable();&lt;br /&gt;props.put("service.vendor", "JBoss, a division of RedHat");&lt;br /&gt;AccountService service = new AccountServiceImpl();&lt;br /&gt;context.registerService(AccountService.class.getName(), service, props);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Please note, that we associate some meta data with the service registration. In this case the service vendor, which could be used by a client to obtain a specific vendor implementation.&lt;br /&gt;&lt;br /&gt;The client bundle could statically obtain a service instance like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;String filter = "(service.vendor=JBoss*)";&lt;br /&gt;String sname = AccountService.class.getName();&lt;br /&gt;ServiceReference[] srefs = context.getServiceReferences(sname, filter);&lt;br /&gt;AccountService service = (AccountService)context.getService(srefs[0]);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Please note that the client explicitly defines a filter criteria for available services. In this case the specific service vendor.&lt;br /&gt;&lt;br /&gt;To account for the dynamic nature of OSGi services, the client would not want to make the assumption that the AccountService is already available when its BundleActivator.start() method is invoked by the framework. This assumption would create an implicit start order dependency of the implementation and client bundle (i.e. the implementationbundle must be started before the client bundle).&lt;br /&gt;&lt;br /&gt;If the the client can dynamically react to the AccountService coming and going it should use code like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;String sname = AccountService.class.getName();&lt;br /&gt;String filterstr = "(&amp;amp;(objectClass=" + sname + ")(service.vendor=JBoss*))";&lt;br /&gt;Filter filter = FrameworkUtil.createFilter(filterstr);&lt;br /&gt;&lt;br /&gt;// Track the service&lt;br /&gt;ServiceTracker tracker = new ServiceTracker(context, filter, null)&lt;br /&gt;{   &lt;br /&gt;   public Object addingService(ServiceReference reference)   &lt;br /&gt;   {&lt;br /&gt;      service = (AccountService)super.addingService(reference);&lt;br /&gt;      return service;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void removedService(ServiceReference reference, Object tracked)&lt;br /&gt;   {&lt;br /&gt;      super.removedService(reference, tracked);&lt;br /&gt;      service = null;&lt;br /&gt;   }&lt;br /&gt;};&lt;br /&gt;tracker.open();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The dynamic nature of OSGi services is in fact its real beauty. The client gets informed when the service gets modified (i.e. a new version of the service from the same vendor becomes available)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Auto registration of META-INF/services&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.linkedin.com/profile?viewProfile=&amp;amp;key=4148453"&gt;David Bosschaert&lt;/a&gt;, a friend and colleague recently brought the topic of META-INF/services and its prevalent nature in Java component architecture to my attention. Because it is such a common pattern, I investigated how an OSGi framework could reuse the information that is already present in META-INF/services when a non OSGi component library is wrapped or migrated to be used in an OSGi framework.&lt;br /&gt;&lt;br /&gt;Starting with JBoss OSGi 1.0.0.Beta6, which should come out early Feb-2010, we provide a jboss-osgi-serviceloader bundle. That registers a &lt;a href="http://jbossosgi.blogspot.com/2009/10/extender-pattern-vs-lifecycle.html"&gt;LifecycleInterceptor&lt;/a&gt;  to introspect every installed bundle. Should a bundle contain META-INF/services, these services are automatically registered as &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/ServiceFactory.html"&gt;ServiceFactories&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The interceptor associates the following properties with every service it registers&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#SERVICE_VENDOR"&gt;service.vendor &lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#VERSION_ATTRIBUTE"&gt;version&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Have a look at the service loader example that demonstrates this functionality&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;Running org.jboss.test.osgi.example.serviceloader.ServiceLoaderTestCase&lt;br /&gt;Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.415 sec&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The OSGi service model has much to offer over the traditional Java model of interfaces and service factories. The ServiceLoader being a particular and well known implementation of the more general service factory pattern.&lt;br /&gt;&lt;br /&gt;In OSGi you can have multiple implementations of the same service available in the framework. Services can be associated with arbitrary meta data, which means you can version your public contract. Clients can use a meta data filter to select a particular implementation. Implementation, can be strictly separated from API with no back doors left open.&lt;br /&gt;&lt;br /&gt;Lastly a few items from my OSGi best practises catalogue&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Export the public contract, not the implementation&lt;/li&gt;&lt;li&gt;Declare implementation details in Private-Package&lt;/li&gt;&lt;li&gt;Associate specific versions with your public API packages&lt;/li&gt;&lt;li&gt;Define dependencies on package versions, not bundle versions&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Define which version range of the API a you implement&lt;/li&gt;&lt;li&gt;Separate the API bundle from the implementation bundle&lt;/li&gt;&lt;li&gt;Keep you public contract concise, well documented and simple&lt;/li&gt;&lt;li&gt;Components should interact with services, not arbitrary stuff you export&lt;/li&gt;&lt;li&gt;Only service interfaces and their associated types should be exported&lt;/li&gt;&lt;li&gt;Track services dynamically, instead of getting the service from the framework&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;May this be useful&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-5869208512646093615?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/5869208512646093615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2010/01/suns-serviceloader-and-how-it-relates.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/5869208512646093615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/5869208512646093615'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2010/01/suns-serviceloader-and-how-it-relates.html' title='ServiceLoader and how it relates to OSGi'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTTbr2TxHjA/S2AnMdWWTtI/AAAAAAAADv0/hzjmlvd7wdo/s72-c/META-INF-services-AccountService.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-8998847711022502697</id><published>2009-12-09T10:21:00.002+01:00</published><updated>2009-12-09T11:28:39.194+01:00</updated><title type='text'>JBossOSGi 1.0.0.Beta5 Released</title><content type='html'>&lt;p&gt;I am happy to announce the release of JBossOSGi-1.0.0.Beta5.&lt;/p&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta5/jboss-osgi-installer-1.0.0.Beta5.jar/download"&gt;jboss-osgi-installer-1.0.0.Beta5.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Improved JBoss Microcontainer based &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/ChapFrameworkIntegration.html#SecIntegrationJBossMC"&gt;Framework&lt;/a&gt; support.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improved Eclipse &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/ChapFrameworkIntegration.html#SecIntegrationEquinox"&gt;Equinox Integration&lt;/a&gt; support.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added Enterprise OSGi &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/ChapProvidedBundles.html#SecBundleJTA"&gt;Transaction&lt;/a&gt; support.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added Compendium &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/ChapProvidedExamples.html#SecEventAdminExample"&gt;Event Admin&lt;/a&gt; support.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added JBossXB based &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/ChapProvidedBundles.html#SecBundleXMLBinding"&gt;XML Binding&lt;/a&gt; support.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/ChapDeveloperGuide.html#SecLifecycleInterceptors"&gt;Lifecycle Interceptor&lt;/a&gt; support.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/userguide/html/"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Bug&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-129"&gt;JBOSGI-129&lt;/a&gt;] - Filter behaviour change in r4v42&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-137"&gt;JBOSGI-137&lt;/a&gt;] - Cannot parse Bundle-SymbolicName&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-153"&gt;JBOSGI-153&lt;/a&gt;] - Cannot parse Import-Package parameters&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-187"&gt;JBOSGI-187&lt;/a&gt;] - Husky SocketInvocation may block forever&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-199"&gt;JBOSGI-199&lt;/a&gt;] - Use thread safe collections where information is mutable&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-212"&gt;JBOSGI-212&lt;/a&gt;] - Cannot refresh Microcontainer service&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Feature Request&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-125"&gt;JBOSGI-125&lt;/a&gt;] - Add ManagedFramework service&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-202"&gt;JBOSGI-202&lt;/a&gt;] - Allow override of where the bootstrap file comes from&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Task&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-157"&gt;JBOSGI-157&lt;/a&gt;] - JTA (RFC-98) - Initial Implementation&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-181"&gt;JBOSGI-181&lt;/a&gt;] - Add EventAdmin as available service&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-182"&gt;JBOSGI-182&lt;/a&gt;] - Release JBoss OSGi 1.0.0.Beta5&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-183"&gt;JBOSGI-183&lt;/a&gt;] - Introduce notion of OSGi Interceptors&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-188"&gt;JBOSGI-188&lt;/a&gt;] - Separate DeployerService from SPI&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-190"&gt;JBOSGI-190&lt;/a&gt;] - Allign getting started guide with latest release&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-200"&gt;JBOSGI-200&lt;/a&gt;] - Split getParameter(s) calls into directives/attributes&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-215"&gt;JBOSGI-215&lt;/a&gt;] - Update Blueprint to 1.0.0.Alpha3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-216"&gt;JBOSGI-216&lt;/a&gt;] - Update to Apache Felix-2.0.2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-217"&gt;JBOSGI-217&lt;/a&gt;] - Update to Eclipse Equinox-3.5.1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-218"&gt;JBOSGI-218&lt;/a&gt;] - Update to jboss-osgi-common-1.0.3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-219"&gt;JBOSGI-219&lt;/a&gt;] - Update to jboss-osgi-husky-1.0.2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-220"&gt;JBOSGI-220&lt;/a&gt;] - Update to jboss-osgi-jmx-1.0.2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-221"&gt;JBOSGI-221&lt;/a&gt;] - Update to jboss-osgi-jndi-1.0.2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-222"&gt;JBOSGI-222&lt;/a&gt;] - Update to jboss-osgi-microcontainer-2.0.9&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-223"&gt;JBOSGI-223&lt;/a&gt;] - Update to jboss-osgi-spi-1.0.3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-224"&gt;JBOSGI-224&lt;/a&gt;] - Update to jboss-osgi-xml-binding-2.0.2.Beta3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-225"&gt;JBOSGI-225&lt;/a&gt;] - Update to jboss-osgi-apache-xerces-2.9.1.SP3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-226"&gt;JBOSGI-226&lt;/a&gt;] - Update to jboss-osgi-hotdeploy-1.0.3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-227"&gt;JBOSGI-227&lt;/a&gt;] - Update to jboss-osgi-framework-1.0.0.Alpha2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-228"&gt;JBOSGI-228&lt;/a&gt;] - Update to jboss-osgi-jaxb-2.1.10.SP3&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-229"&gt;JBOSGI-229&lt;/a&gt;] - Add jboss-osgi-deployment-1.0.0&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-230"&gt;JBOSGI-230&lt;/a&gt;] - Add jboss-osgi-jta-1.0.0&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-231"&gt;JBOSGI-231&lt;/a&gt;] - Add jboss-osgi-reflect-2.0.2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-232"&gt;JBOSGI-232&lt;/a&gt;] - Add jboss-osgi-webapp-0.7.2&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-233"&gt;JBOSGI-233&lt;/a&gt;] - Update to org.apache.felix.configadmin-1.2.4&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-234"&gt;JBOSGI-234&lt;/a&gt;] - Add org.apache.felix.eventadmin-1.0.0&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-8998847711022502697?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/8998847711022502697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/12/jbossosgi-100beta5-released.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/8998847711022502697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/8998847711022502697'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/12/jbossosgi-100beta5-released.html' title='JBossOSGi 1.0.0.Beta5 Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-3401858027548499640</id><published>2009-11-03T16:50:00.013+01:00</published><updated>2009-12-09T10:21:17.589+01:00</updated><title type='text'>OSGi Framework Launch</title><content type='html'>In this post I am going to look at the problems involved when you need to launch an OSGi Framework independent of the actual Framework implementation. There will be coverage of&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Framework Launch API &lt;/li&gt;&lt;li&gt;OSGi Bootstrap abstraction&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;The Framework Launch API &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Starting with &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/package-summary.html"&gt; Version 1.5 of the Framework API&lt;/a&gt;, which is part of the &lt;a href="http://www.osgi.org/download/r4v42/r4.core.pdf"&gt;core r4v42&lt;/a&gt; specification, OSGi comes with the ability to launch an OSGi Framework in an implementation agnostic manner. For this, clients interact with the classes in package &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/package-summary.html"&gt;org.osgi.framework.launch&lt;/a&gt; like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Load the framework factory&lt;br /&gt;FrameworkFactory factory = loadFrameworkFactory();&lt;br /&gt;&lt;br /&gt;// Load the framework configuration&lt;br /&gt;Map config = loadFrameworkConfig();&lt;br /&gt;&lt;br /&gt;// Create a new instance of the framework&lt;br /&gt;Framework framework = factory.newFramework(config);&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;   // Start the framework&lt;br /&gt;   framework.start();&lt;br /&gt;&lt;br /&gt;   // do stuff&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;   // Stop the framework&lt;br /&gt;   framework.stop();&lt;br /&gt;&lt;br /&gt;   // Wait for the framework to stop completely&lt;br /&gt;   framework.waitForStop(3000);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see, this API is fairly low level. The client provides code that loads the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/FrameworkFactory.html"&gt;FrameworkFactory&lt;/a&gt;, as well as code that obtains the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/Framework.html"&gt;Framework&lt;/a&gt; configuration somehow.  At this level, there is no API or standard config that defines initial bundle provisioning.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;OSGi Bootstrap abstraction&lt;/span&gt;  &lt;br /&gt;&lt;br /&gt;If you are running on JDK-1.6 there is a &lt;a href="http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html"&gt;ServiceLoader&lt;/a&gt; available that can be used to load the FrameworkFactory like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Load the framwork factory&lt;br /&gt;ServiceLoader loader = ServiceLoader.load(FrameworkFactory.class);&lt;br /&gt;FrameworkFactory factory = loader.iterator().next();&lt;br /&gt;&lt;br /&gt;// Create a new instance of the framework&lt;br /&gt;Framework framework = factory.newFramework(null);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Since this API might not be available in every environment, JBoss OSGi also provides a &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/util/ServiceLoader.html"&gt;ServiceLoader&lt;/a&gt; as part of its &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/userguide/html/ChapDeveloperGuide.html#SecSPI"&gt;Service Provider Interface&lt;/a&gt; (SPI). Conceptually very similar, here is how you would use this API&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Load the framework factoryFramework&lt;br /&gt;Factory factory = ServiceLoader.load(FrameworkFactory.class);&lt;br /&gt;&lt;br /&gt;// Create a new instance of the framework&lt;br /&gt;Framework framework = factory.newFramework(null);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Both variants of the service loader provide you with an instance of  FrameworkFactory from which you can now use to create a new Framework instance. The null parameter causes the Framework to use it's default configuration.&lt;br /&gt;&lt;br /&gt;The JBoss OSGi SPI supports a Framework bootstrap process based on unified configuration files. In its most simple form the usage of this API would look like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Get the configured bootstrap provider&lt;br /&gt;OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();&lt;br /&gt;&lt;br /&gt;// Get the configured framework from the boot provider&lt;br /&gt;Framework framework = bootProvider.getFramework();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;An &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/framework/OSGiBootstrapProvider.html"&gt;OSGiBootstrapProvider&lt;/a&gt;  is an abstraction of a provider that can somehow bootstrap an OSGi Framework. A concrete implementation and also the default that is used if no other provider is configured is the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.html"&gt;PropertiesBootstrapProvider&lt;/a&gt;. As the name suggests, this bootstrap provider can be configured using a plain java &lt;a href="file:///usr/java/jdk1.6/docs/api/java/util/Properties.html"&gt;properties&lt;/a&gt; file. The default location of this file is a resource called &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.html#DEFAULT_OSGI_FRAMEWORK_PROPERTIES"&gt;jboss-osgi-framework.properties&lt;/a&gt; loadable from the bootstrap classpath.&lt;br /&gt;&lt;br /&gt;An example of such a properties file is shown below&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:plain"&gt;# Extra server specific properties&lt;br /&gt;org.jboss.osgi.spi.framework.extra=${somedir}/osgi-extra.properties&lt;br /&gt;&lt;br /&gt;# Properties to configure the Framework&lt;br /&gt;org.osgi.framework.storage=${osgi.server.home}/data/osgi-store&lt;br /&gt;org.osgi.framework.storage.clean=onFirstInit&lt;br /&gt;&lt;br /&gt;# Hot Deployement&lt;br /&gt;org.jboss.osgi.hotdeploy.scandir=${osgi.server.home}/deploy&lt;br /&gt;&lt;br /&gt;# Bundles that need to be installed with the Framework automatically&lt;br /&gt;org.jboss.osgi.spi.framework.autoInstall=\&lt;br /&gt;file://${osgi.home}/server/minimal/deploy/org.osgi.compendium.jar&lt;br /&gt;&lt;br /&gt;# Bundles that need to be started automatically &lt;br /&gt;org.jboss.osgi.spi.framework.autoStart=\&lt;br /&gt;file://${osgi.home}/server/minimal/deploy/org.apache.felix.log.jar \&lt;br /&gt;file://${osgi.home}/server/minimal/deploy/jboss-osgi-common.jar \&lt;br /&gt;file://${osgi.home}/server/minimal/deploy/jboss-osgi-hotdeploy.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Noteworthy, are perhaps the properties that can be used for initial framework provisioning&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.html#PROP_OSGI_FRAMEWORK_AUTO_INSTALL"&gt;org.jboss.osgi.spi.framework.autoInstall&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.html#PROP_OSGI_FRAMEWORK_AUTO_START"&gt;org.jboss.osgi.spi.framework.autoStart&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;and the extension point that allows to recursively split the properties over multiple files&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.html#PROP_OSGI_FRAMEWORK_EXTRA"&gt;org.jboss.osgi.spi.framework.extra&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;All other properties are simply passed on the  &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/FrameworkFactory.html#newFramework%28java.util.Map%29"&gt;FrameworkFactory.newFramework(Map config)&lt;/a&gt; method.&lt;br /&gt;&lt;br /&gt;We looked at the basic OSGi Framework launch API and have seen how to externalize Framework configuration to property files. Other bootstrap providers could work of your favourite XML dialect. For the &lt;a href="http://felix.apache.org/"&gt;Apache Felix&lt;/a&gt;  JBossAS integration we use a &lt;a href="http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/tags/jboss-osgi-1.0.0.Beta4/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml"&gt;jboss-beans.xml&lt;/a&gt; configuration.&lt;br /&gt;&lt;br /&gt;With my next post I am going to start a series of &lt;a href="http://www.osgi.org/EEG/HomePage"&gt;Enterprise OSGi&lt;/a&gt; topics. There should be coverage of JTA, JMX, JNDI, WebApp and perhaps others.&lt;br /&gt;&lt;br /&gt;May this be useful&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-3401858027548499640?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/3401858027548499640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/11/osgi-framework-launch.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/3401858027548499640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/3401858027548499640'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/11/osgi-framework-launch.html' title='OSGi Framework Launch'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-2754717361186545429</id><published>2009-10-23T19:24:00.025+02:00</published><updated>2010-01-26T15:16:29.963+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>Extender Pattern vs. Lifecycle Interceptor</title><content type='html'>With this post I'd like to give a little more background on the well known OSGi &lt;a href="http://www.osgi.org/blog/2007/02/osgi-extender-model.html"&gt;Extender Pattern&lt;/a&gt;, when this pattern  is applicable and what might be an alternative when it is not applicable. There will be coverage of&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Basics of extending an OSGi Bundle&lt;/li&gt;&lt;li&gt;Advantages and drawbacks of Extenders&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Notion of "self ordering" LifecycleInterceptor&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;Extending an OSGi Bundle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The basic functional sequence of an OSGi Extender goes like this&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Extender  registers itself as &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleListener.html"&gt;BundleListener&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html"&gt;Bundle&lt;/a&gt; gets installed/started &lt;/li&gt;&lt;li&gt; &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/Framework.html"&gt;Framework&lt;/a&gt; fires a &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleEvent.html"&gt;BundleEvent&lt;/a&gt;&lt;/li&gt;&lt;li&gt; Extender picks up the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleEvent.html"&gt;BundleEvent&lt;/a&gt; (e.g. &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html#STARTING"&gt;STARTING&lt;/a&gt;)&lt;/li&gt;&lt;li&gt; Extender reads metadata  from the Bundle and does its work&lt;/li&gt;&lt;/ol&gt;There is no extender specific API. It is a pattern rather than a piece of functionality provided by the Framework. Typical examples of extenders are the &lt;a href="http://jbossosgi.blogspot.com/2009/04/osgi-blueprint-service-rfc-124.html"&gt;Blueprint&lt;/a&gt; or &lt;a href="http://wiki.ops4j.org/display/paxweb/WAR+Extender"&gt;Web Application&lt;/a&gt; Extender.&lt;br /&gt;&lt;br /&gt;The following illustration shows how a WAR Extender might process an OSGi Web Application to register servlets that are declared in WEB-INF/web.xml with the OSGi &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/http/HttpService.html"&gt;HttpService&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SuGuH7BbrxI/AAAAAAAADug/5hfjGDxzERQ/s1600-h/osgi_war_extender.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SuGuH7BbrxI/AAAAAAAADug/5hfjGDxzERQ/s640/osgi_war_extender.jpg" style="height: 299px; width: 555px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Client code that installs, starts and uses the registered endpoint could look like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Install and start the Web Application bundle&lt;br /&gt;Bundle bundle = context.installBundle("mywebapp.war");&lt;br /&gt;bundle.start();&lt;br /&gt;&lt;br /&gt;// Access the Web Application&lt;br /&gt;String response = getHttpResponse("http://localhost:8090/mywebapp/foo");&lt;br /&gt;assertEquals("ok", response);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This seemingly trivial code snippet has a number of issues that are probably worth looking into in more detail&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The WAR might have missing or invalid web metadata (i.e. an invalid WEB-INF/web.xml descriptor)&lt;/li&gt;&lt;li&gt;The WAR Extender might not be present in the system&lt;/li&gt;&lt;li&gt;There might be multiple WAR Extenders present in the system&lt;/li&gt;&lt;li&gt;Code assumes that the endpoint is available on return of bundle.start()&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;It should be noted that the Extender, which is essentially a &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/SynchronousBundleListener.html"&gt;synchronous&lt;/a&gt; or &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleListener.html"&gt;asynchronous&lt;/a&gt; BundleListener has no way to veto the install or start transition of the bundle. Even if the Extender cannot process the metadata or fails for some other reason, the bundle will start just the same. Client code would see an &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html#ACTIVE"&gt;ACTIVE&lt;/a&gt; bundle, which in fact might not be active at all in the colloquial sense of  the word.&lt;br /&gt;&lt;br /&gt;Most Blueprint or WebApp bundles are not useful  if their Blueprint/Web metadata is not processed. Even if they are processed but in the "wrong" order a user might see unexpected results (i.e. the webapp processes the first request before the underlying Blueprint app is wired together).&lt;br /&gt;&lt;br /&gt;As a consequence I would say that the extender pattern is useful in some cases but not all. IMHO it is mainly useful if a bundle can optionally be extended in the true sense of the word.&lt;br /&gt;&lt;br /&gt;There is an RFP in the works that addresses many of the above issues. Adrian Colyer from &lt;a href="http://www.springsource.org/"&gt;SpringSource&lt;/a&gt; has initiated the work around RFP-118 Multiple Extenders in Nov-2008. The document is currently in the non-public review phase of the OSGi Alliance &lt;a href="http://www.osgi.org/EEG/HomePage"&gt;Enterprise Expert Group&lt;/a&gt;. (EEG)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Intercepting the Bundle Lifecycle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If the use case requires the notion of "interceptor" the extender pattern is less useful. The use case  might be such that you would want to intercept the bundle lifecycle at various phases to do mandatory metadata processing.&lt;br /&gt;&lt;br /&gt;An interceptor could be used for annotation processing, byte code weaving, and other non-optional/optional metadata processing steps. Traditionally interceptors have a relative order, can communicate with each other, veto progress, etc.&lt;br /&gt;&lt;br /&gt;Lets look at how multiple interceptors can be used to create Web metadata and publish endpoints on the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/http/HttpService.html"&gt;HttpService&lt;/a&gt; based on that metadata.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SuHYHOTwNWI/AAAAAAAADuo/ArZ5RcLQOF0/s1600-h/osgi_interceptor.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SuHYHOTwNWI/AAAAAAAADuo/ArZ5RcLQOF0/s640/osgi_interceptor.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Here is how it works&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The Wep Application processor registers two &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.html"&gt;LifecycleInterceptors&lt;/a&gt; with the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/deployment/interceptor/LifecycleInterceptorService.html"&gt;LifecycleInterceptorService&lt;/a&gt;&lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/deployment/interceptor/LifecycleInterceptorService.html"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The Parser interceptor declares no required input and WebApp metadata as produced output&lt;/li&gt;&lt;li&gt;The Publisher interceptor declares WebApp metadata as required input&lt;/li&gt;&lt;li&gt;The LifecycleInterceptorService reorders all registered interceptors according to their input/output requirements and relative order&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The WAR Bundle gets installed and started&lt;/li&gt;&lt;li&gt;The Framework calls the LifecycleInterceptorService prior to the actual state change&lt;/li&gt;&lt;li&gt;The LifecycleInterceptorService calls each interceptor in the chain&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Parser interceptor processes WEB-INF/web.xml in the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.html#invoke%28int,%20org.jboss.osgi.deployment.interceptor.InvocationContext%29"&gt;invoke(int state, InvocationContext context)&lt;/a&gt; method and attaches WebApp metadata to the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/deployment/interceptor/InvocationContext.html"&gt;InvocationContext&lt;/a&gt;&lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/distribution/installer/target/auto-install-dest/docs/apidocs/org/jboss/osgi/deployment/common/Deployment.html"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The Publisher interceptor is only called when the InvocationContext has WebApp metadata attached. If so, it publishes the endpoint from the WebApp metadata&lt;/li&gt;&lt;li&gt;If no interceptor throws an Exception the Framework changes the Bundle state and fires the BundleEvent.  &lt;/li&gt;&lt;/ol&gt;Client code is identical to above.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;// Install and start the Web Application bundle&lt;br /&gt;Bundle bundle = context.installBundle("mywebapp.war");&lt;br /&gt;bundle.start();&lt;br /&gt;&lt;br /&gt;// Access the Web Application&lt;br /&gt;String response = getHttpResponse("http://localhost:8090/mywebapp/foo");&lt;br /&gt;assertEquals("ok", response);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The behaviour of that code however, is not only different but also provides a more natural user experience.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html#start%28%29"&gt;Bundle.start()&lt;/a&gt; fails if WEB-INF/web.xml is invalid&lt;/li&gt;&lt;li&gt; An interceptor could fail if web.xml is not present&lt;/li&gt;&lt;li&gt;The Publisher interceptor could fail if the HttpService is not present&lt;/li&gt;&lt;li&gt;Multiple Parser interceptors would work mutually exclusiv on the presents of attached WebApp metadata&lt;/li&gt;&lt;li&gt;The endpoint is guaranteed to be available when Bundle.start() returns&lt;/li&gt;&lt;/ul&gt;The general idea is that each interceptor takes care of a particular aspect of processing during state changes. In the example above WebApp metadata might get provided by an interceptor that scans annotations or by another one that generates the metadata in memory. The Publisher interceptor would not know nor care who attached the WebApp metadata object, its task is to consume the WebApp metadata and publish endpoints from it.&lt;br /&gt;&lt;br /&gt;The current &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html"&gt;BundleContext&lt;/a&gt; API does not allow for &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/deployment/deployer/Attachments.html"&gt;arbitrary attachments&lt;/a&gt; as contextual information to be passed between interceptors. The &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta5/apidocs/org/jboss/osgi/deployment/interceptor/InvocationContext.html"&gt;InvocationContext&lt;/a&gt; adds that plus the notion of a VirtualFile that represents the Bundle's content. The VirtualFile is necessary to access arbitrarily deeply nested resources regardless of their actual location.&lt;br /&gt;&lt;br /&gt;Here a sneak preview of the ParserInterceptor that will come as part of the Interceptor example in JBoss OSGi 1.0.0.Beta5&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;public void invoke(int state, InvocationContext context)&lt;br /&gt;{&lt;br /&gt;  // Do nothing if the metadata is already available  &lt;br /&gt;  HttpMetadata metadata = context.getAttachment(HttpMetadata.class);&lt;br /&gt;  if (metadata != null)&lt;br /&gt;    return;&lt;br /&gt;&lt;br /&gt;  // Parse and create metadta on STARTING&lt;br /&gt;  if (state == Bundle.STARTING)&lt;br /&gt;  {&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;      VirtualFile root = context.getRoot();&lt;br /&gt;      VirtualFile propsFile = root.getChild("/metadata.properties");&lt;br /&gt;      if (propsFile != null)&lt;br /&gt;      {&lt;br /&gt;        log.info("Create and attach HttpMetadata");&lt;br /&gt;        metadata = createHttpMetadata(propsFile);&lt;br /&gt;        context.addAttachment(HttpMetadata.class, metadata);&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    catch (IOException ex)&lt;br /&gt;    {&lt;br /&gt;      throw new LifecycleInterceptorException(ex);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and here the associate PublisherInterceptor&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;public void invoke(int state, InvocationContext context)&lt;br /&gt;{&lt;br /&gt;  // HttpMetadata is guaratied to be available because we registered&lt;br /&gt;  // this type as required input&lt;br /&gt;  HttpMetadata metadata = context.getAttachment(HttpMetadata.class);&lt;br /&gt;&lt;br /&gt;  // Register HttpMetadata on STARTING &lt;br /&gt;  if (state == Bundle.STARTING)&lt;br /&gt;  {&lt;br /&gt;    String servletName = metadata.getServletName();&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;      log.info("Publish HttpMetadata: " + metadata);&lt;br /&gt;&lt;br /&gt;      // Load the endpoint servlet from the bundle&lt;br /&gt;      Bundle bundle = context.getBundle();&lt;br /&gt;      Class servletClass = bundle.loadClass(servletName);&lt;br /&gt;      HttpServlet servlet = (HttpServlet)servletClass.newInstance();&lt;br /&gt;&lt;br /&gt;      // Register the servlet with the HttpService&lt;br /&gt;      HttpService httpService = getHttpService(context, true);&lt;br /&gt;      httpService.registerServlet("/servlet", servlet, null, null);&lt;br /&gt;    }&lt;br /&gt;    catch (RuntimeException rte)&lt;br /&gt;    {&lt;br /&gt;      throw rte;&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt;      throw new LifecycleInterceptorException(ex);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // Unregister the endpoint on STOPPING &lt;br /&gt;  else if (state == Bundle.STOPPING)&lt;br /&gt;  {&lt;br /&gt;    log.info("Unpublish HttpMetadata: " + metadata);&lt;br /&gt;    HttpService httpService = getHttpService(context, false);&lt;br /&gt;    if (httpService != null)&lt;br /&gt;      httpService.unregister("/servlet");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This post and the initial implementation that is based on these concepts is a follow up of a discussion that I had with Hal Hildebrand from Oracle  at one of our recent OSGi EEG meetings. Please stay tuned to find out in what shape or form these ideas develop.&lt;br /&gt;&lt;br /&gt;In parallel to the standards efforts you will of course get this functionality as part of the next JBoss OSGi release, which should come out 01-Dec-2009.&lt;br /&gt;&lt;br /&gt;That's it for now. In my next post I will explore the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/package-frame.html"&gt;Framework launch API&lt;/a&gt; in more detail and show how you can bootstrap an OSGi Framework independent of the actual Framework implementation.&lt;br /&gt;&lt;br /&gt;May this be useful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-2754717361186545429?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/2754717361186545429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/10/extender-pattern-vs-lifecycle.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/2754717361186545429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/2754717361186545429'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/10/extender-pattern-vs-lifecycle.html' title='Extender Pattern vs. Lifecycle Interceptor'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MTTbr2TxHjA/SuGuH7BbrxI/AAAAAAAADug/5hfjGDxzERQ/s72-c/osgi_war_extender.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-2974854444300644806</id><published>2009-10-14T19:07:00.003+02:00</published><updated>2009-10-26T08:17:59.710+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta4 Released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta4.&lt;br /&gt;&lt;br /&gt;You can download the binary here: &lt;a href="http://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta4/jboss-osgi-installer-1.0.0.Beta4.jar/download"&gt;jboss-osgi-installer-1.0.0.Beta4.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Initial release of our native &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta4/userguide/html/ChapFrameworkIntegration.html#SecIntegrationJBossMC"&gt;JBossMC based OSGi Framework&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Added support for OSGi WebApps using &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta4/userguide/html/ChapProvidedBundles.html#SecWebAppExtender"&gt;WebApp Extender&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Improved support for the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta4/userguide/html/ChapProvidedBundles.html#SecHttpService"&gt;HttpService&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta4/userguide/html/"&gt;&lt;span class="jive-link-external-small"&gt;User Guide&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;h4&gt;Feature Request&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-110"&gt;JBOSGI-110&lt;/a&gt;] - Support WAR deployments in the OSGi runtime&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-127"&gt;JBOSGI-127&lt;/a&gt;] - Provide build and hudson support for MC facade&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-128"&gt;JBOSGI-128&lt;/a&gt;] - Add Framework launch API&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Task&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-80"&gt;JBOSGI-80&lt;/a&gt;] - Add support for Framework Launching (RFC-132)&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-132"&gt;JBOSGI-132&lt;/a&gt;] - Release JBoss MC Framework 1.0.0.Alpha1&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-134"&gt;JBOSGI-134&lt;/a&gt;] - Add support for BundleContext.getDataFile()&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-142"&gt;JBOSGI-142&lt;/a&gt;] - Investigate classloading space&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-148"&gt;JBOSGI-148&lt;/a&gt;] - Autostart bundles when deployed in JBossAS&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-156"&gt;JBOSGI-156&lt;/a&gt;] - Setup r4v42 core TCK&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-159"&gt;JBOSGI-159&lt;/a&gt;] - Fire events asynchronously&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-160"&gt;JBOSGI-160&lt;/a&gt;] - Use Pax Web instead of Apache Http-Service&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-164"&gt;JBOSGI-164&lt;/a&gt;] - Update Blueprint to 1.0.0.Alpha2&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-165"&gt;JBOSGI-165&lt;/a&gt;] - Update to jboss-osgi-common-1.0.2&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-166"&gt;JBOSGI-166&lt;/a&gt;] - Update to jboss-osgi-common-core-2.2.13.GA&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-167"&gt;JBOSGI-167&lt;/a&gt;] - Update to jboss-osgi-husky-1.0.1&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-168"&gt;JBOSGI-168&lt;/a&gt;] - Update to jboss-osgi-jmx-1.0.1&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-169"&gt;JBOSGI-169&lt;/a&gt;] - Update to jboss-osgi-jndi-1.0.1&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-170"&gt;JBOSGI-170&lt;/a&gt;] - Update to jboss-osgi-microcontainer-1.0.2&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-171"&gt;JBOSGI-171&lt;/a&gt;] - Update to Eclipse Equinox-3.5&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-172"&gt;JBOSGI-172&lt;/a&gt;] - Update to Apache Felix-2.0.0&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-173"&gt;JBOSGI-173&lt;/a&gt;] - Update to jboss-osgi-spi-1.0.2&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-174"&gt;JBOSGI-174&lt;/a&gt;] - Update to jboss-osgi-webconsole-1.0.1&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-175"&gt;JBOSGI-175&lt;/a&gt;] - Update to osgi core/compendium R4v42&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-176"&gt;JBOSGI-176&lt;/a&gt;] - Release JBoss OSGi 1.0.0.Beta4&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-133"&gt;JBOSGI-133&lt;/a&gt;] - Pass all example tests with MC Framework&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Bug&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-78"&gt;JBOSGI-78&lt;/a&gt;] - ResourceNotFoundException too verbose&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-130"&gt;JBOSGI-130&lt;/a&gt;] - Bundle is still in state INSTALLED after bundle.start()&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-135"&gt;JBOSGI-135&lt;/a&gt;] - Cannot handle package being imported and exported by the same bundle&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-136"&gt;JBOSGI-136&lt;/a&gt;] - Cannot resolve dependency against unstarted bundle&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-140"&gt;JBOSGI-140&lt;/a&gt;] - Invalid delivery of framework events&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-144"&gt;JBOSGI-144&lt;/a&gt;] - Framework does not handle ServiceFactory provided services properly&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-151"&gt;JBOSGI-151&lt;/a&gt;] - Cannot resolve circular dependencies&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-155"&gt;JBOSGI-155&lt;/a&gt;] - OutOfMemoryError on repeated install/unstall bundle&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-158"&gt;JBOSGI-158&lt;/a&gt;] - Framework itself must be a bundle&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-161"&gt;JBOSGI-161&lt;/a&gt;] - Cannot use commons-logging&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-162"&gt;JBOSGI-162&lt;/a&gt;] - Cannot load classes from Bundle-ClassPath&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-163"&gt;JBOSGI-163&lt;/a&gt;] - Husky invocation before async extender processing&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-2974854444300644806?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/2974854444300644806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/10/jbossosgi-100beta4-released_14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/2974854444300644806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/2974854444300644806'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/10/jbossosgi-100beta4-released_14.html' title='JBossOSGi 1.0.0.Beta4 Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-7746438830029932183</id><published>2009-10-14T15:32:00.012+02:00</published><updated>2009-10-26T08:17:59.710+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>OSGi Unit Testing</title><content type='html'>With this post I'd like to give a little more background on OSGi unit testing. There will be coverage of&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Basic problem of OSGi bundle testing&lt;/li&gt;&lt;li&gt;Running a unit test inside an OSGi Framework&lt;/li&gt;&lt;li&gt;Interaction between a test runner and the OSGi Framework&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of the main characteristics of an OSGi environment is its high dynamicity. Services come and go at any time or get updated by newer versions. To verify that functionality provided by an OSGi Bundle does indeed behave as expected, you need good test coverage of that functionality. This of course is a general truth that is not limited to OSGi alone.&lt;br /&gt;&lt;br /&gt;The benefit of &lt;a href="http://en.wikipedia.org/wiki/Unit_testing"&gt;unit testing&lt;/a&gt; is to isolate functionality and show that it behaves as expected. A unit test provides a strict, written contract that the piece of code must satisfy.&lt;br /&gt;&lt;br /&gt;The basic problem in OSGi is that you cannot access the artefacts that you deploy in a bundle directly from the test case that runs external to the OSGi Framework. The test case is loaded from different classloader than the artefacts contained in the bundle.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfAe7uwuraI/AAAAAAAAC5I/a-UAYiYO1J0/s1600-h/osgi-embedded-testing.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" id="BLOGGER_PHOTO_ID_5327792370692828578" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfAe7uwuraI/AAAAAAAAC5I/a-UAYiYO1J0/s320/osgi-embedded-testing.png" style="cursor: pointer; height: 217px; width: 320px;" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Embedded OSGi Framework&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:small;"&gt;This is probably the most common usage. A test or a wrapper around a collection of tests bootstraps the OSGi Framework installs a number of bundles and verifies their correct behaviour. Husky test cases leverage the OSGi &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/launch/package-frame.html"&gt;Framework Launch&lt;/a&gt; API. Framework launching should not require prior knowledge of the actual framework implementation. OSGi Framework and test runner share the same VM. From the perspective of the test runner, the test can be executed like an ordinary unit test, which gives the developer the freedom of choice with respect to the runner (i.e. Eclipse, IntelliJ, Maven, Ant). The test reports results back to the runner like an ordinary unit test, which preserves the runner's test report functionality.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Remote OSGi Framework&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:small;"&gt;&lt;br /&gt;In an enterprise scenario the OSGi Framework is more often than not a &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/userguide/html/ChapRuntime.html"&gt;standalone container&lt;/a&gt;. The same test as above should be deployable in a remote framework that is already running. It is a configuration option of the test environment of whether the test gets installed into an embedded OSGi Framework or deployed to a remote framework instance. OSGi Framework and test runner do not share the same VM. From the perspective of the test runner, the test can still be executed like an ordinary unit test and it is completely transparent that the test gets actually executed in a remote environment. Conceptually, this is similar to what &lt;a href="http://jakarta.apache.org/cactus/"&gt;Apache Cactus&lt;/a&gt;  is about.&lt;/span&gt;&lt;span style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Requirements&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;The solution MUST support plain JUnit4 POJO test cases&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;There SHOULD be no requirement to extend a specific test base class&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;There MUST be no requirement on a specific test runner&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;There SHOULD be a minimum test framework leakage into the test case&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;The test framework MUST support embedded and remote OSGi Runtimes with no change required to the test&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;The same test case MUST be executable from outside as well as from within the OSGi Framework&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;There SHOULD be a pluggable communication layer from the test runner to the OSGi Framework&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;The test framework MUST NOT depend on OSGi Framework specific features&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:small;"&gt;There MUST be no automated creation of test bundles required by the test framework&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Architecture&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;JBoss OSGi Husky has client side interceptor that fields the test request to an embedded/remote OSGi Framework where the      test case is then actually executed.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_MTTbr2TxHjA/StXJHB_YrJI/AAAAAAAADuQ/uRpUBdEheI0/s1600-h/husky-design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://4.bp.blogspot.com/_MTTbr2TxHjA/StXJHB_YrJI/AAAAAAAADuQ/uRpUBdEheI0/s400/husky-design.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span style="font-size:130%;"&gt;How does it work&lt;/span&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;A &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Bridge.html"&gt;Bridge&lt;/a&gt; intercepts a test and determines the FQN of the test case and the test method from the call stack. It then delegates the execution to the same (or another) test in and isolated test environment. An isolated test environment is one that does not have the same class loading space as the test itself.&lt;/li&gt;&lt;li&gt;A Bridge is associated with an &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Invoker.html"&gt;Invoker&lt;/a&gt;. Invokers may be arbitarily complex. Local 'in proccess' invokers are possible just as well as remote invokers.&lt;/li&gt;&lt;li&gt;The Invoker sends the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Request.html"&gt;Request&lt;/a&gt; to a &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/Connector.html"&gt;Connector&lt;/a&gt; in the isolated test environment.&lt;/li&gt;&lt;li&gt;A Connector has associated &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/PackageListener.html"&gt;PackageListeners&lt;/a&gt; that are responsible for processing test cases for their respective test packages.&lt;/li&gt;&lt;li&gt;A PackageListeners delegates the Request to a test &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/Runner.html"&gt;Runner&lt;/a&gt;, typicaly this would be a &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/junit/JUnitRunner.html"&gt;JUnitRunner&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;The Runner injects the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Context.html"&gt;Context&lt;/a&gt; into the test case and returns a &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Response.html"&gt;Response&lt;/a&gt;, which the Connector returns to the Invoker.&lt;/li&gt;&lt;li&gt;The Bridge finally translates potential &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Failure.html"&gt;Failures&lt;/a&gt; that may be contained in the Result, to test failures on the client side.&lt;/li&gt;&lt;/ol&gt;The JBoss OSGi &lt;b&gt;jboss-osgi-husky.jar&lt;/b&gt; bundle registers the Connectors. The &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/osgi/JMXConnector.html"&gt;JMXConnector&lt;/a&gt; is always registered. The &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/osgi/SocketConnector.html"&gt;SocketConnector&lt;/a&gt; is registered when the appropriate configuration options are set. It then registers the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/runtime/osgi/HuskyExtender.html"&gt;HuskyExtender&lt;/a&gt;, which is a &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleListener.html"&gt;BundleListener&lt;/a&gt; that inspects every incomming bundle for the Test-Package manifest header. The Extender creates a PackageListener for every package in the '&lt;b&gt;Test-Package&lt;/b&gt;' manifest header and registers them with the available Connectors.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Configuration&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the target OSGi Framework, which is the one that has the &lt;b&gt;jboss-osgi-husky.jar&lt;/b&gt; bundle installed,     you set these properties.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;# Husky socket connector properties&lt;/span&gt;&lt;br /&gt;org.jboss.osgi.husky.runtime.connector.host=localhost&lt;br /&gt;org.jboss.osgi.husky.runtime.connector.port=5401&lt;br /&gt;&lt;/blockquote&gt;Both properties must be set for the SocketConnector to be available.&lt;br /&gt;&lt;br /&gt;On the client side, you configure the Invoker that you want to use.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;# Husky invoker  properties&lt;/span&gt;&lt;br /&gt;org.jboss.osgi.husky.invoker=org.jboss.osgi.husky.internal.OSGiInvoker&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;This particular invoker will also look for the host and port properties and if availbale will use socket invocation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Writing Husky Tests&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In a typical Husky test you have&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A &lt;b&gt;discriminator&lt;/b&gt; to distinguish between client and 'in container' execution&lt;/li&gt;&lt;li&gt;An &lt;b&gt;interceptor&lt;/b&gt; that delegates the call to an Invoker&lt;/li&gt;&lt;/ul&gt;For OSGi, the "discriminator" would be the &lt;a href="http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html"&gt;BundleContext&lt;/a&gt; that gets injected by the 'in container' test Runner. The "interceptor" would be a call to one of the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/apidocs/org/jboss/osgi/husky/Bridge.html#run%28%29"&gt;Bridge.run()&lt;/a&gt; variants.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;public class SimpleHuskyTestCase&lt;br /&gt;{&lt;br /&gt;@ProvideContext&lt;br /&gt;public BundleContext context;&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;public void testSimpleBundle() throws Exception&lt;br /&gt;{&lt;br /&gt;  // Tell Husky to run this test method within the OSGi Runtime&lt;br /&gt;  if (context == null)&lt;br /&gt;     BridgeFactory.getBridge().run();&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;  // Stop here if the context is not injected&lt;br /&gt;  assumeNotNull(context);&lt;br /&gt;&lt;br /&gt;  // Get the SimpleService reference&lt;br /&gt;  ServiceReference sref = context.getServiceReference("SimpleService");&lt;br /&gt;  assertNotNull("SimpleService Not Null", sref);&lt;br /&gt;&lt;br /&gt;  // Access the SimpleService&lt;br /&gt;  SimpleService service = (SimpleService)context.getService(sref);&lt;br /&gt;  assertEquals("hello", service.echo("hello"));&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The bundle that contains the test case must have the &lt;span class="bold"&gt;&lt;strong&gt;Test-Package&lt;/strong&gt;&lt;/span&gt; manifest header configured.&lt;br /&gt;&lt;blockquote&gt;Bundle-SymbolicName: example-simple-husky&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;# Export the package that contains the test case&lt;/span&gt;&lt;br /&gt;Export-Package: org.jboss.test.osgi.example.simple&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;# Tell Husky that there are test cases in this package&lt;/span&gt;&lt;br /&gt;Test-Package: org.jboss.test.osgi.example.simple&lt;br /&gt;&lt;/blockquote&gt;That's it for now. JBoss OSGi 1.0.0.Beta4 is ready and waiting for the files to show up on &lt;a href="https://sourceforge.net/projects/jboss/files/JBossOSGi"&gt;Sourceforge&lt;/a&gt;. In a follow up post you can read about our new native &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/userguide/html/ChapFrameworkIntegration.html#SecIntegrationJBossMC"&gt;OSGi Framework implementation&lt;/a&gt; that is based on the &lt;a href="http://www.jboss.org/jbossmc/"&gt;JBoss Microcontainer&lt;/a&gt; and how JBoss OSGi uses &lt;a href="http://wiki.ops4j.org/display/paxweb/Pax+Web"&gt;Pax Web&lt;/a&gt; to provide support for OSGi WebApps.&lt;br /&gt;&lt;br /&gt;May this be useful&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-7746438830029932183?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/7746438830029932183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/10/osgi-unit-testing.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/7746438830029932183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/7746438830029932183'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/10/osgi-unit-testing.html' title='OSGi Unit Testing'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTTbr2TxHjA/SfAe7uwuraI/AAAAAAAAC5I/a-UAYiYO1J0/s72-c/osgi-embedded-testing.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-4244581354985882866</id><published>2009-07-24T09:13:00.002+02:00</published><updated>2009-10-26T08:18:19.229+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta3 Released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta3.&lt;br /&gt;&lt;br /&gt;You can download it here: &lt;a href="https://sourceforge.net/projects/jboss/files/JBossOSGi/1.0.0.Beta3/jboss-osgi-installer-1.0.0.Beta3.jar"&gt;jboss-osgi-installer-1.0.0.Beta3.ja&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Early preview of the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedBundles.html#SecBundleBlueprint" mce_href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedBundles.html#SecBundleBlueprint"&gt;Blueprint Container Service&lt;/a&gt; with associated &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedExamples.html#SecBlueprintContainerExample" mce_href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedExamples.html#SecBlueprintContainerExample"&gt;Blueprint Example&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;More samples for &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedExamples.html#SecXMLParserServiceExample" mce_href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedExamples.html#SecXMLParserServiceExample"&gt;SAX/DOM&lt;/a&gt; and &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedExamples.html#SecJAXBServiceExample" mce_href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/ChapProvidedExamples.html#SecJAXBServiceExample"&gt;JAXB&lt;/a&gt; processing.&lt;/li&gt;&lt;li&gt;Aggregated online &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/apidocs/" mce_href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/apidocs/"&gt;API docs&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/" mce_href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta3/userguide/html/"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Feature Requests&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-93" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-93"&gt;JBOSGI-93&lt;/a&gt;] -         Uninstall bundles on OSGiRuntime.shutdown() &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-98" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-98"&gt;JBOSGI-98&lt;/a&gt;] -         Support configuration per profile &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-102" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-102"&gt;JBOSGI-102&lt;/a&gt;] -       Add support for static Husky context injection &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Tasks&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-71" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-71"&gt;JBOSGI-71&lt;/a&gt;] -         Upgrade to IzPack 4.3.1 &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-73" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-73"&gt;JBOSGI-73&lt;/a&gt;] -         Provide Blueprint example &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-95" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-95"&gt;JBOSGI-95&lt;/a&gt;] -         Provide JAXB example &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-97" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-97"&gt;JBOSGI-97&lt;/a&gt;] -         Provide SAX/DOM parser example &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-101" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-101"&gt;JBOSGI-101&lt;/a&gt;] -       Create a ziped source distribution &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-103" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-103"&gt;JBOSGI-103&lt;/a&gt;] -       Add support for BlueprintContainer API &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-104" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-104"&gt;JBOSGI-104&lt;/a&gt;] -       Upgrade to Felix Web Console 1.2.10 &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-108" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-108"&gt;JBOSGI-108&lt;/a&gt;] -       Investigate statics on PackageAdmin.refresh &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-109" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-109"&gt;JBOSGI-109&lt;/a&gt;] -       Upgrade to Felix-1.8.1 &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-111" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-111"&gt;JBOSGI-111&lt;/a&gt;] -       Allign distributed sources with libs &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-112" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-112"&gt;JBOSGI-112&lt;/a&gt;] -       Investigate Exception in SynchronousBundleListener &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Bugs&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-66" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-66"&gt;JBOSGI-66&lt;/a&gt;] -         Support bundle deployment through web console &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-92" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-92"&gt;JBOSGI-92&lt;/a&gt;] -         Class.forName issue with XMLParserActivator &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-99" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-99"&gt;JBOSGI-99&lt;/a&gt;] -         No explicit control over bundle.start() &lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-107" mce_href="https://jira.jboss.org/jira/browse/JBOSGI-107"&gt;JBOSGI-107&lt;/a&gt;] -       MC beans cannot be redeployed after refresh &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-4244581354985882866?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/4244581354985882866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/07/jbossosgi-100beta3-released.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4244581354985882866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/4244581354985882866'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/07/jbossosgi-100beta3-released.html' title='JBossOSGi 1.0.0.Beta3 Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-3206541941607414701</id><published>2009-06-05T14:10:00.039+02:00</published><updated>2009-10-26T08:17:59.710+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBoss OSGi Runtime &amp; JBossAS Integration</title><content type='html'>Now that &lt;a href="http://jbossosgi.blogspot.com/2009/06/jbossosgi-100beta2-released.html"&gt;JBoss OSGi 1.0.0.Beta2&lt;/a&gt; is out I thought I'll explain a little more in detail what the various JBoss OSGi runtime models are about. In this post I'll cover&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JBoss OSGi integration in &lt;a href="http://www.jboss.org/jbossas/"&gt;JBossAS&lt;/a&gt; &lt;/li&gt;&lt;li&gt;The standalone &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html"&gt;JBoss OSGi Runtime&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The possible future of both&lt;/li&gt;&lt;/ul&gt;JBossAS has always been good at integrating loosely coupled services. In the 3.x and 4.x series that was done via a JMX based kernel in the 5.x series the AS switched to a &lt;a href="http://www.jboss.org/jbossmc/"&gt;Microcontainer&lt;/a&gt; based kernel. For JBoss OSGi only the 5.x series is relevenant so lets start with that.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Integration in JBossAS-5.x&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Like any other service JBoss OSGi is integrated via a *-beans.xml descriptor.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SikUv2RtV9I/AAAAAAAADKk/T8yCzb9m5uI/s1600-h/jbossas-integration-tree.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 136px; height: 200px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SikUv2RtV9I/AAAAAAAADKk/T8yCzb9m5uI/s200/jbossas-integration-tree.png" alt="" id="BLOGGER_PHOTO_ID_5343825245108000722" border="0" /&gt;&lt;/a&gt;More specifically, when you choose JBossAS integration in the Installer you will find and 'osgi.deployer' directory together with all your other MC deployers.&lt;br /&gt;&lt;br /&gt;Deployers must be loaded first because as their name nicely suggests they deploy other services and applications. There is a lot to say about deployers, but lets focus on the JBoss OSGi specific &lt;a href="https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/releases/jboss-osgi-1.0.0.Beta2/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml"&gt;&lt;span&gt;osgi-deployers-jboss-beans.xml&lt;/span&gt;&lt;/a&gt; beans descriptor. Here you'll find all OSGi relevevant configuration options. For this post I'll take the &lt;a href="http://felix.apache.org/"&gt;Apache Felix&lt;/a&gt; integration as an example. There is however a similar beans descriptor for &lt;a href="http://www.eclipse.org/equinox"&gt;Equinox&lt;/a&gt; and &lt;a href="http://www.knopflerfish.org/"&gt;Knopflerfish&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Without going in too much detail there are various beans configurations&lt;br /&gt;&lt;ul&gt;&lt;li&gt;OSGi Framework Integration&lt;/li&gt;&lt;li&gt;Bundle Management (JMX) Service &lt;/li&gt;&lt;li&gt;MC Integration Service&lt;/li&gt;&lt;li&gt;OSGi Deployers&lt;/li&gt;&lt;/ul&gt;Every time you deploy a bundle (i.e. drop it into the 'deploy' folder), the bundle gets processed by the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapDeveloperGuide.html#SecDeployers"&gt;OSGi Deployers&lt;/a&gt;, each of them taking care of a specific deployment aspect.&lt;br /&gt;&lt;br /&gt;The JBoss OSGi AS integration looks something like this&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SikZhmF5zKI/AAAAAAAADKs/wDleld3k37Q/s1600-h/jbossas-integration.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 288px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SikZhmF5zKI/AAAAAAAADKs/wDleld3k37Q/s400/jbossas-integration.png" alt="" id="BLOGGER_PHOTO_ID_5343830497803488418" border="0" /&gt;&lt;/a&gt;You will notice that all the interesting AS provided services are 'outside' the OSGi world. You can think of them as 'system services' like the ones provided by the JVM itself. Hence a bundle wanting to access EJB, JTA, JPA, etc. can only do so if the packages that it imports are defined on the OSGi System Classpath. This would be the content of the 'org.osgi.framework.system.packages' property, which for Felix is currently defined like this&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&lt;br /&gt;&amp;lt;key&gt;org.osgi.framework.system.packages.extra&amp;lt;/key&gt;&lt;br /&gt;&amp;lt;value&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- system --&gt;&lt;br /&gt;org.apache.xerces.dom,&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- jboss-osgi --&gt;&lt;br /&gt;org.jboss.osgi.spi;version=1.0,&lt;br /&gt;org.jboss.osgi.spi.capability;version=1.0,&lt;br /&gt;org.jboss.osgi.spi.logging;version=1.0,&lt;br /&gt;org.jboss.osgi.spi.management;version=1.0,&lt;br /&gt;org.jboss.osgi.spi.service;version=1.0,&lt;br /&gt;org.jboss.osgi.spi.testing;version=1.0,&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- jboss --&gt;&lt;br /&gt;org.jboss.logging,&lt;br /&gt;org.jboss.virtual,&lt;br /&gt;org.jboss.virtual.plugins.registry,&lt;br /&gt;org.jboss.virtual.plugins.context.jar,&lt;br /&gt;org.jboss.virtual.plugins.vfs.helpers,&lt;br /&gt;org.jboss.virtual.protocol,&lt;br /&gt;org.jboss.xb.binding;version=2.0,&lt;br /&gt;org.jboss.xb.binding.sunday.unmarshalling;version=2.0,&lt;br /&gt;&amp;lt;/value&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;Say good bye to modularity, if packages from services need to be defined  statically as part of some non-recyclable  deployer.&lt;br /&gt;&lt;br /&gt;So how can the AS integration still be useful?&lt;br /&gt;&lt;ul&gt;&lt;li&gt;It is useful for folks who have plain OSGi applications that either do not interact with system services or can have static dependency on those services. i.e. you can send/receive JMS messages, but there cannot be more than one JMS service available nor can the JMS service come and go.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;It is a neccessary starting point from which OSGi/AS integration can develop. What I describe here is the state of the current AS integration, over the course of time you should see posts explaining an ever improving OSGi/AS integration.&lt;/li&gt;&lt;/ul&gt;The AS intgration is available for&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JBoss-5.0.1.GA&lt;/li&gt;&lt;li&gt;JBoss-5.1.0.GA&lt;/li&gt;&lt;li&gt;JBoss-5.2.0 (not yet released)   &lt;/li&gt;&lt;li&gt;JBoss-6.0.0 (not yet released)   &lt;/li&gt;&lt;/ul&gt;both for jdk1.5 and jdk1.6. Here is the full &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-matrix"&gt;matrix&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There is another JBoss OSGi Runtime available, which is already covered to some extend in the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html"&gt;Userguide&lt;/a&gt;. Lets have a closer look.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Standalone JBoss OSGi Runtime&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The JBoss OSGi Runtime is a pure OSGi container onto which components, services and applications can be deployed.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/Sikh36kdAHI/AAAAAAAADK0/WFrZTc3OeZk/s1600-h/jbossosgi-runtime.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 287px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/Sikh36kdAHI/AAAAAAAADK0/WFrZTc3OeZk/s400/jbossosgi-runtime.png" alt="" id="BLOGGER_PHOTO_ID_5343839677350477938" border="0" /&gt;&lt;/a&gt;Instead of bootstrapping the OSGi Framework from the Microcontainer, the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapProvidedBundles.html#SecBundleMicrocontainer"&gt;Microcontainer Service&lt;/a&gt; is installed in the OSGi Framework as a bundle.&lt;br /&gt;&lt;p&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html#SecRuntimeProfiles" title="3.3. Runtime Profiles"&gt;Preconfigured profiles&lt;/a&gt;, contain OSGi bundles that logically work together. A profile can be bootstrapped either as a standalone server or embedded in some other environment. With a startup time of less than 600ms, the runtime can be easily be bootstrapped from within plain JUnit4 test cases.&lt;/p&gt;&lt;p&gt;For a more &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html#SecRuntimeOverview"&gt;detailed description&lt;/a&gt; and the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html#SecRuntimeFeatures"&gt;feature set&lt;/a&gt;, please have a look at the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html"&gt;userguide&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;For this post lets focus on the &lt;span style="font-weight: bold;"&gt;'-c all'&lt;/span&gt; profile&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;[tdiesler@tdvaio runtime]$ bin/run.sh -c all&lt;br /&gt;=========================================================================&lt;br /&gt;JBossOSGi Bootstrap Environment&lt;br /&gt;OSGI_HOME: /home/tdiesler/jboss-osgi-1.0.0.Beta2/runtime&lt;br /&gt;JAVA: /usr/java/jdk1.6/bin/java&lt;br /&gt;JAVA_OPTS: -Dprogram.name=run.sh ...&lt;br /&gt;=========================================================================&lt;br /&gt;... [FelixIntegration] OSGi Integration Felix - 1.0.0.Beta2&lt;br /&gt;... [FelixIntegration] Installed bundle [1]: org.osgi.compendium&lt;br /&gt;... [FelixIntegration] Installed bundle [2]: org.apache.felix.log&lt;br /&gt;... [FelixIntegration] Installed bundle [3]: jboss-osgi-common&lt;br /&gt;... [FelixIntegration] Installed bundle [4]: jboss-osgi-hotdeploy&lt;br /&gt;... [OSGiBootstrap] &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;JBossOSGi Runtime booted in 0.421sec&lt;/span&gt;&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-xml-binding [5]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-microcontainer [6]&lt;br /&gt;... [jboss-osgi-common] Installed: org.apache.felix.metatype [7]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-jndi [8]&lt;br /&gt;... [jboss-osgi-common] Installed: org.apache.felix.http.jetty [9]&lt;br /&gt;... [jboss-osgi-common] Installed: org.apache.felix.configadmin [10]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-jmx [11]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-jaxb [12]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-common-core [13]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-webconsole [14]&lt;br /&gt;... [jboss-osgi-common] Installed: jboss-osgi-apache-xerces [15]&lt;br /&gt;... [jboss-osgi-jndi] JNDI started: JNP=localhost:1099&lt;br /&gt;... [jboss-osgi-jmx] Bound to: jmx/invoker/RMIAdaptor&lt;br /&gt;... [OSGiBootstrap] &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;JBossOSGi Runtime started in 5.156sec&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;The OSGi Framework boots up and starts the services that are shown in the picture above. Although the startup time is considerably faster that that of the AS it should be mentioned that this is currently not optimized. OSGi comes with a &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/Constants.html#ACTIVATION_LAZY"&gt;lazy bundle activation&lt;/a&gt; policy. What you see above is 'eager' bundle activation for all. Lazy bundle activation means that bundles and their associated service can be started on demand, which should bring the startup time much closer to the boot time.&lt;br /&gt;&lt;br /&gt;So why is this OSGi runtime useful?&lt;br /&gt;&lt;ul&gt;&lt;li&gt;It is useful for folks who want a "clean" OSGi environment with all the benefits that are described in the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html#SecRuntimeFeatures"&gt;feature set&lt;/a&gt;&lt;/li&gt;&lt;li&gt;3rd party bundles can be installed in that runtime and provide truly modular services similar to the ones that exist in the AS integration.&lt;/li&gt;&lt;li&gt;It is the foundation of our OSGi activities that take an already existing OSGi Framework for granted (i.e. the upcomming &lt;a href="http://jbossosgi.blogspot.com/2009/04/osgi-blueprint-service-rfc-124.html"&gt;Blueprint&lt;/a&gt; implementation)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So what cannot be done with this runtime?&lt;/p&gt;&lt;ul&gt;&lt;li&gt;You cannot take advantage of many of the JavaEE and advanced JBoss features. EJB3, JTA, AOP, etc are not available (yet).&lt;/li&gt;&lt;li&gt;JMX and AOP annotations on MC beans do not work&lt;/li&gt;&lt;li&gt;You cannot deploy existing JBoss applications on that runtime&lt;/li&gt;&lt;/ul&gt;From the contrast of the two aproaches you see that it would be beneficial to have the benefits of both available in one runtime environment.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;The possible future of JBoss OSGi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Conceptually, the &lt;a href="http://www.jboss.org/jbossmc/"&gt;Microcontainer&lt;/a&gt; already implements the OSGi provided functionality. Some folks even go as far as saying that the MC is a superset of OSGi. The criteria to prove the truth of that claim is well defined, MC "simply" needs to pass the OSGi core TCK.&lt;br /&gt;&lt;br /&gt;The idea is to provide the MC with a facade that implements the OSGi core API. Our chief scientist has signed up for it, and I am exited to see what will come out of it. The resulting architecture would then look similar to this&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/Sikv80L0owI/AAAAAAAADK8/wGoDIrq286k/s1600-h/jbossas-integration-future.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 321px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/Sikv80L0owI/AAAAAAAADK8/wGoDIrq286k/s400/jbossas-integration-future.png" alt="" id="BLOGGER_PHOTO_ID_5343855154698691330" border="0" /&gt;&lt;/a&gt;The Microcontainer &lt;span style="font-weight: bold;"&gt;is&lt;/span&gt; the OSGi Framework and manages the classloading scope and lifecycle of all components deployed on it. This is the vision, the time line and details still need to be defined.&lt;br /&gt;&lt;br /&gt;That's it for now. Next week I'll be off for a short holiday to my favourite climbing spot&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SikzIRa5XiI/AAAAAAAADLE/bCI6kGqhLc4/s1600-h/climbing32.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 192px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SikzIRa5XiI/AAAAAAAADLE/bCI6kGqhLc4/s320/climbing32.jpg" alt="" id="BLOGGER_PHOTO_ID_5343858650059988514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In my next post I'm going to look into the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/jboss-osgi-spi/apidocs/org/jboss/osgi/spi/testing/OSGiRuntime.html"&gt;OSGiRuntime&lt;/a&gt; abstraction and the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapHuskyTesting.html"&gt;Husky Test Harness&lt;/a&gt; in more detail. If you like, you can already look forward to Beta3, which should see major improvements to our &lt;a href="http://jbossosgi.blogspot.com/2009/04/osgi-blueprint-service-rfc-124.html"&gt;Blueprint&lt;/a&gt; implementation - stay tuned.&lt;br /&gt;&lt;br /&gt;May this be useful&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-3206541941607414701?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/3206541941607414701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/06/jboss-osgi-runtime-as-integration.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/3206541941607414701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/3206541941607414701'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/06/jboss-osgi-runtime-as-integration.html' title='JBoss OSGi Runtime &amp; JBossAS Integration'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MTTbr2TxHjA/SikUv2RtV9I/AAAAAAAADKk/T8yCzb9m5uI/s72-c/jbossas-integration-tree.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-1184329689240722546</id><published>2009-06-03T22:37:00.014+02:00</published><updated>2009-10-26T08:18:04.242+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta2 Released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta2.&lt;br /&gt;&lt;br /&gt;You can download it here: &lt;a href="https://sourceforge.net/project/downloading.php?group_id=22866&amp;filename=jboss-osgi-installer-1.0.0.Beta2.jar&amp;a=13768064"&gt;jboss-osgi-installer-1.0.0.Beta2.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapRuntime.html"&gt;JBoss OSGi Runtime&lt;/a&gt; has is now a pure OSGi container onto which components, services and applications can be deployed.&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapHuskyTesting.html"&gt;Husky Test Framework&lt;/a&gt; for remote and embedded OSGi bundle testing&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added support for &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapProvidedBundles.html#SecBundleJMX"&gt;JMX&lt;/a&gt;, &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapProvidedBundles.html#SecBundleJNDI"&gt;JNDI&lt;/a&gt; services&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/ChapProvidedBundles.html#SecBundleMicrocontainer"&gt;Microcontainer&lt;/a&gt; service to wire and configure OSGi components&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta2/userguide/html/index.html"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Feature Request&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-70"&gt;JBOSGI-70&lt;/a&gt;] -         Expose bundle headers through JMX&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Tasks&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-79"&gt;JBOSGI-79&lt;/a&gt;] -         Provide POM descriptions for bundles&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-86"&gt;JBOSGI-86&lt;/a&gt;] -         Document JBossOSGi Runtime&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-88"&gt;JBOSGI-88&lt;/a&gt;] -         Document JMX Service&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-89"&gt;JBOSGI-89&lt;/a&gt;] -         Document JNDI Service&lt;br /&gt;&lt;/li&gt;&lt;li&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-90"&gt;JBOSGI-90&lt;/a&gt;] -         Add hot-deployment to Runtime&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-1184329689240722546?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/1184329689240722546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/06/jbossosgi-100beta2-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1184329689240722546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1184329689240722546'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/06/jbossosgi-100beta2-released.html' title='JBossOSGi 1.0.0.Beta2 Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-9155493180616256651</id><published>2009-04-23T14:36:00.022+02:00</published><updated>2009-10-26T08:18:04.243+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>OSGi Blueprint Service (RFC-124)</title><content type='html'>This post introduces the OSGi Blueprint Service (RFC-124) as it is currently drafted by the &lt;a href="http://www.osgi.org/EEG/HomePage"&gt;OSGi Enterprise Expert Group (EEG)&lt;/a&gt;. I'll try to present the most relevant information in a fast and easy digestible way such that you should get a good idea of what Blueprint Service is about and why it is relevant for &lt;a href="http://www.jboss.org/community/wiki/JBossOSGi"&gt;JBossOSGi&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.osgi.org/About/WhatIsOSGi"&gt;OSGi platform&lt;/a&gt; provides an attractive foundation for building enterprise applications. However it lacks a rich component model for declaring components within a bundle and for instantiating, configuring, assembling and decorating such components when a bundle is started.&lt;br /&gt;&lt;br /&gt;In 2006 &lt;a href="http://www.springsource.com/"&gt;SpringSource&lt;/a&gt;, the company behind the &lt;a href="http://www.springsource.org/about"&gt;Spring Framework&lt;/a&gt; started development on a project called &lt;a href="http://www.springsource.org/osgi"&gt;Spring Dynamic Modules&lt;/a&gt; to address the above needs. In Sep-2007 that project provided the basis for RFC-124 which is now known as "Blueprint Service".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Application Domain&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The enterprise Java marketplace revolves around the Java Platform, Enterprise Edition (formerly known as J2EE) APIs. This includes APIs such as JMS, JPA, EJB, JTA, Java Servlets, JSF, JAXWS and others. The central component model of JEE is Enterprise JavaBeans (EJBs).  Some core features of the enterprise  programming models the market is moving to include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A focus on writing business logic in “regular” Java classes that are not required to implement certain APIs or contracts in order to integrate with a container&lt;/li&gt;&lt;li&gt;Dependency injection: the ability for a component to be “given” its configuration values and references to any collaborators it needs without having to look them up. This keeps the component testable in isolation and reduces environment dependencies. Dependency injection is a special case of Inversion of Control.&lt;/li&gt;&lt;li&gt;Declarative specification of enterprise services. Transaction and security requirements for example are specified in metadata (typically XML or annotations) keeping the business logic free of such concerns. This also facilitates independent testing of components and reduces environment dependencies.&lt;/li&gt;&lt;li&gt;Aspects, or aspect-like functionality. The ability to specify in a single place behavior that augments the execution of one or more component operations.&lt;/li&gt;&lt;/ul&gt;In the &lt;a href="http://www.jboss.org/jbossas"&gt;JBoss Application Server&lt;/a&gt; all the core features from above are handled by the &lt;a href="http://www.jboss.org/jbossmc"&gt;JBoss Microcontainer&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Problem Description&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Enterprise application developers would like to be able to take advantage of the OSGi platform. The core features of enterprise programming models previously described must be retained for enterprise applications deployed in OSGi. The current OSGi specifications are lacking in the following areas with respect to this requirement:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;There is no defined component model for the internal content of a bundle. Declarative Services only supports the declaration of components that are publicly exposed.&lt;/li&gt;&lt;li&gt;The configuration (property injection) and assembly (collaborator injection) support is very basic&lt;/li&gt;&lt;li&gt;There is no model for declarative specification of services that cut across several components (aspects or aspect-like functionality)&lt;/li&gt;&lt;li&gt;Components that interact with the OSGi runtime frequently need to depend on OSGi APIs&lt;/li&gt;&lt;li&gt;The set of types and resources visible from the context class loader is unspecified&lt;/li&gt;&lt;li&gt;Better tolerance of the dynamic aspects of the OSGi platform is required. The programming model should make it easy to deal with services that may come and go, and with collections of such services, via simple abstractions such as an injecting a constant reference to an object implementing a service interface, or to a managed collection of such objects.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Requirements&lt;/span&gt; (selected)&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The solution MUST enable the instantiation and configuration of components inside a bundle based on metadata provided by the bundle developer.&lt;/li&gt;&lt;li&gt;The solution SHOULD enable the creation of components inside a bundle to be deferred until the dependencies of those components are satisfied.&lt;/li&gt;&lt;li&gt;The solution MUST provide a mechanism for a bundle component to be optionally exported as an OSGic service.&lt;/li&gt;&lt;li&gt;The solution MUST provide a mechanism for injecting a reference to an OSGi service into a bundle component. It SHOULD provide a constant service reference that the receiving component can use even if the target service backing the reference is changed at run time.&lt;/li&gt;&lt;li&gt;The solution SHOULD tolerate services in use being unregistered and support transparent rebinding to alternate services if so configured.&lt;/li&gt;&lt;li&gt;The solution SHOULD provide a rich set of instantiation, configuration, assembly, and decoration options for components&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Solution&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The runtime components to be created for a bundle, together with their configuration and assembly information, are specified declaratively in one or more configuration files contained within the bundle. A bundle with such information present is known as a &lt;span style="font-style: italic;"&gt;managed bundle&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;An extender bundle is responsible for observing the life cycle of such bundles. When a bundle is started, the extender creates a &lt;span style="font-style: italic;"&gt;module context&lt;/span&gt; for that bundle from its blueprint by processing the configuration files and instantiating, configuring, and assembling the components specified there. When a managed bundle is stopped, the extender shuts down the module context, which causes the &lt;span style="font-style: italic;"&gt;managed components&lt;/span&gt; within the context to be cleanly destroyed.&lt;br /&gt;&lt;br /&gt;The declarative configuration for a bundle may also specify that certain of the bundle's managed components are to be exported as services in the OSGi service registry. In addition, it is possible to declare that a bundle component depends on a service or set of services obtained via the service registry, and to have those services dependency injected into the bundle component.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_MTTbr2TxHjA/SfBtWgfsGdI/AAAAAAAAC6E/JsrHDON-tf0/s1600-h/rfc124-solution.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 353px;" src="http://1.bp.blogspot.com/_MTTbr2TxHjA/SfBtWgfsGdI/AAAAAAAAC6E/JsrHDON-tf0/s400/rfc124-solution.jpg" alt="" id="BLOGGER_PHOTO_ID_5327878592626694610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Module Context Life Cycle and the Extender Bundle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfF_MWYyqlI/AAAAAAAAC7s/XSmimOD3cQE/s1600-h/rfc124-module-lifecycle.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 128px; height: 320px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfF_MWYyqlI/AAAAAAAAC7s/XSmimOD3cQE/s320/rfc124-module-lifecycle.jpg" alt="" id="BLOGGER_PHOTO_ID_5328179684300728914" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Module context creation and destruction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A Blueprint Service implementation must provide an extender bundle which manages the lifecycle of module contexts. This bundle is responsible for creating the module contexts for managed bundles (every ACTIVE managed bundle has one and only one associated module context).&lt;br /&gt;&lt;br /&gt;When a managed bundle is stopped, the module context created for it is automatically destroyed. All services exported by the bundle will be unregistered&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Lazy Activation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Module context instantiation is triggered when the STARTED event is issued for a given bundle, Therefore the module context for a lazily activated bundle will not be created until a class has been loaded from that bundle.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Manifest Headers for Managed Bundles&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The extender recognizes a bundle as a managed bundle and will create an associated module context when the bundle is started if one or both of the following conditions is true:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The bundle path contains a folder OSGI-INF/blueprint with one or more files in that folder with a '.xml' extension.&lt;/li&gt;&lt;li&gt;META-INF/MANIFEST.MF contains a manifest header Bundle-Blueprint.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;In the absence of the Bundle-Blueprint header the extender expects every ".xml" file in the OSGI-INF/blueprint folder to be a valid module context configuration file.&lt;br /&gt;&lt;br /&gt;Two directives are defined by the blueprint service specification to control the manner in which module context creation occurs. These directives are applied to the Bundle-SymbolicName header.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;blueprint.wait-for-dependencies&lt;/span&gt; (true|false) - controls whether or not module context creation should wait for any mandatory service dependencies to be satisfied before proceeding (the default), or proceed immediately without waiting if dependencies are not satisfied upon startup.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;blueprint.timeout&lt;/span&gt; (300000) - the time to wait (in milliseconds) for mandatory dependencies to be satisfied before giving up and failing module context creation.&lt;/li&gt;&lt;/ul&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;Bundle-SymbolicName: org.osgi.foobar;blueprint.wait-for-dependencies:=false&lt;br /&gt;&lt;br /&gt;Bundle-SymbolicName: org.osgi.foobar;blueprint.timeout:=60000&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Declaring Module Components&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The basic structure of a configuration file is as follows:&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;components xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"...&gt;&lt;br /&gt;&amp;lt;description&gt;&lt;br /&gt;Optional description for the blueprint defined in this file.&lt;br /&gt;&amp;lt;/description&gt;&lt;br /&gt;&amp;lt;component id="..." class="..."&gt;&lt;br /&gt;&amp;lt;!-- collaborators and configuration for this component go here --&gt;&lt;br /&gt;&amp;lt;/component&gt;&lt;br /&gt;&amp;lt;component id="..." class="..."&gt;&lt;br /&gt;&amp;lt;!-- collaborators and configuration for this component go here --&gt;&lt;br /&gt;&amp;lt;/component&gt;&lt;br /&gt;&amp;lt;!-- more component definitions go here... --&gt;&lt;br /&gt;&amp;lt;/components&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Naming Components&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Every component has at most one id. Component ids must be unique within a module.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Implicit Component Definitions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A module context contains a number of implicitly defined components with well-known names.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;ModuleContext&lt;/span&gt; - provides access to the component objects within the module context&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Bundle&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;BundleContext&lt;/span&gt; - represents the bundle and its contextwith which the module context is associated&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;ConversionService&lt;/span&gt; - provides access to the type conversions that are defined for the module context&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Instantiating Components&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Object instantiation is supported in the following ways:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Using a constructor&lt;/li&gt;&lt;li&gt;Using a static factory method&lt;/li&gt;&lt;li&gt;Using an instance factory method&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Dependencies&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A typical module is made up of components that work (or collaborate) together. The basic principle behind Dependency Injection (DI) is that objects define their dependencies only through constructor arguments, arguments to a factory method, or properties which are set on the object instance after it has been constructed or returned from a factory method.&lt;br /&gt;&lt;br /&gt;Dependency Injection is supported in the following ways:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Constructor Injection&lt;/li&gt;&lt;li&gt;Setter Injection&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Type Conversion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;String values in module context configuration files must be converted to the type expected by an injection target. The module context container supports a number of type conversions by default, and provides an extension mechanism for configuring additional type converters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lazily instantiated components&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By default all singleton components in a module context will be pre-instantiated at startup. A lazily initialized component is not created at startup and will instead be created when it is first requested.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Component Scopes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Components can be defined to be deployed in one of a number of scopes, specified using the scope attribute:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Singleton&lt;/span&gt; - scopes a single component definition to a single object instance per module context&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Prototype&lt;/span&gt; - scopes a single component definition to any number of object instances&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Bundle&lt;/span&gt; - scopes a single component definition to a single object per requesting client bundle&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Lifecycle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Specifying an &lt;span style="font-weight: bold;"&gt;init-method&lt;/span&gt; for a component enables a component to perform initialization work once all the necessary properties on a component have been set by the container. Specifying a &lt;span style="font-weight: bold;"&gt;destroy-method&lt;/span&gt; enables a component to get a callback when the module context containing it is destroyed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Interacting with the Service Registry&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The osgi namespace provides elements that can be used to export managed components as OSGi services, to define references to services obtained via the registry.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Exporting a managed component to the Service Registry&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The service element is used to define a component representing an exported OSGi service. At a minimum you must specify the managed component to be exported, and the service interface that the service advertises.&lt;br /&gt;&lt;br /&gt;For example&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;service ref="comp" interface="com.xyz.MessageService"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Controlling the set of advertised service interfaces&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The simplest mechanism, shown above, is to use the interface attribute to specify a fully-qualified interface name. To register a service under multiple interfaces the nested interfaces element can be used in place of the interface attribute.&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;service ref="componentToBeExported"&gt;&lt;br /&gt;&amp;lt;interfaces&gt;&lt;br /&gt;&amp;lt;value&gt;com.xyz.MessageService&amp;lt;/value&gt;&lt;br /&gt;&amp;lt;value&gt;com.xyz.MarkerInterface&amp;lt;/value&gt;&lt;br /&gt;&amp;lt;/interfaces&gt;&lt;br /&gt;&amp;lt;/service&gt;&lt;/pre&gt;Using the auto-export attribute you can avoid the need to explicitly declare the service interfaces at all by analyzing the object class hierarchy and its interfaces. The auto-export attribute can have one of four values:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;disabled&lt;/span&gt; : the default value; no auto-detected of service interfaces&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;interfaces&lt;/span&gt; : all of the Java interface types implemented by the component&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;class-hierarchy&lt;/span&gt; : component's implementation type and super-types&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;all-classes&lt;/span&gt; : component's implementation type and super-types plus all interfaces implemented by the component.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Controlling the set of advertised properties&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Additional service properties can be specified using the nested service-properties element.&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;service ref="componentToBeExported" interface="com.xyz.MyServiceInterface"&gt;&lt;br /&gt;&amp;lt;service-properties&gt;&lt;br /&gt;&amp;lt;entry key="myOtherKey" value="aStringValue"/&gt;&lt;br /&gt;&amp;lt;entry key="aThirdKey" value-ref="componentToExposeAsProperty"/&gt;&lt;br /&gt;&amp;lt;service-properties&gt;&lt;br /&gt;&amp;lt;/service&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;The depends-on attribute&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The depends-on attribute can be used to provide a comma-delimited list of component names for components that must be instantiated and configured before the service is published to the registry.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Dealing with service dynamics&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The component defined by a reference element is unchanged throughout the lifetime of the module context (the object reference remains constant). However, the OSGi service that backs the reference may come and go at any time.&lt;br /&gt;&lt;br /&gt;When the service backing a reference component goes away, an attempt is made to replace the backing service with another service matching the reference criteria. If no matching service is available, then the reference is said to be unsatisfied.&lt;br /&gt;&lt;br /&gt;When an operation is invoked on an unsatisfied reference component, the invocation blocks until either the reference becomes satisfied or a timeout expires.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Mandatory dependencies&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An exported service may depend, either directly or indirectly, on other services in order to perform its function. If one of these services is considered a mandatory dependency and the dependency can no longer be satisfied (because the backing service has gone away and there is no suitable replacement&lt;br /&gt;available) then the exported service that depends on it will be automatically unregistered from the service registry.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Service Listeners&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Applications that need to be aware of when a service backing a reference component is bound and unbound, or when a member is added to or removed from a collection, can register one or more listeners using the nested listener element.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;reference id="someService" interface="com.xyz.MessageService"&gt;&lt;br /&gt;&amp;lt;listener bind-method="onBind" unbind-method="onUnbind"&gt;&lt;br /&gt;&amp;lt;component class="MyCustomListener"/&gt;&lt;br /&gt;&amp;lt;/listener&gt;&lt;br /&gt;&amp;lt;/reference&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Namespace Extension Mechanism&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Third parties may contribute additional namespaces containing elements and attributes used to configure the components for a module context.&lt;br /&gt;&lt;br /&gt;In order to be able to interpret elements and attributes declared in third party namespaces, a namespace handler must be registered that the container can delegate to.&lt;br /&gt;&lt;br /&gt;Here an example of a hypothetical "cache" namespace:&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;cache:lru-cache id="myCache"/&gt;&lt;br /&gt;&amp;lt;component id="fooService" class="FooServiceImpl" cache:cache-return-values="true"&gt;&lt;br /&gt;&amp;lt;cache:exclude&gt;&lt;br /&gt;&amp;lt;cache:operation name="getVolatile"/&gt;&lt;br /&gt;&amp;lt;/cache:exclude&gt;&lt;br /&gt;&amp;lt;property name="myProp" value="12"/&gt;&lt;br /&gt;&amp;lt;/component&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Credits&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Adrian Colyer from SpringSource is the author of the Blueprint Service specification.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-9155493180616256651?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/9155493180616256651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/04/osgi-blueprint-service-rfc-124.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/9155493180616256651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/9155493180616256651'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/04/osgi-blueprint-service-rfc-124.html' title='OSGi Blueprint Service (RFC-124)'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MTTbr2TxHjA/SfBtWgfsGdI/AAAAAAAAC6E/JsrHDON-tf0/s72-c/rfc124-solution.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-1618721239167147086</id><published>2009-04-23T09:14:00.035+02:00</published><updated>2009-10-26T08:18:04.243+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>Non intrusive OSGi Bundle Testing</title><content type='html'>For &lt;a href="http://www.jboss.org/community/wiki/JBossOSGi"&gt;JBossOSGi&lt;/a&gt; I was looking for ways to test bundles that are deployed to a remote instance of the &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/distribution/target/auto-install-dest/docs/userguide/html/ChapGettingStarted.html#SecRuntime"&gt;JBossOSGi Runtime&lt;/a&gt;. I wanted the solution to also work with an OSGi Framework that is bootstrapped from within a &lt;a href="http://www.junit.org/"&gt;JUnit &lt;/a&gt;test case.&lt;br /&gt;&lt;br /&gt;The basic problem is of course that you cannot access the artefacts that you deploy in a bundle directly from your test case, because they are loaded from different classloaders.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfAe7uwuraI/AAAAAAAAC5I/a-UAYiYO1J0/s1600-h/osgi-embedded-testing.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 217px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfAe7uwuraI/AAAAAAAAC5I/a-UAYiYO1J0/s320/osgi-embedded-testing.png" alt="" id="BLOGGER_PHOTO_ID_5327792370692828578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Most solutions to the problem somehow bring the test case into the OSGi Framework such that it can access the test bundle. They run the test and finally communicate the results back to the test framework. This approach is well documented in &lt;a href="http://static.springframework.org/osgi/docs/current/reference/html/testing.html"&gt;Chapter 11&lt;/a&gt; of the &lt;a href="http://static.springframework.org/osgi/docs/current/reference/html/"&gt;Spring Dynamic Modules Reference Guide&lt;br /&gt;&lt;/a&gt;&lt;h1 class="title"&gt;&lt;/h1&gt;Lets have a look at the specific JBossOSGi test requirements&lt;br /&gt;&lt;ul&gt;&lt;li&gt;OSGi Framework agnostic&lt;/li&gt;&lt;li&gt;non-intrusive to the test bundle&lt;/li&gt;&lt;li&gt;works for embedded and remote test scenarios&lt;/li&gt;&lt;li&gt;simple and fast to implement&lt;/li&gt;&lt;/ul&gt;To achieve that it seemed natural to leverage what OSGi provides natively in terms of reporting, which would be the Log Service from the OSGi compendium specification. The approach would work like this&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Test Case registers a &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html"&gt;LogListener&lt;/a&gt; with the &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html"&gt;LogReaderService&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Test bundle logs messages to the &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogService.html"&gt;LogService&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Test Case verifies the order and content of the received log messages&lt;/li&gt;&lt;/ol&gt;The &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/distribution/target/auto-install-dest/docs/userguide/html/ChapDeveloperGuide.html#SecSPI"&gt;JBossOSGi SPI&lt;/a&gt; provides a special &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html"&gt;LogListener&lt;/a&gt; in form of the &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/spi/target/apidocs/org/jboss/osgi/spi/logging/LogEntryCache.html"&gt;LogEntryCache&lt;/a&gt; to do the log entry caching, filtering and lookup.&lt;br /&gt;&lt;br /&gt;But let's talk a little detour into the Log Service from the OSGi compendium specification.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfArhmMypkI/AAAAAAAAC50/zC_0HjKBxS0/s1600-h/logservice.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 240px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfArhmMypkI/AAAAAAAAC50/zC_0HjKBxS0/s400/logservice.jpg" alt="" id="BLOGGER_PHOTO_ID_5327806215369172546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LogService&lt;/span&gt; – The service interface that allows a bundle to log information, including a message, a level, an exception, a ServiceReference object, and a Bundle object.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LogEntry&lt;/span&gt; - An interface that allows access to a log entry in the log. It includes all the information that can be logged through the Log Service and a time stamp.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LogReaderService&lt;/span&gt; - A service interface that allows access to a list of  recent LogEntry objects, and allows the registration of a LogListener object that receives LogEntry objects as they are created.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LogListener&lt;/span&gt; - The interface for the listener to LogEntry objects. Must be registered with the Log Reader Service.&lt;br /&gt;&lt;br /&gt;First a test bundle needs to obtain an instance of the LogService. Here is a &lt;span style="font-weight: bold;"&gt;bad way&lt;/span&gt; of doing this&lt;pre style="font-family: courier new; font-size: 78%;"&gt;String sName = LogService.class.getName();&lt;br /&gt;ServiceReference sRef = ctx.getServiceReference(sName);&lt;br /&gt;LogService log = sysContext.getService(sRef);&lt;br /&gt;&lt;/pre&gt;The code above has two issues&lt;br /&gt;&lt;ol&gt;&lt;li&gt;It assumes that there is LogService registered&lt;/li&gt;&lt;li&gt;It does not detect when the LogService disappears&lt;/li&gt;&lt;/ol&gt;Here is a &lt;span style="font-weight: bold;"&gt;better way&lt;/span&gt; of obtaining the LogService&lt;br /&gt;&lt;pre style="font-family: courier new; font-size: 78%;"&gt;String sName = LogService.class.getName();&lt;br /&gt;LogService log = new SystemLogService(context);&lt;br /&gt;tracker = new ServiceTracker(context, sName, null)&lt;br /&gt;{&lt;br /&gt; public Object addingService(ServiceReference reference)&lt;br /&gt; {&lt;br /&gt;   log = (LogService)super.addingService(reference);&lt;br /&gt;   return log;&lt;br /&gt; }&lt;br /&gt; public void removedService(ServiceReference reference, Object service)&lt;br /&gt; {&lt;br /&gt;   super.removedService(reference, service);&lt;br /&gt;   log = new SystemLogService(context);&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;tracker.open();&lt;br /&gt;&lt;/pre&gt;The code above initializes the log instance with the SystemLogService that is part of the &lt;span style="font-weight: bold;"&gt;jboss-osgi-common.jar&lt;/span&gt; bundle. The tracker overrides the log instance when an actual LogService gets registered. The tracker restores the SystemLogService, in case the LogService disappears again.&lt;br /&gt;&lt;br /&gt;This LogService tracking code is so common that the &lt;span style="font-weight: bold;"&gt;jboss-osgi-common.jar&lt;/span&gt; bundle already contains a tracker which does all of the above. Hence, the &lt;span style="font-weight: bold;"&gt;best way&lt;/span&gt; to obtaining the LogService with JBossOSGi ist&lt;pre&gt;&lt;/pre&gt;&lt;blockquote&gt;&lt;pre&gt;LogService log = new LogServiceTracker(context);&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;Now that the test bundle actually has an instance of the LogService it can start logging messages to that service. These messages are seen by the LogReaderService that the test case can register a LogListener with.&lt;br /&gt;&lt;br /&gt;In the test case you would create a new &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/spi/target/apidocs/org/jboss/osgi/spi/logging/LogEntryCache.html"&gt;LogEntryCache&lt;/a&gt; and associate one or more &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/spi/target/apidocs/org/jboss/osgi/spi/logging/LogEntryFilter.html"&gt;LogEntryFilter&lt;/a&gt; objects with it.&lt;br /&gt;&lt;pre&gt;LogEntryCache logEntryCache = new LogEntryCache();&lt;br /&gt;LogEntryFilter filter = new LogEntryFilter("example-log(.*)", 0, null);&lt;br /&gt;logEntryCache.addFilter(filter);&lt;br /&gt;&lt;/pre&gt;The &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/spi/target/apidocs/org/jboss/osgi/spi/logging/LogEntryCache.html"&gt;LogEntryCache&lt;/a&gt; is then added to the &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html"&gt;LogReaderService&lt;/a&gt; using a &lt;a href="http://www.osgi.org/javadoc/r4v41/org/osgi/util/tracker/ServiceTracker.html"&gt;ServiceTracker&lt;/a&gt; similar to the one above. Because the filters are 'or' combined the cache stores log enties that pass at least one filter in the list. Each filter has three filter criteria&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A regular expression that matches a Bundle-SymbolicName&lt;/li&gt;&lt;li&gt;A minimum LogLevel, whereas 0 indicates any LogLevel&lt;/li&gt;&lt;li&gt;A regular expression that matches the log message&lt;/li&gt;&lt;/ol&gt;A test case can now verify the cached log messages like this&lt;br /&gt;&lt;pre&gt;List entries = logEntryCache.getLog();&lt;br /&gt;assertEquals("Number of entries", 1, entries.size());&lt;br /&gt;assertEquals("[ServiceA] new Service", entries.get(0).getMessage());&lt;br /&gt;&lt;/pre&gt;In the remote test scenario it works essentially in the same way, only that a RemoteLogListener sends the LogEnties to a RemoteLogReaderService. The local test case registers it's &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/spi/target/apidocs/org/jboss/osgi/spi/logging/LogEntryCache.html"&gt;LogEntryCache&lt;/a&gt; with the RemoteLogReaderService.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfBPZu1KU7I/AAAAAAAAC58/Z703bwrvP2Q/s1600-h/osgi-remote-testing.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 167px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SfBPZu1KU7I/AAAAAAAAC58/Z703bwrvP2Q/s400/osgi-remote-testing.jpg" alt="" id="BLOGGER_PHOTO_ID_5327845662665626546" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The actual communication is done with the &lt;a href="http://www.jboss.org/jbossremoting/"&gt;JBoss Remoting&lt;/a&gt; socket transport. Both, the RemoteLogListener and the RemoteLogReaderService are part of the &lt;span style="font-weight: bold;"&gt;jboss-osgi-remotelog.jar&lt;/span&gt; bundle. That bundle needs to be installed with matching properties in the local and the remote OSGi Framework.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;org.jboss.osgi.service.remote.log.sender&lt;/span&gt; - Enable the server side LogListener&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;org.jboss.osgi.service.remote.log.reader&lt;/span&gt; - Enable the client side LogReaderService&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;org.jboss.osgi.service.remote.log.host&lt;/span&gt; - The remote host that log messages are sent to&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;org.jboss.osgi.service.remote.log.port&lt;/span&gt; - The remote port that log messages are sent to&lt;/li&gt;&lt;/ul&gt;You may also want to have a look at &lt;a href="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/distribution/target/auto-install-dest/docs/userguide/html/ChapProvidedBundles.html#SecRemoteLogService"&gt;Chapter 5.2 Remote Log Service&lt;/a&gt; of the &lt;a href="http://tinyurl.com/jbossosgi-userguide-latest"&gt;JBossOSGi User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In my next post I'm going to look into the &lt;span style="font-weight: bold;"&gt;Blueprint Service (RFC-124)&lt;/span&gt; specification, which provides a rich component model for declaring components within a bundle and for instantiating, configuring, assembling and decorating such components - stay tuned.&lt;br /&gt;&lt;br /&gt;May this be useful&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-1618721239167147086?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/1618721239167147086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/04/non-intrusive-osgi-bundle-testing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1618721239167147086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1618721239167147086'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/04/non-intrusive-osgi-bundle-testing.html' title='Non intrusive OSGi Bundle Testing'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTTbr2TxHjA/SfAe7uwuraI/AAAAAAAAC5I/a-UAYiYO1J0/s72-c/osgi-embedded-testing.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-1846327288303016521</id><published>2009-04-22T14:14:00.009+02:00</published><updated>2009-10-26T08:18:19.229+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knopflerfish'/><category scheme='http://www.blogger.com/atom/ns#' term='equinox'/><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi 1.0.0.Beta1 Released</title><content type='html'>I am happy to announce the release of JBossOSGi-1.0.0.Beta1.&lt;br /&gt;&lt;br /&gt;You can download it here: &lt;a href="http://downloads.sourceforge.net/jboss/jboss-osgi-installer-1.0.0.Beta1.jar"&gt;jboss-osgi-installer-1.0.0.Beta1.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The release comes with improvements in the following areas&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Added &lt;a href="http://www.eclipse.org/equinox"&gt;Equinox&lt;/a&gt; and &lt;a href="http://www.knopflerfish.org/"&gt;Knopflerfish&lt;/a&gt; integration&lt;/li&gt;&lt;li&gt;Improved test support for remote and embedded scenarios&lt;/li&gt;&lt;li&gt;A set of installer provided OSGi examples&lt;/li&gt;&lt;li&gt;A bundle for remote and local log message filtering&lt;/li&gt;&lt;/ul&gt;For details please have a look at the latest version of our &lt;a href="http://jbmuc.dyndns.org/jboss-osgi-1.0.0.Beta1/userguide/html"&gt;User Guide&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here are the change log details&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Tasks&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-28"&gt;JBOSGI-28&lt;/a&gt;] -         Setup OSGi Framework TCK&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-31"&gt;JBOSGI-31&lt;/a&gt;] -         Integration layer for Equinox&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-32"&gt;JBOSGI-32&lt;/a&gt;] -         Integration layer for Knopflerfish&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-59"&gt;JBOSGI-59&lt;/a&gt;] -         Provide initial Examples&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-63"&gt;JBOSGI-63&lt;/a&gt;] -         Update to Felix HTTP Service (Jetty) 1.0.0&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-64"&gt;JBOSGI-64&lt;/a&gt;] -         Update to Felix Log Service 1.0.0&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-65"&gt;JBOSGI-65&lt;/a&gt;] -         Update to Felix 1.6.0&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Bugs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-36"&gt;JBOSGI-36&lt;/a&gt;] -         Bundle classes leak into system classloader&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-37"&gt;JBOSGI-37&lt;/a&gt;] -         Prevent creation of deployment unit for nested jars&lt;br /&gt;[&lt;a href="https://jira.jboss.org/jira/browse/JBOSGI-40"&gt;JBOSGI-40&lt;/a&gt;] -         Cannot run embedded tests with SecurityManager&lt;br /&gt;&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-1846327288303016521?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/1846327288303016521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/04/jbossosgi-100beta1-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1846327288303016521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/1846327288303016521'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/04/jbossosgi-100beta1-released.html' title='JBossOSGi 1.0.0.Beta1 Released'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-8156793658922252544</id><published>2009-03-30T10:56:00.006+02:00</published><updated>2009-10-26T08:18:19.230+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knopflerfish'/><category scheme='http://www.blogger.com/atom/ns#' term='equinox'/><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi - First Release</title><content type='html'>&lt;div style="font-family: arial;" class="jive-rendered-content"&gt;&lt;p&gt;I am happy to announce the release of &lt;span&gt;JBossOSGi-1.0.0.Alpha3&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;You can download it &lt;span&gt;here: &lt;a class="jive-link-external-small" href="http://downloads.sourceforge.net/jboss/jboss-osgi-installer-1.0.0.Alpha3.jar"&gt;jboss-osgi-installer-1.0.0.Alpha3.jar&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;JBossOSGi-1.0.0.Alpha3 is our first functional release that comes with:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a class="jive-link-external-small" href="http://felix.apache.org/"&gt;Apache Felix&lt;/a&gt; integration &lt;/li&gt;&lt;li&gt;A specialized JBossOSGi Runtime&lt;/li&gt;&lt;li&gt;Integrated Hudson QA&lt;/li&gt;&lt;li&gt;IzPack based Installer&lt;/li&gt;&lt;li&gt;Bundle hot deployment&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Management Console&lt;/li&gt;&lt;li&gt;Docbook Guides&lt;/li&gt;&lt;li&gt;HttpService&lt;/li&gt;&lt;li&gt;LogService&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;You may also what to have a look at the &lt;a class="jive-link-external-small" href="http://jbossosgi.blogspot.com/"&gt;JBossOSGi Diary&lt;/a&gt; blog posts&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a class="jive-link-external-small" href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-getting-started.html"&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class="jive-link-external-small" href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-service-provider-interface.html"&gt;Service Provider Interface&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class="active_link" href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-provided-services.html"&gt;Provided Services&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;Here are the change log details&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Tasks&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-29"&gt;JBOSGI-29&lt;/a&gt;] - Provide Initial Framework SPI&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-30"&gt;JBOSGI-30&lt;/a&gt;] - Integration layer for Apache Felix&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-35"&gt;JBOSGI-35&lt;/a&gt;] - Setup JBoss OSGi download area&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-38"&gt;JBOSGI-38&lt;/a&gt;] - Investigate bundle install/start behaviour with random deployment order&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-41"&gt;JBOSGI-41&lt;/a&gt;] - Verify persistent file storage&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-42"&gt;JBOSGI-42&lt;/a&gt;] - Provide IzPack based Installer&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-43"&gt;JBOSGI-43&lt;/a&gt;] - Hudson QA as integral part of each project release&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-44"&gt;JBOSGI-44&lt;/a&gt;] - Provide bundle hot-deployment on jboss&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-45"&gt;JBOSGI-45&lt;/a&gt;] - Provide minimal JBossOSGi Runtime&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-46"&gt;JBOSGI-46&lt;/a&gt;] - Integrate 3rd party HttpService&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-47"&gt;JBOSGI-47&lt;/a&gt;] - Delegate 3rd party framework logging to jboss logging&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-48"&gt;JBOSGI-48&lt;/a&gt;] - Integrate 3rd party LoggingService&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-49"&gt;JBOSGI-49&lt;/a&gt;] - Integrate 3rd party Management Console&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-50"&gt;JBOSGI-50&lt;/a&gt;] - Provide a docbook guides&lt;/li&gt;&lt;li&gt;[&lt;a class="jive-link-external-small" href="https://jira.jboss.org/jira/browse/JBOSGI-51"&gt;JBOSGI-51&lt;/a&gt;] - Provide a management view (JMX) on framework and bundles&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Enjoy&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-8156793658922252544?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/8156793658922252544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-first-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/8156793658922252544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/8156793658922252544'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-first-release.html' title='JBossOSGi - First Release'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-2993908503356331990</id><published>2009-03-27T11:34:00.013+01:00</published><updated>2009-10-26T08:18:04.244+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='felix'/><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi - Provided Services</title><content type='html'>&lt;span style="font-family:arial;"&gt;This is the last of a the current series of three blogs on JBossOSGi&lt;br /&gt;&lt;/span&gt;&lt;ol style="font-family: arial;"&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-getting-started.html"&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-service-provider-interface.html"&gt;Service Provider Interface&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-provided-services.html"&gt;Provided Services&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Logging Service&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The JBossOSGi &lt;span class="bold"&gt;&lt;strong&gt;jboss-osgi-service-logging.jar&lt;/strong&gt;&lt;/span&gt; bundle contains a simple Logging Bridge Service to     &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.jboss.org/community/docs/DOC-11280"&gt;JBoss Logging&lt;/a&gt;. It registers a trivial LogListener with the      LogReaderService in case that service is registered with the Framework.&lt;div class="itemizedlist"&gt;&lt;ul&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html"&gt;LogListener&lt;/a&gt; - Subscribes to LogEntry objects&lt;/li&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html"&gt;LogReaderService&lt;/a&gt; - Retrieve LogEntry objects&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;The LogReaderService is part of the standard &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.osgi.org/Download/File?url=/download/r4v41/r4.cmpn.pdf"&gt;OSGi      Compendium Services&lt;/a&gt;. JBossOSGi currently uses the (not yet released) LogService from &lt;a xlink="http://www.w3.org/1999/xlink" href="http://felix.apache.org/"&gt;Apache Felix&lt;/a&gt;,      which gets deployed as Bundle &lt;span class="bold"&gt;&lt;strong&gt;org.apache.felix.log.jar&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The LogListener itself logs messages under the Bundle's symbolic name.&lt;/p&gt;&lt;p&gt;You can therefore change the logging for specific Bundles by      &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.jboss.org/community/docs/DOC-12490"&gt;setting the respective logging level&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Microcontainer Service&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a id="SecMicrocontainerService"&gt;JBossOSGi SPI comes with a service that give access to the &lt;/a&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.jboss.org/jbossmc"&gt;JBoss Microcontainer&lt;/a&gt; Kernel     and the JMX &lt;a xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html"&gt;MBeanServer&lt;/a&gt;. The service is      registered with the Framework under the name&lt;/p&gt;&lt;div style="font-family: courier new;" class="itemizedlist"&gt;&lt;blockquote&gt;org.jboss.osgi.service.MicrocontainerService&lt;/blockquote&gt;&lt;/div&gt;&lt;p&gt;Here is an example of how an OSGi component can register an arbitrary MBean with the      &lt;a xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html"&gt;MBeanServer&lt;/a&gt;.&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;String sname = &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;MicrocontainerService.class.getName();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;ServiceReference sref = context.getServiceReference(sname);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;MicrocontainerService service = context.getService(sref);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;MBeanServer server = service.getMbeanServer();&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;server.registerMBean(new Foo(), OBJECT_NAME);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;What is there to come?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The intention of this post was to give information on the JBossOSGi Provided Services. This concludes this series of three blogs. I look forward to your feedback on the &lt;a href="http://www.jboss.org/index.html?module=bb&amp;amp;op=viewforum&amp;amp;f=257"&gt;JBossOSGi User Forum&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In my next post I'm hopefully going to write about the JBossOSGi integration for &lt;a href="http://www.eclipse.org/equinox"&gt;Equniox&lt;/a&gt; and &lt;a href="http://www.knopflerfish.org/"&gt;Knopflerfish&lt;/a&gt; - stay tuned.&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-2993908503356331990?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/2993908503356331990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-provided-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/2993908503356331990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/2993908503356331990'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-provided-services.html' title='JBossOSGi - Provided Services'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-6044874120242020327</id><published>2009-03-27T11:31:00.019+01:00</published><updated>2009-10-26T08:18:04.244+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='felix'/><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi - Service Provider Interface</title><content type='html'>&lt;span style="font-family:arial;"&gt;This is the second of a the current series of three blogs on JBossOSGi&lt;br /&gt;&lt;/span&gt;&lt;ol style="font-family: arial;"&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-getting-started.html"&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-service-provider-interface.html"&gt;Service Provider Interface&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-provided-services.html"&gt;Provided Services&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;The JBossOSGi Service Provider Interface (SPI) is the integration point between the supported OSGi Frameworks and the&lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.jboss.org/jbossmc"&gt;JBoss Microcontainer&lt;/a&gt;. The configuration defines MC beans for the      framework itself and its associated deployers.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SczWiEWZa6I/AAAAAAAAC20/RwHt0yk_mWQ/s1600-h/jboss-osgi.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 284px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SczWiEWZa6I/AAAAAAAAC20/RwHt0yk_mWQ/s320/jboss-osgi.png" alt="" id="BLOGGER_PHOTO_ID_5317861140789291938" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;The latest version of the &lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc"&gt;JBossOSGi SPI&lt;/a&gt;      JavaDoc is published online as part of the JBossOSGi &lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson"&gt;Hudson QA Environment&lt;/a&gt;.&lt;/p&gt;&lt;div class="itemizedlist"&gt;&lt;ul&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc/org/jboss/osgi/service/package-summary.html"&gt;org.jboss.osgi.service&lt;/a&gt; - SPI provided services&lt;/li&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc/org/jboss/osgi/spi/package-summary.html"&gt;org.jboss.osgi.spi&lt;/a&gt; - Common classes and interfaces&lt;/li&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc/org/jboss/osgi/spi/framework/package-summary.html"&gt;org.jboss.osgi.spi.framework&lt;/a&gt; - Framework integration&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc/org/jboss/osgi/spi/junit/package-summary.html"&gt;org.jboss.osgi.spi.junit&lt;/a&gt; - JUnit test integration&lt;/li&gt;&lt;li&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc/org/jboss/osgi/spi/management/package-summary.html"&gt;org.jboss.osgi.spi.management&lt;/a&gt; -  Management view&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span class="bold"&gt;&lt;strong&gt;Bootstrapping JBossOSGi&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The OSGiBootstrap provides an OSGiFramework through a OSGiBootstrapProvider.&lt;/p&gt;&lt;p&gt;A OSGiBootstrapProvider is discovered in two stages&lt;/p&gt;&lt;div rf="java:org.jboss.highlight.XhtmlRendererFactory" class="orderedlist"&gt;&lt;ol&gt;&lt;li&gt;Read the bootstrap provider class name from a system property&lt;/li&gt;&lt;li&gt;Read the bootstrap provider class name from a resource file&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;p&gt;In both cases the key is the fully qalified name of the &lt;code class="code"&gt;org.jboss.osgi.spi.framework.OSGiBootstrapProvider&lt;/code&gt; interface.&lt;/p&gt;&lt;p&gt;The following code shows how to get the default OSGiFramework from the OSGiBootstrapProvider.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;    &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;OSGiBootstrapProvider boot = OSGiBootstrap.getBootstrapProvider();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    OSGiFramework fw = boot.getFramework();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    Bundle bundle = fw.getSystemBundle();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;The OSGiBootstrapProvider can also be configured explicitly. The OSGiFramework is a named      object from the configuration.&lt;p&gt;&lt;/p&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;OSGiBootstrapProvider boot = OSGiBootstrap.getBootstrapProvider();&lt;br /&gt;boot.configure(configURL);&lt;br /&gt;&lt;br /&gt;OSGiFramework fw = boot.getFramework("MyOSGiFramework");&lt;br /&gt;Bundle bundle = fw.getSystemBundle();&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;The JBossOSGi SPI comes with a OSGiBootstrapProvider that uses a &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.jboss.org/jbossmc"&gt;JBoss Microcontainer&lt;/a&gt;      bean configuration.&lt;br /&gt;&lt;br /&gt;OSGiBootstrapProvider implementations that read their configurtation from some other source are possible, but currently not     part of the JBossOSGi SPI.&lt;div rf="java:org.jboss.highlight.XhtmlRendererFactory" class="tip"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;span style="font-weight: bold;"&gt;Using the SPI from within JBossAS deployed components&lt;/span&gt;&lt;p&gt;If you need access to the OSGi Framework from within an JBossAS deployed component (e.g. servlet, ejb, mbean) you        &lt;span class="bold"&gt;&lt;strong&gt;would not&lt;/strong&gt;&lt;/span&gt; bootstrap JBossOSGi through the SPI. Instead, you would inject the already bootstrapped       OSGi Framework instance into your component.&lt;br /&gt;&lt;/p&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Bundle Deployers&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;JBossOSGi comes with a number of &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.jboss.org/jbossmc"&gt;JBoss Microcontainer&lt;/a&gt; based deployers. Each deployer     takes care of a specific aspect of bundle deployment.&lt;div class="itemizedlist"&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleMetaDataDeployer&lt;/strong&gt;&lt;/span&gt; - Create BundleMetaData from Manifest Headers&lt;/li&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleRealDeployer&lt;/strong&gt;&lt;/span&gt; - Installs the Bundle into the Framework's SystemContext&lt;/li&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleClassLoaderDeployer&lt;/strong&gt;&lt;/span&gt; - Creates a BundleClassLoader for the deployed Bundle&lt;/li&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleStartStopDeployer&lt;/strong&gt;&lt;/span&gt; - Starts the Bundle when dependencies are resolved&lt;/li&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleManagementDeployer&lt;/strong&gt;&lt;/span&gt; - Register the Bundle as MBean with JMX&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleMetaDataDeployer&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The BundleMetaDataDeployer creates the BundleMetaData from Manifest Headers. If the manifest does not contain      a header named &lt;span class="bold"&gt;&lt;strong&gt;Bundle-SymbolicName&lt;/strong&gt;&lt;/span&gt; this deployer does nothing. &lt;/p&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleRealDeployer&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The BundleRealDeployer installs the Bundle into the Framework's SystemContext. Optionally you can configure a list of     bundle locations that should be skipped and hence not installed. Typically, these bundles are already installed during      Framework startup.&lt;/p&gt;&lt;p&gt;On undeploy the Bundle gets uninstalled from the Framework's SystemContext.&lt;/p&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleClassLoaderDeployer&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The BundleClassLoaderDeployer attaches a ClassLoaderFactory that creates a BundleClassLoader for the deployed Bundle.     A BundleClassLoader delegates all classloading concerns to the underlying Bundle.&lt;/p&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleStartStopDeployer&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The BundleStartStopDeployer currently works in two modes:&lt;/p&gt;&lt;div class="itemizedlist"&gt;&lt;ul&gt;&lt;li&gt;deferredStart (default)&lt;/li&gt;&lt;li&gt;simpleStart&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;In mode &lt;span class="bold"&gt;&lt;strong&gt;deferredStart&lt;/strong&gt;&lt;/span&gt; the Bundle is added to a list of unresolved Bundles, which then get passed     on to &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.osgi.org/javadoc/r4v41/org/osgi/service/packageadmin/PackageAdmin.html#resolveBundles%28org.osgi.framework.Bundle%5B%5D%29"&gt;&lt;code class="code"&gt;PackageAdmin.resolveBundles(Bundle[])&lt;/code&gt;&lt;/a&gt;.     The deployer then iterates over the unresolved Bundles and only starts those Bundles that are in state      &lt;a xlink="http://www.w3.org/1999/xlink" href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/Bundle.html#RESOLVED"&gt;&lt;code class="code"&gt;RESOLVED&lt;/code&gt;&lt;/a&gt;. In this mode Bundles can be deployed in any order and only get started when all their respective dependencies can be resolved.&lt;/p&gt;&lt;p&gt;In mode &lt;span class="bold"&gt;&lt;strong&gt;simpleStart&lt;/strong&gt;&lt;/span&gt; the deployer attempts to start the Bundle regardless of whether its dependencies can get resolved. In case the Bundle has a dependency oin a package that is not yet available, deployment will fail. In this mode Bundles must be deployed in the order required to start them.&lt;/p&gt;&lt;p&gt;The start mode is a configurable property on the Framework's SystemContext.&lt;/p&gt;&lt;p&gt;&lt;span class="bold"&gt;&lt;strong&gt;BundleManagementDeployer&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The BundleManagementDeployer registers the Bundle as &lt;a xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/StandardMBean.html"&gt;StandardMBean&lt;/a&gt; with JMX.     Please see the section on &lt;a href="file:///home/tdiesler/svn/jboss-osgi/trunk/build/docbook/target/docbook/publish/en-US/html/ChapDeveloperGuide.html#SecJMXView" title="4.3. Management View"&gt;Management View&lt;/a&gt; for details.&lt;/p&gt;&lt;p style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Management View&lt;/span&gt;&lt;/p&gt;&lt;p&gt;JBossOSGi &lt;a id="SecJMXView"&gt;registers the Framework and every deployed Bundle with the JMX &lt;/a&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html"&gt;MBeanServer&lt;/a&gt;.&lt;/p&gt;&lt;span class="bold"&gt;&lt;strong&gt;The ManagedFramework&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The ManagedFramework gives you access to the MBean views of the deployed Bundles. It is registerd under the name:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote style="font-family: courier new;"&gt;jboss.osgi:service=ManagedFramework&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;The ManagedBundle&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div style="text-align: left;" class="itemizedlist"&gt;&lt;span class="bold"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The ManagedBundle gives you access to the MBean views of a deployed Bundle. It is registerd under the name:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote style="font-family: courier new;"&gt;jboss.osgi:bundle=[SymbolicName],id=[BundleId]&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Accessing the Management Objects&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;span style="font-weight: bold;" class="bold"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;If you work with the JBossOSGi Testsuite you get access to the Managed Objects through the JBossOSGi SPI provided      &lt;a xlink="http://www.w3.org/1999/xlink" href="http://junit.sourceforge.net/"&gt;JUnit&lt;/a&gt; support package &lt;a xlink="http://www.w3.org/1999/xlink" href="http://jbmuc.dyndns.org:8280/hudson/job/Container-JDK1.6/javadoc/org/jboss/osgi/spi/junit/package-summary.html"&gt;org.jboss.osgi.spi.junit&lt;/a&gt;.     &lt;/p&gt;&lt;p&gt;If you install JBossOSGi in an already existing JBossAS instance you also get access to the Managed Objects through the JBoss provided JMX Console (&lt;a xlink="http://www.w3.org/1999/xlink" href="http://localhost:8080/jmx-console"&gt;http://localhost:8080/jmx-console&lt;/a&gt;).&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/Sczc1wp0reI/AAAAAAAAC28/FoXY-7zjwik/s1600-h/jmx-agent-view.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 152px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/Sczc1wp0reI/AAAAAAAAC28/FoXY-7zjwik/s320/jmx-agent-view.png" alt="" id="BLOGGER_PHOTO_ID_5317868076169211362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The JMX Console is &lt;span class="bold"&gt;&lt;strong&gt;not part&lt;/strong&gt;&lt;/span&gt; of the JBossOSGi Runtime.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 130%;"&gt;What is there to come?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The intention of this post was to provide information the JBossOSGi SPI.&lt;br /&gt;&lt;br /&gt;In my next post I'm going to write about the JBossOSGi Provided Services - stay tuned.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-6044874120242020327?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/6044874120242020327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-service-provider-interface.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/6044874120242020327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/6044874120242020327'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-service-provider-interface.html' title='JBossOSGi - Service Provider Interface'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MTTbr2TxHjA/SczWiEWZa6I/AAAAAAAAC20/RwHt0yk_mWQ/s72-c/jboss-osgi.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-7493122837615674214</id><published>2009-03-27T11:25:00.038+01:00</published><updated>2009-10-26T08:18:04.244+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='felix'/><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi - Getting Started</title><content type='html'>This is the first of a the current series of three blogs on JBossOSGi&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-getting-started.html"&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-service-provider-interface.html"&gt;Service Provider Interface&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jbossosgi.blogspot.com/2009/03/jbossosgi-provided-services.html"&gt;Provided Services&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Installing JBossOSGi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a id="SecInstall"&gt;JBossOSGi is distributed as an &lt;/a&gt;&lt;a xlink="http://www.w3.org/1999/xlink" href="http://izpack.org/"&gt;IzPack&lt;/a&gt; installer archive.      The installer is available from the JBossOSGi &lt;a xlink="http://www.w3.org/1999/xlink" href="https://sourceforge.net/project/showfiles.php?group_id=22866&amp;amp;package_id=316015"&gt;download area&lt;/a&gt;.&lt;/p&gt;To run the installer execute the following command:&lt;br /&gt;&lt;pre class="programlisting"&gt; java -jar jboss-osgi-installer-1.0.0.Alpha3.jar&lt;br /&gt;&lt;/pre&gt;The installer first shows a welcome screen&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SczFcHvNKuI/AAAAAAAAC2c/CDq1wr6RPmE/s1600-h/izpack-welcome.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 124px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SczFcHvNKuI/AAAAAAAAC2c/CDq1wr6RPmE/s320/izpack-welcome.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842346921765602" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then you select the installation path for the JBossOSGi distribution. This is the directory where you find the binary build artifacts, the java sources, documentation and the JBossOSGi Runtime.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SczFNVOnWGI/AAAAAAAAC10/T90unZA04iE/s1600-h/izpack-installpath.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 124px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SczFNVOnWGI/AAAAAAAAC10/T90unZA04iE/s320/izpack-installpath.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842092845127778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The installer contains multiple installation packs. Greyed packs are required, others are optional and can be deselected.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_MTTbr2TxHjA/SczFNvaQY5I/AAAAAAAAC2E/ehuQevz5FgI/s1600-h/izpack-packs.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 186px;" src="http://1.bp.blogspot.com/_MTTbr2TxHjA/SczFNvaQY5I/AAAAAAAAC2E/ehuQevz5FgI/s320/izpack-packs.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842099873276818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="itemizedlist"&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;JBossOSGi Distribution&lt;/strong&gt;&lt;/span&gt; - Documentation, Binary Artifacts and Sources&lt;/li&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;JBossOSGi Runtime&lt;/strong&gt;&lt;/span&gt; - Standalone JBossOSGi Runtime based on JBossAS&lt;/li&gt;&lt;li&gt;&lt;span class="bold"&gt;&lt;strong&gt;JBossOSGi Integration&lt;/strong&gt;&lt;/span&gt; - Integration with an existing JBossAS instance&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;In case you have selected 'JBossOSGi Integration', you will be presented with the choice of supported target containers.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SczFNjIWjrI/AAAAAAAAC2M/RpgYq1sNDMM/s1600-h/izpack-target-server.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 160px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SczFNjIWjrI/AAAAAAAAC2M/RpgYq1sNDMM/s320/izpack-target-server.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842096576958130" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;You will then have to point the installer to your existing &lt;a xlink="http://www.w3.org/1999/xlink" href="http://http//jboss.org/jbossas"&gt;JBossAS&lt;/a&gt; installation.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SczFNbZaakI/AAAAAAAAC18/g-MaiPdqOF0/s1600-h/izpack-jboss-home.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 107px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SczFNbZaakI/AAAAAAAAC18/g-MaiPdqOF0/s320/izpack-jboss-home.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842094501030466" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;You can then verify the selected installation options and proceed with the actual installation.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SczFb4PiNWI/AAAAAAAAC2U/7lmqYil_p8o/s1600-h/izpack-verify.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 162px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SczFb4PiNWI/AAAAAAAAC2U/7lmqYil_p8o/s320/izpack-verify.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842342762394978" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The installer reports its installation progress and finally displays a confirmation screen. You can now optionally generate an "automatic installation script" that you can use when you want to repeat what you have just done without user interaction.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SczFNMHrVYI/AAAAAAAAC1s/W77SVxGbtkE/s1600-h/izpack-done.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 162px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SczFNMHrVYI/AAAAAAAAC1s/W77SVxGbtkE/s320/izpack-done.jpg" alt="" id="BLOGGER_PHOTO_ID_5317842090400109954" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;JBossOSGi Runtime&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you selected 'JBossOSGi Runtime' during installation you should see a runtime folder, which contains      the JBossOSGi Runtime distribution.&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/_MTTbr2TxHjA/ScyxwNFZ8PI/AAAAAAAAC04/K4yGm-UOXa0/izpack-structure.jpg"&gt;&lt;img style="cursor: pointer; width: 227px; height: 403px;" src="http://lh6.ggpht.com/_MTTbr2TxHjA/ScyxwNFZ8PI/AAAAAAAAC04/K4yGm-UOXa0/izpack-structure.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a id="SecRuntime"&gt;&lt;/a&gt;&lt;/p&gt;The JBossOSGi Runtime is a customized version of the &lt;a href="http://www.jboss.org/jbossas"&gt;JBoss Application Server&lt;/a&gt;. From that we removed the services that are not absolutely necessary to run the installed OSGi Framework. Consequently, you can start the JBossOSGi Runtime in the same way as you start &lt;a href="http://www.jboss.org/jbossas"&gt;JBossAS&lt;/a&gt;.&lt;br /&gt;&lt;pre class="programlisting"&gt;&lt;br /&gt;[tdiesler@tdvaio runtime]$ bin/run.sh&lt;br /&gt;=========================================================================&lt;br /&gt;JBoss Bootstrap Environment&lt;br /&gt;JBOSS_HOME: /usr/java/jboss-osgi-1.0.0.Alpha3/runtime&lt;br /&gt;...&lt;br /&gt;=========================================================================&lt;br /&gt;[ServerImpl] Starting JBoss (Microcontainer)...&lt;br /&gt;...&lt;br /&gt;[FelixIntegration] OSGi Integration Felix - 1.0.0.Alpha3&lt;br /&gt;[FelixIntegration] Installed bundle: org.osgi.compendium&lt;br /&gt;[FelixIntegration] Installed bundle: org.jboss.osgi.service.logging&lt;br /&gt;[FelixIntegration] Started bundle: org.osgi.compendium&lt;br /&gt;[FelixIntegration] Started bundle: org.jboss.osgi.service.logging&lt;br /&gt;[OSGiDeployer] Installed: jboss-osgi-service-webconsole [3][INSTALLED]&lt;br /&gt;[OSGiDeployer] Installed: org.apache.felix.bundlerepository [4][INSTALLED]&lt;br /&gt;[OSGiDeployer] Installed: org.apache.felix.configadmin [5][INSTALLED]&lt;br /&gt;[OSGiDeployer] Installed: org.apache.felix.http.jetty [6][INSTALLED]&lt;br /&gt;[OSGiDeployer] Installed: org.apache.felix.log [7][INSTALLED]&lt;br /&gt;[OSGiDeployer] Installed: org.apache.felix.metatype [8][INSTALLED]&lt;br /&gt;...&lt;br /&gt;[ServerImpl] JBoss (Microcontainer) [5.0.1.GA] &lt;span class="bold"&gt;&lt;strong&gt;Started in 11s:645ms&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Bundle Deployment&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Bundle deployment works, as you would probably expect, by dropping your OSGi Bundle into the      JBossOSGi Runtime deploy folder.&lt;br /&gt;&lt;pre class="programlisting"&gt;cp .../test-libs/jbosgi36-bundle.jar .../server/default/deploy&lt;br /&gt;&lt;br /&gt;[OSGiDeployer] Installed: jbosgi36 [9][INSTALLED]&lt;br /&gt;[jbosgi36] BundleEvent INSTALLED&lt;br /&gt;[jbosgi36] BundleEvent RESOLVED&lt;br /&gt;[jbosgi36] ServiceEvent REGISTERED&lt;br /&gt;[jbosgi36] BundleEvent STARTED&lt;br /&gt;[BundleStartStopDeployer] Started: jbosgi36 [9][ACTIVE]&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Managing installed Bundles&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;JBossOSGi comes with a simple Web Console, which is currently based on the      &lt;a href="http://felix.apache.org/site/apache-felix-web-console.html"&gt;Apache Felix Web Console&lt;/a&gt; project.      By default the JBossOSGi Web Console is available at&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;a href="http://localhost:8090/jboss-osgi"&gt;http://localhost:8090/jboss-osgi&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_MTTbr2TxHjA/SczFc5lj13I/AAAAAAAAC2s/wL7_pXWOabY/s1600-h/webconsole.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 215px;" src="http://1.bp.blogspot.com/_MTTbr2TxHjA/SczFc5lj13I/AAAAAAAAC2s/wL7_pXWOabY/s320/webconsole.png" alt="" id="BLOGGER_PHOTO_ID_5317842360303081330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="bold"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Hudson QA Environment&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Setup the Hudson QA Environment&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;The JBossOSGi &lt;a href="http://jbmuc.dyndns.org:8280/hudson"&gt;Hudson QA Environment&lt;/a&gt; is an integral part of the JBossOSGi code base.     It is designed for simplicity because we believe that comprehensive QA will only get done if it is dead simple to do so.&lt;/p&gt;&lt;p&gt;Consequently, you only have to execute two simple ant targets to setup the QA environment that was used to QA the JBossOSGi     release that you currently work with.&lt;/p&gt;&lt;p&gt;If in future we should discover a problem with a previous JBossOSGi release, it will be possible to provide a patch and verify that change using the original QA environment for that release.&lt;/p&gt;&lt;p&gt;With every release we test the matrix of supported target containers and JDKs.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SczFcrMWpDI/AAAAAAAAC2k/1hzHMy-rT-s/s1600-h/hudson-home.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 222px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SczFcrMWpDI/AAAAAAAAC2k/1hzHMy-rT-s/s320/hudson-home.png" alt="" id="BLOGGER_PHOTO_ID_5317842356439262258" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;span class="bold"&gt;&lt;strong&gt;Set Hudson Properties&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;You need to set a few properties, especially these&lt;/p&gt;&lt;div class="itemizedlist"&gt;&lt;ul&gt;&lt;li&gt;hudson.maven.path&lt;/li&gt;&lt;li&gt;hudson.username&lt;/li&gt;&lt;li&gt;hudson.password&lt;/li&gt;&lt;li&gt;hudson.root&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span class="bold"&gt;&lt;strong&gt;Run Hudson Setup&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;pre class="programlisting"&gt;[tdiesler@tdvaio hudson]$ ant hudson-setup&lt;br /&gt;&lt;br /&gt;hudson-setup:&lt;br /&gt;[copy] Copying 2 files to /home/.../hudson/jboss-osgi/apache-tomcat&lt;br /&gt;...&lt;br /&gt;[echo]&lt;br /&gt;[echo] *************************************&lt;br /&gt;[echo] * Hudson setup successfully         *&lt;br /&gt;[echo] * ant hudson-start                  *&lt;br /&gt;[echo] *************************************&lt;br /&gt;[echo]&lt;br /&gt;&lt;/pre&gt;&lt;span class="bold"&gt;&lt;strong&gt;Run Hudson Start&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;pre class="programlisting"&gt;[tdiesler@tdvaio hudson]$ ant hudson-start&lt;br /&gt;&lt;br /&gt;hudson-start:&lt;br /&gt;[echo]&lt;br /&gt;[echo] *************************************&lt;br /&gt;[echo] * Hudson started successfully       *&lt;br /&gt;[echo] * http://localhost:8280/hudson      *&lt;br /&gt;[echo] *************************************&lt;br /&gt;[echo]&lt;br /&gt;&lt;/pre&gt;&lt;span class="bold"&gt;&lt;strong&gt;Run Hudson Stop&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;pre class="programlisting"&gt;[tdiesler@tdvaio hudson]$ ant hudson-stop&lt;br /&gt;&lt;br /&gt;hudson-stop:&lt;br /&gt;[echo]&lt;br /&gt;[echo] *************************************&lt;br /&gt;[echo] * Hudson stopped successfully       *&lt;br /&gt;[echo] * ant hudson-start                  *&lt;br /&gt;[echo] *************************************&lt;br /&gt;[echo]&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;What is there to come?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The intention of this blog post was to provide folks with the information to get started with JBossOSGi.&lt;br /&gt;&lt;br /&gt;In my next post I'm going to write about the JBossOSGi Service Provider Interface - stay tuned.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-7493122837615674214?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/7493122837615674214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-getting-started.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/7493122837615674214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/7493122837615674214'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/03/jbossosgi-getting-started.html' title='JBossOSGi - Getting Started'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MTTbr2TxHjA/SczFcHvNKuI/AAAAAAAAC2c/CDq1wr6RPmE/s72-c/izpack-welcome.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5377918349766062036.post-8238078789791076584</id><published>2009-02-12T11:15:00.004+01:00</published><updated>2009-10-26T08:18:04.245+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='felix'/><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>JBossOSGi - Technology Overview</title><content type='html'>&lt;span style="font-family:arial;"&gt;The &lt;/span&gt;&lt;a style="font-family: arial;" href="http://www2.osgi.org/Release4/HomePage"&gt;Open Services Gateway Initiative (OSGi)&lt;/a&gt;&lt;span style="font-family:arial;"&gt;, specifications define a standardized, component-oriented, computing environment for networked services that is the foundation of an enhanced service-oriented architecture.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The OSGi specification defines two things:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-family: arial;"&gt;&lt;li&gt;A set of services that an OSGi container must implement&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A contract between the container and your application&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;"&gt;Developing on the OSGi platform means first building your application using OSGi APIs, then deploying it in an OSGi container.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:arial;" &gt;What does OSGi offer to Java developers?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSGi modules provide classloader semantics to partially expose code that can then be consumed by other modules. The implementation details of a module, although scoped public by the Java programming language, remain private to the module. On top of that you can install multiple versions of the same code and resolve dependencies by version and other criteria. OSGi also offers advanced security and lifecycle, which I'll explain in more detail further down.&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;&lt;br /&gt;&lt;br /&gt;What kind of applications benefit from OSGi?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Any application that is designed in a modular fashion where it is necessary to start, stop, update individual modules with minimal impact on other modules. Modules can define their own transitive dependencies without the need to resolve these dependencies at the container level. The OSGi platform builds an exellent foundation for the next generation JBoss ESB for example.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;Should Java EE developers adopt the OSGi programming model?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Probably not. The OSGi runtime may be used internally by Java EE container providers to achieve the desired isolation and configuration flexibility that the container whishes to provide. At the application programming level, the Java EE model will continue to exist in its own right, wheras the OSGi model may provide the more suitable runtime environment for applications that require the modular isolation, security and lifecycle management that OSGi offers.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:arial;font-size:130%;"  &gt;OSGi Framework Overview&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The functionality of the Framework is divided in the following layers:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-family: arial;"&gt;&lt;li&gt;Security Layer&lt;/li&gt;&lt;li&gt;Module Layer&lt;/li&gt;&lt;li&gt;Life Cycle Layer&lt;/li&gt;&lt;li&gt;Service Layer&lt;/li&gt;&lt;li&gt;Actual Services&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: left; font-family: arial;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SZlgAeDdfRI/AAAAAAAACt0/OED4i8KLDjo/s1600-h/osgi-layers.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 276px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SZlgAeDdfRI/AAAAAAAACt0/OED4i8KLDjo/s320/osgi-layers.png" alt="" id="BLOGGER_PHOTO_ID_5303375597389315346" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;OSGi Security Layer&lt;/span&gt; is an optional layer that underlies the OSGi Service Platform. The layer is based on the Java 2 security architecture. It provides the infrastructure to deploy and manage applications that must run in fine grained controlled environments.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The OSGi Service Platform can authenticate code in the following ways:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-family: arial;"&gt;&lt;li&gt;By location&lt;/li&gt;&lt;li&gt;By signer&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;"&gt;For example, an Operator can grant the ACME company the right to use networking on their devices. The ACME company can then use networking in every bundle they digitally sign and deploy on the Operator’s device. Also, a specific bundle can be granted permission to only manage the life cycle of bundles that are signed by the ACME company.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left; font-family: arial;"&gt;                                               &lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SZld3GQ7qgI/AAAAAAAACtg/c0uH8aaApNU/s1600-h/osgi-delegation.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 197px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SZld3GQ7qgI/AAAAAAAACtg/c0uH8aaApNU/s320/osgi-delegation.png" alt="" id="BLOGGER_PHOTO_ID_5303373237361289730" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The OSGi &lt;span style="font-weight: bold;"&gt;Module Layer&lt;/span&gt; provides a generic and standardized solution for Java modularization. The Framework defines a unit of modularization, called a bundle. A bundle is comprised of Java classes and other resources, which together can provide functions to end users. Bundles can share Java packages among an exporter bundle and an importer bundle in a well-defined way.&lt;br /&gt;&lt;br /&gt;Once a &lt;span style="font-weight: bold;"&gt;Bundle&lt;/span&gt; is started, its functionality is provided and services are exposed to other bundles installed in the OSGi Service Platform. A bundle can carry descriptive information about itself in the manifest file that is contained in its JAR file. Here are a few important &lt;span style="font-weight: bold;"&gt;Manifest Headers&lt;/span&gt; defined by the OSGi Framework:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Bundle-Activator&lt;/span&gt; - class used to start, stop the bundle&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Bundle-SymbolicName&lt;/span&gt; - identifies the bundle&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Bundle-Version&lt;/span&gt; - specifies the version of the bundle&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Export-Package&lt;/span&gt; - declaration of exported packages&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Import-Package&lt;/span&gt; - declaration of imported packages&lt;/li&gt;&lt;/ul&gt;The notion of OSGi &lt;span style="font-weight: bold;"&gt;Version Range&lt;/span&gt; describes a range of versions using a mathematical interval notation. For example&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;Import-Package: com.acme.foo;version="[1.23, 2)",&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; com.acme.bar;version="[4.0, 5.0)"&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;With the OSGi &lt;span style="font-weight: bold;"&gt;Class Loading Architecture&lt;/span&gt; many bundles can share a single virtual machine (VM). Within this VM, bundles can hide packages and classes from other bundles, as well as share packages with other bundles.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SZlhC_TZxuI/AAAAAAAACuA/lI3djNYbhFo/s1600-h/osgi-classloader.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 261px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SZlhC_TZxuI/AAAAAAAACuA/lI3djNYbhFo/s320/osgi-classloader.png" alt="" id="BLOGGER_PHOTO_ID_5303376740185917154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For example, the following import and export definition resolve correctly because the version range in the import definition matches the version in the export definition:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;   &lt;span style="font-family:courier new;"&gt;A: Import-Package: p; version="[1,2)"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;B: Export-Package: p; version=1.5.1&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SZlh8cVBWuI/AAAAAAAACuI/jXg-3ISRFuI/s1600-h/osgi-version-constraint.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 102px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SZlh8cVBWuI/AAAAAAAACuI/jXg-3ISRFuI/s320/osgi-version-constraint.png" alt="" id="BLOGGER_PHOTO_ID_5303377727229876962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Appart from bundle versions, OSGi &lt;span style="font-weight: bold;"&gt;Attribute Matching&lt;/span&gt; is a generic mechanism to allow the importer and exporter to influence the matching process in a declarative way.  For example, the following statements will match.&lt;br /&gt;&lt;blockquote&gt;   &lt;span style="font-family:courier new;"&gt;A: Import-Package: com.acme.foo;company=ACME&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;B: Export-Package: com.acme.foo;company=ACME;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     security=false&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;An exporter can limit the visibility of the classes in a package with the &lt;span style="font-weight: bold;"&gt;include and exclude directives&lt;/span&gt; on the export definition.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;Export-Package: com.acme.foo; include:="Qux*,BarImpl";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  exclude:=QuxImpl&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Life Cycle Layer&lt;/span&gt; provides an API to control the security and life cycle operations of bundles.&lt;br /&gt;&lt;br /&gt;A bundle can be in one of the following states:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTTbr2TxHjA/SZll8bwLSII/AAAAAAAACuc/pEiBdu0PcSw/s1600-h/osgi-life-cycle.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 214px;" src="http://4.bp.blogspot.com/_MTTbr2TxHjA/SZll8bwLSII/AAAAAAAACuc/pEiBdu0PcSw/s320/osgi-life-cycle.png" alt="" id="BLOGGER_PHOTO_ID_5303382125121849474" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A bundle is activated by calling its &lt;span style="font-weight: bold;"&gt;Bundle Activator&lt;/span&gt; object, if one exists. The BundleActivator interface defines methods that the Framework invokes when it starts and stops the bundle.&lt;br /&gt;&lt;br /&gt;A &lt;span style="font-weight: bold;"&gt;Bundle Context&lt;/span&gt; object represents the execution context of a single bundle within the OSGi Service Platform, and acts as a proxy to the underlying Framework. A Bundle Context object is created by the Framework when a bundle is started. The bundle can use this private BundleContext object for the following purposes:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Installing new bundles into the OSGi environment&lt;/li&gt;&lt;li&gt;Interrogating other bundles installed in the OSGi environment&lt;/li&gt;&lt;li&gt; Obtaining a persistent storage area&lt;/li&gt;&lt;li&gt;Retrieving service objects of registered services&lt;/li&gt;&lt;li&gt;Registering services in the Framework service&lt;/li&gt;&lt;li&gt;Subscribing or unsubscribing to Famework events&lt;/li&gt;&lt;/ul&gt;The OSGi &lt;span style="font-weight: bold;"&gt;Service Layer&lt;/span&gt; defines a dynamic collaborative model that is highly integrated with the Life Cycle Layer. The service model is a publish, find and bind model. A service is a normal Java object that is registered under one or more Java interfaces with the service registry.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTTbr2TxHjA/SZln0kM4L3I/AAAAAAAACuk/yQ_f5NZMjnY/s1600-h/osgi-service-registration.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 185px;" src="http://2.bp.blogspot.com/_MTTbr2TxHjA/SZln0kM4L3I/AAAAAAAACuk/yQ_f5NZMjnY/s320/osgi-service-registration.png" alt="" id="BLOGGER_PHOTO_ID_5303384188974018418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;The &lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;OSGi Service Compendium&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The OSGi Service Compendium specifies a number of services that may be available in an OSGi runtime environment. Although the OSGi Framework specification is useful in itself already, it only defines the OSGi core infrastructure. The services defined in the compendium specification define the scope and functionality of some common services that bundle developers might want to use. Here is a quick summary:&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Log Service &lt;/span&gt;provides a general purpose message logger for the OSGi Service Platform. It consists of two services, one for logging information and another for retrieving current or previously recorded log information.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Http Service&lt;/span&gt; supports two standard techniques for registering servlets and resources to develop communication and user interface solutions for standard technologies such as HTTP, HTML, XML, etc.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Device Access&lt;/span&gt; specification supports the coordination of automatic detection and attachment of existing devices on an OSGi Service Platform, facilitates hot-plugging and -unplugging of new devices, and downloads and installs device drivers on demand.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Configuration Admin&lt;/span&gt; service allows an Operator to set the configuration information of deployed bundles.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTTbr2TxHjA/SZlrnco27zI/AAAAAAAACus/nuFK2e9D0no/s1600-h/osgi-config-service.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 181px;" src="http://3.bp.blogspot.com/_MTTbr2TxHjA/SZlrnco27zI/AAAAAAAACus/nuFK2e9D0no/s320/osgi-config-service.png" alt="" id="BLOGGER_PHOTO_ID_5303388361652105010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;The &lt;span style="font-weight: bold;"&gt;Metatype Service&lt;/span&gt; specification defines interfaces that allow bundle developers to describe attribute types in a computer readable form using so-called &lt;span style="font-style: italic;"&gt;metadata&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Preferences Service&lt;/span&gt; allows storage of data that is specific to a particular user.&lt;br /&gt;&lt;br /&gt;Bundles can use the &lt;span style="font-weight: bold;"&gt;User Admin Service&lt;/span&gt; to authenticate an initiator and represent this authentication as an Authorization object. Bundles that execute actions on behalf of this user can use the Authorization object to verify if that user is authorized.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Wire Admin Service &lt;/span&gt;is an administrative service that is used to control a wiring topology in the OSGi Service Platform. It is intended to be used by user interfaces or management programs that control the wiring of services in an OSGi Service Platform.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;IO Connector Service&lt;/span&gt; specification adopts the Java 2 Micro Edition (J2ME) javax.microedition.io packages as a basic communications infrastructure.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;UPnP Device Service&lt;/span&gt; specifies how OSGi bundles can be developed that interoperate with UPnP (Universal Plug and Play) devices and UPnP control points.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Declarative Services&lt;/span&gt; specification addresses some of the complications that arise when the OSGi service model is used for larger systems and wider deployments, such as: Startup Time, Memory Footprint, Complexity. The service component model uses a declarative model for publishing, finding and binding to OSGi services.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Event Admin Service&lt;/span&gt; provides an inter-bundle communication mechanism. It is based on a event &lt;span style="font-style: italic;"&gt;publish&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;subscribe&lt;/span&gt; model, popular in many message based systems.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Deployment Admin Service&lt;/span&gt; specification, standardizes the access to some of the responsibilities of the management agent: that is, the lifecycle management of interlinked resources on an OSGi Service Platform.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Auto Configuration Specification&lt;/span&gt; is to allow the configuration of bundles. These bundles can be embedded in Deployment Packages or bundles that are already present on the OSGi Service Platform.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Application Admin Service&lt;/span&gt; is intended to simplify the management of an environment with many different types of applications that are simultaneously available.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;DMT Admin Service&lt;/span&gt; specification defines an API for managing a device using concepts from the OMA DM specifications.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Monitor Admin Service&lt;/span&gt; specification outlines how a bundle can publish Status Variables and how administrative bundles can discover Status Variables as well as read and reset their values.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Foreign Application Access&lt;/span&gt; specification is to enable foreign application models like MIDP, Xlets, Applets, other Java application models to participate in the OSGi service oriented architecture.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Service Tracker&lt;/span&gt; specification defines a utility class, ServiceTracker, that makes tracking the registration, modification, and unregistration of services much easier.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;XML Parser Service&lt;/span&gt; specification addresses how the classes defined in JAXP can be used in an OSGi Service Platform.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Position Specification&lt;/span&gt; provides bundle developers with a consistent way of handling geographic positions in OSGi applications.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;Measurement and State Specification&lt;/span&gt; provides a consistent way of handling a diverse range of measurements for bundle developers.&lt;br /&gt;&lt;br /&gt;This &lt;span style="font-weight: bold;"&gt;Execution Environment Specification&lt;/span&gt; defines different execution environments for OSGi Server Platform Servers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;What is there to come?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The intention of this initial blog was to provide folks that have not yet come in contact with this exciting technology a brief overview of what OSGi has to offer. I barely scratched the surface of what this all entails - may it still be useful.&lt;br /&gt;&lt;br /&gt;In my next blog I'm going to write about the JBossOSGi Service Provider Interface (SPI) and how we integrate &lt;a href="http://felix.apache.org/site/index.html"&gt;Apache Felix&lt;/a&gt; to provide an OSGi runtime based  on the &lt;a href="http://www.jboss.org/jbossmc/"&gt;Microcontainer&lt;/a&gt;. You will learn about JBossOSGi Deployers and how to use the JBossOSGi HttpService to setup an Http endpoint. As prove of concept we run the &lt;a href="http://felix.apache.org/site/apache-felix-web-console.html"&gt;Apache Felix Web Console&lt;/a&gt; on &lt;a href="http://www.jboss.org/jbossweb/index.html"&gt;JBossWeb&lt;/a&gt; and use it to manage the JBossOSGi Runtime - stay tuned.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;References&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;h1 style="font-weight: normal;"&gt;&lt;/h1&gt;&lt;span style="font-size:85%;"&gt;[1] Hello, OSGi, Part 1: Bundles for beginners&lt;br /&gt;&lt;a href="http://www.javaworld.com/javaworld/jw-03-2008/jw-03-osgi1.html"&gt;http://www.javaworld.com/javaworld/jw-03-2008/jw-03-osgi1.html&lt;/a&gt;&lt;br /&gt;[2] OSGi Business WhitePaper&lt;br /&gt;&lt;a href="http://www.osgi.org/wiki/uploads/Links/OSGiBusinessBenefitsWhitepaper.pdf"&gt;http://www.osgi.org/wiki/uploads/Links/OSGiBusinessBenefitsWhitepaper.pdf&lt;/a&gt;&lt;br /&gt;[3] OSGi Technical WhitePaper&lt;br /&gt;&lt;a href="http://www.osgi.org/wiki/uploads/Links/OSGiTechnicalWhitePaper.pdf"&gt;http://www.osgi.org/wiki/uploads/Links/OSGiTechnicalWhitePaper.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5377918349766062036-8238078789791076584?l=jbossosgi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbossosgi.blogspot.com/feeds/8238078789791076584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbossosgi.blogspot.com/2009/02/jboss-osgi-getting-started.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/8238078789791076584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5377918349766062036/posts/default/8238078789791076584'/><link rel='alternate' type='text/html' href='http://jbossosgi.blogspot.com/2009/02/jboss-osgi-getting-started.html' title='JBossOSGi - Technology Overview'/><author><name>Thomas Diesler</name><uri>http://www.blogger.com/profile/02865348180399042818</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-DNpeBatr7Gk/Tly45GO6H6I/AAAAAAAAENA/wjtHgsw0_Lc/s220/flower_chucker.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MTTbr2TxHjA/SZlgAeDdfRI/AAAAAAAACt0/OED4i8KLDjo/s72-c/osgi-layers.png' height='72' width='72'/><thr:total>3</thr:total></entry></feed>
