Scan all the BDAs in the deployment to see if there are any bean classes.

This method must be called before scanForEjbEndpoints() and before we try to do
any real work with the deployment or the BDAs

@throws CDIException
978235
@Override
    public void scan() throws CDIException {
        Collection<WebSphereBeanDeploymentArchive> allBDAs = new ArrayList<WebSphereBeanDeploymentArchive>(deploymentDBAs.values());
        for (WebSphereBeanDeploymentArchive bda : allBDAs) {
            bda.scanForBeanDefiningAnnotations(true);
        }
        for (WebSphereBeanDeploymentArchive bda : allBDAs) {
            if (!bda.hasBeenScanned()) {
                bda.scan();
            }
        }
    }
1031412
private void processSingletonConcurrencyManagementType(BeanMetaData bmd) throws EJBConfigurationException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.entry(tc, "processSingletonConcurrencyManagementType");
        }

        // Initialize DD Concurrency Management type to null and change to
        // non null value if it is specified in the DD for the module.
        ConcurrencyManagementType ddType = null;

        // F743-7027 start
        Session sessionBean = (Session) bmd.wccm.enterpriseBean;
        if (sessionBean != null) {
            int type = sessionBean.getConcurrencyManagementTypeValue();
            if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_CONTAINER) {
                ddType = ConcurrencyManagementType.CONTAINER;
            } else if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_BEAN) {
                ddType = ConcurrencyManagementType.BEAN;
            }
        } // F743-7027 end

        // Initialize annotation Concurrency Management type to null and change to
        // non null value only if metadata complete is false and annotation is used
        // for this Singleton session bean.
        ConcurrencyManagementType annotationType = null;
        if (bmd.metadataComplete == false) {
            // Metadata complete is false, so do we have annotation value?
            // Note, EJB spec says annotation can not be inherited from superclass.
            Class<?> ejbClass = bmd.enterpriseBeanClass;
            ConcurrencyManagement annotation = ejbClass.getAnnotation(javax.ejb.ConcurrencyManagement.class);
            if (annotation != null) {
                // We have an annotation on EJB class, so validate that it is a valid value.
                annotationType = annotation.value();
                if (annotationType != ConcurrencyManagementType.CONTAINER && annotationType != ConcurrencyManagementType.BEAN) {
                    // CNTR0193E: The value, {0}, that is specified for the concurrency management type of
                    // the {1} enterprise bean class must be either BEAN or CONTAINER.
                    Tr.error(tc, "SINGLETON_INVALID_CONCURRENCY_MANAGEMENT_CNTR0193E", new Object[] { annotationType, bmd.enterpriseBeanClassName });

                    throw new EJBConfigurationException("CNTR0193E: The value, " + annotationType
                                                        + ", that is specified for the concurrency management type of the "
                                                        + bmd.enterpriseBeanClassName + " enterprise bean class must be either BEAN or CONTAINER.");
                }
            }
        }

        // Assign concurrency management type for this Singleton seesion bean.
        // Note, in "4.8.4.3 Specification of a Concurrency Management Type" of EJB 3.1 specification,
        // it says "The application assembler is not permitted to use the deployment
        // descriptor to override a bean's concurrency management type regardless of whether
        // it has been explicitly specified or defaulted by the Bean Provider."  However,
        // we have no way to know whether DD is from application assembler vs Bean Provider,
        // so we have to assume it came from Bean Provider.  The team decided that if both
        // annotation and DD is used, then the value must match. If they do not match,
        // throw an exception.

        // Was a value provided via DD?
        if (ddType == null) {
            // DD did not provide a value, so use annotation value if one was provided.
            // Otherwise, use default value required by EJB 3.1 spec.
            if (annotationType != null) {
                // No DD, but we have annotation. So use the annotation.
                bmd.ivSingletonUsesBeanManagedConcurrency = (annotationType == ConcurrencyManagementType.BEAN);
            } else {
                // Neither DD nor annotation, so default to Container Concurrency Management type.
                bmd.ivSingletonUsesBeanManagedConcurrency = false;
            }
        } else {
            // DD did provide a concurrency management type. Verify it matches annotation type
            // if both annotation and DD provided a value.
            if (annotationType != null && ddType != annotationType) {
                // CNTR0194E: The value {0} that is specified in the ejb-jar.xml file for concurrency management type is
                // not the same as the @ConcurrencyManagement annotation value {1} on the {2} enterprise bean class.
                Tr.error(tc, "SINGLETON_XML_OVERRIDE_CONCURRENCY_MANAGEMENT_CNTR0194E", new Object[] { ddType, annotationType, bmd.enterpriseBeanClassName });

                throw new EJBConfigurationException("CNTR0194E: The value " + ddType
                                                    + " that is specified in the ejb-jar.xml file for concurrency management type is not the same "
                                                    + " as the @ConcurrencyManagement annotation value " + annotationType + " on the "
                                                    + bmd.enterpriseBeanClassName + " enterprise bean class.");
            }

            // Use DD value since either annotation not used or DD matches the annotation type.
            bmd.ivSingletonUsesBeanManagedConcurrency = (ddType == ConcurrencyManagementType.BEAN);
        }

        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.exit(tc, "processSingletonConcurrencyManagementType returning "
                        + bmd.ivSingletonUsesBeanManagedConcurrency + " for j2ee name = " + bmd.j2eeName);
        }
    }
