package org.keycloak.provider;
import java.util.LinkedList;
import java.util.List;
import java.util.ServiceLoader;
/**
* @author Stian Thorgersen
*/
public class DefaultProviderLoader implements ProviderLoader {
private ClassLoader classLoader;
public DefaultProviderLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
@Override
public List load(Spi spi) {
LinkedList list = new LinkedList();
for (ProviderFactory f : ServiceLoader.load(spi.getProviderFactoryClass(), classLoader)) {
list.add(f);
}
return list;
}
}