use of org.jboss.as.weld.spi.BeanDeploymentArchiveServicesProvider in project wildfly by wildfly.
the class ServiceLoaders method loadBeanDeploymentArchiveServices.
/**
*
* @param clazz
* @param archive
* @return
*/
public static Map<Class<? extends Service>, Service> loadBeanDeploymentArchiveServices(Class<?> clazz, BeanDeploymentArchive archive) {
ServiceLoader<BeanDeploymentArchiveServicesProvider> serviceLoader = ServiceLoader.load(BeanDeploymentArchiveServicesProvider.class, WildFlySecurityManager.getClassLoaderPrivileged(clazz));
List<Service> services = new ArrayList<>();
for (BeanDeploymentArchiveServicesProvider provider : serviceLoader) {
services.addAll(provider.getServices(archive));
}
Map<Class<? extends Service>, Service> servicesMap = new HashMap<>();
for (Service service : services) {
for (Class<? extends Service> serviceInterface : identifyServiceInterfaces(service.getClass(), new HashSet<>())) {
servicesMap.put(serviceInterface, service);
}
}
return servicesMap;
}
Aggregations