You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chris Marasti-Georg <cg...@rjlg.com> on 2005/06/16 16:20:20 UTC

Properties file

Is there a way to make cocoon read global variables from a properties
file?  I am working on a project with a server component, and eXist
database backend, and a client side suite of eclipse plugins.  With our
current setup, if one thing changes (a server port, for instance), 3
fiels have to be changed.  I'd like them to all use one properties file.
Any ideas on getting these values from a .properties file into the
sitemap?

Re: Properties file

Posted by Geert Josten <Ge...@daidalos.nl>.
>> Is there a way to make cocoon read global variables from a properties 
>> file?  I am working on a project with a server component, and eXist 
>> database backend, and a client side suite of eclipse plugins.  With 
>> our current setup, if one thing changes (a server port, for instance), 
>> 3 fiels have to be changed.  I'd like them to all use one properties 
>> file.  Any ideas on getting these values from a .properties file into 
>> the sitemap?
> 
> 
> You could do this, but you will have to write something yourself. For 
> our project I wrote a Properties component that gets configured in 
> cocoon.xconf with the desired property values. The property object can 
> then be accessed via its role name.  You could do something similar and 
> have the component be configured with the location of the property file.

Google sais there should be a PropertiesInputModule. You might be able to define a input module with 
a nice name that points to the properties file you want to access and access it with 
{nicename:someproperty} within your sitemaps...

Take a look at http://doxa.stoa.org:8080/cocoon/samples/modules/properties.html

(Cocoon 2.1.5.1 by the way)

HTH,
Geert

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


Re: Properties file

Posted by Ralph Goers <Ra...@dslextreme.com>.
Chris Marasti-Georg wrote:

> Is there a way to make cocoon read global variables from a properties 
> file?  I am working on a project with a server component, and eXist 
> database backend, and a client side suite of eclipse plugins.  With 
> our current setup, if one thing changes (a server port, for instance), 
> 3 fiels have to be changed.  I'd like them to all use one properties 
> file.  Any ideas on getting these values from a .properties file into 
> the sitemap?

You could do this, but you will have to write something yourself. For 
our project I wrote a Properties component that gets configured in 
cocoon.xconf with the desired property values. The property object can 
then be accessed via its role name.  You could do something similar and 
have the component be configured with the location of the property file.

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


Re: Properties file

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jun 16, 2005, at 12:22 PM, Mark Lundquist wrote:

> Try this...
>
> 	<map:component-configurations>
> 		<global-variables>
> 			<some-property>{foobar-properties;someProperty}</some-property>
> 			<another-property>{foobar-properties:anotherProperty}</another- 
> property>
> 		</global-variables>
> 	</map:component-configurations>
>
> ...to localize the properties interface to one place, and then let the  
> rest of your sitemap(s) use the values as regular sitemap globals  
> without having to worry about where the values came from.

Oops, d'oh!

My bad, that'll never work :-/
—ml—


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


Re: Properties file

Posted by Mark Lundquist <ml...@wrinkledog.com>.
Hi Chris,

On Jun 16, 2005, at 7:20 AM, Chris Marasti-Georg wrote:

>  Any ideas on getting these values from a .properties file into the  
> sitemap?

Yeah.  Try this...

1) Edit  WEB-INF/cocoon.xconf; find the <input-modules> section, and  
add something like this:

	<component-instance
			name="foobar-properties"
			 
class="org.apache.cocoon.components.modules.input.PropertiesFileModule"
			logger="core.modules.input"
		>
		<file src="foobar.properties" />
	</component-instance>

(note, you can have more than one instance, for different property  
files)

2) Then, in the sitemap you can use:

	{foobar-properties:someProperty}

to get the property value.

Try this...

	<map:component-configurations>
		<global-variables>
			<some-property>{foobar-properties;someProperty}</some-property>
			<another-property>{foobar-properties:anotherProperty}</another- 
property>
		</global-variables>
	</map:component-configurations>

...to localize the properties interface to one place, and then let the  
rest of your sitemap(s) use the values as regular sitemap globals  
without having to worry about where the values came from:

	{global:some-property}

Have fun,
—ml—


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