You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Tim Williams <wi...@gmail.com> on 2006/02/18 13:18:17 UTC

resolving project locationmaps [was: Re: svn commit: r328847 - in /forrest/trunk: main/webapp/locationmap.xml main/webapp/sitemap.xmap site-author/content/xdocs/docs_0_80/locationmap.xml

This breaks the locationmaps exists selector and now if the project
locationmap doesn't exist we get errors.  Maybe a better way to get
what this is trying to do is to mount the dynamic locationmap from the
project locationmap?

--tim

On 10/27/05, rgardler@apache.org <rg...@apache.org> wrote:
> Author: rgardler
> Date: Thu Oct 27 03:17:13 2005
> New Revision: 328847
>
> URL: http://svn.apache.org/viewcvs?rev=328847&view=rev
> Log:
> resolve the project lcoationmap via the sitemap, this allows projects to override the match if they want to generate the locationmap dynamically
>
> Modified:
>     forrest/trunk/main/webapp/locationmap.xml
>     forrest/trunk/main/webapp/sitemap.xmap
>     forrest/trunk/site-author/content/xdocs/docs_0_80/locationmap.xml
>
> Modified: forrest/trunk/main/webapp/locationmap.xml
> URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/locationmap.xml?rev=328847&r1=328846&r2=328847&view=diff
> ==============================================================================
> --- forrest/trunk/main/webapp/locationmap.xml (original)
> +++ forrest/trunk/main/webapp/locationmap.xml Thu Oct 27 03:17:13 2005
> @@ -37,7 +37,7 @@
>      <!-- Mount project specific locationmap -->
>      <!-- ================================== -->
>      <select>
> -      <mount src="{project:content}locationmap.xml"/>
> +      <mount src="cocoon://locationmap-project.xml"/>
>      </select>
>
>      <!-- ================================== -->
>
> Modified: forrest/trunk/main/webapp/sitemap.xmap
> URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/sitemap.xmap?rev=328847&r1=328846&r2=328847&view=diff
> ==============================================================================
> --- forrest/trunk/main/webapp/sitemap.xmap (original)
> +++ forrest/trunk/main/webapp/sitemap.xmap Thu Oct 27 03:17:13 2005
> @@ -316,6 +316,15 @@
>          <map:mount uri-prefix="" src="profiler.xmap" check-reload="yes" />
>        </map:match>
>      </map:pipeline>
> +
> +    <!-- Project supplied locationmap. Projects can override this
> +         matcher if they want to generate the locationmap dynamically -->
> +               <map:pipeline internal-only="true">
> +       <map:match pattern="locationmap-project.xml">
> +         <map:generate src="{project:content}locationmap.xml"/>
> +         <map:serialize type="xml"/>
> +       </map:match>
> +               </map:pipeline>
>
>      <!-- The navigation and links file "site.xml" -->
>      <map:pipeline internal-only="true">
>
> Modified: forrest/trunk/site-author/content/xdocs/docs_0_80/locationmap.xml
> URL: http://svn.apache.org/viewcvs/forrest/trunk/site-author/content/xdocs/docs_0_80/locationmap.xml?rev=328847&r1=328846&r2=328847&view=diff
> ==============================================================================
> --- forrest/trunk/site-author/content/xdocs/docs_0_80/locationmap.xml (original)
> +++ forrest/trunk/site-author/content/xdocs/docs_0_80/locationmap.xml Thu Oct 27 03:17:13 2005
> @@ -52,9 +52,19 @@
>        a location string.</p>
>
>        <p>Apache Forrest looks in the standard location for the source file first (by default
> -      <code>PROJECT_HOME/src/documentation/content/xdocs/...</code>), if a file is found in this
> +      <code>PROJECT_HOME/src/documentation/content/...</code>), if a file is found in this
>        location then the locationmap is not consulted. However, if one is not found then the
> -      locationmap is used to resolve the source file.</p>
> +      locationmap is used to resolve the source file. The locationmap is resolved via the
> +      core sitemap, this means that you can generate it dynamically if you so wish. Simply
> +      add a match that looks something like this to your projects sitemap:</p>
> +
> +      <source><![CDATA[
> +   <map:match pattern="locationmap-project.xml">
> +     <map:generate src="..."/>
> +     <map:transform src="..."/>
> +     <map:serialize type="xml"/>
> +   </map:match>
> +      ]]></source>
>
>      </section>
>
> @@ -111,7 +121,7 @@
>    </section>
>
>    <section id="selector">
> -    <title>Location Selectors</title>
> +    <title>Multiple Location Selectors</title>
>      <p>You can define multiple possble locations for a file in the locationmap
>      with the following code:</p>
>
>
>
>

