org.jboss.weld.bootstrap.BeanDeploymentArchiveMapping Maven / Gradle / Ivy
package org.jboss.weld.bootstrap;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author Marko Luksa
*/
public class BeanDeploymentArchiveMapping {
private final Map beanDeployments = new HashMap();
private final ConcurrentMap beanManagers = new ConcurrentHashMap();
public void put(BeanDeploymentArchive bda, BeanDeployment beanDeployment) {
beanDeployments.put(bda, beanDeployment);
beanManagers.put(bda, beanDeployment.getBeanManager());
}
public BeanDeployment getBeanDeployment(BeanDeploymentArchive bda) {
return beanDeployments.get(bda);
}
public Collection getBeanDeployments() {
return beanDeployments.values();
}
public ConcurrentMap getBdaToBeanManagerMap() {
return beanManagers;
}
boolean isNonuniqueIdentifierDetected() {
Set beanDeploymentArchiveIds = new HashSet<>();
Set beanManagerIds = new HashSet<>();
for (Entry entry : beanDeployments.entrySet()) {
if (!beanDeploymentArchiveIds.add(entry.getKey().getId()) || !beanManagerIds.add(entry.getValue().getBeanManager().getId())) {
return true;
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy