Hello, When you say that each client needs a different service instance, would a bundle need more than one instance (i.e. would a ServiceFactory be sufficient or does it need to be a PrototypeServiceFactory)?
Also, where are the Strings in the String array coming from? If those are passed in by the client then you may need an intermediate “factory service” from which the bundles request instances of the provider. Otherwise, it sounds as though this would be pretty simple to achieve. The ServiceFactory gives you access to the requesting bundle, which in turn gives you the class loader that you need. All the best, Tim > On 22 Aug 2019, at 05:58, Peter Firmstone via osgi-dev > <osgi-dev@mail.osgi.org> wrote: > > Hello, > > I'm trying to migrate a custom provider interface to register OSGi services. > > This is a pre existing implementation, functionally similar to Java's SPI, > with one caveat; it doesn't use a zero arg constructor. > > The constructor has two arguments an array of strings, and a ClassLoader. > > Otherwise for all intents and purposes, it's an SPI, implementing services > use a META-INF services file. > > The interface for the service exists and has implementations. > > The ClassLoader passed in is used to resolve classes from the service client. > > It doesn't use the Java SPI mechanism, so we have access to the code that > creates the service. > > Each client will require a different Service instance. > > I was thinking something like a Service Factory might do the job, any > thoughts or advice? > > Thanks in adv, > > Peter. > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev