Hi Serge,

Interesting question.

I have a similar issue but have taken a different approach that does
indeed cache the shared files.

I use a directory based system, where every customer's files are
pulled from a different subdirectory.  Common files are pulled from
the root directory.   I use a standard FileResourceLoader with two
paths (one for customer files, one for shared).  The primary
customization I do is to use a custom InputEventHandler to ensure that
user's #include and #parse directives prepend the directory name (and
eliminate any ".." in the path).  Finally, users are constrained by
the webapp to only be able to retrieve files from the root or from
their directory.

Example.  With user accounts "wgh" and "skn".

File structure

/users/wgh/index.htm
/users/wgh/page2.htm

/users/sk/index.htm
/users/sk/page2.htm

/shared/library.vm

My template path is:  /users,/shared

Scenario
--
* WGH logs onto his account, and with path /wgh/index.htm retrieves
file /users/wgh/index.vm
* WGH is prevented by the webapp from retrieving any files in path "/sk".
* With a path "library.vm", WGH may also retrieve the file /shared/library.vm
* Within the user files, any #include or #parse will automatically
prepend the user directory
* Users may include a shared file with a special custom directive
#IncludeSystem which accesses from the root.  (but with no
subdirectories).

Hope this helps.  Let me know if I can answer any questions about this
approach.

Best, WILL

On Dec 13, 2007 8:42 PM, Serge Knystautas <[EMAIL PROTECTED]> wrote:
> I'm looking for some guidance on either a conf change, rearchitecting,
> or custom class I can implement to more efficient cache parsed
> versions of *shared* velocity templates.
>
> I have implemented two velocity context loaders...
> 1. a per-customer set of files and
> 2. system-provided files
>
> The idea behind this layering is that each customer will automatically
> have standard files that the system provides, and they just need to
> dump in a copy of the file into their set of files to effectively
> override and customize that template.  This all works well.
>
> My challenge is how to efficiently have velocity parse and cache those
> shared files.  AFAICT, the system provided files are getting parsed
> and cached per customer by velocity, i.e., velocity is cacheing
> templates based on the resource location, not the resource data/loader
> that's providing it.
>
> I don't see any way in the API to do what I'm trying to do, so if
> anybody can give me suggestions, that'd be great.  I've implemented a
> custom ResourceCache, ContextLoaders, so am comfortable extending the
> API as needed.
>
> --
> Serge Knystautas
> Lokitech >> software . strategy . design >> http://www.lokitech.com
> p. 301.656.5501
> e. [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to