List of usage examples for org.apache.lucene.util SPIClassIterator get
public static <S> SPIClassIterator<S> get(Class<S> clazz, ClassLoader loader)
From source file:org.elasticsearch.xpack.core.security.SecurityExtension.java
License:Open Source License
/** * Loads the XPackSecurityExtensions from the given class loader *//*from w ww. j a v a2 s . c o m*/ static List<SecurityExtension> loadExtensions(ClassLoader loader) { SPIClassIterator<SecurityExtension> iterator = SPIClassIterator.get(SecurityExtension.class, loader); List<SecurityExtension> extensions = new ArrayList<>(); while (iterator.hasNext()) { final Class<? extends SecurityExtension> c = iterator.next(); try { extensions.add(c.getConstructor().newInstance()); } catch (Exception e) { throw new ServiceConfigurationError("failed to load security extension [" + c.getName() + "]", e); } } return extensions; }