Remove unneeded checkNotNull() calls
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.ust.core / src / org / eclipse / tracecompass / lttng2 / ust / core / trace / LttngUstTrace.java
index 8c4f9c8904e138c97247e3ec7091d3554cb499ba..6e9345cd4c69bc0f1d292ad187ecdd35769c13ba 100644 (file)
@@ -14,6 +14,7 @@
 
 package org.eclipse.tracecompass.lttng2.ust.core.trace;
 
+import java.util.Collection;
 import java.util.Map;
 
 import org.eclipse.core.resources.IProject;
@@ -25,14 +26,20 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.Activator;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst20EventLayout;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst27EventLayout;
+import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst28EventLayout;
+import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect;
+import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoSourceAspect;
 import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTraceValidationStatus;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfUtils;
 
+import com.google.common.collect.ImmutableSet;
+
 /**
  * Class to contain LTTng-UST traces
  *
@@ -40,15 +47,33 @@ import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfUtils;
  */
 public class LttngUstTrace extends CtfTmfTrace {
 
+    /**
+     * Name of the tracer that generates this trace type, as found in the CTF
+     * metadata.
+     *
+     * @since 2.0
+     */
+    public static final String TRACER_NAME = "lttng-ust"; //$NON-NLS-1$
+
     private static final int CONFIDENCE = 100;
 
+    private static final @NonNull Collection<ITmfEventAspect> LTTNG_UST_ASPECTS;
+
+    static {
+        ImmutableSet.Builder<ITmfEventAspect> builder = ImmutableSet.builder();
+        builder.addAll(CtfTmfTrace.CTF_ASPECTS);
+        builder.add(UstDebugInfoBinaryAspect.INSTANCE);
+        builder.add(UstDebugInfoSourceAspect.INSTANCE);
+        LTTNG_UST_ASPECTS = builder.build();
+    }
+
     private @Nullable ILttngUstEventLayout fLayout = null;
 
     /**
      * Default constructor
      */
     public LttngUstTrace() {
-        super();
+        super(LttngUstEventFactory.instance());
     }
 
     /**
@@ -80,9 +105,11 @@ public class LttngUstTrace extends CtfTmfTrace {
         int tracerMajor = CtfUtils.getTracerMajorVersion(this);
         int tracerMinor = CtfUtils.getTracerMinorVersion(this);
 
-        if ("lttng-ust".equals(tracerName)) { //$NON-NLS-1$
+        if (TRACER_NAME.equals(tracerName)) {
             if (tracerMajor >= 2) {
-                if (tracerMinor >= 7) {
+                if (tracerMinor >= 8) {
+                    return LttngUst28EventLayout.getInstance();
+                } else if (tracerMinor >= 7) {
                     return LttngUst27EventLayout.getInstance();
                 }
                 return LttngUst20EventLayout.getInstance();
@@ -93,6 +120,11 @@ public class LttngUstTrace extends CtfTmfTrace {
         return LttngUst20EventLayout.getInstance();
     }
 
+    @Override
+    public Iterable<ITmfEventAspect> getEventAspects() {
+        return LTTNG_UST_ASPECTS;
+    }
+
     /**
      * {@inheritDoc}
      * <p>
This page took 0.024839 seconds and 5 git commands to generate.