Lenya and your publications can be configured with properties files. This can be useful for setting global, deployment and publication specific parameter values like database usernames and passwords, SMTP server hostnames and the like.

Setting properties

You can set properties in two different ways:

Properties files

Properties files can be found in the following places:

Order of precedence

Properties with the same name (including prefix) and located in different properties files can override each other. The order of precedence is (lower number wins):

  1. Publication
  2. System properties
  3. Lenya local ($LENYA_HOME/

  4. Module
  5. Lenya

The publication properties files are aggregate-fallback enabled. This means that you can override properties of a template in a instance publication of that template.
Module properties are visible to all publications, regardless of the publication using a particular module or not.
System properties should probably override publication properties. At the moment they don't.

Name prefixes

Property names should use name prefixes to avoid confusion and accidental overriding. The following name prefixes are suggested:

If you want to override a property, the fully qualified property name of the target property including prefix has to be used.
System properties are normally used to override existing Lenya or module properties. Publication properties cannot be overridden by system properties at the moment.

Using properties

The properties are accessible by an input module. They can be used in sitemaps wherever the usage of an input module is appropriate. For example:

<map:pipeline type="...">
  <map:match pattern="...">
    <map:generate src="..."/>
    <map:transform src="...">
      <map:parameter name="author" value="{}"/>

Properties can also be used in the Cocoon configuration for the EmailNotifier class. The Cocoon .xconf file would look like this:

<?xml version="1.0"?>
<xconf xpath="/cocoon" remove="/cocoon/component[@role = 'org.apache.lenya.notification.Notifier']">
  <component logger="lenya.notification"

  <!-- Use the following configuration to send e-mail notifications -->
  <component logger="lenya.notification"
    <smtp host="${pubname.mail.smtp}" username="" password="" />

The patch in bug 42989 would have to be applied for this feature to work, though. Other Cocoon components do not support this feature (yet).

LenyaProperties (last edited 2009-09-20 23:27:34 by localhost)