Package org.apache.tools.ant
Class UnknownElement
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.UnknownElement
- All Implemented Interfaces:
- Cloneable
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.
- 
Field SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructorsConstructorDescriptionUnknownElement(String elementName) Creates an UnknownElement for the given element name.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddChild(UnknownElement child) Adds a child element to this element.voidThis is used then the realobject of the UE is a PreSetDefinition.voidConfigure the given object from this UnknownElementMake a copy of the unknown element and set it in the new project.voidexecute()Executes the real object if it's a task.protected StringReturn the namespace of the XML element associated with this component.protected BuildExceptiongetNotFoundException(String what, String name) Returns a very verbose exception for when a task/data type cannot be found.getQName()Return the qname of the XML element associated with this component.Return the configured objectgetTag()Returns the name of the XML element which generated this unknown element.getTask()Returns the task instance after it has been created and if it is a task.Returns the name to use in logging messages.Get the RuntimeConfigurable instance for this UnknownElement, containing the configuration information.protected voidhandleChildren(Object parent, RuntimeConfigurable parentWrapper) Creates child elements, creates children of the children (recursively), and sets attributes of the child elements.protected voidhandleErrorFlush(String output) Handles error output sent to System.err by this task or its real task.protected voidhandleErrorOutput(String output) Handles error output sent to System.err by this task or its real task.protected voidhandleFlush(String output) Handles output sent to System.out by this task or its real task.protected inthandleInput(byte[] buffer, int offset, int length) Delegate to realThing if present and if it as task.protected voidhandleOutput(String output) Handles output sent to System.out by this task or its real task.protected ObjectCreates a named task or data type.protected TaskCreates a named task and configures it up to the init() stage.voidCreates the real object instance and child elements, then configures the attributes and text of the real object.voidsetNamespace(String namespace) Set the namespace of the XML element associated with this component.voidSet the namespace qname of the XML element.voidsetRealThing(Object realThing) Set the configured objectbooleanlike contents equals, but ignores projectMethods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskType, init, isInvalid, log, log, log, log, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
- 
Constructor Details- 
UnknownElementCreates an UnknownElement for the given element name.- Parameters:
- elementName- The name of the unknown element. Must not be- null.
 
 
- 
- 
Method Details- 
getChildren- Returns:
- the list of nested UnknownElements for this UnknownElement.
 
- 
getTagReturns the name of the XML element which generated this unknown element.- Returns:
- the name of the XML element which generated this unknown element.
 
- 
getNamespaceReturn the namespace of the XML element associated with this component.- Returns:
- Namespace URI used in the xmlns declaration.
 
- 
setNamespaceSet 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.- Parameters:
- namespace- URI used in the xmlns declaration.
 
- 
getQNameReturn the qname of the XML element associated with this component.- Returns:
- namespace Qname used in the element declaration.
 
- 
setQNameSet the namespace qname of the XML element. This method is typically called by the XML processor.- Parameters:
- qname- the qualified name of the element
 
- 
getWrapperGet the RuntimeConfigurable instance for this UnknownElement, containing the configuration information.- Overrides:
- getWrapperin class- Task
- Returns:
- the configuration info.
 
- 
maybeConfigureCreates 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.- Overrides:
- maybeConfigurein class- Task
- Throws:
- BuildException- if the configuration fails
 
- 
configureConfigure the given object from this UnknownElement- Parameters:
- realObject- the real object this UnknownElement is representing.
 
- 
handleOutputHandles output sent to System.out by this task or its real task.- Overrides:
- handleOutputin class- Task
- Parameters:
- output- The output to log. Should not be- null.
 
- 
handleInputDelegate to realThing if present and if it as task.- Overrides:
- handleInputin class- Task
- Parameters:
- 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.
- Returns:
- the number of bytes read.
- Throws:
- IOException- if the data cannot be read.
- Since:
- Ant 1.6
- See Also:
 
- 
handleFlushHandles output sent to System.out by this task or its real task.- Overrides:
- handleFlushin class- Task
- Parameters:
- output- The output to log. Should not be- null.
 
- 
handleErrorOutputHandles error output sent to System.err by this task or its real task.- Overrides:
- handleErrorOutputin class- Task
- Parameters:
- output- The error output to log. Should not be- null.
 
- 
handleErrorFlushHandles error output sent to System.err by this task or its real task.- Overrides:
- handleErrorFlushin class- Task
- Parameters:
- output- The error output to log. Should not be- null.
 
- 
executepublic 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.
- 
addChildAdds a child element to this element.- Parameters:
- child- The child element to add. Must not be- null.
 
- 
handleChildrenprotected void handleChildren(Object parent, RuntimeConfigurable parentWrapper) throws BuildException Creates child elements, creates children of the children (recursively), and sets attributes of the child elements.- Parameters:
- parent- The configured object for the parent. Must not be- null.
- parentWrapper- The wrapper containing child wrappers to be configured. Must not be- nullif there are any children.
- Throws:
- BuildException- if the children cannot be configured.
 
- 
getComponentName- Returns:
- the component name - uses ProjectHelper#genComponentName()
 
- 
applyPreSetThis 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.- Parameters:
- u- an UnknownElement containing the attributes, elements and text
 
- 
makeObjectCreates a named task or data type. If the real object is a task, it is configured up to the init() stage.- Parameters:
- ue- The unknown element to create the real object for. Must not be- null.
- w- Ignored in this implementation.
- Returns:
- the task or data type represented by the given unknown element.
 
- 
makeTaskCreates a named task and configures it up to the init() stage.- Parameters:
- ue- The UnknownElement to create the real task for. Must not be- null.
- w- Ignored.
- Returns:
- the task specified by the given unknown element, or
         nullif the task name is not recognised.
 
- 
getNotFoundExceptionReturns a very verbose exception for when a task/data type cannot be found.- Parameters:
- 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.
- Returns:
- a detailed description of what might have caused the problem.
 
- 
getTaskNameReturns the name to use in logging messages.- Overrides:
- getTaskNamein class- Task
- Returns:
- the name to use in logging messages.
 
- 
getTaskReturns the task instance after it has been created and if it is a task.- Returns:
- a task instance or nullif the real object is not a task.
 
- 
getRealThingReturn the configured object- Returns:
- the real thing whatever it is
- Since:
- ant 1.6
 
- 
setRealThingSet the configured object- Parameters:
- realThing- the configured object
- Since:
- ant 1.7
 
- 
similarlike contents equals, but ignores project- Parameters:
- obj- the object to check against
- Returns:
- true if this UnknownElement has the same contents the other
 
- 
copyMake a copy of the unknown element and set it in the new project.- Parameters:
- newProject- the project to create the UE in.
- Returns:
- the copied UE.
 
 
-