Re: resolving project locationmaps [was: Re: svn commit: r328847 - in /forrest/trunk: main/webapp/locationmap.xml main/webapp/sitemap.xmap site-author/content/xdocs/docs_0_80/locationmap.xml

Posted by Ross Gardler <rg...@apache.org>.
Tim Williams wrote:
> On 2/18/06, Ross Gardler <rg...@apache.org> wrote:
> 
>>Tim Williams wrote:
>>

...

>> > Maybe a better way to get
>> > what this is trying to do is to mount the dynamic locationmap from the
>> > project locationmap?
>>
>>-1
>>
>>This assumes that the dynamic locationmap is provided by the users site.
>>This was added because some plugins, such as the Daisy plugin, need to
>>generate the locationmap.
>>
>>We could expect users to know they need to add an entry into the
>>locationmap, but I don't like expecting the user to have to do stuff to
>>make things work. I'd rather look for a solution that means the select
>>behaves as expected, i.e. if an optional locationmap is not present it
>>simply ignores the fact.
>>
>>Ross
> 
> 
> I wasn't expecting the users to do anything for plugins.  The plugin
> locationmap would then mount the dynamically generated locationmap. 
> So, Daisy plugin, which already has a static locationmap that gets
> mounted, would simply mount a dynamically generated one.  I think this
> is better than having these exceptions but I'm not convinced it's a
> great solution either.

The dynamically generated project locationmap takes precedence over all 
other locatonmaps. A locatonmap mounted from a plugin comes in an 
unpredicatable location with respect to processing order.

This could cause problems, I'll need to think about the implications of 
this. I'm due to do some work on the Daisy plugin fairly soon, I'll do 
some experimentation then. It would certainly be nice to remove the 
indirection of "cocoon://" in the locationmap (we have an issue for that 
of course).

Ross

Re: resolving project locationmaps [was: Re: svn commit: r328847 - in /forrest/trunk: main/webapp/locationmap.xml main/webapp/sitemap.xmap site-author/content/xdocs/docs_0_80/locationmap.xml

Posted by Tim Williams <wi...@gmail.com>.
On 2/18/06, Ross Gardler <rg...@apache.org> wrote:
> Tim Williams wrote:
> > This breaks the locationmaps exists selector and now if the project
> > locationmap doesn't exist we get errors.
>
> By "errors" you mean in the log don't you? The actual site build does
> not fail does it, or at least it doesn't on any of the many sites I have
> using this since applying the patch in October.

Yeah, in the log, but I was noticing some weird stuff happening with
lm resolution in mounted lm's after that so I thought maybe that was
having some unintended side effects as well -- not sure at this point.

> I accept having the log error is misleading when it is not really an error.

I don't think it's misleading at all.  It's an error;)  We're trying
to generate a file that doesn't exist and that's not good.

>  > Maybe a better way to get
>  > what this is trying to do is to mount the dynamic locationmap from the
>  > project locationmap?
>
> -1
>
> This assumes that the dynamic locationmap is provided by the users site.
> This was added because some plugins, such as the Daisy plugin, need to
> generate the locationmap.
>
> We could expect users to know they need to add an entry into the
> locationmap, but I don't like expecting the user to have to do stuff to
> make things work. I'd rather look for a solution that means the select
> behaves as expected, i.e. if an optional locationmap is not present it
> simply ignores the fact.
>
> Ross

I wasn't expecting the users to do anything for plugins.  The plugin
locationmap would then mount the dynamically generated locationmap. 
So, Daisy plugin, which already has a static locationmap that gets
mounted, would simply mount a dynamically generated one.  I think this
is better than having these exceptions but I'm not convinced it's a
great solution either.

--tim

Re: resolving project locationmaps [was: Re: svn commit: r328847 - in /forrest/trunk: main/webapp/locationmap.xml main/webapp/sitemap.xmap site-author/content/xdocs/docs_0_80/locationmap.xml

Posted by Ross Gardler <rg...@apache.org>.
Tim Williams wrote:
> This breaks the locationmaps exists selector and now if the project
> locationmap doesn't exist we get errors. 

By "errors" you mean in the log don't you? The actual site build does 
not fail does it, or at least it doesn't on any of the many sites I have 
using this since applying the patch in October.

I accept having the log error is misleading when it is not really an error.

 > Maybe a better way to get
 > what this is trying to do is to mount the dynamic locationmap from the
 > project locationmap?

-1

This assumes that the dynamic locationmap is provided by the users site. 
This was added because some plugins, such as the Daisy plugin, need to 
generate the locationmap.

We could expect users to know they need to add an entry into the 
locationmap, but I don't like expecting the user to have to do stuff to 
make things work. I'd rather look for a solution that means the select 
behaves as expected, i.e. if an optional locationmap is not present it 
simply ignores the fact.

Ross