Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider


This article provides the code for the DeepestSourceFactory.
Download Java code (
Download Java Class file (DeepestSourceFactory.class).


Add this line to webapp/WEB-INF/cocoon.xconf within the element:
<component-instance class="com.solprovider.cocoon.DeepestSourceFactory" name="deep"/>


This SourceFactory finds deepest file by incrementally removing directories.
Example 1: deep:/C:\temp1\temp2\myfile.txt
Tries: C:/temp1/temp2/myfile.txt, C:/temp1/myfile.txt, C:/myfile.txt
Example 2: deep:/
Tries:,,, http://myfile.html

The starting level can be specified as the first parameter.
Example 3: deep:/2/C:\temp1\temp2\temp3\temp4\myfile.txt checks for the same files as Example 1.

Any valid protocol should be usable:
Example 4: deep:/2/
Server names are considered a level as this class is indifferent to protocols.

Relevant paths should also be usable: Example 4: deep:/2/test1/test2/myfile.xmap
Tries: {currentPath}/test1/test2/, {currentPath}/test1/, {currentPath}/,

Note the Excalibur FileSourceFactory does not allow the file: protocol to find relevant paths. The URLSourceFactory bypasses this bug by creating a FileSource without using the Factory. This example works because the URLSourceFactory is Cocoon's default when no protocol is specified.

This class can be used to pass control to the deepest XMAP in a directory tree.
<map:match pattern="**/*"/>
<map:select type="resource-exists">
<map:when test="deep:/{1}/sitemap.xmap">
<map:mount uri-prefix="" src="deep:/{1}/sitemap.xmap"/>
<map:serialize type="xml"/>

Deeper XMAPs could contain code to find a higher XMAP using the deepest level parameter. If this XMAP was in the fourth directory from the root XMAP, this example specifies "3" levels so an XMAP in a higher directory is found.
<map:match pattern="**/*"/>
<!-- Do something special for this directory here. -->
<!-- If nothing specific for this directory is needed, pass up to the next deepest XMAP. -->
<map:select type="resource-exists">
<map:when test="deep:/3/{1}/sitemap.xmap">
<map:mount uri-prefix="" src="deep:/3/{1}/sitemap.xmap"/>
<map:serialize type="xml"/>

<< External IntegrationContents >>

Contact Solprovider
Paul Ercolino