loaders = ClassLoaders.getLibLoaders(spi.getSPClass(),
DiscoverClass.class,
true);
}
FirstResourceClassListener listener =
new FirstResourceClassListener();
DiscoverClasses classDiscovery = new DiscoverClasses(loaders);
classDiscovery.setListener(listener);
String[] classNames =
discoverClassNames(spi,
(properties == null)
? null
: properties.getProperties(spi, loaders));
if (classNames.length > 0) {
classDiscovery.find(classNames[0]);
// If it's set as a property.. it had better be there!
ResourceClass resource = listener.getFirst();
return (resource == null) ? null : resource.loadClass();
} else {
DiscoverServiceNames discoverServices = new DiscoverServiceNames(loaders);
/**
* Feed service (name) discovery to classDiscovery
*/
discoverServices.setListener(classDiscovery);
discoverServices.find(spi.getSPName());
ResourceClass resource = listener.getFirst();
Class clazz = (resource == null) ? null : resource.loadClass();
if (clazz != null) {
return clazz;