Class ManifestHeaderProcessor

java.lang.Object
org.apache.aries.util.manifest.ManifestHeaderProcessor

public class ManifestHeaderProcessor extends Object
  • Field Details

  • Constructor Details

    • ManifestHeaderProcessor

      public ManifestHeaderProcessor()
  • Method Details

    • 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]" invalid input: '&' 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 List<ManifestHeaderProcessor.NameValuePair> parseExportString(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 List<ManifestHeaderProcessor.NameValuePair> parseExportList(List<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 Map<String,Map<String,String>> parseImportString(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 List<ManifestHeaderProcessor.GenericMetadata> parseCapabilityString(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 List<ManifestHeaderProcessor.GenericMetadata> parseRequirementString(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(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(String s) throws IllegalArgumentException
      Parse a version range..
      Parameters:
      s -
      Returns:
      VersionRange object.
      Throws:
      IllegalArgumentException - if the String could not be parsed as a VersionRange
    • parseVersionRange

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

      public static String generateFilter(Map<String,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:invalid input: '<'*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 String generateFilter(String type, String name, Map<String,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:invalid input: '<'*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 Map<String,String> parseFilter(String filter)