Example #1
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);
 }