tmf: bug 494698 Add per-event fields to custom parsers
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / internal / tmf / core / parsers / custom / CustomEventAspects.java
index 23fb11a067e78c9613e496b8bafa084b5a8b1229..4b52cebad7093bcc8f532dacbc65bd57f5a60d0c 100644 (file)
@@ -13,6 +13,9 @@
 
 package org.eclipse.tracecompass.internal.tmf.core.parsers.custom;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
@@ -45,15 +48,25 @@ public class CustomEventAspects {
      * @return The set of event aspects for the given trace
      */
     public static @NonNull Iterable<ITmfEventAspect<?>> generateAspects(CustomTraceDefinition definition) {
+        List<String> fieldNames = new ArrayList<>();
         ImmutableList.Builder<ITmfEventAspect<?>> builder = new ImmutableList.Builder<>();
         for (OutputColumn output : definition.outputs) {
+
             if (output.tag.equals(Tag.TIMESTAMP) &&
                     (definition.timeStampOutputFormat == null || definition.timeStampOutputFormat.isEmpty())) {
                 builder.add(TmfBaseAspects.getTimestampAspect());
+                fieldNames.add(output.name);
             } else if (output.tag.equals(Tag.EVENT_TYPE)) {
                 builder.add(TmfBaseAspects.getEventTypeAspect());
+                fieldNames.add(output.name);
+            } else if (output.tag.equals(Tag.EXTRA_FIELD_NAME) || output.tag.equals(Tag.EXTRA_FIELD_VALUE)) {
+                // These tags should have been substituted with Tag.EXTRA_FIELDS
+                continue;
+            } else if (output.tag.equals(Tag.EXTRA_FIELDS)) {
+                builder.add(new CustomExtraFieldsAspect());
             } else {
                 builder.add(new TmfContentFieldAspect(output.name, output.name));
+                fieldNames.add(output.name);
             }
         }
         return builder.build();
This page took 0.025891 seconds and 5 git commands to generate.