Package org.jboss.weld.bootstrap.api

Examples of org.jboss.weld.bootstrap.api.ServiceRegistry


      services.put(serviceType, service);
   }

   public ServiceRegistry create()
   {
      ServiceRegistry serviceRegistry = new SimpleServiceRegistry();
      serviceRegistry.addAll(services.entrySet());
      EjbServices ejbServices = null;
      try
      {
         ejbServices = (EjbServices) ejbServicesFactory.createBean();
      } catch (Throwable e)
      {
         throw new RuntimeException(e);
      }
      serviceRegistry.add(EjbServices.class, ejbServices);
      return serviceRegistry;
   }
View Full Code Here


      Archive archive = archiveLoader.load(beanClass, this);
      loadedArchives.add(archive);
      BeanDeploymentArchive bda = archive.getBeanDeploymentArchive();
      if (archive.getBeanDeploymentArchive() == null)
      {
         ServiceRegistry serviceRegistry = loadedBDAServiceRegistry.create();
         bda = archive.createBeanDeploymentArchive(serviceRegistry);
      }
      return bda;
   }
View Full Code Here

    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 {
            beanDeployer = new BeanDeployer(beanManager, ejbDescriptors, deploymentServices);
        }
        beanManager.getServices().get(SpecializationAndEnablementRegistry.class).registerEnvironment(beanManager, beanDeployer.getEnvironment(), additionalBeanArchive);
View Full Code Here

    private ClassTransformer transformer;
    private boolean initialized;
    private ClassFileServices classFileServices;

    void init(@Observes BeforeBeanDiscovery event, BeanManager manager) throws Exception {
        ServiceRegistry services = BeanManagerProxy.unwrap(manager).getServices();
        this.classFileServices = services.get(ClassFileServices.class);
        this.resolver = new FastProcessAnnotatedTypeResolver(services.get(GlobalObserverNotifierService.class).getAllObserverMethods());
        this.notifier = BeanManagerProxy.unwrap(manager).getGlobalLenientObserverNotifier();
        this.discovery = services.get(RequiredAnnotationDiscovery.class);
        this.transformer = services.get(ClassTransformer.class);
    }
View Full Code Here

        return parent;
    }

    private <T extends Service> void copyService(BeanDeploymentArchive archive, Class<T> serviceClass) {
        // for certain services we can fall back to deployment-level settings or defaults
        ServiceRegistry registry = archive.getServices();
        if (!registry.contains(serviceClass)) {
            T service = deployment.getServices().get(serviceClass);
            if (service != null) {
                registry.add(serviceClass, service);
            }
        }
    }
View Full Code Here

        if (this.extensions == null) {
            this.extensions = deployment.getExtensions();
        }

        final ServiceRegistry registry = deployment.getServices();

        setupInitialServices();
        registry.addAll(initialServices.entrySet());

        new AdditionalServiceLoader(deployment).loadAdditionalServices(registry);

        if (!registry.contains(ResourceLoader.class)) {
            registry.add(ResourceLoader.class, DefaultResourceLoader.INSTANCE);
        }
        if (!registry.contains(InstantiatorFactory.class)) {
            registry.add(InstantiatorFactory.class, new LoaderInstantiatorFactory());
        }
        if (!registry.contains(ScheduledExecutorServiceFactory.class)) {
            registry.add(ScheduledExecutorServiceFactory.class, new SingleThreadScheduledExecutorServiceFactory());
        }
        if (!registry.contains(ProxyServices.class)) {
            registry.add(ProxyServices.class, new SimpleProxyServices());
        }
        if (!registry.contains(BootstrapConfiguration.class)) {
            registry.add(BootstrapConfiguration.class, new FileBasedBootstrapConfiguration(DefaultResourceLoader.INSTANCE));
        }
        addImplementationServices(registry);


        verifyServices(registry, environment.getRequiredDeploymentServices());
        if (!registry.contains(TransactionServices.class)) {
            BootstrapLogger.LOG.jtaUnavailable();
        }

        this.deployment = deployment;
        this.environment = environment;
        this.deploymentManager = BeanManagerImpl.newRootManager(contextId, "deployment", registry);

        Container.initialize(contextId, deploymentManager, ServiceRegistries.unmodifiableServiceRegistry(deployment.getServices()));
        getContainer().setState(ContainerState.STARTING);

        this.contexts = createContexts(registry);

        this.bdaMapping = new BeanDeploymentArchiveMapping();
        this.deploymentVisitor = new DeploymentVisitor(deploymentManager, environment, deployment, contexts, bdaMapping);

        if (deployment instanceof CDI11Deployment) {
            registry.add(BeanManagerLookupService.class, new BeanManagerLookupService((CDI11Deployment) deployment, bdaMapping.getBdaToBeanManagerMap()));
        } else {
            BootstrapLogger.LOG.legacyDeploymentMetadataProvided();
        }

        // Read the deployment structure, bdaMapping will be the physical structure
View Full Code Here

    //
//      URLClassLoader classLoader = new URLClassLoader(fsURLs.toArray(new URL[fsURLs.size()]), owner.classLoader);
    ResourceLoader loader = new ClassLoaderResourceLoader(owner.classLoader);

    //
    ServiceRegistry registry = new SimpleServiceRegistry();
    registry.add(ResourceLoader.class, loader);

    //
    this.beanClasses = beanClasses;
    this.xml = xml;
    this.id = id;
View Full Code Here

TOP

Related Classes of org.jboss.weld.bootstrap.api.ServiceRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.