Search in sources :

Example 1 with Service

use of org.jboss.weld.bootstrap.api.Service in project core by weld.

the class Services method put.

public static <T extends Service> void put(ServiceRegistry registry, Class<T> key, Service value) {
    Service previous = registry.get(key);
    if (previous == null) {
        BootstrapLogger.LOG.debugv("Installing additional service {0} ({1})", key.getName(), value.getClass());
        registry.add(key, Reflections.cast(value));
    } else if (shouldOverride(key, previous, value)) {
        BootstrapLogger.LOG.debugv("Overriding service implementation for {0}. Previous implementation {1} is replaced with {2}", key.getName(), previous.getClass().getName(), value.getClass().getName());
        registry.add(key, Reflections.cast(value));
    }
}
Also used : BootstrapService(org.jboss.weld.bootstrap.api.BootstrapService) Service(org.jboss.weld.bootstrap.api.Service)

Example 2 with Service

use of org.jboss.weld.bootstrap.api.Service in project wildfly by wildfly.

the class WeldDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final DeploymentUnit parent = Utils.getRootDeploymentUnit(deploymentUnit);
    final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        // if there are CDI annotation present and this is the top level deployment we log a warning
        if (deploymentUnit.getParent() == null && CdiAnnotationMarker.cdiAnnotationsPresent(deploymentUnit)) {
            WeldLogger.DEPLOYMENT_LOGGER.cdiAnnotationsButNotBeanArchive(deploymentUnit.getName());
        }
        return;
    }
    // add a dependency on the weld service to web deployments
    final ServiceName weldBootstrapServiceName = parent.getServiceName().append(WeldBootstrapService.SERVICE_NAME);
    final ServiceName weldBootstrapServiceInternalName = parent.getServiceName().append(WeldBootstrapService.INTERNAL_SERVICE_NAME);
    ServiceName weldStartServiceName = parent.getServiceName().append(WeldStartService.SERVICE_NAME);
    deploymentUnit.addToAttachmentList(Attachments.WEB_DEPENDENCIES, weldStartServiceName);
    final Set<ServiceName> dependencies = new HashSet<ServiceName>();
    // we only start weld on top level deployments
    if (deploymentUnit.getParent() != null) {
        return;
    }
    WeldLogger.DEPLOYMENT_LOGGER.startingServicesForCDIDeployment(phaseContext.getDeploymentUnit().getName());
    final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final Set<BeanDeploymentArchiveImpl> beanDeploymentArchives = new HashSet<BeanDeploymentArchiveImpl>();
    final Map<ModuleIdentifier, BeanDeploymentModule> bdmsByIdentifier = new HashMap<ModuleIdentifier, BeanDeploymentModule>();
    final Map<ModuleIdentifier, ModuleSpecification> moduleSpecByIdentifier = new HashMap<ModuleIdentifier, ModuleSpecification>();
    final Map<ModuleIdentifier, EEModuleDescriptor> eeModuleDescriptors = new HashMap<>();
    // the root module only has access to itself. For most deployments this will be the only module
    // for ear deployments this represents the ear/lib directory.
    // war and jar deployment visibility will depend on the dependencies that
    // exist in the application, and mirror inter module dependencies
    final BeanDeploymentModule rootBeanDeploymentModule = deploymentUnit.getAttachment(WeldAttachments.BEAN_DEPLOYMENT_MODULE);
    putIfValueNotNull(eeModuleDescriptors, module.getIdentifier(), rootBeanDeploymentModule.getModuleDescriptor());
    bdmsByIdentifier.put(module.getIdentifier(), rootBeanDeploymentModule);
    moduleSpecByIdentifier.put(module.getIdentifier(), moduleSpecification);
    beanDeploymentArchives.addAll(rootBeanDeploymentModule.getBeanDeploymentArchives());
    final List<DeploymentUnit> subDeployments = deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
    final Set<ClassLoader> subDeploymentLoaders = new HashSet<ClassLoader>();
    final ServiceLoader<DeploymentUnitDependenciesProvider> dependenciesProviders = ServiceLoader.load(DeploymentUnitDependenciesProvider.class, WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
    final ServiceLoader<ModuleServicesProvider> moduleServicesProviders = ServiceLoader.load(ModuleServicesProvider.class, WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
    getDependencies(deploymentUnit, dependencies, dependenciesProviders);
    for (DeploymentUnit subDeployment : subDeployments) {
        getDependencies(subDeployment, dependencies, dependenciesProviders);
        final Module subDeploymentModule = subDeployment.getAttachment(Attachments.MODULE);
        if (subDeploymentModule == null) {
            continue;
        }
        subDeploymentLoaders.add(subDeploymentModule.getClassLoader());
        final ModuleSpecification subDeploymentModuleSpec = subDeployment.getAttachment(Attachments.MODULE_SPECIFICATION);
        final BeanDeploymentModule bdm = subDeployment.getAttachment(WeldAttachments.BEAN_DEPLOYMENT_MODULE);
        if (bdm == null) {
            continue;
        }
        // add the modules bdas to the global set of bdas
        beanDeploymentArchives.addAll(bdm.getBeanDeploymentArchives());
        bdmsByIdentifier.put(subDeploymentModule.getIdentifier(), bdm);
        moduleSpecByIdentifier.put(subDeploymentModule.getIdentifier(), subDeploymentModuleSpec);
        putIfValueNotNull(eeModuleDescriptors, subDeploymentModule.getIdentifier(), bdm.getModuleDescriptor());
        // we have to do this here as the aggregate components are not available in earlier phases
        final ResourceRoot subDeploymentRoot = subDeployment.getAttachment(Attachments.DEPLOYMENT_ROOT);
        // Add module services to bean deployment module
        for (Entry<Class<? extends Service>, Service> entry : ServiceLoaders.loadModuleServices(moduleServicesProviders, deploymentUnit, subDeployment, subDeploymentModule, subDeploymentRoot).entrySet()) {
            bdm.addService(entry.getKey(), Reflections.cast(entry.getValue()));
        }
    }
    for (Map.Entry<ModuleIdentifier, BeanDeploymentModule> entry : bdmsByIdentifier.entrySet()) {
        final ModuleSpecification bdmSpec = moduleSpecByIdentifier.get(entry.getKey());
        final BeanDeploymentModule bdm = entry.getValue();
        if (bdm == rootBeanDeploymentModule) {
            // the root module only has access to itself
            continue;
        }
        for (ModuleDependency dependency : bdmSpec.getSystemDependencies()) {
            BeanDeploymentModule other = bdmsByIdentifier.get(dependency.getIdentifier());
            if (other != null && other != bdm) {
                bdm.addBeanDeploymentModule(other);
            }
        }
    }
    Map<Class<? extends Service>, Service> rootModuleServices = ServiceLoaders.loadModuleServices(moduleServicesProviders, deploymentUnit, deploymentUnit, module, deploymentRoot);
    // Add root module services to root bean deployment module
    for (Entry<Class<? extends Service>, Service> entry : rootModuleServices.entrySet()) {
        rootBeanDeploymentModule.addService(entry.getKey(), Reflections.cast(entry.getValue()));
    }
    // Add root module services to additional bean deployment archives
    for (final BeanDeploymentArchiveImpl additional : deploymentUnit.getAttachmentList(WeldAttachments.ADDITIONAL_BEAN_DEPLOYMENT_MODULES)) {
        beanDeploymentArchives.add(additional);
        for (Entry<Class<? extends Service>, Service> entry : rootModuleServices.entrySet()) {
            additional.getServices().add(entry.getKey(), Reflections.cast(entry.getValue()));
        }
    }
    final Collection<Metadata<Extension>> extensions = WeldPortableExtensions.getPortableExtensions(deploymentUnit).getExtensions();
    final WeldDeployment deployment = new WeldDeployment(beanDeploymentArchives, extensions, module, subDeploymentLoaders, deploymentUnit, rootBeanDeploymentModule, eeModuleDescriptors);
    installBootstrapConfigurationService(deployment, parent);
    // add the weld service
    final ServiceBuilder<?> weldBootstrapServiceBuilder = serviceTarget.addService(weldBootstrapServiceInternalName);
    final Consumer<WeldBootstrapService> weldBootstrapServiceConsumer = weldBootstrapServiceBuilder.provides(weldBootstrapServiceInternalName);
    weldBootstrapServiceBuilder.requires(TCCLSingletonService.SERVICE_NAME);
    final Supplier<ExecutorServices> executorServicesSupplier = weldBootstrapServiceBuilder.requires(WeldExecutorServices.SERVICE_NAME);
    final Supplier<ExecutorService> serverExecutorSupplier = weldBootstrapServiceBuilder.requires(Services.JBOSS_SERVER_EXECUTOR);
    Supplier<SecurityServices> securityServicesSupplier = null;
    Supplier<TransactionServices> weldTransactionServicesSupplier = null;
    // Install additional services
    final ServiceLoader<BootstrapDependencyInstaller> installers = ServiceLoader.load(BootstrapDependencyInstaller.class, WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
    for (BootstrapDependencyInstaller installer : installers) {
        ServiceName serviceName = installer.install(serviceTarget, deploymentUnit, jtsEnabled);
        // Add dependency for recognized services
        if (ServiceNames.WELD_SECURITY_SERVICES_SERVICE_NAME.getSimpleName().equals(serviceName.getSimpleName())) {
            securityServicesSupplier = weldBootstrapServiceBuilder.requires(serviceName);
        } else if (ServiceNames.WELD_TRANSACTION_SERVICES_SERVICE_NAME.getSimpleName().equals(serviceName.getSimpleName())) {
            weldTransactionServicesSupplier = weldBootstrapServiceBuilder.requires(serviceName);
        }
    }
    ServiceName deploymentServiceName = Utils.getRootDeploymentUnit(deploymentUnit).getServiceName();
    final WeldBootstrapService weldBootstrapService = new WeldBootstrapService(deployment, WildFlyWeldEnvironment.INSTANCE, deploymentUnit.getName(), weldBootstrapServiceConsumer, executorServicesSupplier, serverExecutorSupplier, securityServicesSupplier, weldTransactionServicesSupplier, deploymentServiceName, weldBootstrapServiceName);
    // Add root module services to WeldDeployment
    for (Entry<Class<? extends Service>, Service> entry : rootModuleServices.entrySet()) {
        weldBootstrapService.addWeldService(entry.getKey(), Reflections.cast(entry.getValue()));
    }
    weldBootstrapServiceBuilder.setInstance(weldBootstrapService);
    weldBootstrapServiceBuilder.install();
    final List<SetupAction> setupActions = getSetupActions(deploymentUnit);
    ServiceBuilder<?> startService = serviceTarget.addService(weldStartServiceName);
    for (final ServiceName dependency : dependencies) {
        startService.requires(dependency);
    }
    // make sure JNDI bindings are up
    startService.requires(JndiNamingDependencyProcessor.serviceName(deploymentUnit));
    final CapabilityServiceSupport capabilities = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    boolean tx = capabilities.hasCapability("org.wildfly.transactions");
    // [WFLY-5232]
    for (final ServiceName jndiSubsystemDependency : getJNDISubsytemDependencies(tx)) {
        startService.requires(jndiSubsystemDependency);
    }
    final EarMetaData earConfig = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
    if (earConfig == null || !earConfig.getInitializeInOrder()) {
        // in-order install of sub-deployments may result in service dependencies deadlocks if the jndi dependency services of subdeployments are added as dependencies
        for (DeploymentUnit sub : subDeployments) {
            startService.requires(JndiNamingDependencyProcessor.serviceName(sub));
        }
    }
    final Supplier<WeldBootstrapService> bootstrapSupplier = startService.requires(weldBootstrapServiceName);
    startService.setInstance(new WeldStartService(bootstrapSupplier, setupActions, module.getClassLoader(), deploymentServiceName));
    startService.install();
}
Also used : ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) HashMap(java.util.HashMap) WeldDeployment(org.jboss.as.weld.deployment.WeldDeployment) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) WeldStartService(org.jboss.as.weld.WeldStartService) WeldBootstrapService(org.jboss.as.weld.WeldBootstrapService) HashSet(java.util.HashSet) ModuleServicesProvider(org.jboss.as.weld.spi.ModuleServicesProvider) ServiceTarget(org.jboss.msc.service.ServiceTarget) SetupAction(org.jboss.as.server.deployment.SetupAction) ConcurrentContextSetupAction(org.jboss.as.ee.concurrent.ConcurrentContextSetupAction) ServiceName(org.jboss.msc.service.ServiceName) Module(org.jboss.modules.Module) BeanDeploymentModule(org.jboss.as.weld.deployment.BeanDeploymentModule) Map(java.util.Map) HashMap(java.util.HashMap) EEModuleDescriptor(org.jboss.weld.bootstrap.spi.EEModuleDescriptor) SecurityServices(org.jboss.weld.security.spi.SecurityServices) Metadata(org.jboss.weld.bootstrap.spi.Metadata) DeploymentUnitDependenciesProvider(org.jboss.as.weld.spi.DeploymentUnitDependenciesProvider) EarMetaData(org.jboss.metadata.ear.spec.EarMetaData) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) BootstrapDependencyInstaller(org.jboss.as.weld.spi.BootstrapDependencyInstaller) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) BeanDeploymentArchiveImpl(org.jboss.as.weld.deployment.BeanDeploymentArchiveImpl) TCCLSingletonService(org.jboss.as.weld.services.TCCLSingletonService) DefaultNamespaceContextSelectorService(org.jboss.as.naming.service.DefaultNamespaceContextSelectorService) Service(org.jboss.weld.bootstrap.api.Service) WeldBootstrapService(org.jboss.as.weld.WeldBootstrapService) NamingService(org.jboss.as.naming.service.NamingService) WeldStartService(org.jboss.as.weld.WeldStartService) ExecutorService(java.util.concurrent.ExecutorService) TransactionServices(org.jboss.weld.transaction.spi.TransactionServices) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) ExecutorServices(org.jboss.weld.manager.api.ExecutorServices) WeldExecutorServices(org.jboss.as.weld.services.bootstrap.WeldExecutorServices) ExecutorService(java.util.concurrent.ExecutorService) BeanDeploymentModule(org.jboss.as.weld.deployment.BeanDeploymentModule) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 3 with Service

