Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2009, Red Hat, Inc. and/or its affiliates, 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.environment.deployment;
 
 import java.util.Set;
 
 

Author(s):
Peter Royle
Martin Kouba
 
 public class WeldDeployment extends AbstractWeldDeployment {
 
     public static final String ADDITIONAL_BDA_ID = WeldDeployment.class.getName() + ".additionalClasses";
 
 
     private final ResourceLoader resourceLoader;
 
     private WeldBeanDeploymentArchive additionalBeanDeploymentArchive = null;

    

Parameters:
resourceLoader
bootstrap
beanDeploymentArchives The set should be mutable so that additional bean deployment archives can be eventually added
extensions
 
     public WeldDeployment(ResourceLoader resourceLoaderBootstrap bootstrapSet<WeldBeanDeploymentArchivebeanDeploymentArchives,
             Iterable<Metadata<Extension>> extensions) {
         super(bootstrapextensions);
         this. = resourceLoader;
         this. = beanDeploymentArchives;
         for (BeanDeploymentArchive archive : beanDeploymentArchives) {
             archive.getServices().add(ResourceLoader.classresourceLoader);
         }
     }
 
     @Override
         return Collections.<BeanDeploymentArchiveunmodifiableSet();
     }
 
     @Override
     public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) {
         if (.size() == 1) {
             // There's only one bean archive or isolation is disabled - additional bean deployment archive does not make much sense
             return .iterator().next();
         }
         BeanDeploymentArchive bda = getBeanDeploymentArchive(beanClass);
         return bda != null ? bda : createAdditionalBeanDeploymentArchiveIfNeeded(beanClass);
     }
 
     @Override
     public BeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) {
         for (BeanDeploymentArchive bda : ) {
             if (bda.getBeanClasses().contains(beanClass.getName())) {
                 return bda;
             }
         }
         return null;
     }
 
         if ( == null) {
         } else {
             .addBeanClass(beanClass.getName());
         }
         return ;
     }

    
Additional bean deployment archives are used for extentions, synthetic annotated types and beans which do not come from a bean archive.

Parameters:
beanClass
Returns:
the additional bean deployment archive
        // At this time only the initial bean class is known
        Set<StringbeanClasses = new HashSet<String>();
        beanClasses.add(beanClass.getName());
        WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(beanClassesnull);
        additionalBda.getServices().add(ResourceLoader.class);
        additionalBda.getServices().addAll(getServices().entrySet());
        .add(additionalBda);
        // Set visibility - by default all bean archives see each other
        for (WeldBeanDeploymentArchive archive : ) {
        }
        return additionalBda;
    }
New to GrepCode? Check out our FAQ X