Search in sources :

Example 11 with Version

use of org.apache.ivy.osgi.util.Version in project ant-ivy by apache.

the class ManifestParser method parseCapability.

private static void parseCapability(BundleInfo bundleInfo, Attributes mainAttributes, String headerName, String type) throws ParseException {
    ManifestHeaderValue elements = new ManifestHeaderValue(mainAttributes.getValue(headerName));
    for (ManifestHeaderElement element : elements.getElements()) {
        String attVersion = element.getAttributes().get(ATTR_VERSION);
        Version version = null;
        try {
            version = versionOf(attVersion);
        } catch (NumberFormatException e) {
            throw new ParseException("The " + headerName + " has an incorrect version: " + attVersion + " (" + e.getMessage() + ")", 0);
        }
        for (String name : element.getValues()) {
            BundleCapability export = new BundleCapability(type, name, version);
            bundleInfo.addCapability(export);
        }
    }
}
Also used : Version(org.apache.ivy.osgi.util.Version) ParseException(java.text.ParseException)

Aggregations

Version (org.apache.ivy.osgi.util.Version)11 ParseException (java.text.ParseException)4 BundleInfo (org.apache.ivy.osgi.core.BundleInfo)3 BundleArtifact (org.apache.ivy.osgi.core.BundleArtifact)2 ModuleDescriptorWrapper (org.apache.ivy.osgi.repo.ModuleDescriptorWrapper)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 Attributes (java.util.jar.Attributes)1 BundleCapability (org.apache.ivy.osgi.core.BundleCapability)1 ExportPackage (org.apache.ivy.osgi.core.ExportPackage)1 Operator (org.apache.ivy.osgi.filter.CompareFilter.Operator)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1