You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Werner Punz <w....@labor-c.net> on 2002/08/07 11:09:45 UTC

Feature request

I already mailed this in this dev mailing list, but it went under there
unnoticed. 
It seems that the user mailing list is read more. So I will repost it
again.

First I guess, I introduce myself. I am one of the persons, who tries to
integrate Velocity into the OpenCMS project (in fact I started it).
(http://www.opencms.org)

So far it works fine except one problem. I have to access via Velocity a
virtual file system, which is based on a relational database.I made my
own resource loader for accessing the system. But the problem is there
is no way within the standard Velocity API to pass down an extra
parameter which can change dynamically upon loading the resource to the
resource loader, unless you pass it directly to the loader. 

But then you have to put the whole loading into a synchronized block to
avoid threading problems.

Anyway, this parameter is essential in my case to give access to the
virtual file system.

Passing it down directly via statics and synchronize the pass and call,
was my first solution. After a longer discussion in OpenCMS mailing list
we opted for another solution, by adding methods to the Velocity classes
which allow the passing of a separate object down to the resource
loader, if the loader implements a special interface. The problem with
this is, that every time a new Velocity version comes out the code has
to be readjusted. The best way to solve these problems probably would be
to integrate an extension which allows the passings of additional
parameters down to the local resource loader.

I have a working code here for 1.3.1 RC2 (but not published yet since I
want to wait for 1.3.1 final to before sending out the code into the
wild) I could send it in to have the additions (they are additions to
the core classes not really changes) evaluated and maybe merged into the
main branch. I just donĀ“t know whom to contact on this issue. 
Anyway a short description what I did. Not very much, my own classloader
which might enter the OpenCMS core one time.
And an extension to the ResourceManager,
ResourceManagerImpl,RuntimeInstance and Runtimesingleton classes, adding
exactly one method which adds an Object parameter which then gets passed
down to the resource loader (I followed the trace of the parameters from
the outside to the resource loaders). I also moved my extended classes
into another package to avoid conflicts with the core system. In an
earlier version you can find on the opencms.org site there also is a
cache factory added, so that the OpenCMS content cache theoretically can
be added, but this thing fortunately became obsolete with 1.3 :-)


Werner Punz Labor_C


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Feature request

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 8/7/02 5:09 AM, "Werner Punz" <w....@labor-c.net> wrote:

> I already mailed this in this dev mailing list, but it went under there
> unnoticed. 
> It seems that the user mailing list is read more. So I will repost it
> again.

Sorry.  Things busy.

> 
> First I guess, I introduce myself. I am one of the persons, who tries to
> integrate Velocity into the OpenCMS project (in fact I started it).
> (http://www.opencms.org)
> 
> So far it works fine except one problem. I have to access via Velocity a
> virtual file system, which is based on a relational database.I made my
> own resource loader for accessing the system. But the problem is there
> is no way within the standard Velocity API to pass down an extra
> parameter which can change dynamically upon loading the resource to the
> resource loader, unless you pass it directly to the loader.
> 

[snip]

If I understand what you are asking for, you want to pass something app
specific to the resource loader you wrote?

There is something in vel 1.4 called an 'application attribute' that can be
set by name from the application level, and then custom components can
access that attribute.  This attribute can be an object that the app layer
and core layer communicate through, for example.

See o.a.v.app.Velocity/VelocityEngine

Also, to see how this is used, take a look at jakarta-velocity-tools/view,
the VelocityViewServiet uses the app attribute to communicate with the
WebappLoader

See if this does what you need.

Also, I assume it's ok to put opencms on our powered-by page?


-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>