94970
@Override
	public Set<BeanDefinitionHolder> doScan(String... basePackages) {
		Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);

		if (beanDefinitions.isEmpty()) {
			logger.warn("No DaoService was found in '"
					+ Arrays.toString(basePackages)
					+ "' package. Please check your configuration.");
		} else {
			for (BeanDefinitionHolder holder : beanDefinitions) {
				GenericBeanDefinition definition = (GenericBeanDefinition) holder
						.getBeanDefinition();

				if (logger.isDebugEnabled()) {
					logger.debug("Creating DaoFactoryBean with name '"
							+ holder.getBeanName() + "' and '"
							+ definition.getBeanClassName() + "' daoInterface");
				}

				// the mapper interface is the original class of the bean
				// but, the actual class of the bean is HibernateDaoFactoryBean
				definition.getPropertyValues().add("daoInterface",
						definition.getBeanClassName());
				definition.getPropertyValues().add("funcs", functions);
				String className = definition.getBeanClassName();
				int idx = className.lastIndexOf(".");
				if (idx > 0)
					className = className.substring(idx + 1);
				String em = daoEntityManagerNames.get(className);
				if (em == null)
					em = entityManagerName;
				String sf = daoSessionFactoryNames.get(className);
				if (sf == null)
					sf = sessionFactoryName;
				definition.getPropertyValues().add("entityManagerFactoryName", em);
				definition.getPropertyValues().add("sessionFactoryName", sf);
				definition.setBeanClass(DaoFactoryBean.class);

				definition
						.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
			}
		}

		return beanDefinitions;
	}
790035
@SuppressWarnings("unchecked")
    private List<Class<? extends FeatureInstaller>> findInstallers() {
        if (scanner != null) {
            final List<Class<? extends FeatureInstaller>> installers = Lists.newArrayList();
            scanner.scan(new ClassVisitor() {
                @Override
                public void visit(final Class<?> type) {
                    if (FeatureUtils.is(type, FeatureInstaller.class)) {
                        installers.add((Class<? extends FeatureInstaller>) type);
                    }
                }
            });
            // sort to unify registration order on different systems
            installers.sort(Comparator.comparing(Class::getName));
            context.registerInstallersFromScan(installers);
        }
        final List<Class<? extends FeatureInstaller>> installers = context.getEnabledInstallers();
        installers.sort(COMPARATOR);
        logger.debug("Found {} installers", installers.size());
        return installers;
    }
