A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1261.html

Document ID: 1261
Branch: main
Language: default
Name: Property Configuration (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 11/20/06 9:32:24 PM
Updated by: Reinhard Pötz

A new version has been created, state: publish

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 6761 bytes (previous version: 6568 bytes)
Content diff:
(9 equal lines skipped)
    mechanism, which is described in more detail <a 
href="daisy:1259">here</a>.</p>
    
    <p>You can define as many property files and define your own properties as 
you
--- want. Store them in the "WEB-INF/cocoon/properties" directory and Cocoon 
will
--- read all of them on startup in alphabetical order. If two files provide 
values
--- for the same property, the last definition wins. Please note that any 
changes
--- you make to the property files will not be reflected during runtime. The 
changes
--- will take effect, the next time you startup the Cocoon web application (or
--- restart the servlet context). For block specific properties have a look here
+++ want. Store them in the <tt>WEB-INF/cocoon/properties</tt> directory and 
Cocoon
+++ will read all of them on startup in alphabetical order. If two files provide
+++ values for the same property, the last definition wins. Please note that any
+++ changes you make to the property files will not be reflected during 
runtime. The
+++ changes will take effect, the next time you startup the Cocoon web 
application
+++ (or restart the servlet context). For block specific properties have a look 
here
    (FIND CORRECT LINK).</p>
    
    <p>You can refer to the values of a property by using the common
--- ${PROPERTY_NAME} syntax in your configuration file or sitemap (this includes
--- spring configuration files loaded by Cocoon as well).</p>
+++ <tt>${PROPERTY_NAME}</tt> syntax in your configuration file or sitemap (this
+++ includes spring configuration files loaded by Cocoon as well).</p>
    
    <h1>Running modes</h1>
    
(3 equal lines skipped)
    configuration. The system property has precedence over the value from the
    application context. The default running mode is "prod". The name of the 
running
    mode is used to read additional property files and configuration files on
--- startup. Cocoon reads first all property files from 
"WEB-INF/cocoon/properties"
--- and after that from "WEB-INF/cocoon/properties/${RUNNING_MODE}".</p>
+++ startup. Cocoon reads first all property files from
+++ <tt>WEB-INF/cocoon/properties</tt> and after that from
+++ <tt>WEB-INF/cocoon/properties/${RUNNING_MODE}</tt>.</p>
    
    <p>For example if you have different database connections during 
development and
    in production, just put a properties file containing the connection 
information
--- for development in the "WEB-INF/cocoon/properties/dev" directory and put 
another
--- property file with the production settings in 
"WEB-INF/cocoon/properties/prod".
--- (Of course think about security issues regarding this information - you 
might
--- not want that a developer knows the database configuration of the production
--- machine).</p>
+++ for development in the <tt>WEB-INF/cocoon/properties/dev</tt> directory and 
put
+++ another property file with the production settings in
+++ <tt>WEB-INF/cocoon/properties/prod</tt>. (Of course think about security 
issues
+++ regarding this information - you might not want that a developer knows the
+++ database configuration of the production machine).</p>
    
    <p>You can easily set the running mode by setting the system property
--- "org.apache.cocoon.mode" on startup of Cocoon, for example:<br/>
--- "-Dorg.apache.cocoon.mode=dev" or by specifying the mode in your
--- "applicationContext.xml" (see above). The system property takes precedence 
over
--- the application context configuration.</p>
+++ <tt>org.apache.cocoon.mode</tt> on startup of Cocoon, for example:<br/>
+++ <tt> -Dorg.apache.cocoon.mode=dev</tt> or by specifying the mode in your
+++ <tt>applicationContext.xml</tt> (see above). The system property takes
+++ precedence over the application context configuration.</p>
    
--- <p>TODO: Document setting the running mode in applicationContext.xml</p>
+++ <p>TODO: Document setting the running mode in 
<tt>applicationContext.xml</tt>
+++ </p>
    
    <p>Currently Cocoon supports three predefined running modes. You can choose
    between "dev", "test" and "prod" or use your own mode.</p>
(7 equal lines skipped)
    variables.</p>
    
    <p>By default each sitemap tries to read properties from within the 
directory
--- the sitemap is in, looking into these two directories: "config/properties" 
and
--- "config/properties/${RUNNING_MODE}. If you don't want to use these default
--- locations, you can specify the attribute "use-default-include" with a value 
of
--- "false" at the map:components element in the sitemap.</p>
+++ the sitemap is in, looking into these two directories:
+++ <tt>config/properties</tt> and <tt>config/properties/${RUNNING_MODE}</tt>. 
If
+++ you don't want to use these default locations, you can specify the attribute
+++ "use-default-include" with a value of "false" at the map:components element 
in
+++ the sitemap.</p>
    
    <p>You can specify your own property directory where all property files are 
read
--- from by using the element "map:include-properties" with the attribute "dir"
--- specifying the directory location inside the map:components element in the
--- sitemap.</p>
+++ from by using the element <tt>map:include-properties</tt> with the attribute
+++ <tt><tt>dir </tt></tt>specifying the directory location inside the
+++ map:components element in the sitemap.</p>
    
    <p>If you don't want that Cocoon tries to replace strings containing a 
property
--- reference in your sitemap, you can set the attribute "replace-properties" 
with
--- the value "false" at the map:components element in the sitemap.</p>
+++ reference in your sitemap, you can set the attribute 
<tt>replace-properties</tt>
+++ with the value <tt>false</tt> at the <tt>map:components</tt> element in the
+++ sitemap.</p>
    
    <p>Please note, that you can't use properties to define the values for the
    attributes on the map:components element. This means that the possible 
values
(16 equal lines skipped)
    
    <h1>User defined Properties</h1>
    
--- <p>If the user who has started the web application has a 
"settings.properties"
--- file stored in the ".cocoon" directory in his home directory, these 
properties
--- will be read and applied as well.</p>
+++ <p>If the user who has started the web application has a
+++ <tt>settings.properties</tt> file stored in the <tt>~/.cocoon</tt> 
directory in
+++ his home directory, these properties will be read and applied as well.</p>
    
    <h1>Additional Property File</h1>
    
    <p>After all property files have been read, the value of the property
--- "org.apache.cocoon.settings" is evaluated. If this property is set, the 
property
--- file defined by this value is read and applied as well. The property could 
have
--- been set by any previously read property file or by a system property.</p>
+++ <tt>org.apache.cocoon.settings</tt> is evaluated. If this property is set, 
the
+++ property file defined by this value is read and applied as well. The 
property
+++ could have been set by any previously read property file or by a system
+++ property.</p>
    
    <h1>Summarizing Property Loading on Startup</h1>
    
    <p>The whole property mechanism is performed before the Cocoon component
    container is setup and consists of the following seven steps:</p>
    
    <ol>
--- <li>WEB-INF/cocoon/properties/*.properties</li>
--- <li>WEB-INF/cocoon/properties/[RUNNING_MODE]/*.properties</li>
+++ <li><tt>WEB-INF/cocoon/properties/*.properties</tt></li>
+++ <li><tt>WEB-INF/cocoon/properties/[RUNNING_MODE]/*.properties</tt></li>
    <li>Custom PropertyProvider defined in the Spring root application 
context</li>
    <li>Properties set by the servlet environment</li>
--- <li>[USER_HOME]/.cocoon/settings.properties</li>
--- <li>Additional property file specified by "org.apache.cocoon.settings" 
property
--- </li>
+++ <li><tt>[USER_HOME]/.cocoon/settings.properties</tt></li>
+++ <li>Additional property file specified by 
<tt>org.apache.cocoon.settings</tt>
+++ property</li>
    <li>System properties</li>
    </ol>
    
(7 equal lines skipped)