cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <coc...@leverageweb.com>
Subject Re: MountTableMatcher
Date Mon, 17 Nov 2003 11:39:35 GMT
Upayavira wrote:

> Geoff Howard wrote:
>
>> Upayavira wrote:
>>
>>> Sylvain Wallez wrote:
>>>
>>>> Carsten Ziegeler wrote:
>>>>
>>>>>> The main samples sitemap now uses a mount table located at the 
>>>>>> root of the Cocoon directory. It is not present by default (and 
>>>>>> ignored silently), but a "mount-table.xml.sample" is provided 
>>>>>> that just needs to be copied to "mount-table.xml".
>>>>>
>>>>>
>>>>> Just one thing, why is this in cocoon root directory? Couldn't it
>>>>> be in the src/webapp directory (context root)?
>>>>
>>>>
>>>> Certainly not! The purpose of putting it in the root directory is 
>>>> that it is not part of the build, and so not deleted if you do a 
>>>> "build clean".
>>>>
>>>> Now maybe directly at the root is not a so good location and it 
>>>> should be placed elswhere. But this also would mean that it's less 
>>>> visible.
>>>
>>>
>>> Would it be possible to make it configurable in build.properties and 
>>> have it default to ../..?
>>>
>>> This would, to my mind, make your solution usable in a live 
>>> environment too where webapps aren't necessarily still in build/webapp.
>>>
>>> I don't know if the XPatch task can handle patches with ant 
>>> properties, but if it could...
>>
>>
>> No, XPatch doesn't handle properties expansion now.  I looked briefly 
>> at how to add support for this and didn't get it worked out.  I don't 
>> know Ant internals much at all - maybe someone more familiar would 
>> know better.
>
>
> I've just asked on ant-dev, and was told:
>
> String org.apache.tools.ant.Project.replaceProperties(String value)


Ok, I tried the other option which looked cleaner - they have a subclass 
of Reader which replaces properties on the way in.  I tried it again the 
other night and found that it throws an NPE when the task runs.  
Unfortunately for some reason the line number of the NPE isn't preserved 
in the stack trace. 

> So, from looking at the xpatch task, we would have to use this 
> replaceProperties method on each attribute and text value of each node 
> in the patch file.


Hmm, I'll look at that solution.  I was thinking of slurping the whole 
patch file into a string, running replaceProperties on it, and creating 
an InputStream from the string to pass to builder.parse().   

> We could add a 'replace-properties' top level element, which says 
> whether this should be done.
>
>> I haven't followed the specific context here but would love to see it 
>> added too.
>
>
> I'm a bit busy here, any chance you could look into it, Geoff?
>
> It would be really cool, it would mean that you can mount your site 
> without having to touch the root sitemap at all.

I can't look into it more now but can pick it up in the next few days.

Geoff


Mime
View raw message