Wrapper class that holds all the information necessary to create a task
or data type that did not exist when Ant started, or one which
has had its definition updated to use a different implementation class.
addChild
public void addChild(UnknownElement child)
Adds a child element to this element.
child
- The child element to add. Must not be null
.
applyPreSet
public void applyPreSet(UnknownElement u)
This is used then the realobject of the UE is a PreSetDefinition.
This is also used when a presetdef is used on a presetdef
The attributes, elements and text are applied to this
UE.
u
- an UnknownElement containing the attributes, elements and text
configure
public void configure(Object realObject)
Configure the given object from this UnknownElement
realObject
- the real object this UnknownElement is representing.
execute
public void execute()
Executes the real object if it's a task. If it's not a task
(e.g. a data type) then this method does nothing.
- execute in interface Task
getChildren
public List getChildren()
- the list of nested UnknownElements for this UnknownElement.
getComponentName
protected String getComponentName()
- the component name - uses ProjectHelper#genComponentName()
getNamespace
public String getNamespace()
Return the namespace of the XML element associated with this component.
- Namespace URI used in the xmlns declaration.
getNotFoundException
protected BuildException getNotFoundException(String what,
String elementName)
Returns a very verbose exception for when a task/data type cannot
be found.
what
- The kind of thing being created. For example, when
a task name could not be found, this would be
"task"
. Should not be null
.elementName
- The name of the element which could not be found.
Should not be null
.
- a detailed description of what might have caused the problem.
getQName
public String getQName()
Return the qname of the XML element associated with this component.
- namespace Qname used in the element declaration.
getRealThing
public Object getRealThing()
Return the configured object
- the real thing whatever it is
- ant 1.6
getTag
public String getTag()
Returns the name of the XML element which generated this unknown
element.
- the name of the XML element which generated this unknown
element.
getTask
public Task getTask()
Returns the task instance after it has been created and if it is a task.
- a task instance or
null
if the real object is not
a task.
getTaskName
public String getTaskName()
Returns the name to use in logging messages.
- getTaskName in interface Task
- the name to use in logging messages.
getWrapper
public RuntimeConfigurable getWrapper()
Get the RuntimeConfigurable instance for this UnknownElement, containing
the configuration information.
- getWrapper in interface Task
- the configuration info.
handleChildren
protected void handleChildren(Object parent,
RuntimeConfigurable parentWrapper)
throws BuildException
Creates child elements, creates children of the children
(recursively), and sets attributes of the child elements.
parent
- The configured object for the parent.
Must not be null
.parentWrapper
- The wrapper containing child wrappers
to be configured. Must not be null
if there are any children.
BuildException
- if the children cannot be configured.
handleErrorFlush
protected void handleErrorFlush(String output)
Handles error output sent to System.err by this task or its real task.
- handleErrorFlush in interface Task
output
- The error output to log. Should not be null
.
handleErrorOutput
protected void handleErrorOutput(String output)
Handles error output sent to System.err by this task or its real task.
- handleErrorOutput in interface Task
output
- The error output to log. Should not be null
.
handleFlush
protected void handleFlush(String output)
Handles output sent to System.out by this task or its real task.
- handleFlush in interface Task
output
- The output to log. Should not be null
.
handleOutput
protected void handleOutput(String output)
Handles output sent to System.out by this task or its real task.
- handleOutput in interface Task
output
- The output to log. Should not be null
.
makeObject
protected Object makeObject(UnknownElement ue,
RuntimeConfigurable w)
Creates a named task or data type. If the real object is a task,
it is configured up to the init() stage.
ue
- The unknown element to create the real object for.
Must not be null
.w
- Ignored in this implementation.
- the task or data type represented by the given unknown element.
makeTask
protected Task makeTask(UnknownElement ue,
RuntimeConfigurable w)
Creates a named task and configures it up to the init() stage.
ue
- The UnknownElement to create the real task for.
Must not be null
.w
- Ignored.
- the task specified by the given unknown element, or
null
if the task name is not recognised.
maybeConfigure
public void maybeConfigure()
throws BuildException
Creates the real object instance and child elements, then configures
the attributes and text of the real object. This unknown element
is then replaced with the real object in the containing target's list
of children.
- maybeConfigure in interface Task
BuildException
- if the configuration fails
setNamespace
public void setNamespace(String namespace)
Set the namespace of the XML element associated with this component.
This method is typically called by the XML processor.
If the namespace is "ant:current", the component helper
is used to get the current antlib uri.
namespace
- URI used in the xmlns declaration.
setQName
public void setQName(String qname)
Set the namespace qname of the XML element.
This method is typically called by the XML processor.
qname
- the qualified name of the element
similar
public boolean similar(Object obj)
like contents equals, but ignores project
obj
- the object to check against
- true if this unknownelement has the same contents the other