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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to