You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Sjur Moshagen <sj...@mac.com> on 2006/10/31 15:05:58 UTC

LM properties lookup for JTidy

Hello all,

The main sitemap at FORREST_HOME/main/webapp/sitemap.xmap contains  
the following snippet around line 30:

       <map:generator name="html"   
src="org.apache.cocoon.generation.HTMLGenerator">
         <jtidy-config>WEB-INF/jtidy.properties</jtidy-config>
       </map:generator>

I would like to augment this with a LM lookup, to facilitate project- 
specific jtidy config. As it is now, one needs to change e.g. the  
file encoding in the file FORREST_HOME/main/webapp/WEB-INF/ 
jtidy.properties. I would like to have Forrest look in a couple of  
different places:

PROJECT_HOME/src/documentation/WEB-INF/
FORREST_HOME/webapp/WEB-INF/

This way, it is easy for any single project to change whatever jtidy  
settings is needed (or provide more) without needing to change any of  
the Forrest code.

The problem:

I don't grasp how I should formulate what I want. I guess there need  
to be two pieces in place:

#1 - replace the reference in the above sitemap snippet with a LM lookup
#2 - resolve that LM lookup to one of the two locations mentioned

But what does #1 look like? And where should #2 be stored and called?

Any hints appreciated,
Sjur


Re: LM properties lookup for JTidy

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> 
> AFAIR Cyriaque tried once something similar but it was not working
> because the map:generator will be read during setup and the lm is not
> available until after that.
> 
> As I remember the use case it was the serializer that he wanted to
> configure via lm. 

I don't recall such discussion regarding locationmap use.
That should be fully explored in preference to other solutions.

The part i do remember was that Cyriaque tried to find
various means for projects to configure Cocoon components
(yes, in his case xhtml serializer).

There are various discussions in our dev archives, then
it moved to http://issues.apache.org/jira/browse/COCOON-1928

We need someone to add a FOR issue for this general enhancement.

> One solution was the new property system of cocoon (David mentioned
> something).

See above discussions and here is a snip from COCOON-1928
Vadim said:
"Variable substitution in component configuration has to happen manually. Sitemap variable susbstitution in parameter values is happening only within <map:pipeline> section, not within <map:components> section."

The new property system that Thorsten mentions is
"Cocoon running modes:
http://issues.apache.org/jira/browse/FOR-917

-David

Re: LM properties lookup for JTidy

Posted by Thorsten Scherler <th...@apache.org>.
On Tue, 2006-10-31 at 10:38 -0500, Tim Williams wrote:
> On 10/31/06, Thorsten Scherler <th...@apache.org> wrote:
> > On Tue, 2006-10-31 at 10:05 -0500, Tim Williams wrote:
> > > On 10/31/06, Sjur Moshagen <sj...@mac.com> wrote:
> > > > Hello all,
> > > >
> > > > The main sitemap at FORREST_HOME/main/webapp/sitemap.xmap contains
> > > > the following snippet around line 30:
> > > >
> > > >        <map:generator name="html"
> > > > src="org.apache.cocoon.generation.HTMLGenerator">
> > > >          <jtidy-config>WEB-INF/jtidy.properties</jtidy-config>
> > > >        </map:generator>
> > > >
> > > > I would like to augment this with a LM lookup, to facilitate project-
> > > > specific jtidy config. As it is now, one needs to change e.g. the
> > > > file encoding in the file FORREST_HOME/main/webapp/WEB-INF/
> > > > jtidy.properties. I would like to have Forrest look in a couple of
> > > > different places:
> > > >
> > > > PROJECT_HOME/src/documentation/WEB-INF/
> > > > FORREST_HOME/webapp/WEB-INF/
> > > >
> > > > This way, it is easy for any single project to change whatever jtidy
> > > > settings is needed (or provide more) without needing to change any of
> > > > the Forrest code.
> > > >
> > > > The problem:
> > > >
> > > > I don't grasp how I should formulate what I want. I guess there need
> > > > to be two pieces in place:
> > > >
> > > > #1 - replace the reference in the above sitemap snippet with a LM lookup
> > > > #2 - resolve that LM lookup to one of the two locations mentioned
> > > >
> > > > But what does #1 look like? And where should #2 be stored and called?
> > > >
> > > > Any hints appreciated,
> > > > Sjur
> > >
> > > Hi Sjur,
> > > Try the locationmap protocol.  It seems to me that it should work for
> > > what you want.
> > >
> > > e.g.
> > >       <map:generator name="html"
> > > src="org.apache.cocoon.generation.HTMLGenerator">
> > >         <jtidy-config>lm://jtidy-config</jtidy-config>
> > >       </map:generator>
> > >
> > > then add a locationmap entry for
> > >
> > > <match pattern="jtidy-config">
> > > ...various locations....
> > > </match>
> > >
> >
> > AFAIR Cyriaque tried once something similar but it was not working
> > because the map:generator will be read during setup and the lm is not
> > available until after that.
> 
> The locationmap should be available before a generator begins its
> lifecycle.  Why not?