use of org.jboss.weld.bootstrap.api.Service in project wildfly by wildfly.

the class WeldDeployment method createAndRegisterAdditionalBeanDeploymentArchive.

protected BeanDeploymentArchiveImpl createAndRegisterAdditionalBeanDeploymentArchive(Module module, Class<?> beanClass) {
    String id = null;
    if (module == null) {
        id = BOOTSTRAP_CLASSLOADER_BDA_ID;
    } else {
        id = module.getIdentifier() + ADDITIONAL_CLASSES_BDA_SUFFIX;
    }
    BeanDeploymentArchiveImpl newBda = new BeanDeploymentArchiveImpl(Collections.singleton(beanClass.getName()), Collections.singleton(beanClass.getName()), BeansXml.EMPTY_BEANS_XML, module, id, BeanArchiveType.SYNTHETIC, false);
    WeldLogger.DEPLOYMENT_LOGGER.beanArchiveDiscovered(newBda);
    newBda.addBeanClass(beanClass);
    ServiceRegistry newBdaServices = newBda.getServices();
    for (Entry<Class<? extends Service>, Service> entry : serviceRegistry.entrySet()) {
        // Do not overwrite existing services
        if (!newBdaServices.contains(entry.getKey())) {
            newBdaServices.add(entry.getKey(), Reflections.cast(entry.getValue()));
        }
    }
    if (module == null) {
        // For bootstrapClassLoaderBeanDeploymentArchive always use the parent ResourceLoader
        newBdaServices.add(ResourceLoader.class, serviceRegistry.get(ResourceLoader.class));
    }
    if (module != null && eeModuleDescriptors.containsKey(module.getIdentifier())) {
        newBda.getServices().add(EEModuleDescriptor.class, eeModuleDescriptors.get(module.getIdentifier()));
    }
    // handle BDAs visible from the new BDA
    for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) {
        if (newBda.isAccessible(bda)) {
            newBda.addBeanDeploymentArchive(bda);
        }
    }
    // handle visibility of the new BDA from other BDAs
    for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) {
        if (bda.isAccessible(newBda)) {
            bda.addBeanDeploymentArchive(newBda);
        }
    }
    // make the top-level deployment BDAs visible from the additional archive
    newBda.addBeanDeploymentArchives(rootBeanDeploymentModule.getBeanDeploymentArchives());
    // Ignore beans loaded by the bootstrap class loader. This should only be JDK classes in most cases.
    // See getBeanDeploymentArchive(final Class<?> beanClass), per the JavaDoc this is mean to archive which
    // contains the bean class.
    final ClassLoader cl = beanClass.getClassLoader();
    if (cl != null) {
        additionalBeanDeploymentArchivesByClassloader.put(cl, newBda);
    }
    beanDeploymentArchives.add(newBda);
    return newBda;
}
Also used : WeldModuleResourceLoader(org.jboss.as.weld.WeldModuleResourceLoader) ResourceLoader(org.jboss.weld.resources.spi.ResourceLoader) Service(org.jboss.weld.bootstrap.api.Service) ServiceRegistry(org.jboss.weld.bootstrap.api.ServiceRegistry) SimpleServiceRegistry(org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry)

