use of aQute.lib.tag.Tag in project bnd by bndtools.
the class PomFromManifest method tagFromMap.
/**
* Utility function to print a tag from a map
*
* @param ps
* @param values
* @param string
* @param tag
* @param object
*/
private Tag tagFromMap(Tag parent, Map<String, String> values, String string, String tag, String object) {
String value = values.get(string);
if (value == null)
value = object;
if (value == null)
return parent;
new Tag(parent, tag).addContent(value.trim());
return parent;
}
use of aQute.lib.tag.Tag in project bnd by bndtools.
the class DesignateDef method getInnerTag.
Tag getInnerTag(Namespaces namespaces) {
Tag designate = new Tag("Designate");
if (factory) {
designate.addAttribute("factoryPid", pid);
} else {
designate.addAttribute("pid", pid);
}
addAttributes(designate, namespaces);
new Tag(designate, "Object").addAttribute("ocdref", ocdRef);
return designate;
}
use of aQute.lib.tag.Tag in project bnd by bndtools.
the class DesignateDef method getOuterTag.
Tag getOuterTag() {
Tag metadata = new Tag("metatype:MetaData").addAttribute("xmlns:metatype", MetatypeVersion.VERSION_1_3.getNamespace());
Namespaces namespaces = new Namespaces();
String xmlns = MetatypeVersion.VERSION_1_3.getNamespace();
namespaces.registerNamespace("metatype", xmlns);
addNamespaces(namespaces, xmlns);
namespaces.addNamespaces(metadata);
metadata.addContent(getInnerTag(namespaces));
return metadata;
}
use of aQute.lib.tag.Tag in project bnd by bndtools.
the class CoverageResource method write.
@Override
public void write(OutputStream out) throws IOException {
try {
Map<MethodDef, List<MethodDef>> table = getCrossRef(testsuite, service);
Tag coverage = toTag(table);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, Constants.DEFAULT_CHARSET));
try {
coverage.print(0, pw);
} finally {
pw.flush();
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of aQute.lib.tag.Tag in project bnd by bndtools.
the class CoverageResource method toTag.
public static Tag toTag(Map<MethodDef, List<MethodDef>> catalog) {
Tag coverage = new Tag("coverage");
String currentClass = null;
Tag classTag = null;
for (Map.Entry<MethodDef, List<MethodDef>> m : catalog.entrySet()) {
String className = m.getKey().getContainingClass().getFQN();
if (!className.equals(currentClass)) {
classTag = new Tag("class");
classTag.addAttribute("name", className);
classTag.addAttribute("package", Descriptors.getPackage(className));
classTag.addAttribute("short", Descriptors.getShortName(className));
coverage.addContent(classTag);
currentClass = className;
}
Tag method = doMethod(new Tag("method"), m.getKey());
if (classTag != null)
classTag.addContent(method);
for (MethodDef r : m.getValue()) {
Tag ref = doMethod(new Tag("ref"), r);
method.addContent(ref);
}
}
return coverage;
}
Aggregations