Class ManifestProcessor


  • public class ManifestProcessor
    extends Object
    This class contains utilities for parsing manifests. It provides methods to parse the manifest, read a manifest into a map and to split an manifest entry that follows the Import-Package syntax.
    • Constructor Detail

      • ManifestProcessor

        public ManifestProcessor()
    • Method Detail

      • readManifestIntoMap

        public static Map<String,​String> readManifestIntoMap​(Manifest mf)
        Reads a manifest's main attributes into a String->String map.

        Will always return a map, empty if the manifest had no attributes.

        Parameters:
        mf - The manifest to read.
        Returns:
        Map of manifest main attributes.
      • parseManifest

        public static Manifest parseManifest​(InputStream in)
                                      throws IOException
        This method parses the manifest using a custom manifest parsing routine. This means that we can avoid the 76 byte line length in a manifest providing a better developer experience.
        Parameters:
        in - the input stream to read the manifest from.
        Returns:
        the parsed manifest
        Throws:
        IOException
      • obtainManifestFromAppDir

        public static Manifest obtainManifestFromAppDir​(IDirectory appDir,
                                                        String manifestName)
                                                 throws IOException
        Obtain a manifest from an IDirectory.
        Parameters:
        appDir -
        manifestName - the name of manifest
        Returns:
        Manifest, or null if none found.
        Throws:
        IOException
      • split

        public static List<String> split​(String value,
                                         String delimiter)
        Splits a delimiter separated string, tolerating presence of non separator commas within double quoted segments. Eg. com.ibm.ws.eba.helloWorldService;version="[1.0.0, 1.0.0]" & com.ibm.ws.eba.helloWorldService;version="1.0.0" com.ibm.ws.eba.helloWorld;version="2";bundle-version="[2,30)" com.acme.foo;weirdAttr="one;two;three";weirdDir:="1;2;3"
        Parameters:
        value - the value to be split
        delimiter - the delimiter string such as ',' etc.
        Returns:
        List the components of the split String in a list