示例#1
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);
   }
 }
示例#2
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);
    }
  }
示例#3
0
  private void populateCategoriesAndTraceTypes() {
    if (fTraceTypes.isEmpty()) {
      // Populate the Categories and Trace Types
      IConfigurationElement[] config =
          Platform.getExtensionRegistry()
              .getConfigurationElementsFor(TmfTraceType.TMF_TRACE_TYPE_ID);
      for (IConfigurationElement ce : config) {
        String elementName = ce.getName();
        if (elementName.equals(TmfTraceType.TYPE_ELEM)) {
          String traceTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
          fTraceTypeAttributes.put(traceTypeId, ce);
        } else if (elementName.equals(TmfTraceType.CATEGORY_ELEM)) {
          String categoryId = ce.getAttribute(TmfTraceType.ID_ATTR);
          fTraceCategories.put(categoryId, ce);
        } else if (elementName.equals(TmfTraceType.EXPERIMENT_ELEM)) {
          String experimentTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
          fTraceTypeAttributes.put(experimentTypeId, ce);
        }
      }
      // create the trace types
      for (String typeId : fTraceTypeAttributes.keySet()) {
        IConfigurationElement ce = fTraceTypeAttributes.get(typeId);
        final String category = getCategory(ce);
        final String attribute = ce.getAttribute(TmfTraceType.NAME_ATTR);
        ITmfTrace trace = null;
        TraceElementType elementType = TraceElementType.TRACE;
        try {
          if (ce.getName().equals(TmfTraceType.TYPE_ELEM)) {
            trace = (ITmfTrace) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);
          } else if (ce.getName().equals(TmfTraceType.EXPERIMENT_ELEM)) {
            trace = (ITmfTrace) ce.createExecutableExtension(TmfTraceType.EXPERIMENT_TYPE_ATTR);
            elementType = TraceElementType.EXPERIMENT;
          }
          if (trace == null) {
            break;
          }
          // Deregister trace as signal handler because it is only
          // used for validation
          TmfSignalManager.deregister(trace);

          final String dirString = ce.getAttribute(TmfTraceType.IS_DIR_ATTR);
          boolean isDir = Boolean.parseBoolean(dirString);

          TraceTypeHelper tt =
              new TraceTypeHelper(typeId, category, attribute, trace, isDir, elementType);
          fTraceTypes.put(typeId, tt);
        } catch (CoreException e) {
        }
      }
    }
  }
示例#4
0
 /**
  * Initialize the trace common attributes and the base component.
  *
  * @param resource the Eclipse resource (trace)
  * @param path the trace path
  * @param type the trace event type
  * @throws TmfTraceException If something failed during the initialization
  */
 protected void initialize(
     final IResource resource, final String path, final Class<? extends ITmfEvent> type)
     throws TmfTraceException {
   if (path == null) {
     throw new TmfTraceException("Invalid trace path"); // $NON-NLS-1$
   }
   fPath = path;
   fResource = resource;
   String traceName = getName();
   if (traceName == null || traceName.isEmpty()) {
     traceName = (resource != null) ? resource.getName() : new Path(path).lastSegment();
   }
   if (fParser == null) {
     if (this instanceof ITmfEventParser) {
       fParser = (ITmfEventParser) this;
     } else {
       throw new TmfTraceException("Invalid trace parser"); // $NON-NLS-1$
     }
   }
   super.init(traceName, type);
   // register as VIP after super.init() because TmfComponent registers to signal manager there
   TmfSignalManager.registerVIP(this);
   fIndexer = createIndexer(fCacheSize);
 }
示例#5
0
 @Override
 public TmfExperiment<T> copy() {
   TmfExperiment<T> experiment = new TmfExperiment<T>(this);
   TmfSignalManager.deregister(experiment);
   return experiment;
 }
 @Override
 public void dispose() {
   TmfSignalManager.deregister(this);
 }
 /**
  * Constructor with given group and text values.
  *
  * @param parentView The parent histogram view.
  * @param parent The parent composite
  * @param groupLabel A group value
  * @param value A text value
  * @since 2.0
  */
 public HistogramTimeRangeControl(
     HistogramView parentView, Composite parent, String groupLabel, long value) {
   super(parentView, parent, groupLabel, value);
   TmfSignalManager.register(this);
 }