Exemplo n.º 1
0
  /**
   * Add or replace a custom trace type
   *
   * @param category The custom parser category
   * @param definitionName The custom parser definition name to add or replace
   */
  public void addCustomTraceType(String category, String definitionName) {
    String traceTypeId = null;
    ITmfTrace trace = null;

    if (category.equals(CUSTOM_TXT_CATEGORY)) {
      traceTypeId = CustomTxtTrace.class.getCanonicalName() + SEPARATOR + definitionName;
      CustomTxtTraceDefinition def = CustomTxtTraceDefinition.load(definitionName);
      if (def != null) {
        trace = new CustomTxtTrace(def);
      }
    } else if (category.equals(CUSTOM_XML_CATEGORY)) {
      traceTypeId = CustomXmlTrace.class.getCanonicalName() + SEPARATOR + definitionName;
      CustomXmlTraceDefinition def = CustomXmlTraceDefinition.load(definitionName);
      if (def != null) {
        trace = new CustomXmlTrace(def);
      }
    }

    if (traceTypeId != null && trace != null) {
      TraceTypeHelper helper = fTraceTypes.get(traceTypeId);
      if (helper != null) {
        helper.getTrace().dispose();
      }
      TraceTypeHelper tt =
          new TraceTypeHelper(
              traceTypeId, category, definitionName, trace, false, TraceElementType.TRACE);
      fTraceTypes.put(traceTypeId, tt);
      // Deregister trace as signal handler because it is only used for validation
      TmfSignalManager.deregister(trace);
    }
  }
Exemplo n.º 2
0
 private void populateCustomTraceTypes() {
   // add the custom trace types
   for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
     String traceTypeId = CustomTxtTrace.class.getCanonicalName() + SEPARATOR + def.definitionName;
     ITmfTrace trace = new CustomTxtTrace(def);
     TraceTypeHelper tt =
         new TraceTypeHelper(
             traceTypeId,
             CUSTOM_TXT_CATEGORY,
             def.definitionName,
             trace,
             false,
             TraceElementType.TRACE);
     fTraceTypes.put(traceTypeId, tt);
     // Deregister trace as signal handler because it is only used for validation
     TmfSignalManager.deregister(trace);
   }
   for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
     String traceTypeId = CustomXmlTrace.class.getCanonicalName() + SEPARATOR + def.definitionName;
     ITmfTrace trace = new CustomXmlTrace(def);
     TraceTypeHelper tt =
         new TraceTypeHelper(
             traceTypeId,
             CUSTOM_XML_CATEGORY,
             def.definitionName,
             trace,
             false,
             TraceElementType.TRACE);
     fTraceTypes.put(traceTypeId, tt);
     // Deregister trace as signal handler because it is only used for validation
     TmfSignalManager.deregister(trace);
   }
 }
Exemplo n.º 3
0
  /**
   * Gets all the custom trace types
   *
   * @return the list of custom trace types
   */
  public static List<String> getCustomTraceTypes() {

    List<String> traceTypes = new ArrayList<>();
    for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
      String traceTypeName = def.definitionName;
      traceTypes.add(traceTypeName);
    }
    for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
      String traceTypeName = def.definitionName;
      traceTypes.add(traceTypeName);
    }
    return traceTypes;
  }
Exemplo n.º 4
0
 /**
  * Gets the custom trace types (custom text and friends)
  *
  * @param type the type to get (Text, xml or other...)
  * @return the list of custom trace types
  */
 public static List<String> getCustomTraceTypes(String type) {
   List<String> traceTypes = new ArrayList<>();
   if (type.equals(CUSTOM_TXT_CATEGORY)) {
     for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
       String traceTypeName = def.definitionName;
       traceTypes.add(traceTypeName);
     }
   }
   if (type.equals(CUSTOM_XML_CATEGORY)) {
     for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
       String traceTypeName = def.definitionName;
       traceTypes.add(traceTypeName);
     }
   }
   return traceTypes;
 }