M2M transformation reports [message #811592] |
Fri, 02 March 2012 10:17  |
Eclipse User |
|
|
|
I am doing a model to model transformation using Xtext2 and Xtend2, working fine so far.
What I did:
- Parse a set of thousands of IDL model files using Xtext.
- Transform each of the IDL files to another meta model using Xtend and save a huge target model file.
Now I would like to have a separate transformation report for each IDL file which have been parsed. Target is to create rather simple HTML on the fly during transformation and putting relevant transformation information to the HTML report. These reports will be needed for manual postprocessing of the result model.
My idea was to use Xtend for that purpose, but how may I handle the various reports?
My issues:
- How to open and handle the various IGenerator instances? doGenerate() would expect a top-down handling of each resource, but I need to append some pieces of text during the transformation. (should be called at the beginning of the resource transformation method)
- Output to these generators would not be written at once. From various transformation methods, I need to append text to the reports. I would like to call a Xtend method like report(typename, resourcename, text).
- Must be able to keep different generators open at the same time, because the transformation may require to transform included resources before continuing with another resource.
- How to close these files? (should be called at the end of the resource transformation method)
Do you think it's a good idea to use Xtend for that, or should I try another framework / all handling manual?
I would be glad if you could share your experience regarding transformation reports.
Kind regards
Michael
|
|
|
|
Re: M2M transformation reports [message #813583 is a reply to message #811733] |
Mon, 05 March 2012 08:15  |
Eclipse User |
|
|
|
Thanks for the fast response.
Handling a bundle of resources for one target model was already solved.
As I do not need to parse more than 20 resources in parallel (handling nested includes) and having reports less than 20 kB, I decided to do the reporting manually:
- Create a hash map (key: resource name; value: report StringBuffer)
- Append text to the report StringBuffer based on the resource name
- When completing a resource, writing the StringBuffer to the report file and deleting the HashMap entry.
- All the report handling will be encapsulated in a static report class, serving all required methods.
This should be a robust and performant way for the reports.
|
|
|
Powered by
FUDForum. Page generated in 0.03993 seconds