I\'m currently trying to get a simple bundle containing a Service Factory running.
This is my factory class:
public class SvcFactory implements Servi
It is actually rather simple ... DS creates an instance for each bundle, so with DS you do not implement Service Factory, DS does all the hard work. For example:
@Service(serviceFactory=true)
public class MyServiceFactory implements XyzService {
...
@Activate
void activate(ComponentContext ctx) {
System.out.println("Using bundle: " + ctx.getUsingBundle());
}
}
Every time another bundle gets this XyzService, DS will create a new instance. You can use the ComponentContext (optionally passed in the activate method) to get the bundle that is using you.