You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Michael Gruebsch <ne...@mkm-rabis.de> on 2012/05/11 08:07:30 UTC
How to map META-INF/services to OSGI services?
Hello,
I have a bunch of JAR files from open source projects which
rely heavily on the ServiceLocator pattern META-INF/services.
For each of these JARs I want to build a corresponding OSGI
bundle. Is there any standardized way how to map META-INF/services
to OSGI services such that the dependencies between the JARS
still work? As far as I know this is necessary because of the
class loaders architecture which is different between the
META-INF/services and the OSGI pattern.
Here is an example
JARS
JAR X JAR Y
defines an implements org.a.X
interface org.a.X with class net.b.Y
looks up has a file
implementations META-INF/services/org.a.X
via ServiceLocator which contains the line
which in turn scans net.b.Y
any entry in
META-INF/services/org.a.X
on the available
class path
Class loader for org.a.X has net.b.Y in its class path.
OSGI bundles
OSGI bundle org.X OSGI bundle org.Y
include JAR X include JAR Y
class loader does not depends on bundle
see net.b.Y org.X
requires service provides OSGI services
implementations for for each entry in
org.a.X META-INF/services/org.a.X
which contains an
provides them to entry from JAR Y
JAR X such that (here only for net.b.Y)
they are found by
the ServiceLocator [How can this work?]
pattern
[How this can work
is exactly the
question I asked]
Thank you
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: How to map META-INF/services to OSGI services?
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
That's a difficult topic. Take a look at the following:
- http://aries.apache.org/modules/spi-fly.html
- RFC 167: http://www.osgi.org/download/osgi-early-draft-2011-09.pdf
Jeremias Maerki
On 11.05.2012 08:07:30 Michael Gruebsch wrote:
> Hello,
>
> I have a bunch of JAR files from open source projects which
> rely heavily on the ServiceLocator pattern META-INF/services.
>
> For each of these JARs I want to build a corresponding OSGI
> bundle. Is there any standardized way how to map META-INF/services
> to OSGI services such that the dependencies between the JARS
> still work? As far as I know this is necessary because of the
> class loaders architecture which is different between the
> META-INF/services and the OSGI pattern.
>
> Here is an example
>
> JARS
>
> JAR X JAR Y
>
> defines an implements org.a.X
> interface org.a.X with class net.b.Y
>
> looks up has a file
> implementations META-INF/services/org.a.X
> via ServiceLocator which contains the line
> which in turn scans net.b.Y
> any entry in
> META-INF/services/org.a.X
> on the available
> class path
>
> Class loader for org.a.X has net.b.Y in its class path.
>
>
> OSGI bundles
>
> OSGI bundle org.X OSGI bundle org.Y
>
> include JAR X include JAR Y
>
> class loader does not depends on bundle
> see net.b.Y org.X
>
> requires service provides OSGI services
> implementations for for each entry in
> org.a.X META-INF/services/org.a.X
> which contains an
> provides them to entry from JAR Y
> JAR X such that (here only for net.b.Y)
> they are found by
> the ServiceLocator [How can this work?]
> pattern
>
> [How this can work
> is exactly the
> question I asked]
>
>
> Thank you
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org