Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » When is generated file availible?
When is generated file availible? [message #55522] Thu, 15 January 2009 06:30 Go to next message
Eclipse User
Originally posted by: johannes.nel.gmail.com

Hi

I generate a file from a template, then in the next line in my main.jet
I try to access that file from a custom function tag. The resource
writen by the ws:file does seem to be availible (can I refresh the
eclipse file system model from jet (i assume that is the cause) or has
the file not been written to the file system yet?

Regards
Johan
Re: When is generated file availible? [message #55549 is a reply to message #55522] Thu, 15 January 2009 06:34 Go to previous messageGo to next message
Eclipse User
Originally posted by: johannes.nel.gmail.com

ok, stupid question, suspending the plugin i see nothing is written to
the file system. this is certainly more optimal.

so, next question, can i trigger another template after the output has
been written to the file stystem?

Johannes Nel wrote:
> Hi
>
> I generate a file from a template, then in the next line in my main.jet
> I try to access that file from a custom function tag. The resource
> writen by the ws:file does seem to be availible (can I refresh the
> eclipse file system model from jet (i assume that is the cause) or has
> the file not been written to the file system yet?
>
> Regards
> Johan
Re: When is generated file availible? [message #55575 is a reply to message #55549] Thu, 15 January 2009 09:07 Go to previous messageGo to next message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Johan:

As you have notices, JET doesn't write files immediately. In fact, it
accumulates all workspace actions until main.jet is complete, then it does
all the actions within a single workspace operation. The main reason for
this is JET can do a single validateEdit call on all files are controlled by
team environments. (Some team environments, including IBM Rational's
ClearCase will prompt you to check out files before writing them - failing
to do a single validateEdit call could result in a check-out prompt for each
file.)

But, that's not answering your question :-)

With the standard tags, there isn't a way for one template to read a file
created by another (simply because all templates have been evaluated before
any file gets written.)

A couple of suggestions:

1) write your own version of ws:file that, instead of defering the write,
writes the file immediately. Depending on what team environment you use (if
any), you may be able to live quite confortably without the delayed writing,
unified validate edit, and single workspace operation.

2) Evaluate your first template and save its result into a JET variable -
you'd need to create a custom tag for this. Then, have your tags in the
second template access the contents from the variable instead of the file
system.

Paul
Re: When is generated file availible? [message #55628 is a reply to message #55575] Fri, 16 January 2009 03:51 Go to previous message
Eclipse User
Originally posted by: johannes.nel.gmail.com

clearcase, cvs.ok, point taken.

ok, so I am thinking of using a two-time parsing approach. either kick
of a seperate timed thread to invoke the second pass or write a manager
plugin which executes two jet transformations.


I had not considered team enviroments in my regeneration (duh!), thanks
for that timely reminder of that reality (we use svn which makes it much
easier), thanks.


Paul Elder wrote:
> Johan:
>
> As you have notices, JET doesn't write files immediately. In fact, it
> accumulates all workspace actions until main.jet is complete, then it does
> all the actions within a single workspace operation. The main reason for
> this is JET can do a single validateEdit call on all files are controlled by
> team environments. (Some team environments, including IBM Rational's
> ClearCase will prompt you to check out files before writing them - failing
> to do a single validateEdit call could result in a check-out prompt for each
> file.)
>
> But, that's not answering your question :-)
>
> With the standard tags, there isn't a way for one template to read a file
> created by another (simply because all templates have been evaluated before
> any file gets written.)
>
> A couple of suggestions:
>
> 1) write your own version of ws:file that, instead of defering the write,
> writes the file immediately. Depending on what team environment you use (if
> any), you may be able to live quite confortably without the delayed writing,
> unified validate edit, and single workspace operation.
>
> 2) Evaluate your first template and save its result into a JET variable -
> you'd need to create a custom tag for this. Then, have your tags in the
> second template access the contents from the variable instead of the file
> system.
>
> Paul
>
>
Previous Topic:Nested packages in input ecore file
Next Topic:[Announce] M2T XPAND 0.7.0 I200901151131 is available
Goto Forum:
  


Current Time: Wed Jul 23 22:35:11 EDT 2014

Powered by FUDForum. Page generated in 0.02335 seconds