Porting Paloose Sites to Cocoon
It is inevitable that some sites will grow so much in both traffic and functionality that
moving the whole thing to Cocoon is sensible. It is obviously
important that the minimal amount of work is done in doing this. The whole process is
relatively simple with very little in Paloose that cannot be moved to Cocoon. The following is a summary of the important points to
remember:
- The component src attribute is a Java class in
Cocoon (uses package separators), not a file name in Paloose
(uses path separators) — (although since there is one class per file it
amounts to the same thing).
- Paloose is more relaxed in places about having the uri-prefix attribute present or not in the mount pipeline element.
- Some transformers in Paloose do not work in Cocoon. For
example the Gallery and Page-hit transformers. There is no reason, however, why it
should not be possible to write a version in Java of both of these.
- Paloose errors work slightly differently to Cocoon
ones, although the differences are not great.
An example
The example below is a very simple private site that I run to serve my work at home. I
have it both in Paloose and Cocoon forms as a test of
porting.
Root sitemap
The sitemap component declaration is where the most change must occur. In the Paloose
sitemap there is:
<map:components>
<map:generators default="file">
<map:generator name="file" src="resource://lib/generation/FileGenerator"/>
</map:generators>
<map:transformers default="xslt">
<map:transformer name="xslt" src="resource://lib/transforming/TRAXTransformer">
<map:use-request-parameters>true</map:use-request-parameters>
</map:transformer>
<map:transformer name="i18n" src="resource://lib/transforming/I18nTransformer">
<map:catalogues default="index">
<map:catalogue id="index" name="index" location="context://content/translations"/>
</map:catalogues>
<map:untranslated-text>untranslated text</map:untranslated-text>
</map:transformer>
</map:transformers>
<map:serializers default="html">
<map:serializer name="html" mime-type="text/html" src="resource://lib/serialization/HTMLSerializer"/>
<map:serializer name="text" mime-type="text/plain" src="resource://lib/serialization/TextSerializer"/>
<map:serializer name="xhtml" mime-type="text/html" src="resource://lib/serialization/XMLSerializer">
<doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>
<omit-xml-declaration>yes</omit-xml-declaration>
</map:serializer>
</map:serializers>
<map:matchers default="wildcard">
<map:matcher name="wildcard" src="resource://lib/matching/WildcardURIMatcher"/>
<map:matcher name="regexp" src="resource://lib/matching/RegexpURIMatcher"/>
</map:matchers>
<map:readers default="resource">
<map:reader name="resource" src="resource://lib/reading/ResourceReader"/>
</map:readers>
<map:selectors default="browser">
<map:selector name="browser" src="resource://lib/selection/BrowserSelector">
<browser name="explorer" useragent="MSIE"/>
<browser name="pocketexplorer" useragent="MSPIE"/>
<browser name="handweb" useragent="HandHTTP"/>
<browser name="avantgo" useragent="AvantGo"/>
<browser name="imode" useragent="DoCoMo"/>
<browser name="opera" useragent="Opera"/>
<browser name="lynx" useragent="Lynx"/>
<browser name="java" useragent="Java"/>
<browser name="wap" useragent="Nokia"/>
<browser name="wap" useragent="UP"/>
<browser name="wap" useragent="Wapalizer"/>
<browser name="mozilla5" useragent="Mozilla/5"/>
<browser name="mozilla5" useragent="Netscape6/"/>
<browser name="netscape" useragent="Mozilla"/>
<browser name="safari" useragent="Safari"/>
</map:selector>
</map:selectors>
</map:components>
The Cocoon version uses the same with the src attribute changes:
<map:components>
<map:pipes default="noncaching">
<map:pipe name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"/>
<map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline"/>
</map:pipes>
<map:generators default="file">
<map:generator name="file" src="org.apache.cocoon.generation.FileGenerator" />
</map:generators>
<map:transformers default="xslt">
<map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"/>
<map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
<catalogues default="index">
<catalogue id="index" name="index" location="context://content/translations"/>
</catalogues>
<map:untranslated-text>untranslated text</map:untranslated-text>
</map:transformer>
</map:transformers>
<map:serializers default="xhtml">
<map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer"/>
<map:serializer name="text" src="org.apache.cocoon.serialization.TextSerializer" mime-type="text/plain"/>
<map:serializer name="xhtml" mime-type="text/html" src="org.apache.cocoon.serialization.XMLSerializer">
<doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
<mdoctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>
<omit-xml-declaration>yes</omit-xml-declaration>
</map:serializer>
</map:serializers>
<map:matchers default="wildcard">
<map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
<map:matcher name="regexp" src="org.apache.cocoon.matching.RegexpURIMatcher"/>
</map:matchers>
<map:readers default="resource">
<map:reader name="resource" src="org.apache.cocoon.reading.ResourceReader"/>
</map:readers>
<map:selectors default="browser">
<map:selector name="browser" src="org.apache.cocoon.selection.BrowserSelector">
<browser name="explorer" useragent="MSIE"/>
<browser name="pocketexplorer" useragent="MSPIE"/>
<browser name="handweb" useragent="HandHTTP"/>
<browser name="avantgo" useragent="AvantGo"/>
<browser name="imode" useragent="DoCoMo"/>
<browser name="opera" useragent="Opera"/>
<browser name="lynx" useragent="Lynx"/>
<browser name="java" useragent="Java"/>
<browser name="wap" useragent="Nokia"/>
<browser name="wap" useragent="UP"/>
<browser name="wap" useragent="Wapalizer"/>
<browser name="mozilla5" useragent="Mozilla/5"/>
<browser name="mozilla5" useragent="Netscape6/"/>
<browser name="netscape" useragent="Mozilla"/>
<browser name="safari" useragent="Safari"/>
</map:selector>
</map:selectors>
</map:components>
Obviously in the Cocoon sitemap it is possible to manage the
cache, logging and component pools which are not present in Paloose.
What about the Subsitemaps, XML Content and XSL Transforms?
Absolutely nothing to do here at all. Good isn't it?
Ok, that is not strictly true, on my home web site and this site I had to change the
subsitemap "src" attributes. But other than that nothing. However in future the
authorisation and continuations that I am currently adding will require a slightly
different use of session variables in the XML. When this is added I will detail the
differences then. The authorisation (login etc.) is working on the next version and I am
finalising the form continuations. Watch this space.
Copyright 2006 – 2023 Hugh Field-Richards. All Rights
Reserved.