You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Guillaume Nodet <gn...@gmail.com> on 2008/03/14 14:34:29 UTC

Java service discovery in OSGi

I'm trying to use a few java specifications in OSGi but I have a real
problem that maybe someone has already addressed somehow.
Lots of java specifications use META-INF/services to discover the
implementation, but it's not really easy to export this package,
because lots of different jars may use it.
Has anyone a good solution to solve this problem ?

-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Java service discovery in OSGi

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Guillaume,

I would not export it. Rather I would take the extender pattern approach
([1]). Here you would register for bundle events and when a bundle is
started you inspect the bundles entries for the specific
META-INF/services entry and act upon it.

We do this over in Sling to register Java Scripting ScriptEngineFactory
instances listed in those files. And it works very well. The class of
interest is the SlingScriptAdapterFactory [2].

Hope this helps.

Regards
Felix


[1] http://www.osgi.org/blog/2007/02/osgi-extender-model.html
[2] http://svn.apache.org/repos/asf/incubator/sling/trunk/scripting/resolver/src/main/java/org/apache/sling/scripting/resolver/impl/SlingScriptAdapterFactory.java

Am Freitag, den 14.03.2008, 14:34 +0100 schrieb Guillaume Nodet:
> I'm trying to use a few java specifications in OSGi but I have a real
> problem that maybe someone has already addressed somehow.
> Lots of java specifications use META-INF/services to discover the
> implementation, but it's not really easy to export this package,
> because lots of different jars may use it.
> Has anyone a good solution to solve this problem ?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org