private void processModules ( WebSphereCDIDeployment applicationContext , DiscoveredBdas discoveredBdas , Collection < CDIArchive > moduleArchives ) throws CDIException { List < WebSphereBeanDeploymentArchive > moduleBDAs = new ArrayList < WebSphereBeanDeploymentArchive > ( ) ; for ( CDIArchive archive : moduleArchives ) { if ( cdiRuntime . isClientProcess ( ) ) { // when on a client process, we only process client modules and ignore the others if ( ArchiveType . CLIENT_MODULE != archive . getType ( ) ) { continue ; } } else { // when on a server process, we do not process client modules, just the others if ( ArchiveType . CLIENT_MODULE == archive . getType ( ) ) { continue ; } } //if the app is not an EAR then there should be only one module and we can just use it's classloader if ( applicationContext . getClassLoader ( ) == null ) { applicationContext . setClassLoader ( archive . getClassLoader ( ) ) ; } String archiveID = archive . getJ2EEName ( ) . toString ( ) ; // we need to work our whether to create a bda or not if ( cdiRuntime . skipCreatingBda ( archive ) ) { continue ; } WebSphereBeanDeploymentArchive moduleBda = BDAFactory . createBDA ( applicationContext , archiveID , archive , cdiRuntime ) ; discoveredBdas . addDiscoveredBda ( archive . getType ( ) , moduleBda ) ; moduleBDAs . add ( moduleBda ) ; } // Having processed all the modules, we now process their libraries // We do it in this order in case one of the modules references another of the same type as a library for ( WebSphereBeanDeploymentArchive bda : moduleBDAs ) { processModuleLibraries ( bda , discoveredBdas ) ; } }
Create BDAs for either the EJB Web or Client modules and any libraries they reference on their classpath .