<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4417.0">
<TITLE>AW: [opencms-dev] On how to integrate OpenCMS and velocity:</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>>> So the OpenCms Template mechanism is used as a wrapper to </FONT>

<BR><FONT SIZE=2>>> start the VTL processing - at least this is what the code </FONT>

<BR><FONT SIZE=2>>> example looks like. The LC_Velocity_OpenCMS is initialized </FONT>

<BR><FONT SIZE=2>>> somewhere outside the example, but what would prevent to </FONT>

<BR><FONT SIZE=2>>> initialize the ResourceLoader in a new OpenCms launcher class?</FONT>
</P>

<P><FONT SIZE=2>>You still miss the point. The ResourceLoader is a Velocity class, it is</FONT>

<BR><FONT SIZE=2>>not inteded to be accessible from Outside of Velocity and the way Werner</FONT>

<BR><FONT SIZE=2>>has done it is a quick workaraound to get going. You will have no way to</FONT>

<BR><FONT SIZE=2>>initialize the Velocity ResourceLoader in the launcher. Believe me, or</FONT>

<BR><FONT SIZE=2>>better yet, look at the Velocity code. </FONT>
</P>

<P><FONT SIZE=2>Actually that is the exact way Velocity works. They use a factory pattern to initialize</FONT>

<BR><FONT SIZE=2>resource loaders (it is some kind of software driver model they use). </FONT>

<BR><FONT SIZE=2>The resource loaders are used to access file systems and therefore</FONT>

<BR><FONT SIZE=2>thats the exact way to hook a foreign filesystem into velocity. You either can hook a foreign filesystem</FONT>

<BR><FONT SIZE=2>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.</FONT></P>

<P><FONT SIZE=2>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)</FONT></P>

<P><FONT SIZE=2>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.</FONT></P>

<P><FONT SIZE=2>The resource loader can initalized once due to the singleton pattern and then is called whenever needed.</FONT>
</P>
<BR>
<BR>
<BR>
<BR>

</BODY>
</HTML>