1309192
private BeanDeploymentArchive createNewBdaAndMakeWiring(Class<?> beanClass) {
        try {
            OnDemandArchive onDemandArchive = new OnDemandArchive(cdiRuntime, application, beanClass);
            WebSphereBeanDeploymentArchive newBda = BDAFactory.createBDA(this, onDemandArchive, cdiRuntime);

            ClassLoader beanClassCL = onDemandArchive.getClassLoader();

            // need to make this bda to be accessible to other bdas according to classloader hierarchy
            for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {

                ClassLoader thisBDACL = wbda.getClassLoader();
                //If the current archive is an extension bda, let's add this newly created bda accessible to it
                if (wbda.getType() == ArchiveType.RUNTIME_EXTENSION) {
                    newBda.addBeanDeploymentArchive(wbda);
                } else {

                    //let's check to see whether the wbda needs to be accessible to this new bda
                    //The current bda should be accessible to the newly created bda if the newly created bda's classloader
                    // is the same or the child classloader of the current bda
                    makeWiring(newBda, wbda, thisBDACL, beanClassCL);
                }

                if ((wbda.getType() == ArchiveType.RUNTIME_EXTENSION) && wbda.extensionCanSeeApplicationBDAs()) {
                    wbda.addBeanDeploymentArchive(newBda);
                } else {

                    //Let's check whether the wbda's classloader is the descendant classloader of the new bda
                    makeWiring(wbda, newBda, beanClassCL, thisBDACL);

                }

            }
            //Add this new bda to the deployment graph
            addBeanDeploymentArchive(newBda);
            return newBda;
        } catch (CDIException e) {
            throw new IllegalStateException(e);
        }
    }
1063820
private void processBeanInterceptors() // d630717
    throws EJBConfigurationException
    {
        ivBeanInterceptorProxyMap = createInterceptorProxyMap(ivEjbClass, -1);

        // F743-1751 - Not all bean types collect bean methods.  For those
        // that do, find the methods that are declared on the bean.
        if (ivBeanLifecycleMethods != null)
        {
            for (InterceptorMethodKind kind : InterceptorMethodKind.values())
            {
                int mid = kind.getMethodID();
                if (mid != -1)
                {
                    List<InterceptorProxy> proxyList = ivBeanInterceptorProxyMap.get(kind);
                    if (proxyList != null)
                    {
                        for (InterceptorProxy proxy : proxyList)
                        {
                            Method m = proxy.ivInterceptorMethod;
                            if (m.getDeclaringClass() == ivEjbClass)
                            {
                                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                    Tr.debug(tc, "found bean " + LifecycleInterceptorWrapper.TRACE_NAMES[mid] + " method: " + m);

                                ivBeanLifecycleMethods[mid] = m;
                                break;
                            }
                        }
                    }
                }
            }
        }
    }
931813
public void processEJB(EJBEndpoint ejb, String ejbInterfaceName, ClassLoader appClassloader, Set<Class<?>> AllApplicationClasses, Set<String> AllPathProviderClassNames) {

        getEJBApplicationSubclasses(AllApplicationClasses, ejb, appClassloader);
        getEJBWithProviderClasses(AllPathProviderClassNames, ejb, ejbInterfaceName, appClassloader);
        getEJBWithPathClasses(AllPathProviderClassNames, ejb, ejbInterfaceName, appClassloader);

    }
909663
@SafeVarargs
	public final Set<Class<?>> scan(Class<? extends Annotation>... annotationTypes)
			throws ClassNotFoundException {
		List<String> packages = getPackages();
		if (packages.isEmpty()) {
			return Collections.emptySet();
		}
		ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
				false);
		scanner.setEnvironment(this.context.getEnvironment());
		scanner.setResourceLoader(this.context);
		for (Class<? extends Annotation> annotationType : annotationTypes) {
			scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
		}
		Set<Class<?>> entitySet = new HashSet<>();
		for (String basePackage : packages) {
			if (StringUtils.hasText(basePackage)) {
				for (BeanDefinition candidate : scanner
						.findCandidateComponents(basePackage)) {
					entitySet.add(ClassUtils.forName(candidate.getBeanClassName(),
							this.context.getClassLoader()));
				}
			}
		}
		return entitySet;
	}
