Hi Patrick Thank you very much for the detail description.
It is very helpful Ran-How On Mon, Apr 7, 2014 at 10:59 PM, Patrick Tasse <patrick.ta...@gmail.com>wrote: > Hi Ran-How, > > The spirit of TMF framework is that you would define a new trace type with > the org.eclipse.linuxtools.tmf.core.tracetype extension point. I'm guessing > you have already done so and that your trace type id is > Activator.TRACETYPE_ID, although that means your plugin only has 1 trace > type. > > Then you would add a trace to a Tracing project in the Project Explorer, > select the correct trace type and then open the trace from there. > > I'm not sure why you need to use injection, but I think that you could > probably find the corresponding configuration element from the platform > extension registry (look at TmfTraceElement.init()) and maybe your plugin > could look it up only once and store the IConfigurationElement for later > use. > > Later when you need a trace instance you can invoke > createExecutableExtension on the configuration element, then call initTrace > on the returned instance. But then the rest of the framework will not be > aware of your trace instance because it wasn't opened the 'spirit' way... > Also don't forget to dispose the trace instance when it's no longer needed. > > Patrick > > > On Sat, Apr 5, 2014 at 1:25 AM, Chen RanHow <ranhow.c...@gmail.com> wrote: > >> Hi Patrick >> >> Got it, actually, I saw the dummy helper for validation purpose also ^^ >> >> The cause I ask it is that I am trying to to some injection under the TMF >> way implementation for a new TraceType >> >> I try to implementation a E4 based service that can do some additional >> PIPE like trace processing >> >> For example a power consume index could take frequency & load as input, >> output could be other pipes as input also >> >> To bridge / trigger the service to work, I bind it to the class extends >> TmfTrace >> >> To workaround it, I did a ModelAddon to force createExecutableExtension() >> in TmfTraceType like bellow >> >> @PostConstruct >> public void init(IEclipseContext context, IExtensionRegistry reg) { >> assert context != null; >> _context = context; >> >> /* >> * A hack to TMF, since inject must be before TMFTrace implementation >> * >> * The getInstance() call would trigger load extension points >> * >> * It is the point to force inject here >> * >> */ >> TraceTypeHelper tth = >> TmfTraceType.getInstance().getTraceType(Activator.TRACETYPE_ID); >> tmfTrace = tth.getTrace(); >> assert tmfTrace != null; >> ContextInjectionFactory.inject(tmfTrace, _context); >> >> ......... >> >> >> As you mentioned, it is for validation only. so I got null point on other >> callbacks like parseEvent() XDDDDDDDDDDDD >> >> Is there any way that can make the INJECT got chance to work in the class >> extends TmfTrace for a new trace type ? >> >> Or maybe I got misunderstand for the spirit of TMF framework = =!! >> >> Thank you again for the quick response. >> >> The TMF is very amazing ! >> >> Ran-How >> >> >> >> >> On Sat, Apr 5, 2014 at 2:08 AM, Patrick Tasse <patrick.ta...@gmail.com>wrote: >> >>> Hi Ran-How, >>> >>> The reason we can't use the ITmfTrace instance owned by the trace type >>> helper is that we need a different instance for each opened trace (they >>> have different resources, paths, indexers, etc.). >>> >>> The instance in the trace type helper is a dummy trace instance that is >>> only used for trace type validation. It's not sure that these instances >>> will remain in the future, if for example we implement a validator class >>> that is separate from the trace class. >>> >>> Patrick >>> >>> >>> On Fri, Apr 4, 2014 at 1:17 PM, Chen RanHow <ranhow.c...@gmail.com>wrote: >>> >>>> >>>> Hi TMF advances >>>> >>>> Thank you team for the powerful framework, I have a question bellow >>>> >>>> In TmfTraceElement.java >>>> >>>> I saw createExecutableExtension() in instantiateTrace() to get an >>>> instance from the extension points like bellow >>>> >>>> IConfigurationElement ce = >>>> sfTraceTypeAttributes.get(fTraceTypeId); >>>> >>>> ....... >>>> >>>> ITmfTrace trace = (ITmfTrace) >>>> ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR); >>>> >>>> ...... >>>> >>>> return trace; >>>> >>>> I wonder why not just use TmfTraceType.getInstance() to do it ? >>>> >>>> Since the init() in TmfTraceType constructor >>>> call populateCategoriesAndTraceTypes() >>>> >>>> The instance of createExecutableExtension is created >>>> >>>> Could it be replaced with >>>> >>>> TraceTypeHelper tth = >>>> TmfTraceType.getInstance().getTraceType(fTraceTypeId); >>>> >>>> ITmfTrace trace = tth.getTrace(); >>>> >>>> return trace; >>>> >>>> Or I misunderstand it ? >>>> >>>> Please kindly to reply >>>> >>>> Ran-How >>>> >>>> >>>> _______________________________________________ >>>> linuxtools-dev mailing list >>>> linuxtools-dev@eclipse.org >>>> https://dev.eclipse.org/mailman/listinfo/linuxtools-dev >>>> >>>> >>> >>> _______________________________________________ >>> linuxtools-dev mailing list >>> linuxtools-dev@eclipse.org >>> https://dev.eclipse.org/mailman/listinfo/linuxtools-dev >>> >>> >> >> _______________________________________________ >> linuxtools-dev mailing list >> linuxtools-dev@eclipse.org >> https://dev.eclipse.org/mailman/listinfo/linuxtools-dev >> >> > > _______________________________________________ > linuxtools-dev mailing list > linuxtools-dev@eclipse.org > https://dev.eclipse.org/mailman/listinfo/linuxtools-dev > >
_______________________________________________ linuxtools-dev mailing list linuxtools-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/linuxtools-dev