public static boolean copyModuleMetaDataSlot ( MetaDataEvent < ModuleMetaData > event , MetaDataSlot slot ) { Container container = event . getContainer ( ) ; MetaData metaData = event . getMetaData ( ) ; try { // For now, we just need to copy from WebModuleInfo, and ClientModuleInfo // Supports EJB in WAR and ManagedBean in Client ExtendedModuleInfo moduleInfo = ( ExtendedModuleInfo ) container . adapt ( NonPersistentCache . class ) . getFromCache ( WebModuleInfo . class ) ; if ( moduleInfo == null ) { moduleInfo = ( ExtendedModuleInfo ) container . adapt ( NonPersistentCache . class ) . getFromCache ( ClientModuleInfo . class ) ; } if ( moduleInfo != null ) { ModuleMetaData primaryMetaData = moduleInfo . getMetaData ( ) ; if ( metaData != primaryMetaData ) { Object slotData = primaryMetaData . getMetaData ( slot ) ; if ( slotData == null ) { // The caller is required to populate slot data. throw new IllegalStateException ( ) ; } metaData . setMetaData ( slot , slotData ) ; return true ; } } } catch ( UnableToAdaptException e ) { throw new UnsupportedOperationException ( e ) ; } return false ; }
Copy slot data from a primary module metadata to a nested module metadata . This is necessary for containers that want to share module - level data for all components in a module because nested modules have their own distinct metadata .