use of org.apache.ivy.osgi.core.ExportPackage in project ant-ivy by apache.
the class CapabilityAdapter method getExportPackage.
private static ExportPackage getExportPackage(BundleInfo bundleInfo, Capability capability) throws ParseException {
String pkgName = null;
Version version = null;
String uses = null;
for (CapabilityProperty property : capability.getProperties()) {
String propName = property.getName();
switch(propName) {
case "package":
pkgName = property.getValue();
break;
case "uses":
uses = property.getValue();
break;
case "version":
version = new Version(property.getValue());
break;
default:
Message.warn("Unsupported property '" + propName + "' on the 'package' capability of the bundle '" + bundleInfo.getSymbolicName() + "'");
break;
}
}
if (pkgName == null) {
throw new ParseException("No package name for the capability", 0);
}
ExportPackage exportPackage = new ExportPackage(pkgName, version);
if (uses != null) {
for (String use : splitToArray(uses)) {
exportPackage.addUse(use);
}
}
return exportPackage;
}
Aggregations