public class UnknownElement extends Task
description, location, project
Constructor and Description |
---|
UnknownElement(java.lang.String elementName)
Creates an UnknownElement for the given element name.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(UnknownElement child)
Adds a child element to this element.
|
void |
applyPreSet(UnknownElement u)
This is used then the realobject of the UE is a PreSetDefinition.
|
void |
configure(java.lang.Object realObject)
Configure the given object from this UnknownElement
|
UnknownElement |
copy(Project newProject)
Make a copy of the unknown element and set it in the new project.
|
void |
execute()
Executes the real object if it's a task.
|
java.util.List |
getChildren() |
protected java.lang.String |
getComponentName() |
java.lang.String |
getNamespace()
Return the namespace of the XML element associated with this component.
|
protected BuildException |
getNotFoundException(java.lang.String what,
java.lang.String name)
Returns a very verbose exception for when a task/data type cannot
be found.
|
java.lang.String |
getQName()
Return the qname of the XML element associated with this component.
|
java.lang.Object |
getRealThing()
Return the configured object
|
java.lang.String |
getTag()
Returns the name of the XML element which generated this unknown
element.
|
Task |
getTask()
Returns the task instance after it has been created and if it is a task.
|
java.lang.String |
getTaskName()
Returns the name to use in logging messages.
|
RuntimeConfigurable |
getWrapper()
Get the RuntimeConfigurable instance for this UnknownElement, containing
the configuration information.
|
protected void |
handleChildren(java.lang.Object parent,
RuntimeConfigurable parentWrapper)
Creates child elements, creates children of the children
(recursively), and sets attributes of the child elements.
|
protected void |
handleErrorFlush(java.lang.String output)
Handles error output sent to System.err by this task or its real task.
|
protected void |
handleErrorOutput(java.lang.String output)
Handles error output sent to System.err by this task or its real task.
|
protected void |
handleFlush(java.lang.String output)
Handles output sent to System.out by this task or its real task.
|
protected int |
handleInput(byte[] buffer,
int offset,
int length)
Delegate to realThing if present and if it as task.
|
protected void |
handleOutput(java.lang.String output)
Handles output sent to System.out by this task or its real task.
|
protected java.lang.Object |
makeObject(UnknownElement ue,
RuntimeConfigurable w)
Creates a named task or data type.
|
protected Task |
makeTask(UnknownElement ue,
RuntimeConfigurable w)
Creates a named task and configures it up to the init() stage.
|
void |
maybeConfigure()
Creates the real object instance and child elements, then configures
the attributes and text of the real object.
|
void |
setNamespace(java.lang.String namespace)
Set the namespace of the XML element associated with this component.
|
void |
setQName(java.lang.String qname)
Set the namespace qname of the XML element.
|
void |
setRealThing(java.lang.Object realThing)
Set the configured object
|
boolean |
similar(java.lang.Object obj)
like contents equals, but ignores project
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskType, init, isInvalid, log, log, log, log, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public UnknownElement(java.lang.String elementName)
elementName
- The name of the unknown element.
Must not be null
.public java.util.List getChildren()
public java.lang.String getTag()
public java.lang.String getNamespace()
public void setNamespace(java.lang.String namespace)
namespace
- URI used in the xmlns declaration.public java.lang.String getQName()
public void setQName(java.lang.String qname)
qname
- the qualified name of the elementpublic RuntimeConfigurable getWrapper()
getWrapper
in class Task
public void maybeConfigure() throws BuildException
maybeConfigure
in class Task
BuildException
- if the configuration failspublic void configure(java.lang.Object realObject)
realObject
- the real object this UnknownElement is representing.protected void handleOutput(java.lang.String output)
handleOutput
in class Task
output
- The output to log. Should not be null
.protected int handleInput(byte[] buffer, int offset, int length) throws java.io.IOException
handleInput
in class Task
buffer
- the buffer into which data is to be read.offset
- the offset into the buffer at which data is stored.length
- the amount of data to read.java.io.IOException
- if the data cannot be read.Task.handleInput(byte[], int, int)
protected void handleFlush(java.lang.String output)
handleFlush
in class Task
output
- The output to log. Should not be null
.protected void handleErrorOutput(java.lang.String output)
handleErrorOutput
in class Task
output
- The error output to log. Should not be null
.protected void handleErrorFlush(java.lang.String output)
handleErrorFlush
in class Task
output
- The error output to log. Should not be null
.public void execute()
public void addChild(UnknownElement child)
child
- The child element to add. Must not be null
.protected void handleChildren(java.lang.Object parent, RuntimeConfigurable parentWrapper) throws BuildException
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.protected java.lang.String getComponentName()
public void applyPreSet(UnknownElement u)
u
- an UnknownElement containing the attributes, elements and textprotected java.lang.Object makeObject(UnknownElement ue, RuntimeConfigurable w)
ue
- The unknown element to create the real object for.
Must not be null
.w
- Ignored in this implementation.protected Task makeTask(UnknownElement ue, RuntimeConfigurable w)
ue
- The UnknownElement to create the real task for.
Must not be null
.w
- Ignored.null
if the task name is not recognised.protected BuildException getNotFoundException(java.lang.String what, java.lang.String name)
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
.name
- The name of the element which could not be found.
Should not be null
.public java.lang.String getTaskName()
getTaskName
in class Task
public Task getTask()
null
if the real object is not
a task.public java.lang.Object getRealThing()
public void setRealThing(java.lang.Object realThing)
realThing
- the configured objectpublic boolean similar(java.lang.Object obj)
obj
- the object to check againstpublic UnknownElement copy(Project newProject)
newProject
- the project to create the UE in.