<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: OSGi and SPI</title>
	<atom:link href="http://blog.tfd.co.uk/2011/12/13/osgi-and-spi/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tfd.co.uk/2011/12/13/osgi-and-spi/</link>
	<description>Open Source Open Thought</description>
	<lastBuildDate>Thu, 24 Jan 2013 05:22:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Ian</title>
		<link>http://blog.tfd.co.uk/2011/12/13/osgi-and-spi/#comment-1263</link>
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Mon, 19 Dec 2011 23:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tfd.co.uk/?p=544#comment-1263</guid>
		<description><![CDATA[I had not looked at it, thank you for the link. I agree that Fragments feel like an OSGi anti pattern, but the fundamental problem I was struggling with was how to write a SPI implementation that had access to the SPI where the SPI was not exported outside the bundle. The reason the SPI was not exported is that I did not want well behaved clients to bind to the SPI bypassing the logic in the SPI consumer. I cant do a great deal about badly behaved clients that bypass normal OSGi boundaries. IIRC, RFC 167 assumes that the consumer and provider are in separate bundles allowing any other bundle access to the SPI?

The other problem is that (IIUC) the ServiceLoader pattern was intended for simple services that either dont need to connect to the environment they are working within or explicitly have initialization as part of the SPI. Where the SPI is agnostic about initialization and context, leaning towards pure IoC like patterns it falls to the SPI implementation to acquire context through out of band or other means. What would be really nice is to see a RFC that enabled a SPI implementation to be a declaratively managed component, living in a separate bundle, where it gained access to a protected set of SPI and support classes within the SPI consumer bundle. I think I am right in saying that would require the declarative service manager to pre-bind to the SPI consumer classloader before instancing the SPI implementation, so that the SPI classes from the correct classloader were already available?

It is good to see Aries addressing these issues and looking at RFC 167 it certainly looks like its going to address the ServiceLocator pattern, which continues to be the bain of anyone integrating 3rd part components in OSGi. Its almost become a standard pattern in my code bases to set the context classloader to the bundle classloader in advance of performing initialisation of anything not designed for OSGi.]]></description>
		<content:encoded><![CDATA[<p>I had not looked at it, thank you for the link. I agree that Fragments feel like an OSGi anti pattern, but the fundamental problem I was struggling with was how to write a SPI implementation that had access to the SPI where the SPI was not exported outside the bundle. The reason the SPI was not exported is that I did not want well behaved clients to bind to the SPI bypassing the logic in the SPI consumer. I cant do a great deal about badly behaved clients that bypass normal OSGi boundaries. IIRC, RFC 167 assumes that the consumer and provider are in separate bundles allowing any other bundle access to the SPI?</p>
<p>The other problem is that (IIUC) the ServiceLoader pattern was intended for simple services that either dont need to connect to the environment they are working within or explicitly have initialization as part of the SPI. Where the SPI is agnostic about initialization and context, leaning towards pure IoC like patterns it falls to the SPI implementation to acquire context through out of band or other means. What would be really nice is to see a RFC that enabled a SPI implementation to be a declaratively managed component, living in a separate bundle, where it gained access to a protected set of SPI and support classes within the SPI consumer bundle. I think I am right in saying that would require the declarative service manager to pre-bind to the SPI consumer classloader before instancing the SPI implementation, so that the SPI classes from the correct classloader were already available?</p>
<p>It is good to see Aries addressing these issues and looking at RFC 167 it certainly looks like its going to address the ServiceLocator pattern, which continues to be the bain of anyone integrating 3rd part components in OSGi. Its almost become a standard pattern in my code bases to set the context classloader to the bundle classloader in advance of performing initialisation of anything not designed for OSGi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremias Märki</title>
		<link>http://blog.tfd.co.uk/2011/12/13/osgi-and-spi/#comment-1261</link>
		<dc:creator><![CDATA[Jeremias Märki]]></dc:creator>
		<pubDate>Mon, 19 Dec 2011 13:52:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tfd.co.uk/?p=544#comment-1261</guid>
		<description><![CDATA[Have you looked at RFC 167 in the OSGi Enterprise 5 EA draft? This is being prototyped by Apache Aries: http://aries.apache.org/modules/spi-fly.html
Using fragment bundles doesn&#039;t really follow the OSGi spirit, IMO. I&#039;d want to expose plug-ins as OSGi services when working in an OSGi environment.]]></description>
		<content:encoded><![CDATA[<p>Have you looked at RFC 167 in the OSGi Enterprise 5 EA draft? This is being prototyped by Apache Aries: <a href="http://aries.apache.org/modules/spi-fly.html" rel="nofollow">http://aries.apache.org/modules/spi-fly.html</a><br />
Using fragment bundles doesn&#8217;t really follow the OSGi spirit, IMO. I&#8217;d want to expose plug-ins as OSGi services when working in an OSGi environment.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
