groovy.util
Class AntBuilder

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.util.BuilderSupport
          extended by groovy.util.AntBuilder
All Implemented Interfaces:
GroovyObject

public class AntBuilder
extends BuilderSupport

Allows Ant tasks to be used with GroovyMarkup

Version:
$Revision: 9755 $
Author:
James Strachan, changes by Dierk Koenig (dk)

Field Summary
private static java.lang.Class[] ADD_TASK_PARAM_TYPES
           
private  org.apache.tools.ant.helper.ProjectHelper2.ElementHandler antElementHandler
           
private  org.apache.tools.ant.helper.AntXMLContext antXmlContext
           
private  org.apache.tools.ant.Target collectorTarget
           
private  java.lang.Object lastCompletedNode
           
private  java.util.logging.Logger log
           
private  org.apache.tools.ant.Project project
           
 
Constructor Summary
AntBuilder()
           
AntBuilder(org.apache.tools.ant.Project project)
           
AntBuilder(org.apache.tools.ant.Project project, org.apache.tools.ant.Target owningTarget)
           
AntBuilder(org.apache.tools.ant.Task parentTask)
           
 
Method Summary
protected static org.xml.sax.Attributes buildAttributes(java.util.Map attributes)
          Builds an Attributes from a Map
protected  java.lang.Object createNode(java.lang.Object tagName)
           
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
           
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
           
protected  java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
           
protected static org.apache.tools.ant.Project createProject()
           
protected  java.lang.Object doInvokeMethod(java.lang.String methodName, java.lang.Object name, java.lang.Object args)
          We don't want to return the node as created in createNode(Object, Map, Object) but the one made ready by nodeCompleted(Object, Object)
 org.apache.tools.ant.Project getAntProject()
           
 org.apache.tools.ant.Project getProject()
          # Gets the Ant project in which the tasks are executed
protected  void nodeCompleted(java.lang.Object parent, java.lang.Object node)
          Determines, when the ANT Task that is represented by the "node" should perform.
protected  void setParent(java.lang.Object parent, java.lang.Object child)
           
protected  void setText(java.lang.Object task, java.lang.String text)
           
 
Methods inherited from class groovy.util.BuilderSupport
getCurrent, getName, invokeMethod, invokeMethod, postNodeCompletion, setClosureDelegate, setCurrent
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_TASK_PARAM_TYPES

private static final java.lang.Class[] ADD_TASK_PARAM_TYPES

log

private final java.util.logging.Logger log

project

private org.apache.tools.ant.Project project

antXmlContext

private final org.apache.tools.ant.helper.AntXMLContext antXmlContext

antElementHandler

private final org.apache.tools.ant.helper.ProjectHelper2.ElementHandler antElementHandler

collectorTarget

private final org.apache.tools.ant.Target collectorTarget

lastCompletedNode

private java.lang.Object lastCompletedNode
Constructor Detail

AntBuilder

public AntBuilder()

AntBuilder

public AntBuilder(org.apache.tools.ant.Project project)

AntBuilder

public AntBuilder(org.apache.tools.ant.Project project,
                  org.apache.tools.ant.Target owningTarget)

AntBuilder

public AntBuilder(org.apache.tools.ant.Task parentTask)
Method Detail

getProject

public org.apache.tools.ant.Project getProject()
# Gets the Ant project in which the tasks are executed

Returns:
the project

createProject

protected static org.apache.tools.ant.Project createProject()
Returns:
Factory method to create new Project instances

setParent

protected void setParent(java.lang.Object parent,
                         java.lang.Object child)
Specified by:
setParent in class BuilderSupport

doInvokeMethod

protected java.lang.Object doInvokeMethod(java.lang.String methodName,
                                          java.lang.Object name,
                                          java.lang.Object args)
We don't want to return the node as created in createNode(Object, Map, Object) but the one made ready by nodeCompleted(Object, Object)

Overrides:
doInvokeMethod in class BuilderSupport
See Also:
BuilderSupport.doInvokeMethod(java.lang.String, java.lang.Object, java.lang.Object)

nodeCompleted

protected void nodeCompleted(java.lang.Object parent,
                             java.lang.Object node)
Determines, when the ANT Task that is represented by the "node" should perform. Node must be an ANT Task or no "perform" is called. If node is an ANT Task, it performs right after complete contstruction. If node is nested in a TaskContainer, calling "perform" is delegated to that TaskContainer.

Overrides:
nodeCompleted in class BuilderSupport
Parameters:
parent - note: null when node is root
node - the node that now has all its children applied

createNode

protected java.lang.Object createNode(java.lang.Object tagName)
Specified by:
createNode in class BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.lang.Object value)
Specified by:
createNode in class BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes,
                                      java.lang.Object value)
Specified by:
createNode in class BuilderSupport

buildAttributes

protected static org.xml.sax.Attributes buildAttributes(java.util.Map attributes)
Builds an Attributes from a Map

Parameters:
attributes - the attributes to wrap
Returns:
the wrapped attributes

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes)
Specified by:
createNode in class BuilderSupport

setText

protected void setText(java.lang.Object task,
                       java.lang.String text)

getAntProject

public org.apache.tools.ant.Project getAntProject()


Copyright © ${year} The Codehaus. All Rights Reserved.