Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Optimize succeeding workflow calls
[Xpand] Optimize succeeding workflow calls [message #540774] Thu, 17 June 2010 10:54 Go to next message
Ludwig Straub is currently offline Ludwig Straub
Messages: 14
Registered: July 2009
Junior Member
Hello,

I am using the org.eclipse.emf.mwe.core.WorkflowRunner class to execute a workflow and generate text via Xpand.

This class offers two methods:
* prepare
* executeWorkflow

In my situation, I want to execute the same workflow multiple times.
In order to gain performance, I intend to call "prepare" only once and then call "executeWorkflow" multiple times.
(But this seems not possible out of the box. Should it?)

As input I pass the same EMF model instance (created via Xtext) via slot. The model contents however changes from call to call, as the user enters new data in the Xtext-Editor.

In order to achieve this, I have to clear/reset the internal memory (hashtable?) where data is stored concerning the results of Xtend-methods marked with the keywords "create" or "cached".

Is there a way to reset this storage manually or perhaps a flag you can set before calling executeWorkflow?

Any help is appreciated Smile

Note:
I came across another problem but was able to avoid it:
The Xpand-Component throws exceptions as it tries to register the same outlets again and again each call of "invoke".

Kind regards
Ludwig
Re: [Xpand] Optimize succeeding workflow calls [message #540823 is a reply to message #540774] Thu, 17 June 2010 12:56 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1769
Registered: July 2009
Senior Member
I think it would be best not to use the old mwe in this case, but
directly call Xpand (through XpandFacade).
If you release the ExecutionContext, i.e. create a new one on each
invocation the caches will be empty.

Sven

Ludwig Straub schrieb:
> Hello,
>
> I am using the org.eclipse.emf.mwe.core.WorkflowRunner class to execute
> a workflow and generate text via Xpand.
>
> This class offers two methods:
> * prepare
> * executeWorkflow
>
> In my situation, I want to execute the same workflow multiple times.
> In order to gain performance, I intend to call "prepare" only once and
> then call "executeWorkflow" multiple times.
> (But this seems not possible out of the box. Should it?)
>
> As input I pass the same EMF model instance (created via Xtext) via
> slot. The model contents however changes from call to call, as the user
> enters new data in the Xtext-Editor.
>
> In order to achieve this, I have to clear/reset the internal memory
> (hashtable?) where data is stored concerning the results of
> Xtend-methods marked with the keywords "create" or "cached".
>
> Is there a way to reset this storage manually or perhaps a flag you can
> set before calling executeWorkflow?
>
> Any help is appreciated :)
>
> Note:
> I came across another problem but was able to avoid it:
> The Xpand-Component throws exceptions as it tries to register the same
> outlets again and again each call of "invoke".
>
> Kind regards
> Ludwig


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xpand] Optimize succeeding workflow calls [message #540846 is a reply to message #540774] Thu, 17 June 2010 13:39 Go to previous messageGo to next message
Ludwig Straub is currently offline Ludwig Straub
Messages: 14
Registered: July 2009
Junior Member
Thank you for the quick answer and the hint.

The old mwe workflow contains quite a few other components beside the Xpand-Component.

Also ist should be callable via command line.

Therefore a drawback to use the XpandFacade is not ideal for the situation.

An upgrade to mwe2 however would be possible.


I will use your input to continue my investigation on this topic and will post the result.

Thanks again.

Kind regards
Ludwig
Re: [Xpand] Optimize succeeding workflow calls [message #541047 is a reply to message #540846] Fri, 18 June 2010 07:31 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1769
Registered: July 2009
Senior Member
Ludwig Straub schrieb:
> Thank you for the quick answer and the hint.
>
> The old mwe workflow contains quite a few other components beside the
> Xpand-Component.
>
> Also ist should be callable via command line.
>
> Therefore a drawback to use the XpandFacade is not ideal for the situation.
>
> An upgrade to mwe2 however would be possible.

MWE2 won't solve the problem, since it is not related to mwe but to Xpand.
Xpand uses a so called ExecutionContext and the Workflow component
written for Xpand creates one once and not on each call a new one,
you'll have to patch that.
Can be done by creating a subclass and overrideing the respective methods.

Sven


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xpand] Optimize succeeding workflow calls [message #541191 is a reply to message #540774] Fri, 18 June 2010 15:28 Go to previous message
Ludwig Straub is currently offline Ludwig Straub
Messages: 14
Registered: July 2009
Junior Member
Hi Sven,

ok, thank you.
I will do it this way.

Kind regards
Ludwig
Previous Topic:[Acceleo] Launching a module from Java
Next Topic:[Xpand] typesystem.uml2 confuses xpand editor
Goto Forum:
  


Current Time: Thu Oct 23 04:02:06 GMT 2014

Powered by FUDForum. Page generated in 0.23488 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software