this(beanDeploymentArchive, deploymentManager, deploymentServices, contexts, false);
}
public BeanDeployment(BeanDeploymentArchive beanDeploymentArchive, BeanManagerImpl deploymentManager, ServiceRegistry deploymentServices, Collection<ContextHolder<? extends Context>> contexts, boolean additionalBeanArchive) {
this.beanDeploymentArchive = beanDeploymentArchive;
EjbDescriptors ejbDescriptors = new EjbDescriptors();
ServiceRegistry registry = beanDeploymentArchive.getServices();
registry.add(EjbDescriptors.class, ejbDescriptors);
ResourceLoader resourceLoader = registry.get(ResourceLoader.class);
if (resourceLoader == null) {
resourceLoader = DefaultResourceLoader.INSTANCE;
registry.add(ResourceLoader.class, resourceLoader);
}
InstantiatorFactory factory = registry.get(InstantiatorFactory.class);
if (factory == null) {
registry.add(InstantiatorFactory.class, new DefaultInstantiatorFactory(resourceLoader));
}
ServiceRegistry services = new SimpleServiceRegistry();
services.addAll(deploymentServices.entrySet());
services.addAll(registry.entrySet());
services.add(EJBApiAbstraction.class, new EJBApiAbstraction(resourceLoader));
services.add(PersistenceApiAbstraction.class, new PersistenceApiAbstraction(resourceLoader));
services.add(WSApiAbstraction.class, new WSApiAbstraction(resourceLoader));
services.add(JtaApiAbstraction.class, new JtaApiAbstraction(resourceLoader));
services.add(InterceptorsApiAbstraction.class, new InterceptorsApiAbstraction(resourceLoader));
services.add(AnnotationApiAbstraction.class, new AnnotationApiAbstraction(resourceLoader));
services.add(ServletApiAbstraction.class, new ServletApiAbstraction(resourceLoader));
this.beanManager = BeanManagerImpl.newManager(deploymentManager, beanDeploymentArchive.getId(), services);
services.add(InjectionTargetService.class, new InjectionTargetService(beanManager));
if (beanManager.getServices().contains(EjbServices.class)) {
// Must populate EJB cache first, as we need it to detect whether a
// bean is an EJB!
ejbDescriptors.addAll(beanDeploymentArchive.getEjbs());
}
if (services.get(BootstrapConfiguration.class).isConcurrentDeploymentEnabled() && services.contains(ExecutorServices.class)) {
beanDeployer = new ConcurrentBeanDeployer(beanManager, ejbDescriptors, deploymentServices);
} else {