From svn-return-7674-apmail-forrest-svn-archive=forrest.apache.org@forrest.apache.org Tue May 06 11:29:18 2008 Return-Path: Delivered-To: apmail-forrest-svn-archive@www.apache.org Received: (qmail 33232 invoked from network); 6 May 2008 11:29:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 May 2008 11:29:18 -0000 Received: (qmail 85559 invoked by uid 500); 6 May 2008 11:29:20 -0000 Delivered-To: apmail-forrest-svn-archive@forrest.apache.org Received: (qmail 85525 invoked by uid 500); 6 May 2008 11:29:19 -0000 Mailing-List: contact svn-help@forrest.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Forrest Developers List" List-Id: Delivered-To: mailing list svn@forrest.apache.org Received: (qmail 85514 invoked by uid 99); 6 May 2008 11:29:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 04:29:19 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 11:28:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7CF2723889FA; Tue, 6 May 2008 04:28:54 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: svn@forrest.apache.org From: thorsten@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080506112854.7CF2723889FA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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. *

- * For example, we could define a SourceExistsSelector with: - * - *

- * 
- *  <map:selector name="exists"
- *                logger="sitemap.selector.source-exists"
- *                src="org.apache.cocoon.selection.SourceExistsSelector" />
- *  
- * 
- * - * And use it to build a PDF from XSL:FO or a higher-level XML format with: - * - *
+ * We are looking first in the request string and then using a 
+ * fallback algorithm to find alternative fallbacks.
+ * 

+ * e.g. the request is "sample/index". First choice is to find: + * {$projectDir}sample/index{$projectExtension}
+ * If the file does not exist we will try with the fallback file + * {$projectDir}sample/{$projectFallback}{$projectExtension}
+ * The last file we will try in our example is + * {$projectDir}{$projectFallback}{$projectExtension}.
+ * With this we have reached the root directory and we cannot find the + * requested file the action will return null. + *

+ * <map:act type="RecursiveDirectoryTraversalAction">
+ * <map:parameter value="{../1}{1}" name="request"/>
+ * <map:parameter value="{properties:dispatcher.theme}" name="projectFallback"/>
+ * <map:parameter value="{properties:dispatcher.theme-ext}" + * name="projectExtension"/>
+ * <map:parameter value="{properties:resources}structurer/url/" + * name="projectDir"/>
+ * <!-- url project-based theme-based = directory-based / parent-directory based (recursively) -->
+ * <map:location src="{uri}" />
+ * </map:act> * - * <map:match pattern="**.pdf"> - * <map:select type="exists"> - * <map:when test="context/xdocs/{1}.fo"> - * <map:generate src="content/xdocs/{1}.fo" /> - * </map:when> - * <map:otherwise> - * <map:generate src="content/xdocs/{1}.xml" /> - * <map:transform src="stylesheets/document2fo.xsl" /> - * </map:otherwise> - * </map:select> - * <map:serialize type="fo2pdf" /> - * - *

*/ 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}. + *

+ * component declaration (lm and sitemap):
* <action name="resourceTypeAction" * src="org.apache.forrest.dispatcher.acting.ResourceTypeAction"/> - * - *pipline usage lm -* <act type="resourceTypeAction"> -* <parameter value="{1}" name="request"/> -* <parameter value="{project:content.xdocs}" name="projectDir"/> -* <parameter value="lm://dispatcher.structurer.resourceType." name="resourceTypeBase"/> -* <parameter value=".xml.meta" name="metaExtension"/> -* <parameter value="resourceType" name="resourceTypeElement"/> -* <parameter value="http://apache.org/cocoon/lenya/page-envelope/1.0" name="resourceTypeElementNS"/> -* <!-- Meta data based --> -* <location src="{uri}" /> + *

+ *pipline usage lm
+* <act type="resourceTypeAction">
+* <parameter value="{1}" name="request"/>
+* <parameter value="{project:content.xdocs}" name="projectDir"/>
+* <parameter value="lm://dispatcher.structurer.resourceType." name="resourceTypeBase"/>
+* <parameter value=".xml.meta" name="metaExtension"/>
+* <parameter value="resourceType" name="resourceTypeElement"/>
+* <parameter value="http://apache.org/cocoon/lenya/page-envelope/1.0" name="resourceTypeElementNS"/>
+* <!-- Meta data based -->
+* <location src="{uri}" />
* </act> */ import java.io.IOException;