You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2005/07/08 15:05:03 UTC

svn commit: r209756 - in /forrest/trunk/main: fresh-site/src/documentation/content/ fresh-site/src/documentation/content/xdocs/ fresh-site/src/documentation/content/xdocs/samples/ fresh-site/src/documentation/content/xdocs/samples/locationmap/ java/org...

Author: rgardler
Date: Fri Jul  8 06:05:02 2005
New Revision: 209756

URL: http://svn.apache.org/viewcvs?rev=209756&view=rev
Log:
complete merge of locationmap branch

Added:
    forrest/trunk/main/fresh-site/src/documentation/content/locationmap.xml
      - copied unchanged from r209747, forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/locationmap.xml
    forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/
      - copied from r209747, forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/
    forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap.xml   (with props)
    forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml   (contents, props changed)
      - copied, changed from r209747, forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml
Modified:
    forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml
    forrest/trunk/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java
    forrest/trunk/main/webapp/WEB-INF/xconf/forrest-core.xconf
    forrest/trunk/main/webapp/sitemap.xmap

Added: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap.xml?rev=209756&view=auto
==============================================================================
--- forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap.xml (added)
+++ forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap.xml Fri Jul  8 06:05:02 2005
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation or its licensors,
+  as applicable.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<locationmap xmlns="http://apache.org/forrest/locationmap/1.0">
+
+  <components>
+    <matchers default="lm">
+      <matcher 
+        name="lm" 
+        src="org.apache.forrest.locationmap.WildcardLocationMapHintMatcher"/>
+    </matchers>
+  </components>
+  
+  <locator>
+
+   
+	   <match pattern="rewriteDemo/**">
+	     <location src="http://www.burrokeet.org/{1}.xml" />
+	   </match>
+	   <match pattern="remoteDemo/**.xml">
+	     <location src="http://svn.apache.org/viewcvs.cgi/*checkout*/forrest/trunk/site-author/content/xdocs/{1}.xml" />
+	   </match>
+	   <match pattern="lenya/**.xml">
+		     <location src="http://lenya.zones.apache.org:8888/default/live/{1}.html?raw=true" />
+	   </match>
+	   <match pattern="tabs.xml">
+		   <location src="{project:content.xdocs}tabs.xml"/>
+	   	<!--<location src="http://127.0.0.1:8080/slide/files/tabs.xml"/>-->
+	   </match>
+	   <match pattern="site.xml">
+		   <location src="{project:content.xdocs}site.xml"/>
+		   <!--<location src="http://127.0.0.1:8080/slide/files/site.xml"/>-->
+	   </match>
+	  
+	  <!--
+	    <match pattern="**.xml">
+	   	<location src="http://127.0.0.1:8080/slide/files/{1}.xml"/>
+	   </match>
+	  -->
+ 
+  </locator>
+</locationmap>

Propchange: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml (from r209747, forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml)
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml?p2=forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml&p1=forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml&r1=209747&r2=209756&rev=209756&view=diff
==============================================================================
--- forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml (original)
+++ forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml Fri Jul  8 06:05:02 2005
@@ -52,11 +52,11 @@
         This is useful if you want to pull files from different directory structures,
         oe even remote repositories.</p>
         
-        <p>The target of <a href="/remoteDemo/index.html">href="/remoteDemo/index.html"</a>
+        <p>The target of "/remoteDemo/index.html"
         is generated from a source retrieved from the Forrest SVN via viewSVN.</p>
         
-        <note>Because the above link retrieves the source file from viewSVN it will
-        only work if you are online.</note>
+        <note>Because the above URL retrieves the source file from viewSVN it will
+        only work if you are online. For this reason we have not enabled this link as it would stop you building this site offline. However, if you are online you can enter the URL into the browesr and it will work (however, note the surrent limitations regarding the site: and ext: protocols).</note>
         
         <p>The locationmap matcher for the link above is:</p>
         
@@ -69,7 +69,7 @@
         <p>Note that because this is a wildcard matcher you can request any page
         from viewsSVN simply by requesting 
         <code>/remoteDemo/PATH/TO/FILE/FILENAME.html</code>. In addition, we
-        can request any other output format available via FOrrest plugins.</p>
+        can request any other output format available via Forrest plugins.</p>
         
         <p>When including resources from remote repositories one has to
         be careful about things like <code>site</code> and <code>ext</code>
@@ -80,6 +80,8 @@
         page generated from the above example are broken.</warning>
         
       </section>