http://marc.theaimsgroup.com/?t=114975509600004&r=1&w=2

Ross points out
http://marc.theaimsgroup.com/?l=forrest-dev&m=115313354117234&w=2
"I missed the fact you were trying to configure a component with a 
property. Unfortunately you can't. The prooperties module is loaded 
during initialisation, i.e. at the same tie as the initialisation of all 
the components. Therefore the property value is not available at that time."

Bottom line I mixed it up and the properties variant is already tested and it seems the lm alternative not. 
Now one need to verify that the above said is as well true for the lm.

salu2

> --tim
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: LM properties lookup for JTidy

Posted by Tim Williams <wi...@gmail.com>.
On 10/31/06, Thorsten Scherler <th...@apache.org> wrote:
> On Tue, 2006-10-31 at 10:05 -0500, Tim Williams wrote:
> > On 10/31/06, Sjur Moshagen <sj...@mac.com> wrote:
> > > Hello all,
> > >
> > > The main sitemap at FORREST_HOME/main/webapp/sitemap.xmap contains
> > > the following snippet around line 30:
> > >
> > >        <map:generator name="html"
> > > src="org.apache.cocoon.generation.HTMLGenerator">
> > >          <jtidy-config>WEB-INF/jtidy.properties</jtidy-config>
> > >        </map:generator>
> > >
> > > I would like to augment this with a LM lookup, to facilitate project-
> > > specific jtidy config. As it is now, one needs to change e.g. the
> > > file encoding in the file FORREST_HOME/main/webapp/WEB-INF/
> > > jtidy.properties. I would like to have Forrest look in a couple of
> > > different places:
> > >
> > > PROJECT_HOME/src/documentation/WEB-INF/
> > > FORREST_HOME/webapp/WEB-INF/
> > >
> > > This way, it is easy for any single project to change whatever jtidy
> > > settings is needed (or provide more) without needing to change any of
> > > the Forrest code.
> > >
> > > The problem:
> > >
> > > I don't grasp how I should formulate what I want. I guess there need
> > > to be two pieces in place:
> > >
> > > #1 - replace the reference in the above sitemap snippet with a LM lookup
> > > #2 - resolve that LM lookup to one of the two locations mentioned
> > >
> > > But what does #1 look like? And where should #2 be stored and called?
> > >
> > > Any hints appreciated,
> > > Sjur
> >
> > Hi Sjur,
> > Try the locationmap protocol.  It seems to me that it should work for
> > what you want.
> >
> > e.g.
> >       <map:generator name="html"
> > src="org.apache.cocoon.generation.HTMLGenerator">
> >         <jtidy-config>lm://jtidy-config</jtidy-config>
> >       </map:generator>
> >
> > then add a locationmap entry for
> >
> > <match pattern="jtidy-config">
> > ...various locations....
> > </match>
> >
>
> AFAIR Cyriaque tried once something similar but it was not working
> because the map:generator will be read during setup and the lm is not
> available until after that.

The locationmap should be available before a generator begins its
lifecycle.  Why not?
--tim

Re: LM properties lookup for JTidy

