Search in sources :

Example 1 with StudioNameResolver

use of com.evolveum.midpoint.studio.impl.trace.StudioNameResolver in project midpoint-studio by Evolveum.

the class TraceViewEditor method initialize.

private void initialize() {
    OpNode root;
    long start = System.currentTimeMillis();
    LOG.info("Initializing TraceViewEditor");
    try (InputStream is = file.getInputStream()) {
        String extension = file.getExtension();
        boolean isZip = extension != null && extension.equalsIgnoreCase("zip");
        PrismContext prismContext = MidPointUtils.DEFAULT_PRISM_CONTEXT;
        TraceParser parser = new TraceParser(prismContext);
        TracingOutputType tracingOutput = parser.parse(is, isZip, file.getCanonicalPath());
        LOG.info("Initializing TraceViewEditor - parsed tracing output: " + (System.currentTimeMillis() - start) + " ms");
        StudioNameResolver nameResolver = new StudioNameResolver(tracingOutput.getDictionary(), file);
        List<OpNode> data = new OpNodeTreeBuilder(prismContext).build(tracingOutput, nameResolver);
        if (data.size() == 1) {
            root = data.get(0);
        } else {
            throw new IllegalStateException("Unexpected # of OpNode objects: " + data.size());
        }
        LOG.info("Initializing TraceViewEditor - built op node tree: " + (System.currentTimeMillis() - start) + " ms");
    } catch (Exception ex) {
        MidPointService mm = MidPointService.getInstance(project);
        mm.printToConsole(null, TraceViewEditor.class, "Couldn't load file", ex, ConsoleViewContentType.LOG_ERROR_OUTPUT);
        MidPointUtils.publishExceptionNotification(project, null, TraceViewEditor.class, NOTIFICATION_KEY, "Couldn't load file", ex);
        ex.printStackTrace();
        root = null;
    }
    if (root != null) {
        PresentationInitializer.initialize(root);
    }
    opTreePanel = new OpTreePanel(project, root);
    wrapper.setContent(opTreePanel);
}
Also used : TraceParser(com.evolveum.midpoint.schema.traces.TraceParser) OpNodeTreeBuilder(com.evolveum.midpoint.schema.traces.OpNodeTreeBuilder) InputStream(java.io.InputStream) PrismContext(com.evolveum.midpoint.prism.PrismContext) TracingOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType) MidPointService(com.evolveum.midpoint.studio.impl.MidPointService) OpTreePanel(com.evolveum.midpoint.studio.ui.trace.mainTree.OpTreePanel) StudioNameResolver(com.evolveum.midpoint.studio.impl.trace.StudioNameResolver) OpNode(com.evolveum.midpoint.schema.traces.OpNode)

Aggregations

PrismContext (com.evolveum.midpoint.prism.PrismContext)1 OpNode (com.evolveum.midpoint.schema.traces.OpNode)1 OpNodeTreeBuilder (com.evolveum.midpoint.schema.traces.OpNodeTreeBuilder)1 TraceParser (com.evolveum.midpoint.schema.traces.TraceParser)1 MidPointService (com.evolveum.midpoint.studio.impl.MidPointService)1 StudioNameResolver (com.evolveum.midpoint.studio.impl.trace.StudioNameResolver)1 OpTreePanel (com.evolveum.midpoint.studio.ui.trace.mainTree.OpTreePanel)1 TracingOutputType (com.evolveum.midpoint.xml.ns._public.common.common_3.TracingOutputType)1 InputStream (java.io.InputStream)1