// are enabling a slightly odd use case anyway.
Bundle serviceProviderBundle = pair.ref.getBundle();
Bundle owningBundle = ctx.getBundle();
ProxyManager proxyManager = Activator.getProxyManager();
for (String interfaceName : interfaces) {
try {
Class<?> potentialClass = serviceProviderBundle.loadClass(interfaceName);
if (pair.ref.isAssignableTo(owningBundle, interfaceName)) {
clazz.add(potentialClass);
}
} catch (ClassNotFoundException e) {
}
}
if (clazz.isEmpty()) {
throw new IllegalArgumentException(Arrays.asList(interfaces).toString());
}
Callable<Object> ih = new JNDIServiceDamper(ctx, interface1, filter, pair, dynamicRebind, timeout);
// The ClassLoader needs to be able to load the service interface
// classes so it needs to be
// wrapping the service provider bundle. The class is actually defined
// on this adapter.
try {
return proxyManager.createProxy(serviceProviderBundle, clazz, ih);
} catch (UnableToProxyException e) {
throw new IllegalArgumentException(e);
} catch (RuntimeException e) {
throw new IllegalArgumentException("Unable to create proxy for " + pair.ref, e);
}