private static void addSubsystemManifestRequireCapability ( File esa , Map < Path , String > requiresMap ) throws IOException { String esaLocation = esa . getAbsolutePath ( ) ; ZipFile zip = null ; try { zip = new ZipFile ( esaLocation ) ; Enumeration < ? extends ZipEntry > zipEntries = zip . entries ( ) ; ZipEntry subsystemEntry = null ; while ( zipEntries . hasMoreElements ( ) ) { ZipEntry nextEntry = zipEntries . nextElement ( ) ; if ( "OSGI-INF/SUBSYSTEM.MF" . equalsIgnoreCase ( nextEntry . getName ( ) ) ) { subsystemEntry = nextEntry ; break ; } } if ( subsystemEntry == null ) { ; } else { Manifest m = ManifestProcessor . parseManifest ( zip . getInputStream ( subsystemEntry ) ) ; Attributes manifestAttrs = m . getMainAttributes ( ) ; String requireCapabilityAttr = manifestAttrs . getValue ( REQUIRE_CAPABILITY_HEADER_NAME ) ; requiresMap . put ( esa . toPath ( ) , requireCapabilityAttr ) ; } } finally { if ( zip != null ) { zip . close ( ) ; } } }
Adds the Require - Capability Strings from a SUBSYSTEM . MF to the Map of Require - Capabilities found