AW: [opencms-dev] On how to integrate OpenCMS and velocity:
Werner Punz
werpu at gmx.at
Mon Apr 1 15:40:05 CEST 2002
>> So the OpenCms Template mechanism is used as a wrapper to
>> start the VTL processing - at least this is what the code
>> example looks like. The LC_Velocity_OpenCMS is initialized
>> somewhere outside the example, but what would prevent to
>> initialize the ResourceLoader in a new OpenCms launcher class?
>You still miss the point. The ResourceLoader is a Velocity class, it is
>not inteded to be accessible from Outside of Velocity and the way Werner
>has done it is a quick workaraound to get going. You will have no way to
>initialize the Velocity ResourceLoader in the launcher. Believe me, or
>better yet, look at the Velocity code.
Actually that is the exact way Velocity works. They use a factory pattern to initialize
resource loaders (it is some kind of software driver model they use).
The resource loaders are used to access file systems and therefore
thats the exact way to hook a foreign filesystem into velocity. You either can hook a foreign filesystem
into velocity or use velocity to access a normal filesystem and find a workaround within the VFS to hook normal filesystems into the mechanism. There seems to be no other way, sorry.
The synchronized as I pointed out was to ensure a proper way to pass down the CMS object into the resource loader. There might be a way to workaround this by rewriting parts of Velocity and adding a parameter passing mechanism which then passes parameters down to the resource loaders, but that means rewriting Velocity (which when I hacked the thing together, tried to avoid)
I couldnĀ“t find another way to pass down the CMS object properly within the OpenCMS context without either rewriting of OpenCMS or Velocity, sorry.
The resource loader can initalized once due to the singleton pattern and then is called whenever needed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20020401/02f4ffdd/attachment.htm>
More information about the opencms-dev
mailing list