use of org.apache.ivy.osgi.core.BundleCapability in project ant-ivy by apache.
the class OBRXMLWriter method saxBundleInfo.
private static void saxBundleInfo(BundleInfo bundleInfo, ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
addAttr(atts, ResourceHandler.SYMBOLIC_NAME, bundleInfo.getSymbolicName());
addAttr(atts, ResourceHandler.VERSION, bundleInfo.getRawVersion());
for (BundleArtifact artifact : bundleInfo.getArtifacts()) {
if (!artifact.isSource()) {
addAttr(atts, ResourceHandler.URI, bundleInfo.getArtifacts().get(0).getUri().toString());
break;
}
}
handler.startElement("", ResourceHandler.RESOURCE, ResourceHandler.RESOURCE, atts);
for (BundleArtifact artifact : bundleInfo.getArtifacts()) {
if (artifact.isSource()) {
startElement(handler, ResourceSourceHandler.SOURCE);
characters(handler, artifact.getUri().toString());
endElement(handler, ResourceSourceHandler.SOURCE);
break;
}
}
for (BundleCapability capability : bundleInfo.getCapabilities()) {
saxCapability(capability, handler);
}
for (BundleRequirement requirement : bundleInfo.getRequirements()) {
saxRequirement(requirement, handler);
}
handler.endElement("", ResourceHandler.RESOURCE, ResourceHandler.RESOURCE);
handler.characters("\n".toCharArray(), 0, 1);
}
use of org.apache.ivy.osgi.core.BundleCapability in project ant-ivy by apache.
the class CapabilityAdapter method getOSGiService.
private static BundleCapability getOSGiService(BundleInfo bundleInfo, Capability capability) throws ParseException {
String name = null;
Version version = null;
for (CapabilityProperty property : capability.getProperties()) {
String propName = property.getName();
switch(propName) {
case "service":
name = 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 (name == null) {
throw new ParseException("No service name for the capability", 0);
}
return new BundleCapability(BundleInfo.SERVICE_TYPE, name, version);
}
use of org.apache.ivy.osgi.core.BundleCapability in project ant-ivy by apache.
the class EditableRepoDescriptor method addBundle.
public void addBundle(BundleInfo bundleInfo) {
ModuleDescriptorWrapper module = findModule(bundleInfo.getSymbolicName(), bundleInfo.getVersion());
if (module != null) {
Message.debug("Duplicate module " + bundleInfo.getSymbolicName() + "@" + bundleInfo.getVersion());
return;
}
ModuleDescriptorWrapper md = new ModuleDescriptorWrapper(bundleInfo, baseUri, profileProvider);
add(BundleInfo.BUNDLE_TYPE, bundleInfo.getSymbolicName(), md);
for (BundleCapability capability : bundleInfo.getCapabilities()) {
add(capability.getType(), capability.getName(), md);
}
}
Aggregations