You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Tim Colson <tc...@cisco.com> on 2003/06/26 20:00:59 UTC

news: Velocity used in Intellij IDEA

Howdy folks -
  I just received some code generation templates for IntelliJ IDEA from
one of my colleagues and noticed that they use Velocity. I didn't see
this in the "Powered By" page, perhaps worth adding.

-Timo

>From the IntelliJ IDEA 3.x help system:

IntelliJ IDEA provides several built-in templates for creating new
files, classes and interfaces, as well as some supplementary templates
to be automatically used when generating particular blocks of code.
Along with using the built-in templates, you can easily create your own.
To view/edit the existing templates, or to define your own, select the
Options | File Templates menu item.  The File Templates dialog will
appear, containing the following three tabs:
  Templates - for file templates   Includes - for code fragment
templates to be dynamically included into the file templates   Code -
for code templates
...
  When writing or editing templates, you can use built-in and custom
variables, conditional directives, etc. which are briefly described in
the Description field of the File Template dialog. For more details on
template syntax, please, refer to
http://jakarta.apache.org/velocity/user-guide.html. 

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Alternate Language Engine

Posted by Gonzalo Diethelm <go...@diethelm.org>.
> > * Write a Velocity-compatible template engine in C, with
> >   hooks for everything that could be environment dependent,
> >   like how to access a context, how to call an object's
> >   method, how to access an object's properties, etc.
> 
> I like this because it makes it easier to hook into engine of the day, 
> but the pain of writing a templating engine in C... It would be 
> probably easier do separate Perl, Ruby, Python, and C# implementations 
> than write one in ANSI C and write wrappers for each I think =/

But I wouldn't want to be the one maintaining the separate engines,
in several different languages... I have written a couple of compilers
in C before, I don't think it would be that hard.

The one thing I could never assess was how easy it would be to design
a generic interface for each language "skin". What would you need to
support in this interface?

* Access to a "context".
* The ability to introspect.
* The ability to call methods in objects placed in the context.
* Anything else?

That's about it. The rest of the code could be implemented ONCE in C.

> >  One set of template pages, many possible "back-ends".
> 
> That be the idea. Couple it with a Context Service (ie, extract the 
> Context via JAXB and equivalents in other languages) and things get 
> interesting. In theory you can define your services to be pretty 
> transparent. As webapp contexts are pretty close to single-thread 
> oriented most of the time you can cache them very aggressively and be 
> okay - but this is worrying about performance way too early.

Yeah. It sounds interesting to me, no one ever agreed though...

> -Brian

Regards,


-- 
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Alternate Language Engine

Posted by Tim Colson <tc...@cisco.com>.
> but the pain of writing a templating engine in C... It would be 
> probably easier do separate Perl, Ruby, Python, and C# 

.Net/C# has already been done. :-)
http://nvelocity.sourceforge.net/

I wonder if there is an equivelant to JavaCC for the other languages.

-Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Alternate Language Engine

Posted by Brian McCallister <mc...@forthillcompany.com>.
On Friday, June 27, 2003, at 09:24 AM, Gonzalo Diethelm wrote:
> * Write a Velocity-compatible template engine in C, with
>   hooks for everything that could be environment dependent,
>   like how to access a context, how to call an object's
>   method, how to access an object's properties, etc.

I like this because it makes it easier to hook into engine of the day, 
but the pain of writing a templating engine in C... It would be 
probably easier do separate Perl, Ruby, Python, and C# implementations 
than write one in ANSI C and write wrappers for each I think =/

>  One set of template pages,
> many possible "back-ends".
>

That be the idea. Couple it with a Context Service (ie, extract the 
Context via JAXB and equivalents in other languages) and things get 
interesting. In theory you can define your services to be pretty 
transparent. As webapp contexts are pretty close to single-thread 
oriented most of the time you can cache them very aggressively and be 
okay - but this is worrying about performance way too early.

-Brian


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Alternate Language Engine

Posted by Gonzalo Diethelm <go...@diethelm.org>.
I once faced a similar project, where we needed some PHP-
and Perl-backed pages. I thought the simplicity and power
of Velocity were just perfect for my needs. At one point,
I charted  the following plan:

