Search in sources :

Example 11 with Tag

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;
}
Also used : Tag(aQute.lib.tag.Tag)

Example 12 with Tag

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;
}
Also used : Tag(aQute.lib.tag.Tag)

Example 13 with Tag

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;
}
Also used : Namespaces(aQute.bnd.xmlattribute.Namespaces) Tag(aQute.lib.tag.Tag)

Example 14 with Tag

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();
    }
}
Also used : MethodDef(aQute.bnd.osgi.Clazz.MethodDef) List(java.util.List) OutputStreamWriter(java.io.OutputStreamWriter) Tag(aQute.lib.tag.Tag) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Example 15 with Tag

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;
}
Also used : MethodDef(aQute.bnd.osgi.Clazz.MethodDef) List(java.util.List) Tag(aQute.lib.tag.Tag) Map(java.util.Map)

Aggregations

Tag (aQute.lib.tag.Tag)28 PrintWriter (java.io.PrintWriter)8 File (java.io.File)5 Attrs (aQute.bnd.header.Attrs)3 Parameters (aQute.bnd.header.Parameters)3 TypeRef (aQute.bnd.osgi.Descriptors.TypeRef)3 Namespaces (aQute.bnd.xmlattribute.Namespaces)3 List (java.util.List)3 Map (java.util.Map)3 Matcher (java.util.regex.Matcher)3 MethodDef (aQute.bnd.osgi.Clazz.MethodDef)2 Instructions (aQute.bnd.osgi.Instructions)2 Diff (aQute.bnd.service.diff.Diff)2 Tree (aQute.bnd.service.diff.Tree)2 MultiMap (aQute.lib.collections.MultiMap)2 IOException (java.io.IOException)2 OutputStreamWriter (java.io.OutputStreamWriter)2 Date (java.util.Date)2 Meta (aQute.bnd.annotation.metatype.Meta)1 Project (aQute.bnd.build.Project)1