Posted by Thorsten Scherler <th...@apache.org>.
On Tue, 2006-10-31 at 10:05 -0500, Tim Williams wrote:
> On 10/31/06, Sjur Moshagen <sj...@mac.com> wrote:
> > Hello all,
> >
> > The main sitemap at FORREST_HOME/main/webapp/sitemap.xmap contains
> > the following snippet around line 30:
> >
> >        <map:generator name="html"
> > src="org.apache.cocoon.generation.HTMLGenerator">
> >          <jtidy-config>WEB-INF/jtidy.properties</jtidy-config>
> >        </map:generator>
> >
> > I would like to augment this with a LM lookup, to facilitate project-
> > specific jtidy config. As it is now, one needs to change e.g. the
> > file encoding in the file FORREST_HOME/main/webapp/WEB-INF/
> > jtidy.properties. I would like to have Forrest look in a couple of
> > different places:
> >
> > PROJECT_HOME/src/documentation/WEB-INF/
> > FORREST_HOME/webapp/WEB-INF/
> >
> > This way, it is easy for any single project to change whatever jtidy
> > settings is needed (or provide more) without needing to change any of
> > the Forrest code.
> >
> > The problem:
> >
> > I don't grasp how I should formulate what I want. I guess there need
> > to be two pieces in place:
> >
> > #1 - replace the reference in the above sitemap snippet with a LM lookup
> > #2 - resolve that LM lookup to one of the two locations mentioned
> >
> > But what does #1 look like? And where should #2 be stored and called?
> >
> > Any hints appreciated,
> > Sjur
> 
> Hi Sjur,
> Try the locationmap protocol.  It seems to me that it should work for
> what you want.
> 
> e.g.
>       <map:generator name="html"
> src="org.apache.cocoon.generation.HTMLGenerator">
>         <jtidy-config>lm://jtidy-config</jtidy-config>
>       </map:generator>
> 
> then add a locationmap entry for
> 
> <match pattern="jtidy-config">
> ...various locations....
> </match>
> 

AFAIR Cyriaque tried once something similar but it was not working
because the map:generator will be read during setup and the lm is not
available until after that.

As I remember the use case it was the serializer that he wanted to
configure via lm. 

One solution was the new property system of cocoon (David mentioned
something).

I am not sure but maybe you could try via input modules. Like adding
jtidy-config to f.p.xml and then 
<map:generator name="html"
src="org.apache.cocoon.generation.HTMLGenerator">
  <jtidy-config>{forrest://jtidy-config}</jtidy-config>
</map:generator>


... but not sure if you are not running into the same dead end.

salu2
> --tim
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: LM properties lookup for JTidy

Posted by Tim Williams <wi...@gmail.com>.
On 10/31/06, Sjur Moshagen <sj...@mac.com> wrote:
> Hello all,
>
> The main sitemap at FORREST_HOME/main/webapp/sitemap.xmap contains
> the following snippet around line 30:
>
>        <map:generator name="html"
> src="org.apache.cocoon.generation.HTMLGenerator">
>          <jtidy-config>WEB-INF/jtidy.properties</jtidy-config>
>        </map:generator>
>
> I would like to augment this with a LM lookup, to facilitate project-
> specific jtidy config. As it is now, one needs to change e.g. the
> file encoding in the file FORREST_HOME/main/webapp/WEB-INF/
> jtidy.properties. I would like to have Forrest look in a couple of
> different places:
>
> PROJECT_HOME/src/documentation/WEB-INF/
> FORREST_HOME/webapp/WEB-INF/
>
> This way, it is easy for any single project to change whatever jtidy
> settings is needed (or provide more) without needing to change any of
> the Forrest code.
>
> The problem:
>
> I don't grasp how I should formulate what I want. I guess there need
> to be two pieces in place:
>
> #1 - replace the reference in the above sitemap snippet with a LM lookup
> #2 - resolve that LM lookup to one of the two locations mentioned
>
> But what does #1 look like? And where should #2 be stored and called?
>
> Any hints appreciated,
> Sjur

Hi Sjur,
Try the locationmap protocol.  It seems to me that it should work for
what you want.

e.g.
      <map:generator name="html"
src="org.apache.cocoon.generation.HTMLGenerator">
        <jtidy-config>lm://jtidy-config</jtidy-config>
      </map:generator>

then add a locationmap entry for

<match pattern="jtidy-config">
...various locations....
</match>

--tim