Constructor and Description |
---|
UnknownElement(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(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.
|
List<UnknownElement> |
getChildren() |
protected String |
getComponentName() |
String |
getNamespace()
Return the namespace of the XML element associated with this component.
|
protected BuildException |
getNotFoundException(String what,
String name)
Returns a very verbose exception for when a task/data type cannot
be found.
|
String |
getQName()
Return the qname of the XML element associated with this component.
|
Object |
getRealThing()
Return the configured object
|
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.
|
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(Object parent,
RuntimeConfigurable parentWrapper)
Creates child elements, creates children of the children
(recursively), and sets attributes of the child elements.
|
protected void |
handleErrorFlush(String output)
Handles error output sent to System.err by this task or its real task.
|
protected void |
handleErrorOutput(String output)
Handles error output sent to System.err by this task or its real task.
|
protected void |
handleFlush(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(String output)
Handles output sent to System.out by this task or its real task.
|
protected 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(String namespace)
Set the namespace of the XML element associated with this component.
|
void |
setQName(String qname)
Set the namespace qname of the XML element.
|
void |
setRealThing(Object realThing)
Set the configured object
|
boolean |
similar(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(String elementName)
elementName
- The name of the unknown element.
Must not be null
.public void addChild(UnknownElement child)
child
- The child element to add. Must not be null
.public void applyPreSet(UnknownElement u)
u
- an UnknownElement containing the attributes, elements and textpublic void configure(Object realObject)
realObject
- the real object this UnknownElement is representing.public UnknownElement copy(Project newProject)
newProject
- the project to create the UE in.public void execute()
public List<UnknownElement> getChildren()
protected String getComponentName()
public String getNamespace()
protected BuildException getNotFoundException(String what, 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 String getQName()
public Object getRealThing()
public String getTag()
public Task getTask()
null
if the real object is not
a task.public String getTaskName()
getTaskName
in class Task
public RuntimeConfigurable getWrapper()
getWrapper
in class Task
protected void handleChildren(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 void handleErrorFlush(String output)
handleErrorFlush
in class Task
output
- The error output to log. Should not be null
.protected void handleErrorOutput(String output)
handleErrorOutput
in class Task
output
- The error output to log. Should not be null
.protected void handleFlush(String output)
handleFlush
in class Task
output
- The output to log. Should not be null
.protected int handleInput(byte[] buffer, int offset, int length) throws 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.IOException
- if the data cannot be read.Task.handleInput(byte[], int, int)
protected void handleOutput(String output)
handleOutput
in class Task
output
- The output to log. Should not be null
.protected 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.public void maybeConfigure() throws BuildException
maybeConfigure
in class Task
BuildException
- if the configuration failspublic void setNamespace(String namespace)
namespace
- URI used in the xmlns declaration.public void setQName(String qname)
qname
- the qualified name of the elementpublic void setRealThing(Object realThing)
realThing
- the configured objectpublic boolean similar(Object obj)
obj
- the object to check against