* Write a Velocity-compatible template engine in C, with
  hooks for everything that could be environment dependent,
  like how to access a context, how to call an object's
  method, how to access an object's properties, etc.

* Write "flavors" for this engine in each desired language.
  The first one would be Java, as a proof of concept.

Alas, I never found the time to do this. I still believe
it could be a good way to spread Velocity to other languages
and/or environments. Imagine that! One set of template pages,
many possible "back-ends".

Regards,


-- 
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com


> -----Original Message-----
> From: Anthony Eden [mailto:aeden@signaturedomains.com]
> Sent: Thursday, June 26, 2003 17:18
> To: Velocity Users List
> Subject: Re: Alternate Language Engine
> 
> 
> You might want to have a look at http://freshmeat.net/articles/view/447/ 
> for an article which discusses creating a basic template engine in 
> Ruby.  Should be pretty easy to build one from there, especially with 
> the regex support.
> 
> Sincerely,
> Anthony Eden
> 
> Brian McCallister wrote:
> 
> > Hello all,
> >
> > This may be a bit way off-scope (particularly as Jakarta is Java 
> > centric) but I have a problem I would like to solve via Velocity which 
> > I cannot quite yet.
> >
> > Basically I need to integrate look and feel of several web 
> > applications that are spread across Java and Ruby. The Java side of 
> > the application is planning to use Velocity for page generation, and 
> > the Ruby side is... planning to use eruby (think ASP/PHP but with 
> > Ruby) unless I can come up with something better. I am attempting to 
> > do this so that we don't wind up maintaining twice the templates for 
> > common things (top/bottom/left etc).
> >
> > I would dearly love to use a common set of templates between all of 
> > the components (be they ruby, Java, or... whatever else winds up being 
> > grafted on down the line).
> >
> > So, does anyone know of any effort to port a VTL engine to Ruby? As I 
> > am pretty confident that no one has done this yet - is anyone familiar 
> > with the inner workings of VTL interested in helping to build one?
> >
> > Thanks,
> > Brian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Alternate Language Engine

Posted by Anthony Eden <ae...@signaturedomains.com>.
You might want to have a look at http://freshmeat.net/articles/view/447/ 
for an article which discusses creating a basic template engine in 
Ruby.  Should be pretty easy to build one from there, especially with 
the regex support.

Sincerely,
Anthony Eden

Brian McCallister wrote:

> Hello all,
>
> This may be a bit way off-scope (particularly as Jakarta is Java 
> centric) but I have a problem I would like to solve via Velocity which 
> I cannot quite yet.
>
> Basically I need to integrate look and feel of several web 
> applications that are spread across Java and Ruby. The Java side of 
> the application is planning to use Velocity for page generation, and 
> the Ruby side is... planning to use eruby (think ASP/PHP but with 
> Ruby) unless I can come up with something better. I am attempting to 
> do this so that we don't wind up maintaining twice the templates for 
> common things (top/bottom/left etc).
>
> I would dearly love to use a common set of templates between all of 
> the components (be they ruby, Java, or... whatever else winds up being 
> grafted on down the line).
>
> So, does anyone know of any effort to port a VTL engine to Ruby? As I 
> am pretty confident that no one has done this yet - is anyone familiar 
> with the inner workings of VTL interested in helping to build one?
>
> Thanks,
> Brian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Alternate Language Engine

Posted by Brian McCallister <mc...@forthillcompany.com>.
Hello all,

This may be a bit way off-scope (particularly as Jakarta is Java 
centric) but I have a problem I would like to solve via Velocity which 
I cannot quite yet.

Basically I need to integrate look and feel of several web applications 
that are spread across Java and Ruby. The Java side of the application 
is planning to use Velocity for page generation, and the Ruby side 
is... planning to use eruby (think ASP/PHP but with Ruby) unless I can 
come up with something better. I am attempting to do this so that we 
don't wind up maintaining twice the templates for common things 
(top/bottom/left etc).

I would dearly love to use a common set of templates between all of the 
components (be they ruby, Java, or... whatever else winds up being 
grafted on down the line).

So, does anyone know of any effort to port a VTL engine to Ruby? As I 
am pretty confident that no one has done this yet - is anyone familiar 
with the inner workings of VTL interested in helping to build one?

Thanks,
Brian


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org