Search in sources :

Example 1 with SimpleProxyServices

use of org.jboss.weld.bean.proxy.util.SimpleProxyServices in project core by weld.

the class WeldStartup method startContainer.

public WeldRuntime startContainer(String contextId, Environment environment, Deployment deployment) {
    if (deployment == null) {
        throw BootstrapLogger.LOG.deploymentRequired();
    }
    tracker.start(Tracker.OP_BOOTSTRAP);
    tracker.start(Tracker.OP_START_CONTAINER);
    checkApiVersion();
    final ServiceRegistry registry = deployment.getServices();
    // initiate part of registry in order to allow access to WeldConfiguration
    new AdditionalServiceLoader(deployment).loadAdditionalServices(registry);
    // Resource Loader has to be loaded prior to WeldConfiguration
    if (!registry.contains(ResourceLoader.class)) {
        registry.add(ResourceLoader.class, DefaultResourceLoader.INSTANCE);
    }
    WeldConfiguration configuration = new WeldConfiguration(registry, deployment);
    registry.add(WeldConfiguration.class, configuration);
    String finalContextId = BeanDeployments.getFinalId(contextId, registry.get(WeldConfiguration.class).getStringProperty(ROLLING_UPGRADES_ID_DELIMITER));
    this.contextId = finalContextId;
    this.deployment = deployment;
    this.environment = environment;
    if (this.extensions == null) {
        setExtensions(deployment.getExtensions());
    }
    // Add extension to register built-in components
    this.extensions.add(MetadataImpl.from(new WeldExtension()));
    // Add Weld extensions
    String vetoTypeRegex = configuration.getStringProperty(ConfigurationKey.VETO_TYPES_WITHOUT_BEAN_DEFINING_ANNOTATION);
    if (!vetoTypeRegex.isEmpty()) {
        this.extensions.add(MetadataImpl.from(new WeldVetoExtension(vetoTypeRegex)));
    }
    // Finish the rest of registry init, setupInitialServices() requires already changed finalContextId
    tracker.start(Tracker.OP_INIT_SERVICES);
    setupInitialServices();
    registry.addAll(initialServices.entrySet());
    if (!registry.contains(ProxyServices.class)) {
        registry.add(ProxyServices.class, new SimpleProxyServices());
    }
    if (!registry.contains(SecurityServices.class)) {
        registry.add(SecurityServices.class, NoopSecurityServices.INSTANCE);
    }
    addImplementationServices(registry);
    tracker.end();
    verifyServices(registry, environment.getRequiredDeploymentServices(), contextId);
    if (!registry.contains(TransactionServices.class)) {
        BootstrapLogger.LOG.jtaUnavailable();
    }
    this.deploymentManager = BeanManagerImpl.newRootManager(finalContextId, "deployment", registry);
    Container.initialize(finalContextId, deploymentManager, ServiceRegistries.unmodifiableServiceRegistry(deployment.getServices()));
    getContainer().setState(ContainerState.STARTING);
    tracker.start(Tracker.OP_CONTEXTS);
    this.contexts = createContexts(registry);
    tracker.end();
    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
    // as caused by the presence of beans.xml
    tracker.start(Tracker.OP_READ_DEPLOYMENT);
    deploymentVisitor.visit();
    tracker.end();
    WeldRuntime weldRuntime = new WeldRuntime(finalContextId, deploymentManager, bdaMapping.getBdaToBeanManagerMap());
    tracker.end();
    return weldRuntime;
}
Also used : ProxyServices(org.jboss.weld.serialization.spi.ProxyServices) SimpleProxyServices(org.jboss.weld.bean.proxy.util.SimpleProxyServices) DefaultResourceLoader(org.jboss.weld.resources.DefaultResourceLoader) ResourceLoader(org.jboss.weld.resources.spi.ResourceLoader) SecurityServices(org.jboss.weld.security.spi.SecurityServices) NoopSecurityServices(org.jboss.weld.security.NoopSecurityServices) BeanManagerLookupService(org.jboss.weld.manager.BeanManagerLookupService) CDI11Deployment(org.jboss.weld.bootstrap.spi.CDI11Deployment) SimpleProxyServices(org.jboss.weld.bean.proxy.util.SimpleProxyServices) TransactionServices(org.jboss.weld.transaction.spi.TransactionServices) ServiceRegistry(org.jboss.weld.bootstrap.api.ServiceRegistry) SimpleServiceRegistry(org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry) WeldConfiguration(org.jboss.weld.config.WeldConfiguration)

Aggregations

SimpleProxyServices (org.jboss.weld.bean.proxy.util.SimpleProxyServices)1 ServiceRegistry (org.jboss.weld.bootstrap.api.ServiceRegistry)1 SimpleServiceRegistry (org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry)1 CDI11Deployment (org.jboss.weld.bootstrap.spi.CDI11Deployment)1 WeldConfiguration (org.jboss.weld.config.WeldConfiguration)1 BeanManagerLookupService (org.jboss.weld.manager.BeanManagerLookupService)1 DefaultResourceLoader (org.jboss.weld.resources.DefaultResourceLoader)1 ResourceLoader (org.jboss.weld.resources.spi.ResourceLoader)1 NoopSecurityServices (org.jboss.weld.security.NoopSecurityServices)1 SecurityServices (org.jboss.weld.security.spi.SecurityServices)1 ProxyServices (org.jboss.weld.serialization.spi.ProxyServices)1 TransactionServices (org.jboss.weld.transaction.spi.TransactionServices)1