forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r653747 - in /forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting: RecursiveDirectoryTraversalAction.java ResourceTypeAction.java
Date Tue, 06 May 2008 11:28:54 GMT
Author: thorsten
Date: Tue May  6 04:28:53 2008
New Revision: 653747

URL: http://svn.apache.org/viewvc?rev=653747&view=rev
Log:
Adding javadoc.

Modified:
    forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/RecursiveDirectoryTraversalAction.java
    forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/ResourceTypeAction.java

Modified: forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/RecursiveDirectoryTraversalAction.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/RecursiveDirectoryTraversalAction.java?rev=653747&r1=653746&r2=653747&view=diff
==============================================================================
--- forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/RecursiveDirectoryTraversalAction.java
(original)
+++ forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/RecursiveDirectoryTraversalAction.java
Tue May  6 04:28:53 2008
@@ -32,35 +32,32 @@
 import org.apache.excalibur.source.SourceResolver;
 
 /**
- * Selects the first of a set of Sources that exists in the context.
+ * Calculates which location to return for a given directory.
+ * Here we are traversing the tree till we reach its root. 
  * <p>
- * For example, we could define a SourceExistsSelector with:
- * 
- * <pre>
- * 
- *  &lt;map:selector name=&quot;exists&quot;
- *                logger=&quot;sitemap.selector.source-exists&quot;
- *                src=&quot;org.apache.cocoon.selection.SourceExistsSelector&quot;
/&gt;
- *  
- * </pre>
- * 
- * And use it to build a PDF from XSL:FO or a higher-level XML format with:
- * 
- * <pre>
+ * We are looking first in the request string and then using a 
+ * fallback algorithm to find alternative fallbacks.
+ * <p> 
+ * e.g. the request is "sample/index". First choice is to find: 
+ * {$projectDir}sample/index{$projectExtension}<br>
+ * If the file does not exist we will try with the fallback file
+ * {$projectDir}sample/{$projectFallback}{$projectExtension}<br>
+ * The last file we will try in our example is 
+ * {$projectDir}{$projectFallback}{$projectExtension}.<br>
+ * With this we have reached the root directory and we cannot find the
+ * requested file the action will return null.
+ * <p>
+ * &lt;map:act type="RecursiveDirectoryTraversalAction"&gt;<br>
+ *   &lt;map:parameter value="{../1}{1}" name="request"/&gt;<br>
+ *   &lt;map:parameter value="{properties:dispatcher.theme}" name="projectFallback"/&gt;<br>
+ *   &lt;map:parameter value="{properties:dispatcher.theme-ext}" 
+ *                     name="projectExtension"/&gt;<br>
+ *   &lt;map:parameter value="{properties:resources}structurer/url/" 
+ *                     name="projectDir"/&gt;<br>
+ * &lt;!--  url project-based theme-based = directory-based / parent-directory based
(recursively) --&gt;<br>
+ *         &lt;map:location src="{uri}" /&gt;<br>
+ *  &lt;/map:act&gt;
  * 
- *   &lt;map:match pattern=&quot;**.pdf&quot;&gt;
- *     &lt;map:select type=&quot;exists&quot;&gt;
- *        &lt;map:when test=&quot;context/xdocs/{1}.fo&quot;&gt;
- *           &lt;map:generate src=&quot;content/xdocs/{1}.fo&quot; /&gt;
- *        &lt;/map:when&gt;
- *        &lt;map:otherwise&gt;
- *          &lt;map:generate src=&quot;content/xdocs/{1}.xml&quot; /&gt;
- *          &lt;map:transform src=&quot;stylesheets/document2fo.xsl&quot; /&gt;
- *        &lt;/map:otherwise&gt;
- *     &lt;/map:select&gt;
- *     &lt;map:serialize type=&quot;fo2pdf&quot; /&gt;
- *  
- * </pre>
  */
 public class RecursiveDirectoryTraversalAction extends ServiceableAction
         implements ThreadSafe, Serviceable {

Modified: forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/ResourceTypeAction.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/ResourceTypeAction.java?rev=653747&r1=653746&r2=653747&view=diff
==============================================================================
--- forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/ResourceTypeAction.java
(original)
+++ forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/acting/ResourceTypeAction.java
Tue May  6 04:28:53 2008
@@ -17,22 +17,23 @@
 package org.apache.forrest.dispatcher.acting;
 /**
  * Looks up a meta data file to determine which resource type should be returned. 
- */
-/**
- * component declaration (lm and sitemap)
+ * Will parse the document and looks for the {$resourceTypeElement}.
+ * If found the action returns {$resourceTypeBase}{$resourceTypeElement}.
+ * <p>
+ * component declaration (lm and sitemap):<br>
  * &lt;action name="resourceTypeAction" 
  *      src="org.apache.forrest.dispatcher.acting.ResourceTypeAction"/&gt;
- *
- *pipline usage lm
-*  &lt;act type="resourceTypeAction"&gt;
-*     &lt;parameter value="{1}" name="request"/&gt;
-*     &lt;parameter value="{project:content.xdocs}" name="projectDir"/&gt;
-*     &lt;parameter value="lm://dispatcher.structurer.resourceType." name="resourceTypeBase"/&gt;
-*     &lt;parameter value=".xml.meta" name="metaExtension"/&gt;
-*     &lt;parameter value="resourceType" name="resourceTypeElement"/&gt;
-*     &lt;parameter value="http://apache.org/cocoon/lenya/page-envelope/1.0" name="resourceTypeElementNS"/&gt;
-*     &lt;!--  Meta data based --&gt;
-*     &lt;location src="{uri}" /&gt;
+ *<p>
+ *pipline usage lm<br>
+*  &lt;act type="resourceTypeAction"&gt;<br>
+*     &lt;parameter value="{1}" name="request"/&gt;<br>
+*     &lt;parameter value="{project:content.xdocs}" name="projectDir"/&gt;<br>
+*     &lt;parameter value="lm://dispatcher.structurer.resourceType." name="resourceTypeBase"/&gt;<br>
+*     &lt;parameter value=".xml.meta" name="metaExtension"/&gt;<br>
+*     &lt;parameter value="resourceType" name="resourceTypeElement"/&gt;<br>
+*     &lt;parameter value="http://apache.org/cocoon/lenya/page-envelope/1.0" name="resourceTypeElementNS"/&gt;<br>
+*     &lt;!--  Meta data based --&gt;<br>
+*     &lt;location src="{uri}" /&gt;<br>
  * &lt;/act&gt;
  */
 import java.io.IOException;



Mime
View raw message