Example 4 with Service

use of org.jboss.weld.bootstrap.api.Service in project wildfly by wildfly.

the class DefaultModuleServiceProvider method getServices.

@Override
public Collection<Service> getServices(DeploymentUnit rootDeploymentUnit, DeploymentUnit deploymentUnit, Module module, ResourceRoot resourceRoot) {
    List<Service> services = new ArrayList<>();
    // ResourceInjectionServices
    // TODO I'm not quite sure we should use rootDeploymentUnit here
    services.add(new WeldResourceInjectionServices(rootDeploymentUnit.getServiceRegistry(), rootDeploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION), EJBAnnotationPropertyReplacement.propertyReplacer(deploymentUnit), module, DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)));
    // ClassFileServices
    final CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    if (index != null) {
        services.add(new WeldClassFileServices(index, module.getClassLoader()));
    }
    return services;
}
Also used : WeldClassFileServices(org.jboss.as.weld.discovery.WeldClassFileServices) ArrayList(java.util.ArrayList) CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) Service(org.jboss.weld.bootstrap.api.Service) WeldResourceInjectionServices(org.jboss.as.weld.services.bootstrap.WeldResourceInjectionServices)

Example 5 with Service

use of org.jboss.weld.bootstrap.api.Service in project core by weld.

the class Weld method createDeployment.

