Class ManifestHeaderProcessor


  • public class ManifestHeaderProcessor
    extends java.lang.Object
    • Field Detail

      • NESTED_FILTER_ATTRIBUTE

        public static final java.lang.String NESTED_FILTER_ATTRIBUTE
        See Also:
        Constant Field Values
    • Constructor Detail

      • ManifestHeaderProcessor

        public ManifestHeaderProcessor()
    • Method Detail

      • split

        public static java.util.List<java.lang.String> split​(java.lang.String value,
                                                             java.lang.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
      • parseExportString

        public static java.util.List<ManifestHeaderProcessor.NameValuePair> parseExportString​(java.lang.String s)
        Parse an export style header.

        pkg1;attrib=value;attrib=value,pkg2;attrib=value,pkg3;attrib=value2

        Result is returned as a list, as export does allow duplicate package exports.

        Parameters:
        s - The data to parse.
        Returns:
        List of NameValuePairs, where each Name in the list is an exported package, with its associated Value being a NameValueMap of any attributes declared.
      • parseExportList

        public static java.util.List<ManifestHeaderProcessor.NameValuePair> parseExportList​(java.util.List<java.lang.String> list)
        Parse an export style header in a list.

        pkg1;attrib=value;attrib=value pkg2;attrib=value pkg3;attrib=value2

        Result is returned as a list, as export does allow duplicate package exports.

        Parameters:
        list - The data to parse.
        Returns:
        List of NameValuePairs, where each Name in the list is an exported package, with its associated Value being a NameValueMap of any attributes declared.
      • parseImportString

        public static java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> parseImportString​(java.lang.String s)
        Parse an import style header.

        pkg1;attrib=value;attrib=value,pkg2;attrib=value,pkg3;attrib=value

        Result is returned as a set, as import does not allow duplicate package imports.

        Parameters:
        s - The data to parse.
        Returns:
        Map of NameValuePairs, where each Key in the Map is an imported package, with its associated Value being a NameValueMap of any attributes declared.
      • parseCapabilityString

        public static java.util.List<ManifestHeaderProcessor.GenericMetadata> parseCapabilityString​(java.lang.String s)
        Parse a generic capability header. For example
        com.acme.myns;mylist:List="nl,be,fr,uk";myver:Version=1.3;long:Long="1234";d:Double="3.14";myattr=xyz, com.acme.myns;myattr=abc
        Parameters:
        s - The header to be parsed
        Returns:
        A list of GenericMetadata objects each representing an individual capability. The values in the attribute map are of the specified datatype.
      • parseRequirementString

        public static java.util.List<ManifestHeaderProcessor.GenericMetadata> parseRequirementString​(java.lang.String s)
        Parse a generic capability header. For example
        com.acme.myns;mylist:List="nl,be,fr,uk";myver:Version=1.3;long:Long="1234";d:Double="3.14";myattr=xyz, com.acme.myns;myattr=abc
        Parameters:
        s - The header to be parsed
        Returns:
        A list of GenericMetadata objects each representing an individual capability. The values in the attribute map are of the specified datatype.
      • parseBundleSymbolicName

        public static ManifestHeaderProcessor.NameValuePair parseBundleSymbolicName​(java.lang.String s)
        Parse a bundle symbolic name.

        bundlesymbolicname;attrib=value;attrib=value

        Parameters:
        s - The data to parse.
        Returns:
        NameValuePair with Name being the BundleSymbolicName, and Value being any attribs declared for the name.
      • parseVersionRange

        public static VersionRange parseVersionRange​(java.lang.String s)
                                              throws java.lang.IllegalArgumentException
        Parse a version range..
        Parameters:
        s -
        Returns:
        VersionRange object.
        Throws:
        java.lang.IllegalArgumentException - if the String could not be parsed as a VersionRange
      • parseVersionRange

        public static VersionRange parseVersionRange​(java.lang.String s,
                                                     boolean exactVersion)
                                              throws java.lang.IllegalArgumentException
        Parse a version range and indicate if the version is an exact version
        Parameters:
        s -
        exactVersion -
        Returns:
        VersionRange object.
        Throws:
        java.lang.IllegalArgumentException - if the String could not be parsed as a VersionRange
      • generateFilter

        public static java.lang.String generateFilter​(java.util.Map<java.lang.String,​java.lang.String> attribs)
        Generate a filter from a set of attributes. This filter will be suitable for presentation to OBR This means that, due to the way OBR works, it will include a stanza of the form, (mandatory:<*mandatoryAttribute) Filter strings generated by this method will therefore tend to break the standard OSGi Filter class. The OBR stanza can be stripped out later if required.
        Parameters:
        attribs -
        Returns:
        filter string
      • generateFilter

        public static java.lang.String generateFilter​(java.lang.String type,
                                                      java.lang.String name,
                                                      java.util.Map<java.lang.String,​java.lang.String> attribs)
        Generate a filter from a set of attributes. This filter will be suitable for presentation to OBR. This means that, due to the way OBR works, it will include a stanza of the form, (mandatory:<*mandatoryAttribute) Filter strings generated by this method will therefore tend to break the standard OSGi Filter class. The OBR stanza can be stripped out later if required. We may wish to consider relocating this method since VersionRange has its own top level class.
        Parameters:
        type -
        name -
        attribs -
        Returns:
        filter string
      • parseFilter

        public static java.util.Map<java.lang.String,​java.lang.String> parseFilter​(java.lang.String filter)