public static void scan ( ServletContext c , Set < String > jars , Functor < Void , ServiceModule > collector , Logger logger ) { for ( String j : jars ) { logger . config ( "... " + j ) ; try ( JarInputStream jis = new JarInputStream ( j . startsWith ( "/" ) ? c . getResourceAsStream ( j ) : new URL ( j ) . openStream ( ) ) ) { Attributes attrs = jis . getManifest ( ) . getMainAttributes ( ) ; String d = attrs . getValue ( DOMAIN_NAME ) , n = attrs . getValue ( MODULE_NAME ) , s = attrs . getValue ( SIMPLE_NAME ) ; if ( d != null && n != null && s != null ) { collector . invoke ( new ServiceModule ( d , n , s , attrs . getValue ( MODULE_BASE ) , j ) ) ; } } catch ( IOException x ) { logger . log ( Level . WARNING , "Unexpected error during jar inspection, ignored" , x ) ; } catch ( Exception x ) { logger . config ( "Unknown resource ignored" ) ; } } }
Scans a collection of jar files passing recognized Xillium application modules as ServiceModule objects to a collector .