Search in sources :

Example 1 with WeldModules

use of org.jboss.weld.module.WeldModules in project core by weld.

the class WeldStartup method addImplementationServices.

private void addImplementationServices(ServiceRegistry services) {
    final WeldModules modules = new WeldModules();
    services.add(WeldModules.class, modules);
    final WeldConfiguration configuration = services.get(WeldConfiguration.class);
    services.add(SlimAnnotatedTypeStore.class, new SlimAnnotatedTypeStoreImpl());
    if (services.get(ClassTransformer.class) == null) {
        throw new IllegalStateException(ClassTransformer.class.getSimpleName() + " not installed.");
    }
    services.add(MemberTransformer.class, new MemberTransformer(services.get(ClassTransformer.class)));
    services.add(MetaAnnotationStore.class, new MetaAnnotationStore(services.get(ClassTransformer.class)));
    BeanIdentifierIndex beanIdentifierIndex = null;
    if (configuration.getBooleanProperty(ConfigurationKey.BEAN_IDENTIFIER_INDEX_OPTIMIZATION)) {
        beanIdentifierIndex = new BeanIdentifierIndex();
        services.add(BeanIdentifierIndex.class, beanIdentifierIndex);
    }
    services.add(ContextualStore.class, new ContextualStoreImpl(contextId, beanIdentifierIndex));
    services.add(CurrentInjectionPoint.class, new CurrentInjectionPoint());
    services.add(CurrentEventMetadata.class, new CurrentEventMetadata());
    services.add(SpecializationAndEnablementRegistry.class, new SpecializationAndEnablementRegistry());
    services.add(MissingDependenciesRegistry.class, new MissingDependenciesRegistry());
    /*
         * Setup ExecutorServices
         */
    ExecutorServices executor = services.get(ExecutorServices.class);
    if (executor == null) {
        executor = ExecutorServicesFactory.create(DefaultResourceLoader.INSTANCE, configuration);
        if (executor != null) {
            services.add(ExecutorServices.class, executor);
        }
    }
    services.add(RequiredAnnotationDiscovery.class, new RequiredAnnotationDiscovery(services.get(ReflectionCache.class)));
    services.add(GlobalEnablementBuilder.class, new GlobalEnablementBuilder());
    if (!services.contains(HttpContextActivationFilter.class)) {
        services.add(HttpContextActivationFilter.class, AcceptingHttpContextActivationFilter.INSTANCE);
    }
    services.add(ProtectionDomainCache.class, new ProtectionDomainCache());
    services.add(ProxyInstantiator.class, ProxyInstantiator.Factory.create(configuration));
    services.add(ObserverNotifierFactory.class, DefaultObserverNotifierFactory.INSTANCE);
    services.add(ResourceInjectionFactory.class, new ResourceInjectionFactory());
    modules.postServiceRegistration(contextId, services);
    /*
         * Setup Validator
         */
    if (configuration.getBooleanProperty(ConfigurationKey.CONCURRENT_DEPLOYMENT) && services.contains(ExecutorServices.class)) {
        services.add(Validator.class, new ConcurrentValidator(modules.getPluggableValidators(), executor));
    } else {
        services.add(Validator.class, new Validator(modules.getPluggableValidators()));
    }
    GlobalObserverNotifierService observerNotificationService = new GlobalObserverNotifierService(services, contextId);
    services.add(GlobalObserverNotifierService.class, observerNotificationService);
    /*
         * Preloader for container lifecycle events
         */
    ContainerLifecycleEventPreloader preloader = null;
    int preloaderThreadPoolSize = configuration.getIntegerProperty(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE);
    if (preloaderThreadPoolSize > 0 && Permissions.hasPermission(Permissions.MODIFY_THREAD_GROUP)) {
        preloader = new ContainerLifecycleEventPreloader(preloaderThreadPoolSize, observerNotificationService.getGlobalLenientObserverNotifier());
    }
    services.add(ContainerLifecycleEvents.class, new ContainerLifecycleEvents(preloader, services.get(RequiredAnnotationDiscovery.class)));
    if (environment.isEEModulesAware()) {
        services.add(BeanDeploymentModules.class, new BeanDeploymentModules(contextId, services));
    }
}
Also used : MemberTransformer(org.jboss.weld.resources.MemberTransformer) RequiredAnnotationDiscovery(org.jboss.weld.bootstrap.events.RequiredAnnotationDiscovery) CurrentInjectionPoint(org.jboss.weld.injection.CurrentInjectionPoint) AcceptingHttpContextActivationFilter(org.jboss.weld.servlet.spi.helpers.AcceptingHttpContextActivationFilter) HttpContextActivationFilter(org.jboss.weld.servlet.spi.HttpContextActivationFilter) GlobalEnablementBuilder(org.jboss.weld.bootstrap.enablement.GlobalEnablementBuilder) ContainerLifecycleEventPreloader(org.jboss.weld.bootstrap.events.ContainerLifecycleEventPreloader) MetaAnnotationStore(org.jboss.weld.metadata.cache.MetaAnnotationStore) ClassTransformer(org.jboss.weld.resources.ClassTransformer) BeanIdentifierIndex(org.jboss.weld.serialization.BeanIdentifierIndex) ContainerLifecycleEvents(org.jboss.weld.bootstrap.events.ContainerLifecycleEvents) ContextualStoreImpl(org.jboss.weld.serialization.ContextualStoreImpl) ResourceInjectionFactory(org.jboss.weld.injection.ResourceInjectionFactory) WeldModules(org.jboss.weld.module.WeldModules) CurrentInjectionPoint(org.jboss.weld.injection.CurrentInjectionPoint) SlimAnnotatedTypeStoreImpl(org.jboss.weld.annotated.slim.SlimAnnotatedTypeStoreImpl) ExecutorServices(org.jboss.weld.manager.api.ExecutorServices) ProtectionDomainCache(org.jboss.weld.bean.proxy.ProtectionDomainCache) GlobalObserverNotifierService(org.jboss.weld.event.GlobalObserverNotifierService) WeldConfiguration(org.jboss.weld.config.WeldConfiguration) CurrentEventMetadata(org.jboss.weld.event.CurrentEventMetadata)

