Search in sources :

Example 1 with XMLWriter

use of com.yahoo.text.XMLWriter in project vespa by vespa-engine.

the class Metric method toXml.

public String toXml(int secondsPassed, int verbosity) {
    StringWriter writer = new StringWriter();
    printXml(new XMLWriter(writer), secondsPassed, verbosity);
    return writer.toString();
}
Also used : StringWriter(java.io.StringWriter) XMLWriter(com.yahoo.text.XMLWriter)

Example 2 with XMLWriter

use of com.yahoo.text.XMLWriter in project vespa by vespa-engine.

the class QueryContext method render.

public boolean render(Writer writer) throws java.io.IOException {
    if (owner.getTraceLevel() != 0) {
        XMLWriter xmlWriter = XMLWriter.from(writer);
        xmlWriter.openTag("meta").attribute("type", ID);
        TraceNode traceRoot = owner.getModel().getExecution().trace().traceNode().root();
        traceRoot.accept(new DefaultRenderer.RenderingVisitor(xmlWriter, owner.getStartTime()));
        xmlWriter.closeTag();
    }
    return true;
}
Also used : DefaultRenderer(com.yahoo.search.rendering.DefaultRenderer) TraceNode(com.yahoo.yolean.trace.TraceNode) XMLWriter(com.yahoo.text.XMLWriter)

Example 3 with XMLWriter

use of com.yahoo.text.XMLWriter in project vespa by vespa-engine.

the class DefaultRenderer method queryContext.

@SuppressWarnings("UnusedParameters")
public void queryContext(XMLWriter writer, QueryContext queryContext, Query owner) throws IOException {
    if (owner.getTraceLevel() != 0) {
        XMLWriter xmlWriter = XMLWriter.from(writer);
        xmlWriter.openTag("meta").attribute("type", QueryContext.ID);
        TraceNode traceRoot = owner.getModel().getExecution().trace().traceNode().root();
        traceRoot.accept(new RenderingVisitor(xmlWriter, owner.getStartTime()));
        xmlWriter.closeTag();
    }
}
Also used : TraceNode(com.yahoo.yolean.trace.TraceNode) XMLWriter(com.yahoo.text.XMLWriter)

Example 4 with XMLWriter

use of com.yahoo.text.XMLWriter in project vespa by vespa-engine.

the class MetricResponse method render.

@Override
public void render(OutputStream stream) throws IOException {
    XMLWriter writer = new XMLWriter(new OutputStreamWriter(stream));
    writer.openTag("status");
    set.printXml(writer, 0, 2);
    writer.closeTag();
    writer.flush();
}
Also used : OutputStreamWriter(java.io.OutputStreamWriter) XMLWriter(com.yahoo.text.XMLWriter)

Example 5 with XMLWriter

use of com.yahoo.text.XMLWriter in project vespa by vespa-engine.

the class SearchRendererAdaptor method simpleRenderDefaultErrorHit.

public static boolean simpleRenderDefaultErrorHit(Writer writer, ErrorHit defaultErrorHit) throws IOException {
    XMLWriter xmlWriter = (writer instanceof XMLWriter) ? (XMLWriter) writer : new XMLWriter(writer, 10, -1);
    xmlWriter.openTag("errordetails");
    for (Iterator i = defaultErrorHit.errorIterator(); i.hasNext(); ) {
        ErrorMessage error = (ErrorMessage) i.next();
        renderMessageDefaultErrorHit(xmlWriter, error);
    }
    xmlWriter.closeTag();
    return true;
}
Also used : Iterator(java.util.Iterator) ErrorMessage(com.yahoo.processing.request.ErrorMessage) XMLWriter(com.yahoo.text.XMLWriter)

Aggregations

XMLWriter (com.yahoo.text.XMLWriter)14 IOException (java.io.IOException)4 StringWriter (java.io.StringWriter)4 TraceNode (com.yahoo.yolean.trace.TraceNode)3 OutputStreamWriter (java.io.OutputStreamWriter)3 ErrorMessage (com.yahoo.processing.request.ErrorMessage)2 Utf8String (com.yahoo.text.Utf8String)2 Iterator (java.util.Iterator)2 Test (org.junit.Test)2 LoadBalancer (com.yahoo.documentapi.messagebus.protocol.LoadBalancer)1 Mirror (com.yahoo.jrt.slobrok.api.Mirror)1 MetricSnapshot (com.yahoo.metrics.MetricSnapshot)1 DefaultRenderer (com.yahoo.search.rendering.DefaultRenderer)1 DefaultErrorHit (com.yahoo.search.result.DefaultErrorHit)1 ErrorHit (com.yahoo.search.result.ErrorHit)1 PrintWriter (java.io.PrintWriter)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1