cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: Property Configuration
Date Thu, 11 Jan 2007 10:56:26 GMT
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: 1/11/07 10:56:26 AM
Updated by: Carsten Ziegeler

A new version has been created, state: publish

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 3089 bytes (previous version: 6761 bytes)
Content diff:
(6 equal lines skipped)
    without changing the files itself you can define properties to which you can
    refer to from within the configuration files (and sitemaps and your own code).
    In addition, Cocoon provides integrated support for the Spring property override
--- mechanism, which is described in more detail <a href="daisy:1259">here</a>.</p>
+++ mechanism.</p>
    
--- <p>You can define as many property files and define your own properties as you
--- 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>Cocoon uses the Cocoon Spring Configurator for these features. You can find a
+++ complete description <a href="daisy:1304">here</a>. In short, you can define
+++ various property files and have different ways of configuring these properties.
+++ You can refer to the values of a property by using the common
+++ <tt>${PROPERTY_NAME}</tt> syntax in your configuration files or sitemaps.
You
+++ can also access these values in your Java code.</p>
    
--- <p>You can refer to the values of a property by using the common
--- <tt>${PROPERTY_NAME}</tt> syntax in your configuration file or sitemap (this
--- includes spring configuration files loaded by Cocoon as well).</p>
+++ <p>In addition the Spring Configurator supports different running modes, so you
+++ can define on startup which set of properties is used. This allows you to define
+++ different properties for production, development and test, for example.</p>
    
--- <h1>Running modes</h1>
+++ <h1>Properties and Sitemaps</h1>
    
--- <p>Cocoon extends the property based configuration mechanism by "running
--- modes". You have two possibilities to define the running mode: the running mode
--- can either be set by using a system property or in the application context
--- 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
--- <tt>WEB-INF/cocoon/properties</tt> and after that from
--- <tt>WEB-INF/cocoon/properties/${RUNNING_MODE}</tt>.</p>
+++ <p class="warn">THIS DOCUMENTATION HAS TO BE UPDATED - IT DOESN'T REFLECT THE
+++ LATEST CHANGES</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 <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
--- <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 <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>
--- 
--- <h1>Properties and Sitemaps</h1>
--- 
    <p>As explained above, you can simply refer to a value of a property within a
    sitemap. In addition a sitemap can have a set of own properties which are only
    available to this sitemap (and the components defined in this sitemap) and all
(26 equal lines skipped)
    
    <p>If you need access to the defined properties within your Java code, just
    lookup the Settings bean. This bean provides access to all available properties.
--- </p>
+++ See the documentation about the Configuration API for more information.</p>
    
--- <h1>Using your own Property Provider</h1>
--- 
--- <p>If you want to store all your properties in a different storage than the file
--- system, for example in a database, you can implement your own provider
--- mechanism. Add a bean implementing the PropertyProvider interface to the root
--- application context of Spring and Cocoon will get all properties from this
--- provider after it has read the properties from the properties files.</p>
--- 
--- <h1>User defined Properties</h1>
--- 
--- <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
--- <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><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><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>
--- 
--- <p>The different property files and providers are queried in this order and the
--- files in a directory are processed in alphabetical order. The properties are
--- merged into one big set of properties. If there is more than one definition for
--- a property the last definition wins.</p>
--- 
    </body>
    </html>


Mime
View raw message