Refine search
public WeldBootstrapService(final WeldDeployment deployment, final Environment environment, final String deploymentName, final Consumer<WeldBootstrapService> weldBootstrapServiceConsumer, final Supplier<ExecutorServices> executorServicesSupplier, final Supplier<ExecutorService> serverExecutorSupplier, final Supplier<SecurityServices> securityServicesSupplier, final Supplier<TransactionServices> weldTransactionServicesSupplier ) { this.deployment = deployment; this.environment = environment; this.deploymentName = deploymentName; this.weldBootstrapServiceConsumer = weldBootstrapServiceConsumer; this.executorServicesSupplier = executorServicesSupplier; this.serverExecutorSupplier = serverExecutorSupplier; this.securityServicesSupplier = securityServicesSupplier; this.weldTransactionServicesSupplier = weldTransactionServicesSupplier; this.bootstrap = new WeldBootstrap(); Map<String, BeanDeploymentArchive> bdas = new HashMap<String, BeanDeploymentArchive>(); BeanDeploymentArchiveImpl rootBeanDeploymentArchive = null; for (BeanDeploymentArchive archive : deployment.getBeanDeploymentArchives()) { bdas.put(archive.getId(), archive); if (archive instanceof BeanDeploymentArchiveImpl) { BeanDeploymentArchiveImpl bda = (BeanDeploymentArchiveImpl) archive; if (bda.isRoot()) { rootBeanDeploymentArchive = bda; } } } this.rootBeanDeploymentArchive = rootBeanDeploymentArchive; this.beanDeploymentArchives = Collections.unmodifiableMap(bdas); }
try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(deployment.getModule().getClassLoader()); bootstrap.startContainer(deploymentName, environment, deployment); WeldProvider.containerInitialized(Container.instance(deploymentName), getBeanManager(), deployment); } finally {
bootstrapSupplier.get().getBootstrap().startInitialization(); bootstrapSupplier.get().getBootstrap().deployBeans(); bootstrapSupplier.get().getBootstrap().validateBeans(); } finally {
final WeldBootstrap bootstrap = new WeldBootstrap(); final Deployment deployment = createDeployment(resourceLoader, bootstrap); bootstrap.startContainer(containerId, Environments.SE, deployment); bootstrap.startInitialization(); bootstrap.deployBeans(); bootstrap.validateBeans(); bootstrap.endInitialization(); WeldContainer.endInitialization(weldContainer, isEnabled(SHUTDOWN_HOOK_SYSTEM_PROPERTY, true)); initializedContainers.put(containerId, weldContainer);
private void createBeanManager() { bootstrap = new WeldBootstrap(); BundleDeployment deployment = new BundleDeployment(getBundle(), bootstrap, getContextClassLoader()); BeanDeploymentArchive beanDeploymentArchive = deployment.getBeanDeploymentArchive(); pause(); String contextId = getBundle().getSymbolicName() + ":" + getBundle().getBundleId(); ExternalConfigurationBuilder configurationBuilder = new ExternalConfigurationBuilder() // Use relaxed construction by default .add(ConfigurationKey.RELAXED_CONSTRUCTION.get(), true) .add(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), false); deployment.getServices() .add(ExternalConfiguration.class, configurationBuilder.build()); bootstrap.startContainer(contextId, OsgiEnvironment.getInstance(), deployment); // Add the ProxyServices service: we rely on the BeanManager to use its annotated // types cache to discover type closures which is required for proxied beans // whose type closures span multiple bundles deployment.getServices() .add(ProxyServices.class, new OsgiProxyService( bootstrap.getManager(beanDeploymentArchive), getContextClassLoader())); bootstrap.startInitialization(); bootstrap.deployBeans(); bootstrap.validateBeans(); manager = bootstrap.getManager(beanDeploymentArchive); resume(); }
@Before public void setup() throws Exception { Deployment deployment = createDeployment(Service.class, Cat.class, CatService.class, Dog.class, DogService.class); bootstrap = new WeldBootstrap(); bootstrap.startContainer(Environments.SE, deployment, new ConcurrentHashMapBeanStore()) .startInitialization() .deployBeans() .validateBeans() .endInitialization(); manager = bootstrap.getManager(deployment.getBeanDeploymentArchives().iterator().next()); enricher = new CDIInjectionEnricher() { protected BeanManager lookupBeanManager() { return manager; } }; }
bootstrap.startExtensions(deploymentImpl.getExtensions()); bootstrap.startContainer(fAppName, Environments.SERVLET, deploymentImpl/*, new ConcurrentHashMapBeanStore()*/); bootstrap.startInitialization(); fireProcessInjectionTargetEvents(bootstrap, deploymentImpl); bootstrap.deployBeans(); bootstrap.validateBeans(); bootstrap.endInitialization(); } catch (Throwable t) { try {
@Override public void start(final StartContext context) throws StartException { ClassLoader oldTccl = SecurityActions.getContextClassLoader(); try { for (SetupAction action : setupActions) { action.setup(null); } SecurityActions.setContextClassLoader(classLoader); bootstrap.getValue().getBootstrap().startInitialization(); bootstrap.getValue().getBootstrap().deployBeans(); bootstrap.getValue().getBootstrap().validateBeans(); bootstrap.getValue().getBootstrap().endInitialization(); } finally { for (SetupAction action : setupActions) { try { action.teardown(null); } catch (Exception e) { WeldLogger.DEPLOYMENT_LOGGER.exceptionClearingThreadState(e); } } SecurityActions.setContextClassLoader(oldTccl); } }
/** * Gets the {@link BeanManager} linked to the root bean deployment archive. This BeanManager has access to all beans in a * deployment * * @throws IllegalStateException if the container is not running */ public BeanManagerImpl getBeanManager() { if (!started) { throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer"); } return bootstrap.getManager(rootBeanDeploymentArchive); }
/** * Stops the container * Executed in WeldStartService to shutdown the runtime before NamingService is closed. * * @throws IllegalStateException if the container is not running */ @Override public void stop(final StopContext context) { final WeldBootstrapService bootstrapService = bootstrapSupplier.get(); if (!bootstrapService.isStarted()) { throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer"); } WeldLogger.DEPLOYMENT_LOGGER.stoppingWeldService(bootstrapService.getDeploymentName()); ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(bootstrapService.getDeployment().getModule().getClassLoader()); WeldProvider.containerShutDown(Container.instance(bootstrapService.getDeploymentName())); bootstrapService.getBootstrap().shutdown(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); ModuleGroupSingletonProvider.removeClassLoader(bootstrapService.getDeployment().getModule().getClassLoader()); } bootstrapService.setStarted(false); }
@Override public BeansXml parse(Iterable<URL> urls) { return parse(urls, false); }
bootstrapSupplier.get().getBootstrap().endInitialization(); } finally { for (SetupAction action : setupActions) {
final WeldBootstrap bootstrap = new WeldBootstrap(); final Deployment deployment = createDeployment(resourceLoader, bootstrap); bootstrap.startContainer(containerId, Environments.SE, deployment); bootstrap.startInitialization(); bootstrap.deployBeans(); bootstrap.validateBeans(); bootstrap.endInitialization(); WeldContainer.endInitialization(weldContainer, isEnabled(SHUTDOWN_HOOK_SYSTEM_PROPERTY, true)); initializedContainers.put(containerId, weldContainer);
WeldBootstrap bootstrap = new WeldBootstrap(); beanArchive.setBootstrap(bootstrap); bootstrap.startContainer(Environments.SE, deployment) .startInitialization() .deployBeans() .endInitialization(); WeldManager manager = bootstrap.getManager(beanArchive);
/** * Gets the {@link BeanManager} for a given bean deployment archive id. * * @throws IllegalStateException if the container is not running * @throws IllegalArgumentException if the bean deployment archive id is not found */ public BeanManagerImpl getBeanManager(String beanArchiveId) { if (!started) { throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer"); } BeanDeploymentArchive beanDeploymentArchive = beanDeploymentArchives.get(beanArchiveId); if (beanDeploymentArchive == null) { throw WeldLogger.ROOT_LOGGER.beanDeploymentNotFound(beanArchiveId); } return bootstrap.getManager(beanDeploymentArchive); }
@Override public Object call() throws Exception { manager.fireEvent(environment, DestroyedLiteral.APPLICATION); bootstrap.shutdown(); return null; } });
@Override public BeansXml parse(Iterable<URL> urls) { return parse(urls, false); }
@Override public Object call() throws Exception { bootstrap.endInitialization(); manager.fireEvent(environment, InitializedLiteral.APPLICATION); return null; } });
final WeldBootstrap bootstrap = new WeldBootstrap(); final Deployment deployment = createDeployment(resourceLoader, bootstrap); bootstrap.startContainer(containerId, Environments.SE, deployment); bootstrap.startInitialization(); bootstrap.deployBeans(); bootstrap.validateBeans(); bootstrap.endInitialization(); WeldContainer.endInitialization(weldContainer, isEnabled(SHUTDOWN_HOOK_SYSTEM_PROPERTY, true)); initializedContainers.put(containerId, weldContainer);
public TestContainer(Deployment deployment) { this.bootstrap = new WeldBootstrap(); this.deployment = deployment; }