cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Updated: Property Handling
Date Thu, 11 Jan 2007 08:52:49 GMT
A document has been updated:

Document ID: 1310
Branch: main
Language: default
Name: Property Handling (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 1/11/07 8:52:40 AM
Updated by: Carsten Ziegeler

A new version has been created, state: publish


This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 4914 bytes (previous version: 10710 bytes)
Content diff:
--- <h1>The Cocoon Spring Configurator</h1>
--- <p>The Spring Configurator is a useful component providing support in common
--- configuration issues when using the Spring framework. Although this product has
--- been developed inside the Cocoon project, it is aimed at making easier the usage
--- of Spring in each and every web application; it is not tied to the famous Cocoon
--- web application framework and can be used standalone. The impact on your code is
--- nearly zero and the Spring Configurator as only Spring itself as a dependency.
--- </p>
--- <h2>Motivation</h2>
--- <p>When using a framework like Spring there are always the same problems to
--- solve, like</p>
--- <ul>
--- <li>Where do I store my bean configurations?</li>
--- <li>How can I parameterize them dynamically?</li>
--- <li>Where do I store these extra information?</li>
--- <li>How can I handle different environments like a testing environment, a
--- development environment and a production environment?</li>
--- <li>How can I distribute not only code but also corresponding configurations?
--- </li>
--- <li>How can I distribute partial web applications?</li>
--- <li>How do I manage hierarchial web application contexts?</li>
--- </ul>
--- <p>Of course Spring is flexible enough to enable solutions to the above
--- problems, but you have to do it and implement it for your solution. And there is
--- more than one way of doing this and each and every project ends up developing
--- its own "proprietary" solution. A best practice and a standardized way of doing
--- these things would be great. And guess what, the Spring Configurator is the
--- answer to your problems. Like Maven has standardized the build process, the
--- Spring Configurator standardizes the way of dealing with various configuration
--- issues with Spring. Ok, enough motivation, let's see what the Spring
--- configurator can provide for your work.</p>
--- <h2>Requirements</h2>
--- <p>The Spring Configurator requires</p>
--- <ul>
--- <li>the Spring Framework Version 2.0.1 (or above)</li>
--- <li>JDK 1.4 (or above)</li>
--- <li>Servlet API 2.3 (or above)</li>
--- </ul>
--- <p>The Spring Configuration requires two additional jar files, the Cocoon
--- Configuration API and the Cocoon Spring Configurator, which you can either
--- download here or from a public Maven repository by adding the Spring
--- Configurator as a dependency to your project:</p>
--- <p><strong>TODO - Show dependency configuration</strong></p>
--- <h2>Configuration</h2>
--- <p>The Spring Configurator uses the Spring the
--- <a href="">extensible
--- XML authoring features</a> and therefore it can be directly used in your Spring
--- bean configurations. Usually you add the configurator to your global web
--- application context configuration (which is usually located at
--- <em>/WEB-INF/applicationContext.xml</em>). The extensible XML authoring requires
--- that you use the schema based configuration for Spring. Just add the required
--- namespace definition, a reference to the configurator XML schema to your bean
--- configuration:</p>
--- <pre>&lt;beans xmlns=""
---        xmlns:xsi=""
---        <strong>xmlns:configurator=""</strong>
---        xsi:schemaLocation="
---                            <strong>"</strong>&gt;
---     ...
--- &lt;/beans&gt;
--- </pre>
--- <p>Then you can initialize the configurator by adding the <tt>settings</tt>
--- element to your bean configuration:</p>
--- <pre>   &lt;!-- Activate Cocoon Spring Configurator --&gt;
---    &lt;configurator:settings/&gt;
--- </pre>
--- <p>And then...</p>
--- <h2>Running Modes</h2>
--- <p>The configurator provides the support of <em>running modes</em>.
A running
--- mode defines the environment the application is currently running in. For
--- example this can be during development, a test setup or production. As you will
--- see in just some paragraphs, the configurator can use different configurations
--- and settings depending on the running mode.</p>
--- <p>A running mode is just a unique text key, like <tt>dev</tt>, <tt>test</tt>
--- or <tt>prod</tt>. This key is used to determine the correct configuration
--- runtime. Although you can use any text key, it is advisable to use one of the
--- standard keys (dev, test or prod).</p>
--- <p>The running mode can be set in two ways: you can either set it in your
--- <tt>applicationContext.xml</tt> as a configuration for the <tt>settings
--- </tt>element:</p>
--- <pre>   &lt;!-- Activate Cocoon Spring Configurator --&gt;
---    &lt;configurator:settings runningMode="test"/&gt;
--- </pre>
--- <p>Or you can define the running mode by setting the system property
--- <tt>org.apache.cocoon.mode</tt> on startup of your web application, usually
--- do this by specifying <tt>-Dorg.apache.cocoon.mode=test</tt> when starting
--- application server. The system property has precedence over the value from the
--- application context. The default running mode is <tt>prod</tt>.</p>
--- <h2>Property Configurations</h2>
    <p>For using properties in your configuration files, Spring provides the
    <a href="">property
    placeholder configurer</a> which you have to configure in your application
(79 equal lines skipped)
--- <h2>Configuring Log4j</h2>
--- <p>You can use the Configurator to
--- configure <a href="">Log4j</a> through an
--- configuration file:</p>
--- <pre>  &lt;bean name="org.apache.cocoon.spring.configurator.log4j"
---         class="org.apache.cocoon.spring.configurator.log4j.Log4JConfigurator"
---         scope="singleton"&gt;
---     &lt;property name="resource" value="/WEB-INF/cocoon/log4j.xconf"/&gt;
---   &lt;/bean&gt;
--- </pre>
--- <p>The property <tt>resource</tt> should point to a valid Log4j XML
--- configuration file. You can use all properties configured through the
--- Configurator in the XML configuration and reference the actual values.</p>

View raw message