<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
<document>
  <header>
    <title>Welcome to the org.apache.forrest.plugin.input.Lenya Plugin</title>
  </header>
  <body>
    <section>
      <title>Apache Forrest - org.apache.forrest.plugin.input.Lenya Plugin</title>
      <p>
        This plugin retrieves documents from a
        <a href="http://lenya.apache.org">Lenya</a> repository.
      </p>
    </section>
    <section>
      <title>Usage</title>
      <p>
        Perhaps the most important thing to realise about this plugin is that
        there is no relationship between the Forrest URL space and the URL space
        defined in the Lenya repository. That is the path to and the name of
        each document within Forrest needs not be the same as the path to and
        the name of the document within the Lenya repository.
      </p>
      <p>
        This enables the repository to be structured in a way that is
        appropriate for it's editors and the Forrest document collection can be
        structured in a way that is appropriate for the target audience. In
        fact, it is possible to use the same document from a Lenya repository in
        multiple Forrest collections each using a completely different URL space
        that is custom designed for the end user of the document collection.
      </p>
      <section>
        <title>Locationmap</title>
        <p>
          In order to tell Forrest which document to retrieve from the
          repository you need to make use of the locationmap in Forrest. Your
          project must therefore provide a locationmap similar to the one that
          follows.
        </p>
        <source>
<![CDATA[
<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="index.xml">
         <location src="http://127.0.0.1:18888/default/live/index.xml" />
     </match>	
     <match pattern="lenya-site.xml">
       <location src="cocoon://lenya-site.xml"/>
     </match>
     <match pattern="lenya/**.xml">
       <location src="http://127.0.0.1:18888/default/live/{1}.xml"/>
     </match>
     
  </locator>
</locationmap>
        ]]>
        </source>
        <p>
          The first match (<code>pattern="index.xml"</code>) will redirect the
          request for index.xml to a named document in the Lenya repository. If
          you provide your index.xml file locally then omit this matcher.
        </p>
        <note>
          In a future version of Forrest it planned to allow plugins to provide
          locationmaps of their own. Therefore, the need for a project to
          provide this locationmap will be removed.
        </note>
      </section>
      <section>
        <title>Retrieveing Lenya Documents</title>
        <p>
          To retrieve a lenya document simply request
          http://localhost:8888/lenya/PATH/TO/FILE.html.
        </p>
        <note>
          It is intended that his need to fix the urlspace as lenya/** will be
          removed in a future version of the plugin
        </note>
      </section>
    </section>
  </body>
</document>
