Search in sources :

Example 1 with TracingOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType in project midpoint by Evolveum.

the class TraceParser method parse.

public TracingOutputType parse(InputStream inputStream, boolean isZip, boolean raw, String description) throws SchemaException, IOException {
    TracingOutputType wholeTracingOutput = getObject(inputStream, isZip, description);
    if (!raw && wholeTracingOutput != null) {
        new DictionaryExpander(wholeTracingOutput).expand();
        new OperationCategorizer(wholeTracingOutput).categorize();
    }
    return wholeTracingOutput;
}
Also used : TracingOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType)

Example 2 with TracingOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType in project midpoint by Evolveum.

the class TraceParser method getObject.

public TracingOutputType getObject(InputStream stream, boolean isZip, String description) throws IOException, SchemaException {
    long start = System.currentTimeMillis();
    Object object;
    if (isZip) {
        try (ZipInputStream zis = new ZipInputStream(stream)) {
            ZipEntry zipEntry = zis.getNextEntry();
            if (zipEntry != null) {
                object = prismContext.parserFor(zis).xml().compat().parseRealValue();
            } else {
                LOGGER.error("No zip entry in input file '{}'", description);
                object = null;
            }
        }
    } else {
        object = prismContext.parserFor(stream).xml().compat().parseRealValue();
    }
    stream.close();
    long read = System.currentTimeMillis();
    LOGGER.debug("Read the content of {} in {} milliseconds", description, read - start);
    if (object instanceof TracingOutputType) {
        return (TracingOutputType) object;
    } else if (object instanceof OperationResultType) {
        TracingOutputType rv = new TracingOutputType(prismContext);
        rv.setResult((OperationResultType) object);
        return rv;
    } else {
        LOGGER.error("Wrong object type in input file '{}': {}", description, object);
        return null;
    }
}
Also used : ZipInputStream(java.util.zip.ZipInputStream) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ZipEntry(java.util.zip.ZipEntry) TracingOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType)

Example 3 with TracingOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType in project midpoint by Evolveum.

the class EditTraceAction method execute.

@Override
public void execute() throws Exception {
    TracingOutputType trace = parseInput();
    if (options.isPrintStat() || options.isPrintStatExtra()) {
        printStatistics(trace);
    }
    if (CollectionUtils.isNotEmpty(options.getKeep()) || CollectionUtils.isNotEmpty(options.getKill())) {
        applyKeep(trace);
        applyKill(trace);
        writeTrace(trace);
    }
}
Also used : TracingOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType)

Example 4 with TracingOutputType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType in project midpoint by Evolveum.

the class EditTraceAction method parseInput.

private TracingOutputType parseInput() throws IOException, SchemaException {
    String inputFile = options.getInput();
    log.info("Starting parsing input file: {}", inputFile);
    long start = System.currentTimeMillis();
    TraceParser parser = new TraceParser(context.getPrismContext());
    TracingOutputType trace = parser.parse(new File(inputFile), true);
    log.info("Parsing finished; in {} seconds", (System.currentTimeMillis() - start) / 1000);
    return trace;
}
Also used : TraceParser(com.evolveum.midpoint.schema.traces.TraceParser) TracingOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType) File(java.io.File)

Aggregations

TracingOutputType (com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType)4 TraceParser (com.evolveum.midpoint.schema.traces.TraceParser)1 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)1 File (java.io.File)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1