private String parseManifestForAppliesTo ( File file ) throws RepositoryArchiveIOException { Manifest mf = null ; try ( JarFile jar = new JarFile ( file ) ) { try { mf = jar . getManifest ( ) ; } catch ( IOException ioe ) { throw new RepositoryArchiveIOException ( "Error getting manifest from jar " + jar . getName ( ) , new File ( jar . getName ( ) ) , ioe ) ; } } catch ( IOException ioe ) { throw new RepositoryArchiveIOException ( "Unable to create JarFile from path " + file , new File ( file . getName ( ) ) , ioe ) ; } String appliesTo = null ; Attributes mainattrs = mf . getMainAttributes ( ) ; // Iterate over the main attributes in the manifest and look for the ones we // are interested in. for ( Object at : mainattrs . keySet ( ) ) { String attribName = ( ( Attributes . Name ) at ) . toString ( ) ; String attribValue = ( String ) mainattrs . get ( at ) ; if ( APPLIES_TO . equals ( attribName ) ) { appliesTo = attribValue ; } } return appliesTo ; }
Looks at the manifest file extracting info and putting the info into the supplied asset