Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo3] properties file
[Acceleo3] properties file [message #662217] Tue, 29 March 2011 18:27 Go to next message
Sergio  is currently offline Sergio
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Hi!,

I was searching for information about the use of getProperty and the properties file.
I think that the use of properties file is only possible inside the acceleo project...

But...Could be possible to have a file (maybe a properties file) but next to the uml file (so could be possible to have properties attached to an uml diagram) in a way that can be used to generate code?

For example, in my case it could be nice that if I have a properties file with a propertie that told me from where to import the 'persistence'
Thank you!



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Re: [Acceleo3] properties file [message #662298 is a reply to message #662217] Wed, 30 March 2011 07:40 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Sergio,

With Acceleo 3.0.x, it is possible but it is a bit tricky since it will require some changes in the Java launcher class generated by Acceleo.

You would have to override the method "createAcceleoService()" to access the Acceleo service instance used during your generation. From there you can simply use the 'addProperties' methods to add new properties.

With Acceleo 3.1.x, starting with M6, it is now way easier to manipulate properties files. You can create an AbstractPropertiesLoaderService that will have to return the java.util.Properties object matching the given name (persistence.properties for example). With this new mechanism, you will be able to load your properties files as you want. You can have a look here to have more informations.

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com



Re: [Acceleo3] properties file [message #662437 is a reply to message #662298] Wed, 30 March 2011 16:26 Go to previous message
Sergio  is currently offline Sergio
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
great!

thank you!



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Previous Topic:[Xpand] Error "Couldn't find property 'a' for type 'b::c'" when "a" is EDataType
Next Topic:Workflow
Goto Forum:
  


Current Time: Tue Sep 30 18:06:46 GMT 2014

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

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