aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes What is the use of VM file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "What is the use of VM file?" Watch "What is the use of VM file?" New topic
Author

What is the use of VM file?

Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 231
Hi Members,

I was working on a project where I saw some VM files for generating classes having some code like



However in Java files which are generated from this VM file has almost the same code style. So can any one explain me how VM file works?

I found one document in this support but could not able to understand.

Thanks in advance !




God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42611
    
  65
That looks as if the Apache Velocity templating library is being used to generate Java source code.


Ping & DNS - my free Android networking tools app
Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 231
Ulf Dittmer wrote:That looks as if the Apache Velocity templating library is being used to generate Java source code.


In fact it is swing based client/server project. I talked with a developer for the same he told me earlier these files being used for developing some mapping between java file and database. Now all the newly developed module is using hibernate for the same.

I tried to create a new getter/setter in the older code. Developer told me just create abstract getter and setter method in abstract class. And then try to generate the Implementation class via rant export command.

I don't know but I see some ruby.... something.. something.. on console. I am totally discombobulated
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

HibernateTools may use Velocity templates for codegen (it's either that or FreeMarker, I forget which).

Rant is a Ruby-based makefile system.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

Ulf Dittmer wrote:That looks as if the Apache Velocity templating library is being used to generate Java source code.

As someone who has worked with Velocity as recently as today I concur - this looks like a Velocity template file.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 231
Rob Prime wrote:
Ulf Dittmer wrote:That looks as if the Apache Velocity templating library is being used to generate Java source code.

As someone who has worked with Velocity as recently as today I concur - this looks like a Velocity template file.


But what I am seeing this project is using these files as generator for java files.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42611
    
  65
Fidel Edwards wrote:But what I am seeing this project is using these files as generator for java files.

What do you mean, "but"? Aren't you saying the exact same thing as Rob and I before?
Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 231
Ulf Dittmer wrote:
What do you mean, "but"? Aren't you saying the exact same thing as Rob and I before?


Sorry for restating the things. If I get any tutorial or example then that will be really helpful.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Fidel Edwards wrote:But what I am seeing this project is using these files as generator for java files.

That's correct--they are.

What, precisely, do you want a tutorial on? Velocity? Check the Velocity website and get the docs for your version. HibernateTools (if that's what's being used)? The Hibernate docs have some information about that and the reveng file.
Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 231
David Newton wrote:
Check the Velocity website and get the docs for your version. HibernateTools (if that's what's being used)? The Hibernate docs have some information about that and the reveng file.


Thanks David!
 
 
subject: What is the use of VM file?