net.sourceforge.cruisecontrol.config
Class DefaultPropertiesPlugin

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.config.DefaultPropertiesPlugin
All Implemented Interfaces:
PropertiesPlugin

public class DefaultPropertiesPlugin
extends java.lang.Object
implements PropertiesPlugin

The <property> element is used to set a property (or set of properties) within the CruiseControl configuration file. Properties may be set at the global level and/or within the scope of a project. There are three ways to set properties within CruiseControl:

  1. By supplying both the name and value attributes.
  2. By setting the file attribute with the filename of the property file to load. This property file must follow the format defined by the class java.util.Properties, with the same rules about how non-ISO8859-1 characters must be escaped.
  3. By setting the environment attribute with a prefix to use. Properties will be defined for every environment variable by prefixing the supplied name and a period to the name of the variable.

Properties in CruiseControl are not entirely immutable: whoever sets a property last will freeze it's value within the scope in which the property was set. In other words, you may define a property at the global level, then eclipse this value within the scope of a single project by redefining the property within that project. You may not, however, set a property more than once within the same scope. If you do so, only the last assignment will be used.

Just as in Ant, the value part of a property being set may contain references to other properties. These references are resolved at the time these properties are set. This also holds for properties loaded from a property file, or from the environment.

Also note that the property ${project.name} is set for you automatically and will always resolve to the name of the project currently being serviced - even outside the scope of the project definition.

Finally, note that properties bring their best when combined with plugin preconfigurations.


Constructor Summary
DefaultPropertiesPlugin()
           
 
Method Summary
 void loadProperties(java.util.Map props, boolean failIfMissing)
           
 void setEnvironment(java.lang.String environment)
          The prefix to use when retrieving environment variables.
 void setFile(java.lang.String file)
          The filename of the property file to load.
 void setName(java.lang.String name)
          The name of the property to set.
 void setToupper(java.lang.String toupper)
          Used in conjunction with environment.
 void setValue(java.lang.String value)
           
 void validate()
          Called after the configuration is read to make sure that all the mandatory parameters were specified..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPropertiesPlugin

public DefaultPropertiesPlugin()
Method Detail

setName

public void setName(java.lang.String name)
The name of the property to set.


setEnvironment

public void setEnvironment(java.lang.String environment)
The prefix to use when retrieving environment variables. Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names such as "myenv.PATH" or "myenv.MAVEN_HOME".


setFile

public void setFile(java.lang.String file)
The filename of the property file to load.


setValue

public void setValue(java.lang.String value)
Parameters:
value -

setToupper

public void setToupper(java.lang.String toupper)
Used in conjunction with environment. If set to true, all environment variable names will be converted to upper case.

Parameters:
toupper -

validate

public void validate()
              throws CruiseControlException
Called after the configuration is read to make sure that all the mandatory parameters were specified.. @throws CruiseControlException if there was a configuration error.

Throws:
CruiseControlException

loadProperties

public void loadProperties(java.util.Map props,
                           boolean failIfMissing)
                    throws CruiseControlException
Specified by:
loadProperties in interface PropertiesPlugin
Throws:
CruiseControlException