+
+<!-- Comment out as this requries additions to the sitemap, they should really be done in a plugin
       
       <section>
         <title>Retrieving HTML from Lenya</title>
@@ -157,6 +159,8 @@
         
       </section>
 
+-->
+
       <section>
         <title>Link Rewriting</title>
         <p>The locationmap can be used to rewrite URLs when the page is generated.
@@ -170,6 +174,7 @@
         an offsite address</a> not
         specified in the link, which has <code>href="lm:rewriteDemo/index"</code>.</p>
       </section>
+
     </section>
   </body>
 </document>

Propchange: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml?rev=209756&r1=209755&r2=209756&view=diff
==============================================================================
--- forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml (original)
+++ forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml Fri Jul  8 06:05:02 2005
@@ -66,6 +66,7 @@
       description="Custom XML Schemas"/>
     <custom label="Custom File" href="custom.html" description="A custom XML file"/>
     <faq label="FAQ" href="faq.html" description="Frequently Asked Questions" />
+    <locationmap label="Locationmap" href="locationmap/index.html" description="Locationmaps allow the user URL space to be different from the storage URL Space"/>
     <subdir label="Subdir" href="subdir/">
       <index label="Index" href="index.html" 
         description="Page generated from a sub-directory"/>

Modified: forrest/trunk/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java?rev=209756&r1=209755&r2=209756&view=diff
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java (original)
+++ forrest/trunk/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java Fri Jul  8 06:05:02 2005
@@ -75,6 +75,15 @@
     /** Return true if Source 'uri' resolves and exists. */
     public boolean select(String uri, Map objectModel, Parameters parameters) {
         Source src = null;
+        
+        // The locationmap module will return null if there is no match for
+        // the supplied hint, without the following the URI will be resolved to
+        // the context root, which always exists, but does not contain a valid
+        // resource.
+        if (uri == null || uri == "") {
+           return false; 
+        }
+        
         try {
             src = resolver.resolveURI(uri);
             if (src.exists()) {

Modified: forrest/trunk/main/webapp/WEB-INF/xconf/forrest-core.xconf
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/WEB-INF/xconf/forrest-core.xconf?rev=209756&r1=209755&r2=209756&view=diff
==============================================================================
--- forrest/trunk/main/webapp/WEB-INF/xconf/forrest-core.xconf (original)
+++ forrest/trunk/main/webapp/WEB-INF/xconf/forrest-core.xconf Fri Jul  8 06:05:02 2005
@@ -173,6 +173,13 @@
     <component-instance
       class="org.apache.cocoon.components.modules.input.SimpleMappingMetaModule"
       logger="core.modules.mapper" name="site"/>
+      
+    <!-- LocationMap is used to map one URL to another, allowing content to be stored anywhere -->
+    <component-instance 
+      class="org.apache.forrest.locationmap.LocationMapModule" 
+      logger="core.modules.mapper" name="lm">
+      <file src="cocoon://locationmap.xml"/>
+    </component-instance>
 
     <!-- Links to external URIs, as distinct from 'site' URIs -->
     <component-instance

Modified: forrest/trunk/main/webapp/sitemap.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/sitemap.xmap?rev=209756&r1=209755&r2=209756&view=diff
==============================================================================
--- forrest/trunk/main/webapp/sitemap.xmap (original)
+++ forrest/trunk/main/webapp/sitemap.xmap Fri Jul  8 06:05:02 2005
@@ -63,8 +63,9 @@
       <!-- See http://forrest.apache.org/docs/sitemap-ref.html#linkrewriting_impl -->
       <map:transformer name="linkrewriter" logger="sitemap.transformer.linkrewriter" src="org.apache.cocoon.transformation.LinkRewriterTransformer">
         <link-attrs>href src</link-attrs>
-        <schemes>site ext</schemes>
+        <schemes>site ext lm</schemes>
 
+        <input-module name="lm"/>
         <input-module name="site">
           <input-module name="linkmap">
             <file src="{src}" reloadable="true" />
@@ -353,6 +354,11 @@
             <map:part src="{forrest:whiteboard-plugins-src}/whiteboard-plugins.xml"/>
           </map:aggregate>
           <map:transform src="{forrest:stylesheets}/plugins2xdoc.xsl"/>
+          <map:serialize type="xml"/>
+        </map:match>
+   
+        <map:match pattern="locationmap.xml">
+          <map:generate src="{project:content}/locationmap.xml" />
           <map:serialize type="xml"/>
         </map:match>