[Acceleo3] properties file [message #662217] |
Tue, 29 March 2011 18:27  |
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   |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03645 seconds