You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mansour Al Akeel <ma...@gmail.com> on 2009/05/17 22:18:55 UTC

sharing properties in blocks

Hello all:
I have this senario where I need to override properties in more than one 
of the blocks when they are used from a top level one. For example, I 
need the site navigation block to construct a navigation from one 
directory. In another block, the contents will be server from the same 
directory. In the site navigation block I have this:

<map:generate type="directory" src="${site.contents.directory}">
             <map:parameter name="depth" value="3"/>
  </map:generate>


Then in define this value in the cocoon.properties for the 
contents-block using the relative path:

site.contents.directory=contents

Now, the problem is, this directory doesn't exist in the navigation 
block. I considered using one of the InputModules varaibles that refers 
to the deployment path (not sure which one yet), but again this won't 
help as I want to be able to change this variable to an absolute path on 
the filesystem.

I am using aggregation to combine results from multiple blocks.

Is there's a clean way to achieve this?

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: sharing properties in blocks

Posted by Mansour Al Akeel <ma...@gmail.com>.
If this problem can not be resolved, it will be nice if someone can
indicate this. 



On Mon May 18,2009 10:07 pm, Mansour Al Akeel wrote:
> Ok, I found what I was looking for. I can override the properties in the 
> contents block, and they will be available to the navigation block. The 
> problem now is, I need (for testing and dev) the absolute path to the 
> current cocoon block context (ie, the absolute location of the sitemap).
> I tried using different protocols but none worked for me. I tried (in my 
> properties file) :
>
> site.root.directory=context:/
>
> but it returns the absolute path of the webapp directory and not COB-INF.
>
> Other protocols like cocoon:/ and cocoon:// gave exceptions :
>
> java.lang.StackOverflowError
>         at org.apache.regexp.RE.matchNodes(Unknown Source)
>         at org.apache.regexp.RE.matchNodes(Unknown Source)
>         at org.apache.regexp.RE.matchNodes(Unknown Source)
> ...
>
>
> Is there a way when developing with maven, to obtain the absolute path of 
> the current block context, so that I can share it with other blocks ?
>
> I know this can be taken care later on when putting everything in a war, 
> and use either context:/ or file:// but as a default value I need to set 
> this up this way.
>
> Any idea ?
>
>
> Mansour Al Akeel wrote:
>> Hello all:
>> I have this senario where I need to override properties in more than one 
>> of the blocks when they are used from a top level one. For example, I need 
>> the site navigation block to construct a navigation from one directory. In 
>> another block, the contents will be server from the same directory. In the 
>> site navigation block I have this:
>> <map:generate type="directory" src="${site.contents.directory}">
>>             <map:parameter name="depth" value="3"/>
>>  </map:generate>
>> Then in define this value in the cocoon.properties for the contents-block 
>> using the relative path:
>> site.contents.directory=contents
>> Now, the problem is, this directory doesn't exist in the navigation block. 
>> I considered using one of the InputModules varaibles that refers to the 
>> deployment path (not sure which one yet), but again this won't help as I 
>> want to be able to change this variable to an absolute path on the 
>> filesystem.
>> I am using aggregation to combine results from multiple blocks.
>> Is there's a clean way to achieve this?
>> Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: sharing properties in blocks

Posted by Mansour Al Akeel <ma...@gmail.com>.
Ok, I found what I was looking for. I can override the properties in the 
contents block, and they will be available to the navigation block. The 
problem now is, I need (for testing and dev) the absolute path to the 
current cocoon block context (ie, the absolute location of the sitemap).
I tried using different protocols but none worked for me. I tried (in my 
properties file) :

site.root.directory=context:/

but it returns the absolute path of the webapp directory and not COB-INF.

Other protocols like cocoon:/ and cocoon:// gave exceptions :

java.lang.StackOverflowError
         at org.apache.regexp.RE.matchNodes(Unknown Source)
         at org.apache.regexp.RE.matchNodes(Unknown Source)
         at org.apache.regexp.RE.matchNodes(Unknown Source)
...


Is there a way when developing with maven, to obtain the absolute path 
of the current block context, so that I can share it with other blocks ?

I know this can be taken care later on when putting everything in a war, 
and use either context:/ or file:// but as a default value I need to set 
this up this way.

Any idea ?


Mansour Al Akeel wrote:
> Hello all:
> I have this senario where I need to override properties in more than one 
> of the blocks when they are used from a top level one. For example, I 
> need the site navigation block to construct a navigation from one 
> directory. In another block, the contents will be server from the same 
> directory. In the site navigation block I have this:
> 
> <map:generate type="directory" src="${site.contents.directory}">
>             <map:parameter name="depth" value="3"/>
>  </map:generate>
> 
> 
> Then in define this value in the cocoon.properties for the 
> contents-block using the relative path:
> 
> site.contents.directory=contents
> 
> Now, the problem is, this directory doesn't exist in the navigation 
> block. I considered using one of the InputModules varaibles that refers 
> to the deployment path (not sure which one yet), but again this won't 
> help as I want to be able to change this variable to an absolute path on 
> the filesystem.
> 
> I am using aggregation to combine results from multiple blocks.
> 
> Is there's a clean way to achieve this?
> 
> Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org