cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <>
Subject Re: more about properties in cocoon 2.2
Date Mon, 21 Aug 2006 11:48:32 GMT
Carsten Ziegeler wrote:
> Leszek Gawron schrieb:
>> Carsten Ziegeler wrote:
>>> Leszek Gawron wrote:
>>>>> Yes, I like your idea. Just one simple "include-config" and that's it.
>>>>> And the use-default-dirs can then be used to turn off including from
>>>>> default location which is on by default (If the directories do not
>>>>> exists this is not concidered an error).
>>>>> If you want I can implement this (I would not disable the possibility
>>>>> do a include and include-beans in the sitemap though).
>>>> Would be even better if you described in few words how to do it. Then I 
>>>> would do it myself and learn a lot.
>>> Sure. The whole code is in the SitemapLanguage class. Now, there is the
>>> evaluation of the property-dir attribute and the like. You just have to
>>> get all "include-config" children of the Configuration object and pass
>>> that into the method creating the settings objects. There you read all
>>> the property files.
>>> The second thing is to replace the "include-config" statements with
>>> "include" and "include-bean" elements in the Configuration object (ok,
>>> this could be solved differently but that approach works) - this is
>>> already done for the default locations.
>>> And this should be more or less everything.
>> I forgot one thing: what about the same functionality for main 
>> cocoon.xconf? From what I saw there is different code (duplication) that 
>> handles inclusions and property management in cocoon.xconf...
> I think we should not use the functionality for cocoon.xconf and just
> use it in sitemaps. The configuration for cocoon.xconf is imho working
> fine/complete.

It is not (I am writing this without testing, just showing you the steps 
to recreate my problem):

mvn archetype:create -DarchetypeArtifactId=cocoon-22-archetype-block 
-DarchetypeVersion=1.0.0-M4-SNAPSHOT -DartifactId=myblock 

cd myblock
mkdir src/main/resources/META-INF/properties/
echo "property1=value" > 

mvn install cocoon:deploy jetty:run

If locally testing a block the resources from src/ are not copied to 
target folder/

this works well for:
- COB-INF/ (linked directly via map:mount in a sitemap)
- META-INF/legacy/xconf ('include' in cocoon.xconf)
- META-INF/spring ('include-beans' in cocoon.xconf)

but it NOT working for properties as they are only read from 

That is why we need 'include-properties' to load properties from 

I have been browsing the code for the solution to include properties but 
I have found none. My problem I cannot resolve occurs for both 
cocoon.xconf and sitemap entries. When creating a new CocoonBean factory 
those steps are performed:

1. read settings from default/specified location
2. Apply settings to Configuration holding component information. AFAIU 
this means:

  <map:generators default="file">
    <map:generator logger="${my.generator.logger}" name="mygenerator" 

3. read Configuration using ConfigReader.
4. Create CocoonBeanFactory using ComponentInfo provided by ConfigReader

This procedure cannot be the same if we want to add 'include-properties' 

	<!-- properties visible: default -->
	<map:include-properties src="abc/"/>

	<!-- properties visible: default, abc -->
	<map:include src="additional.xconf"/>

	<!-- properties visible: default, abc, additional -->


ConfigReader would have to intruduce side effects of modifying Settings 
when 'include-properties' occurs.

Leszek Gawron, IT Manager                          MobileBox sp. z o.o.
+48 (61) 855 06 67                    
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

View raw message