Aggregations

SlimAnnotatedTypeStoreImpl (org.jboss.weld.annotated.slim.SlimAnnotatedTypeStoreImpl)1 ProtectionDomainCache (org.jboss.weld.bean.proxy.ProtectionDomainCache)1 GlobalEnablementBuilder (org.jboss.weld.bootstrap.enablement.GlobalEnablementBuilder)1 ContainerLifecycleEventPreloader (org.jboss.weld.bootstrap.events.ContainerLifecycleEventPreloader)1 ContainerLifecycleEvents (org.jboss.weld.bootstrap.events.ContainerLifecycleEvents)1 RequiredAnnotationDiscovery (org.jboss.weld.bootstrap.events.RequiredAnnotationDiscovery)1 WeldConfiguration (org.jboss.weld.config.WeldConfiguration)1 CurrentEventMetadata (org.jboss.weld.event.CurrentEventMetadata)1 GlobalObserverNotifierService (org.jboss.weld.event.GlobalObserverNotifierService)1 CurrentInjectionPoint (org.jboss.weld.injection.CurrentInjectionPoint)1 ResourceInjectionFactory (org.jboss.weld.injection.ResourceInjectionFactory)1 ExecutorServices (org.jboss.weld.manager.api.ExecutorServices)1 MetaAnnotationStore (org.jboss.weld.metadata.cache.MetaAnnotationStore)1 WeldModules (org.jboss.weld.module.WeldModules)1 ClassTransformer (org.jboss.weld.resources.ClassTransformer)1 MemberTransformer (org.jboss.weld.resources.MemberTransformer)1 BeanIdentifierIndex (org.jboss.weld.serialization.BeanIdentifierIndex)1 ContextualStoreImpl (org.jboss.weld.serialization.ContextualStoreImpl)1 HttpContextActivationFilter (org.jboss.weld.servlet.spi.HttpContextActivationFilter)1 AcceptingHttpContextActivationFilter (org.jboss.weld.servlet.spi.helpers.AcceptingHttpContextActivationFilter)1