458784
@Override
    @FFDCIgnore({ ClassNotFoundException.class })
    public void validateEjbInjection(EJB ejb, CDIArchive injectionArchive, Class<?> injectionType) throws ClassCastException, CDIException {

        Collection<CDIArchive> moduleArchives = injectionArchive.getApplication().getModuleArchives();
        String applicationName = injectionArchive.getApplication().getName();
        String moduleName = injectionArchive.getName();

        for (CDIArchive archive : moduleArchives) {
            try {

                EJBEndpoint endpoint = findEJBEndpoint(archive, ejb, injectionType, applicationName, moduleName);

                if (endpoint != null) {
                    // Found it!
                    return;
                }
            } catch (ClassNotFoundException e) {
                // Could not find the class, even though it should be in this module
                // Give up looking but don't fail validation
                return;
            } catch (ClassCastException e) {
                // Found the EJB and it's the wrong type
                // Throw on this exception to be handled by the caller
                throw e;
            }

            //TODO what happens if the endpoint is not found in any of the archives??
        }
    }
1000455
@SuppressWarnings("unchecked")
   private void verifyBeanValidation(Deployment deployment) throws DeployException
   {
      if (beanValidation != null)
      {
         ValidatorFactory vf = null;

         try
         {
            vf = beanValidation.getValidatorFactory();
            javax.validation.Validator v = vf.getValidator();

            Collection<String> l = deployment.getActivation().getBeanValidationGroups();
            if (l == null || l.isEmpty())
               l = Arrays.asList(javax.validation.groups.Default.class.getName());

            Collection<Class<?>> groups = new ArrayList<>();
            for (String clz : l)
            {
               try
               {
                  groups.add(Class.forName(clz, true, deployment.getClassLoader()));
               }
               catch (ClassNotFoundException e)
               {
                  throw new DeployException(bundle.unableToLoadBeanValidationGroup(clz, deployment.getIdentifier()),
                        e);
               }
            }
         
            Set failures = new HashSet();

            if (deployment.getResourceAdapter() != null)
            {

               Set f = v.validate(deployment.getResourceAdapter().getResourceAdapter(),
                     groups.toArray(new Class<?>[groups.size()]));
               if (!f.isEmpty())
                  failures.addAll(f);

            }
            if (deployment.getConnectionFactories() != null)
            {
               for (org.ironjacamar.core.api.deploymentrepository.ConnectionFactory cf :
                       deployment.getConnectionFactories())
               {

                  Set f = v.validate(cf.getConnectionFactory(), groups.toArray(new Class<?>[groups.size()]));
                  if (!f.isEmpty())
                     failures.addAll(f);

               }
            }
            if (deployment.getAdminObjects() != null)
            {
               for (org.ironjacamar.core.api.deploymentrepository.AdminObject ao :
                       deployment.getAdminObjects())
               {

                  Set f = v.validate(ao.getAdminObject(), groups.toArray(new Class<?>[groups.size()]));
                  if (!f.isEmpty())
                     failures.addAll(f);

               }
            }
         
            if (!failures.isEmpty())
            {
               throw new DeployException(bundle.violationOfValidationRule(deployment.getIdentifier()),
                     new ConstraintViolationException(failures));
            }
         }
         finally
         {
            if (vf != null)
               vf.close();
         }
      }
   }
1210544
@Override
    public <T> List<InjectionPoint> getJEEComponentInjectionPoints(Class<T> clazz) throws CDIException {
        InjectionTarget<T> injectionTarget = getJEEComponentInjectionTarget(clazz);
        List<InjectionPoint> injectionPoints = null;

        if (injectionTarget != null) {
            injectionPoints = new ArrayList<InjectionPoint>();
            Set<InjectionPoint> jeeClassInjectionPoints = injectionTarget.getInjectionPoints();
            if (jeeClassInjectionPoints != null && jeeClassInjectionPoints.size() > 0) {
                injectionPoints.addAll(jeeClassInjectionPoints);
            }

            String mainClassName = archive.getClientModuleMainClass();

            if (mainClassName != null) {
                if (clazz.getName().equals(mainClassName)) {
                    List<InjectionPoint> staticInjectionPoints = this.staticInjectionPoints.get(clazz);
                    if (staticInjectionPoints != null) {
                        injectionPoints.addAll(staticInjectionPoints);
                    }
                }
            }
        }

        return injectionPoints;
    }
