net.sourceforge.cruisecontrol
Class ProjectXMLHelper

java.lang.Object
  extended by net.sourceforge.cruisecontrol.ProjectXMLHelper
All Implemented Interfaces:
ProjectHelper

public class ProjectXMLHelper
extends java.lang.Object
implements ProjectHelper

Instantiates a project from a JDOM Element. Supports the use of Ant-like patterns in attribute values that look like this: ${propertyname}


Constructor Summary
ProjectXMLHelper()
           
ProjectXMLHelper(java.util.Map projectProperties, PluginRegistry projectPlugins)
           
ProjectXMLHelper(java.util.Map projectProperties, PluginRegistry projectPlugins, CruiseControlController controller)
           
 
Method Summary
 java.lang.Object configurePlugin(org.jdom.Element pluginElement, boolean skipChildElements)
          TODO: also check that instantiated class implements/extends correct interface/class
static void parsePropertiesInElement(org.jdom.Element element, java.util.Map props, boolean failIfMissing)
           
static java.lang.String parsePropertiesInString(java.util.Map props, java.lang.String string, boolean failIfMissing)
          Parses a string by replacing all occurrences of a property macro with the resolved value of the property.
static DefaultPropertiesPlugin registerProperty(java.util.Map props, org.jdom.Element propertyElement, boolean failIfMissing)
          Registers one or more properties as defined in a property element.
static void setProperty(java.util.Map props, java.lang.String name, java.lang.String parsedValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectXMLHelper

public ProjectXMLHelper()

ProjectXMLHelper

public ProjectXMLHelper(java.util.Map projectProperties,
                        PluginRegistry projectPlugins)

ProjectXMLHelper

public ProjectXMLHelper(java.util.Map projectProperties,
                        PluginRegistry projectPlugins,
                        CruiseControlController controller)
Method Detail

configurePlugin

public java.lang.Object configurePlugin(org.jdom.Element pluginElement,
                                        boolean skipChildElements)
                                 throws CruiseControlException
TODO: also check that instantiated class implements/extends correct interface/class

Specified by:
configurePlugin in interface ProjectHelper
Throws:
CruiseControlException

registerProperty

public static DefaultPropertiesPlugin registerProperty(java.util.Map props,
                                                       org.jdom.Element propertyElement,
                                                       boolean failIfMissing)
                                                throws CruiseControlException
Registers one or more properties as defined in a property element.

Parameters:
propertyElement - The element from which we will register properties
Throws:
CruiseControlException

parsePropertiesInString

public static java.lang.String parsePropertiesInString(java.util.Map props,
                                                       java.lang.String string,
                                                       boolean failIfMissing)
                                                throws CruiseControlException
Parses a string by replacing all occurrences of a property macro with the resolved value of the property. Nested macros are allowed - the inner most macro will be resolved first, moving out from there.

Parameters:
string - The string to be parsed
Returns:
The parsed string
Throws:
CruiseControlException - if a property cannot be resolved

parsePropertiesInElement

public static void parsePropertiesInElement(org.jdom.Element element,
                                            java.util.Map props,
                                            boolean failIfMissing)
                                     throws CruiseControlException
Throws:
CruiseControlException

setProperty

public static void setProperty(java.util.Map props,
                               java.lang.String name,
                               java.lang.String parsedValue)