Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2008, Red Hat, Inc., and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.jboss.weld.bootstrap;
 
 import static com.google.common.collect.Collections2.filter;
 import static com.google.common.collect.Collections2.transform;
 import static java.util.Collections.emptyList;
 import static org.jboss.weld.config.ConfigurationKey.CONCURRENT_DEPLOYMENT;
 
 
 
 

Author(s):
Pete Muir
Jozef Hartinger
alesj
 
 public class BeanDeployment {
 
     private final BeanManagerImpl beanManager;
     private final BeanDeployer beanDeployer;
     private final Collection<ContextHolder<? extends Context>> contexts;
 
     public BeanDeployment(BeanDeploymentArchive beanDeploymentArchiveBeanManagerImpl deploymentManagerServiceRegistry deploymentServicesCollection<ContextHolder<? extends Context>> contexts) {
         this(beanDeploymentArchivedeploymentManagerdeploymentServicescontextsfalse);
     }
 
    public BeanDeployment(BeanDeploymentArchive beanDeploymentArchiveBeanManagerImpl deploymentManagerServiceRegistry deploymentServicesCollection<ContextHolder<? extends Context>> contextsboolean additionalBeanArchive) {
        this. = beanDeploymentArchive;
        EjbDescriptors ejbDescriptors = new EjbDescriptors();
        ServiceRegistry registry = beanDeploymentArchive.getServices();
        registry.add(EjbDescriptors.classejbDescriptors);
        ResourceLoader resourceLoader = registry.get(ResourceLoader.class);
        if (resourceLoader == null) {
            resourceLoader = .;
            registry.add(ResourceLoader.classresourceLoader);
        }
        ServiceRegistry services = new SimpleServiceRegistry();
        services.addAll(deploymentServices.entrySet());
        services.addAll(registry.entrySet());
        services.add(EJBApiAbstraction.classnew EJBApiAbstraction(resourceLoader));
        services.add(PersistenceApiAbstraction.classnew PersistenceApiAbstraction(resourceLoader));
        services.add(WSApiAbstraction.classnew WSApiAbstraction(resourceLoader));
        services.add(JtaApiAbstraction.classnew JtaApiAbstraction(resourceLoader));
        services.add(InterceptorsApiAbstraction.classnew InterceptorsApiAbstraction(resourceLoader));
        services.add(AnnotationApiAbstraction.classnew AnnotationApiAbstraction(resourceLoader));
        services.add(ServletApiAbstraction.classnew ServletApiAbstraction(resourceLoader));
        this. = BeanManagerImpl.newManager(deploymentManagerbeanDeploymentArchive.getId(), services);
        services.add(InjectionTargetService.classnew InjectionTargetService());
        if (.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(WeldConfiguration.class).getBooleanProperty() && services.contains(ExecutorServices.class)) {
             = new ConcurrentBeanDeployer(ejbDescriptorsdeploymentServices);
        } else {
             = new BeanDeployer(ejbDescriptorsdeploymentServices);
        }
        // Must at the Manager bean straight away, as it can be injected during startup!
        this. = contexts;
    }
    public BeanManagerImpl getBeanManager() {
        return ;
    }
    public BeanDeployer getBeanDeployer() {
        return ;
    }
        return ;
    }
    protected Iterable<StringobtainClasses() {
            // if the integrator for some reason ignored the "none" flag make sure we do not process the archive
            return Collections.emptySet();
        }
        Function<Metadata<Filter>, Predicate<String>> filterToPredicateFunction = new Function<Metadata<Filter>, Predicate<String>>() {
            final ResourceLoader resourceLoader = .getResourceLoader();
            @Override
            public Predicate<Stringapply(Metadata<Filterfrom) {
                return new FilterPredicate(from);
            }
        };
        Collection<StringclassNames;
        if (getBeanDeploymentArchive().getBeansXml() != null && getBeanDeploymentArchive().getBeansXml().getScanning() != null) {
            Collection<Metadata<Filter>> includeFilters;
            if (getBeanDeploymentArchive().getBeansXml().getScanning().getIncludes() != null) {
                includeFilters = getBeanDeploymentArchive().getBeansXml().getScanning().getIncludes();
            } else {
                includeFilters = emptyList();
            }
            Collection<Metadata<Filter>> excludeFilters;
            if (getBeanDeploymentArchive().getBeansXml().getScanning().getExcludes() != null) {
                excludeFilters = getBeanDeploymentArchive().getBeansXml().getScanning().getExcludes();
            } else {
                excludeFilters = emptyList();
            }
            /*
            * Take a copy of the transformed collection, this means that the
            * filter predicate is only built once per filter predicate
            */
            Collection<Predicate<String>> includes = new ArrayList<Predicate<String>>(transform(includeFiltersfilterToPredicateFunction));
            Collection<Predicate<String>> excludes = new ArrayList<Predicate<String>>(transform(excludeFiltersfilterToPredicateFunction));
            Predicate<Stringfilters = new ScanningPredicate<String>(includesexcludes);
            classNames = filter(.getBeanClasses(), filters);
        } else {
            classNames = .getBeanClasses();
        }
        return classNames;
    }
    public void createClasses() {
    }

    
Initializes module enablement.

See also:
ModuleEnablement
    public void createEnablement() {
        ModuleEnablement enablement = builder.createModuleEnablement(this);
        .setEnabled(enablement);
        if (..isDebugEnabled()) {
            ..enabledAlternatives(this., WeldCollections.toMultiRowString(enablement.getAllAlternatives()));
            ..enabledDecorators(this., WeldCollections.toMultiRowString(enablement.getDecorators()));
            ..enabledInterceptors(this., WeldCollections.toMultiRowString(enablement.getInterceptors()));
        }
    }
    public void createTypes() {
    }
    public void createBeans(Environment environment) {
        }
        if (.getServices().contains(TransactionServices.class)) {
        }
        if (.getServices().contains(SecurityServices.class)) {
        }
        // Register the context beans
        for (ContextHolder<? extends Contextcontext : ) {
            .addBuiltInBean(ContextBean.of(context));
        }
        // TODO Register the context beans
    }
    public void deploySpecialized(Environment environment) {
    }
    // TODO Move class stuff into startContainer phase
    // TODO read EJB descriptors after reading classes
    public void deployBeans(Environment environment) {
        .deploy();
    }
    public void afterBeanDiscovery(Environment environment) {
    }
New to GrepCode? Check out our FAQ X