385531
@Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        final ModuleLoader moduleLoader = Module.getBootModuleLoader();

    //    ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
        //   final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild("META-INF/beans.xml");
        //   final boolean rootBeansXmlPresent = rootBeansXml.exists() && rootBeansXml.isFile();
        //   System.out.println("rootBeansXmlPresent " + rootBeansXmlPresent);
    /*    Map<ResourceRoot, ExplicitBeanArchiveMetadata> beanArchiveMetadata = new HashMap<>();
         PropertyReplacingBeansXmlParser parser = new PropertyReplacingBeansXmlParser(deploymentUnit);

         ResourceRoot classesRoot = null;
         List<ResourceRoot> structure = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
         for (ResourceRoot resourceRoot : structure) {
         if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) {
         if (resourceRoot.getRootName().equals("classes")) {
         // hack for dealing with war modules
         classesRoot = resourceRoot;
         deploymentUnit.putAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT, resourceRoot);
         } else {
         VirtualFile beansXml = resourceRoot.getRoot().getChild("META-INF/beans.xml");
         if (beansXml.exists() && beansXml.isFile()) {
         System.out.println("rootBeansXmlPresent found");
         beanArchiveMetadata.put(resourceRoot, new ExplicitBeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml, parser, deploymentUnit), false));
         }
         }
         }
         }
         */
        //   BeansXml beansXml = deployment.getBeanDeploymentArchive().getBeansXml();
        if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
            return; // Skip if there are no beans.xml files in the deployment
        }

        ModuleDependency dep = new ModuleDependency(moduleLoader, ORG_JAM_METRICS, false, false, true, false);
        dep.addImportFilter(PathFilters.getMetaInfFilter(), true);
        dep.addExportFilter(PathFilters.getMetaInfFilter(), true);
        moduleSpecification.addSystemDependency(dep);

        ModuleDependency dep2 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_API, false, false, true, false);
        dep2.addImportFilter(PathFilters.getMetaInfFilter(), true);
        dep2.addExportFilter(PathFilters.getMetaInfFilter(), true);
        moduleSpecification.addSystemDependency(dep2);

        ModuleDependency dep3 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_PROPERTIES, false, false, true, false);
        dep3.addImportFilter(PathFilters.getMetaInfFilter(), true);
        dep3.addExportFilter(PathFilters.getMetaInfFilter(), true);
        moduleSpecification.addSystemDependency(dep3);

        ModuleDependency dep4 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY, false, false, true, false);
        dep4.addImportFilter(PathFilters.getMetaInfFilter(), true);
        dep4.addExportFilter(PathFilters.getMetaInfFilter(), true);
        moduleSpecification.addSystemDependency(dep4);

        ModuleDependency dep5 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY2, false, false, true, false);
        dep5.addImportFilter(PathFilters.getMetaInfFilter(), true);
        dep5.addExportFilter(PathFilters.getMetaInfFilter(), true);
        moduleSpecification.addSystemDependency(dep5);
    }
21558
public final void enlistBean(ContainerTx tx, BeanO bean)
    {
        bean.getActivationStrategy().atEnlist(tx, bean);
    }
694852
private void addRuntimeExtensions(WebSphereCDIDeployment webSphereCDIDeployment,
                                      DiscoveredBdas discoveredBdas) throws CDIException {
        //add the normal runtime extension using the bundle classloader to load the bda classes
        Set<WebSphereBeanDeploymentArchive> extensions = createExtensionBDAs(webSphereCDIDeployment);
        //add the runtime extensions containers
        webSphereCDIDeployment.addBeanDeploymentArchives(extensions);
        //add the runtime extensions containers
        for (WebSphereBeanDeploymentArchive bda : webSphereCDIDeployment.getApplicationBDAs()) {
            for (WebSphereBeanDeploymentArchive extBDA : extensions) {
                if (bda != extBDA) {
                    bda.addBeanDeploymentArchive(extBDA);
                    if (extBDA.extensionCanSeeApplicationBDAs() && !discoveredBdas.isExcluded(bda)) {
                        extBDA.addBeanDeploymentArchive(bda);
                    }
                }
            }
        }
    }
