use of aQute.libg.sed.ReplacerAdapter in project bnd by bndtools.
the class ArtifactRepository method parse.
void parse() throws Exception {
final Map<String, String> properties = getProperties("repository/properties/property");
properties.put("repoUrl", base.resolve("").toString());
final Domain parent = new Domain() {
@Override
public Map<String, String> getMap() {
return properties;
}
@Override
public Domain getParent() {
return null;
}
};
rules = getRules();
NodeList artifactNodes = getNodes("repository/artifacts/artifact");
for (int i = 0; i < artifactNodes.getLength(); i++) {
final Node artifactNode = artifactNodes.item(i).cloneNode(true);
final XMLArtifact xmlArtifact = getFromType(artifactNode, XMLArtifact.class);
final Map<String, String> map = Converter.cnv(new TypeReference<Map<String, String>>() {
}, xmlArtifact);
if ("osgi.bundle".equals(xmlArtifact.classifier)) {
Domain domain = new Domain() {
@Override
public Map<String, String> getMap() {
return map;
}
@Override
public Domain getParent() {
return parent;
}
};
ReplacerAdapter ra = new ReplacerAdapter(domain);
for (Rule r : rules) {
if (r.matches(map)) {
String s = ra.process(r.output);
URI uri = new URI(s).normalize();
Artifact artifact = new Artifact();
artifact.uri = uri;
artifact.id = xmlArtifact.id;
artifact.version = new Version(xmlArtifact.version);
artifact.md5 = getProperties(artifactNode, "properties/property").get("download.md5");
artifacts.add(artifact);
break;
}
}
}
}
}