Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] - change file access rights from within Acceleo
[Acceleo] - change file access rights from within Acceleo [message #846676] Mon, 16 April 2012 12:04 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 1
Registered: February 2010
Junior Member
All,

I have a code generator that generates ~60 files (out of overall ~200) for a rather complex SW baseline. In order to keep track of the changes I tend to make all files write protected before starting to make major changes. Now when the generators run I need to change the access rights of the files (only the ones that are overwritten) to right access.

Is there a simple way to do this from within the code generator. i.e. just before the [file ('XYZ',....)/] I want to check if the file exists, check the access right and if it is write protected change that.

rgds

Hermann
Re: [Acceleo] - change file access rights from within Acceleo [message #847298 is a reply to message #846676] Tue, 17 April 2012 03:11 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1623
Registered: July 2009
Senior Member
Hi,

This is done for you if you change the generation strategy used by Acceleo for your generator. In the generated Java class, override getGenerationStrategy and change its implementation to "return new WorkspaceAwareStrategy()". Do take note that this strategy cannot be used in standalone.

You can also create your own strategy in order to make one that checks for access rights of java.io.Files : the strategy is the entry point for such use cases.

Laurent Goubet
Obeo
Previous Topic:[XPAND] Ecore to Text with XPand
Next Topic:[Acceleo] The generated code contains only the name of the first class
Goto Forum:
  


Current Time: Wed Aug 20 06:59:31 EDT 2014

Powered by FUDForum. Page generated in 0.01551 seconds