893517
private void scanEntityMappings() throws PersistenceUnitScannerException {
        /*
         * From the JPA 2.1 Specification:
         *
         * 8.2.1.6.2 Object/relational Mapping Files
         * An object/relational mapping XML file contains mapping information for the classes listed in it.
         *
         * A object/relational mapping XML file named orm.xml may be specified in the META-INF directory
         * in the root of the persistence unit or in the META-INF directory of any jar file referenced by the persistence.
         * xml. Alternatively, or in addition, one or more mapping files may be referenced by the
         * mapping-file elements of the persistence-unit element. These mapping files may be
         * present anywhere on the class path.
         *
         * An orm.xml mapping file or other mapping file is loaded as a resource by the persistence provider. If
         * a mapping file is specified, the classes and mapping information specified in the mapping file will be
         * used as described in Chapter 12. If multiple mapping files are specified (possibly including one or more
         * orm.xml files), the resulting mappings are obtained by combining the mappings from all of the files.
         * The result is undefined if multiple mapping files (including any orm.xml file) referenced within a single
         * persistence unit contain overlapping mapping information for any given class. The object/relational
         * mapping information contained in any mapping file referenced within the persistence unit must be disjoint
         * at the class-level from object/relational mapping information contained in any other such mapping
         * file.
         */
        final HashSet<URL> mappingFilesLocated = new HashSet<URL>();
        final HashSet<String> searchNames = new HashSet<String>();

        for (PersistenceUnitInfo pui : puiList) {
            try {
                mappingFilesLocated.clear();
                searchNames.clear();
                searchNames.add("META-INF/orm.xml");

                if (pui.getMappingFileNames() != null) {
                    searchNames.addAll(pui.getMappingFileNames());
                }

                for (String mappingFile : searchNames) {
                    mappingFilesLocated.addAll(findORMResources(pui, mappingFile));
                }

                final List<EntityMappingsDefinition> parsedOrmList = pu_ormFileParsed_map.get(pui);
                pu_ormFiles_map.get(pui).addAll(mappingFilesLocated);

                // Process discovered mapping files
                for (final URL mappingFileURL : mappingFilesLocated) {
                    if (scanned_ormfile_map.containsKey(mappingFileURL)) {
                        // Already processed this ORM File, no need to process it again.
                        parsedOrmList.add(scanned_ormfile_map.get(mappingFileURL));
                        continue;
                    }

                    EntityMappingsDefinition emapdef = EntityMappingsFactory.parseEntityMappings(mappingFileURL);
                    parsedOrmList.add(emapdef);
                    scanned_ormfile_map.put(mappingFileURL, emapdef);
                }
            } catch (Exception e) {
                FFDCFilter.processException(e, PersistenceUnitScanner.class.getName() + ".scanEntityMappings", "460");
                throw new PersistenceUnitScannerException(e);
            }
        }
    }
270141
private <T> List<Class<?>> filter(List<Class<?>> enabledClasses, List<Class<?>> globallyEnabledClasses, LogMessageCallback logMessageCallback,
            BeanDeployment deployment) {
        for (Iterator<Class<?>> iterator = enabledClasses.iterator(); iterator.hasNext(); ) {
            Class<?> enabledClass = iterator.next();
            if (globallyEnabledClasses.contains(enabledClass)) {
                logMessageCallback.log(enabledClass, deployment.getBeanDeploymentArchive().getId());
                iterator.remove();
            }
        }
        return enabledClasses;
    }
745791
protected void doScanDirectClasses() throws AnnotationTargets_Exception {
        if (haveScannedDirectClasses) {
            return;
        }

        haveScannedDirectClasses = true;

        if (rootClassSource == null) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Call to scan direct classes before activation");
            }

        } else {
            if (directClassSourceCount == 0) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Strange call to scan direct classes before adding direct class sources");
                }
            }

            createScanner(rootClassSource).scanDirect();
            // 'createScanner' and 'scanDirect' both throw AnnotationTargets_Exception
        }
    }