in src/java/org/apache/ivy/osgi/obr/xml/OBRXMLParser.java [107:200]
public ResourceHandler() {
super(RESOURCE);
setSkipOnError(true); // if anything bad happen in any children, just ignore the
// resource
addChild(new ResourceSourceHandler(), new ChildElementHandler<ResourceSourceHandler>() {
@Override
public void childHandled(ResourceSourceHandler child) {
String uri = child.getBufferedChars().trim();
if (!uri.endsWith(".jar")) {
// the maven plugin is putting some useless source url sometimes...
log(Message.MSG_WARN,
"A source uri is suspect, it is not ending with .jar, it is probably"
+ " a pointer to a download page. Ignoring it.");
return;
}
try {
bundleInfo.addArtifact(new BundleArtifact(true, new URI(uri), null));
} catch (URISyntaxException e) {
log(Message.MSG_WARN, "Incorrect uri " + uri + ". The source of "
+ bundleInfo.getSymbolicName() + " is then ignored.");
return;
}
}
});
addChild(new ResourceDescriptionHandler(),
new ChildElementHandler<ResourceDescriptionHandler>() {
@Override
public void childHandled(ResourceDescriptionHandler child) {
bundleInfo.setDescription(child.getBufferedChars().trim());
}
});
addChild(new ResourceDocumentationHandler(),
new ChildElementHandler<ResourceDocumentationHandler>() {
@Override
public void childHandled(ResourceDocumentationHandler child) {
bundleInfo.setDocumentation(child.getBufferedChars().trim());
}
});
addChild(new ResourceLicenseHandler(),
new ChildElementHandler<ResourceLicenseHandler>() {
@Override
public void childHandled(ResourceLicenseHandler child) {
bundleInfo.setLicense(child.getBufferedChars().trim());
}
});
addChild(new ResourceSizeHandler(), new ChildElementHandler<ResourceSizeHandler>() {
@Override
public void childHandled(ResourceSizeHandler child) {
String size = child.getBufferedChars().trim();
try {
bundleInfo.setSize(Integer.valueOf(size));
} catch (NumberFormatException e) {
log(Message.MSG_WARN,
"Invalid size for the bundle " + bundleInfo.getSymbolicName() + ": "
+ size + ". This size is then ignored.");
}
}
});
addChild(new CapabilityHandler(), new ChildElementHandler<CapabilityHandler>() {
@Override
public void childHandled(CapabilityHandler child) throws SAXParseException {
try {
CapabilityAdapter.adapt(bundleInfo, child.capability);
} catch (ParseException e) {
throw new SAXParseException("Invalid capability: " + e.getMessage(), child
.getLocator());
}
}
});
addChild(new RequireHandler(), new ChildElementHandler<RequireHandler>() {
@Override
public void childHandled(RequireHandler child) throws SAXParseException {
try {
RequirementAdapter.adapt(bundleInfo, child.requirement);
} catch (UnsupportedFilterException e) {
throw new SAXParseException("Unsupported requirement filter: "
+ child.filter + " (" + e.getMessage() + ")", getLocator());
} catch (ParseException e) {
throw new SAXParseException(
"Error in the requirement filter on the bundle: " + e.getMessage(),
getLocator());
}
}
});
addChild(new ExtendHandler(), new ChildElementHandler<ExtendHandler>() {
@Override
public void childHandled(ExtendHandler child) throws SAXParseException {
// TODO handle fragment host
}
});
}