1 /**********************************************************************
2 * Copyright (c) 2013 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Matthew Khouzam - Initial API and implementation
11 * Alexandre Montplaisir - Add UST callstack state system
12 * Marc-Andre Laperle - Handle BufferOverflowException (Bug 420203)
13 **********************************************************************/
15 package org
.eclipse
.linuxtools
.lttng2
.ust
.core
.trace
;
17 import java
.nio
.BufferOverflowException
;
19 import org
.eclipse
.core
.resources
.IProject
;
20 import org
.eclipse
.core
.runtime
.IStatus
;
21 import org
.eclipse
.core
.runtime
.Status
;
22 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFReaderException
;
23 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFTrace
;
24 import org
.eclipse
.linuxtools
.internal
.lttng2
.ust
.core
.Activator
;
25 import org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
.CtfTmfTrace
;
26 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TraceValidationStatus
;
29 * Class to contain LTTng-UST traces
31 * @author Matthew Khouzam
34 public class LttngUstTrace
extends CtfTmfTrace
{
36 private static final int CONFIDENCE
= 100;
41 public LttngUstTrace() {
48 * This implementation sets the confidence to 100 if the trace is a valid
49 * CTF trace in the "ust" domain.
52 public IStatus
validate(final IProject project
, final String path
) {
55 /* Make sure the trace is openable as a CTF trace. */
57 temp
= new CTFTrace(path
);
58 } catch (CTFReaderException e
) {
59 status
= new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, e
.toString(), e
);
61 } catch (NullPointerException e
) {
62 status
= new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, e
.toString(), e
);
64 } catch (final BufferOverflowException e
) {
65 status
= new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, Messages
.LttngUstTrace_TraceReadError
+ ": " + Messages
.LttngUstTrace_MalformedTrace
); //$NON-NLS-1$
69 /* Make sure the domain is "ust" in the trace's env vars */
70 String dom
= temp
.getEnvironment().get("domain"); //$NON-NLS-1$
72 if (dom
!= null && dom
.equals("\"ust\"")) { //$NON-NLS-1$
73 return new TraceValidationStatus(CONFIDENCE
, Activator
.PLUGIN_ID
);
75 status
= new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, Messages
.LttngUstTrace_DomainError
);