/**
 * <p>
 * Extensions to Weld SE can subclass and override this method to customize the deployment before weld boots up. For example, to add a custom
 * ResourceLoader, you would subclass Weld like so:
 * </p>
 *
 * <pre>
 * public class MyWeld extends Weld {
 *     protected Deployment createDeployment(ResourceLoader resourceLoader, CDI11Bootstrap bootstrap) {
 *         return super.createDeployment(new MyResourceLoader(), bootstrap);
 *     }
 * }
 * </pre>
 *
 * <p>
 * This could then be used as normal:
 * </p>
 *
 * <pre>
 * WeldContainer container = new MyWeld().initialize();
 * </pre>
 *
 * @param resourceLoader
 * @param bootstrap
 */
protected Deployment createDeployment(ResourceLoader resourceLoader, CDI11Bootstrap bootstrap) {
    final Iterable<Metadata<Extension>> extensions = getExtensions();
    final TypeDiscoveryConfiguration typeDiscoveryConfiguration = bootstrap.startExtensions(extensions);
    final Deployment deployment;
    final Set<WeldBeanDeploymentArchive> beanDeploymentArchives = new HashSet<WeldBeanDeploymentArchive>();
    final Map<Class<? extends Service>, Service> additionalServices = new HashMap<>(this.additionalServices);
    final Set<Class<? extends Annotation>> beanDefiningAnnotations = ImmutableSet.<Class<? extends Annotation>>builder().addAll(typeDiscoveryConfiguration.getKnownBeanDefiningAnnotations()).add(ThreadScoped.class).build();
    if (discoveryEnabled) {
        DiscoveryStrategy strategy = DiscoveryStrategyFactory.create(resourceLoader, bootstrap, beanDefiningAnnotations, isEnabled(Jandex.DISABLE_JANDEX_DISCOVERY_STRATEGY, false));
        if (isImplicitScanEnabled()) {
            strategy.setScanner(new ClassPathBeanArchiveScanner(bootstrap));
        }
        beanDeploymentArchives.addAll(strategy.performDiscovery());
        ClassFileServices classFileServices = strategy.getClassFileServices();
        if (classFileServices != null) {
            additionalServices.put(ClassFileServices.class, classFileServices);
        }
    }
    if (isSyntheticBeanArchiveRequired()) {
        ImmutableSet.Builder<String> beanClassesBuilder = ImmutableSet.builder();
        beanClassesBuilder.addAll(scanPackages());
        Set<String> setOfAllBeanClasses = beanClassesBuilder.build();
        // the creation process differs based on bean discovery mode
        if (BeanDiscoveryMode.ANNOTATED.equals(beanDiscoveryMode)) {
            // Annotated bean discovery mode, filter classes
            ImmutableSet.Builder<String> filteredSetbuilder = ImmutableSet.builder();
            for (String className : setOfAllBeanClasses) {
                Class<?> clazz = Reflections.loadClass(resourceLoader, className);
                if (clazz != null && Reflections.hasBeanDefiningAnnotation(clazz, beanDefiningAnnotations)) {
                    filteredSetbuilder.add(className);
                }
            }
            setOfAllBeanClasses = filteredSetbuilder.build();
        }
        WeldBeanDeploymentArchive syntheticBeanArchive = new WeldBeanDeploymentArchive(WeldDeployment.SYNTHETIC_BDA_ID, setOfAllBeanClasses, null, buildSyntheticBeansXml(), Collections.emptySet(), ImmutableSet.copyOf(beanClasses));
        beanDeploymentArchives.add(syntheticBeanArchive);
    }
    if (beanDeploymentArchives.isEmpty() && this.containerLifecycleObservers.isEmpty() && this.extensions.isEmpty()) {
        throw WeldSELogger.LOG.weldContainerCannotBeInitializedNoBeanArchivesFound();
    }
    Multimap<String, BeanDeploymentArchive> problems = BeanArchives.findBeanClassesDeployedInMultipleBeanArchives(beanDeploymentArchives);
    if (!problems.isEmpty()) {
        // Right now, we only log a warning for each bean class deployed in multiple bean archives
        for (Entry<String, Collection<BeanDeploymentArchive>> entry : problems.entrySet()) {
            WeldSELogger.LOG.beanClassDeployedInMultipleBeanArchives(entry.getKey(), WeldCollections.toMultiRowString(entry.getValue()));
        }
    }
    if (isEnabled(ARCHIVE_ISOLATION_SYSTEM_PROPERTY, true)) {
        deployment = new WeldDeployment(resourceLoader, bootstrap, beanDeploymentArchives, extensions);
        CommonLogger.LOG.archiveIsolationEnabled();
    } else {
        Set<WeldBeanDeploymentArchive> flatDeployment = new HashSet<WeldBeanDeploymentArchive>();
        flatDeployment.add(WeldBeanDeploymentArchive.merge(bootstrap, beanDeploymentArchives));
        deployment = new WeldDeployment(resourceLoader, bootstrap, flatDeployment, extensions);
        CommonLogger.LOG.archiveIsolationDisabled();
    }
    // Register additional services if a service with higher priority not present
    for (Entry<Class<? extends Service>, Service> entry : additionalServices.entrySet()) {
        Services.put(deployment.getServices(), entry.getKey(), entry.getValue());
    }
    return deployment;
}
Also used : WeldBeanDeploymentArchive(org.jboss.weld.environment.deployment.WeldBeanDeploymentArchive) HashMap(java.util.HashMap) Metadata(org.jboss.weld.bootstrap.spi.Metadata) Deployment(org.jboss.weld.bootstrap.spi.Deployment) WeldDeployment(org.jboss.weld.environment.deployment.WeldDeployment) WeldDeployment(org.jboss.weld.environment.deployment.WeldDeployment) DiscoveryStrategy(org.jboss.weld.environment.deployment.discovery.DiscoveryStrategy) TypeDiscoveryConfiguration(org.jboss.weld.bootstrap.api.TypeDiscoveryConfiguration) ImmutableSet(org.jboss.weld.util.collections.ImmutableSet) HashSet(java.util.HashSet) ClassPathBeanArchiveScanner(org.jboss.weld.environment.deployment.discovery.ClassPathBeanArchiveScanner) Service(org.jboss.weld.bootstrap.api.Service) ThreadScoped(org.jboss.weld.environment.se.contexts.ThreadScoped) Annotation(java.lang.annotation.Annotation) ClassFileServices(org.jboss.weld.resources.spi.ClassFileServices) WeldBeanDeploymentArchive(org.jboss.weld.environment.deployment.WeldBeanDeploymentArchive) BeanDeploymentArchive(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive) Collection(java.util.Collection)

Aggregations

Service (org.jboss.weld.bootstrap.api.Service)8 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)3 ModuleServicesProvider (org.jboss.as.weld.spi.ModuleServicesProvider)3 BootstrapService (org.jboss.weld.bootstrap.api.BootstrapService)3 Map (java.util.Map)2 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)2 BeanDeploymentArchiveImpl (org.jboss.as.weld.deployment.BeanDeploymentArchiveImpl)2 Module (org.jboss.modules.Module)2 Metadata (org.jboss.weld.bootstrap.spi.Metadata)2 Annotation (java.lang.annotation.Annotation)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Collection (java.util.Collection)1 List (java.util.List)1 ExecutorService (java.util.concurrent.ExecutorService)1 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1