Hi,

Following on from the launch of the Cocoon driven
StandardLifeInvestments.com sites, I've been given the go-ahead to offer the
code that we developed in order to make our task a bit easier :)

A bit of background will make it easier to understand the changes :)

There are various sub-sites within StandardLifeInvestments.com, and for some
of these sub-sites, there is content that is shared between them.

This content is managed within a "shared" branch inside Teamsite.

We have modified FileSourceFactory to return our new FilePathSource

25c80
< public class FilePathSourceFactory extends AbstractLoggable
---
> public class FileSourceFactory extends AbstractLoggable
36c91
<         Source result = new FilePathSource(location, this.manager);
---
>         Source result = new FileSource(location, this.manager);
46c101

FilePathSource extends FileSource with functionality that if the filename
referred to by the FilePathSource doesn't exist, it passes the name of the
file to a class which returns a list of "alternate" names for the file,
which FilePathSource then checks for, of course if none of these
"alternative" names exist, then it complains about not being able to find
the original file, and all is as before.

In our production code, there's only one "alternative" name returned, which
is the result of a Regex on the original filename to replace the original
sitename or Teamsite branch with our "shared" directory.

This /hostname.com/pages/prices.xml would be replaced with
/shared/pages/prices.xml.

What this has allowed us to do, is transparently link content on sites,
without having to have some "shared" identified in URIs, as a side-effect
(due to being a modification to the resolver), you can have shared XSLT
documents too, this might have application (WRT our setup), when you have
Apache virtual hosting static content (i.e. images and CSS), you can have a
totally shared page, that is customised by CSS and images.

If this is of interest to the Cocoon project, I can contribute patches...

Thanks again for Cocoon.

Kevin

---

Kevin McDermott Senior Technologist
0131 476 6000 Cert. TeamSite Consult
www.realise.com





Reply via email to