Package org.apache.tools.ant.helper
Class AntXMLContext
java.lang.Object
org.apache.tools.ant.helper.AntXMLContext
public class AntXMLContext
extends java.lang.Object
Context information for the ant processing.
-
Constructor Summary
Constructors Constructor Description AntXMLContext(Project project)
constructor -
Method Summary
Modifier and Type Method Description void
addTarget(Target target)
add a new targetvoid
configureId(java.lang.Object element, org.xml.sax.Attributes attr)
Scans an attribute list for theid
attribute and stores a reference to the target object in the project if an id is found.RuntimeConfigurable
currentWrapper()
get the current runtime configurable wrapper can return nullvoid
endPrefixMapping(java.lang.String prefix)
End of prefix to uri mapping.java.io.File
getBuildFile()
find out the build filejava.io.File
getBuildFileParent()
find out the parent build file of this build filejava.net.URL
getBuildFileParentURL()
find out the parent build file of this build filejava.net.URL
getBuildFileURL()
find out the build filejava.lang.String
getCurrentProjectName()
find out the current project nameTarget
getCurrentTarget()
get the current targetjava.util.Map<java.lang.String,Target>
getCurrentTargets()
Get the targets in the current source file.Target
getImplicitTarget()
get the implicit targetorg.xml.sax.Locator
getLocator()
access the locatorjava.lang.String
getPrefixMapping(java.lang.String prefix)
prefix to namespace uri mappingProject
getProject()
find out the project to which this antxml context belongsjava.util.Vector<Target>
getTargets()
access the vector of targetsjava.util.Vector<RuntimeConfigurable>
getWrapperStack()
access the stack of wrappersboolean
isIgnoringProjectTag()
tells whether the project tag is being ignoredRuntimeConfigurable
parentWrapper()
get the runtime configurable wrapper of the parent project can return nullvoid
popWrapper()
remove a runtime configurable wrapper from the stackvoid
pushWrapper(RuntimeConfigurable wrapper)
add a runtime configurable wrapper to the internal stackvoid
setBuildFile(java.io.File buildFile)
sets the build file to which the XML context belongsvoid
setBuildFile(java.net.URL buildFile)
sets the build file to which the XML context belongsvoid
setCurrentProjectName(java.lang.String name)
set the name of the current projectvoid
setCurrentTarget(Target target)
sets the current targetvoid
setCurrentTargets(java.util.Map<java.lang.String,Target> currentTargets)
Set the map of the targets in the current source file.void
setIgnoreProjectTag(boolean flag)
sets the flag to ignore the project tagvoid
setImplicitTarget(Target target)
sets the implicit targetvoid
setLocator(org.xml.sax.Locator locator)
sets the locatorvoid
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
Called during parsing, stores the prefix to uri mapping.
-
Constructor Details
-
AntXMLContext
constructor- Parameters:
project
- the project to which this antxml context belongs to
-
-
Method Details
-
setBuildFile
public void setBuildFile(java.io.File buildFile)sets the build file to which the XML context belongs- Parameters:
buildFile
- ant build file
-
setBuildFile
public void setBuildFile(java.net.URL buildFile) throws java.net.MalformedURLExceptionsets the build file to which the XML context belongs- Parameters:
buildFile
- Ant build file- Throws:
java.net.MalformedURLException
- if parent URL cannot be constructed- Since:
- Ant 1.8.0
-
getBuildFile
public java.io.File getBuildFile()find out the build file- Returns:
- the build file to which the XML context belongs
-
getBuildFileParent
public java.io.File getBuildFileParent()find out the parent build file of this build file- Returns:
- the parent build file of this build file
-
getBuildFileURL
public java.net.URL getBuildFileURL()find out the build file- Returns:
- the build file to which the xml context belongs
- Since:
- Ant 1.8.0
-
getBuildFileParentURL
public java.net.URL getBuildFileParentURL()find out the parent build file of this build file- Returns:
- the parent build file of this build file
- Since:
- Ant 1.8.0
-
getProject
find out the project to which this antxml context belongs- Returns:
- project
-
getCurrentProjectName
public java.lang.String getCurrentProjectName()find out the current project name- Returns:
- current project name
-
setCurrentProjectName
public void setCurrentProjectName(java.lang.String name)set the name of the current project- Parameters:
name
- name of the current project
-
currentWrapper
get the current runtime configurable wrapper can return null- Returns:
- runtime configurable wrapper
-
parentWrapper
get the runtime configurable wrapper of the parent project can return null- Returns:
- runtime configurable wrapper of the parent project
-
pushWrapper
add a runtime configurable wrapper to the internal stack- Parameters:
wrapper
- runtime configurable wrapper
-
popWrapper
public void popWrapper()remove a runtime configurable wrapper from the stack -
getWrapperStack
access the stack of wrappers- Returns:
- the stack of wrappers
-
addTarget
add a new target- Parameters:
target
- target to add
-
getCurrentTarget
get the current target- Returns:
- current target
-
getImplicitTarget
get the implicit target- Returns:
- implicit target
-
setCurrentTarget
sets the current target- Parameters:
target
- current target
-
setImplicitTarget
sets the implicit target- Parameters:
target
- the implicit target
-
getTargets
access the vector of targets- Returns:
- vector of targets
-
configureId
public void configureId(java.lang.Object element, org.xml.sax.Attributes attr)Scans an attribute list for theid
attribute and stores a reference to the target object in the project if an id is found.This method was moved out of the configure method to allow it to be executed at parse time.
- Parameters:
element
- the current elementattr
- attributes of the current element
-
getLocator
public org.xml.sax.Locator getLocator()access the locator- Returns:
- locator
-
setLocator
public void setLocator(org.xml.sax.Locator locator)sets the locator- Parameters:
locator
- locator
-
isIgnoringProjectTag
public boolean isIgnoringProjectTag()tells whether the project tag is being ignored- Returns:
- whether the project tag is being ignored
-
setIgnoreProjectTag
public void setIgnoreProjectTag(boolean flag)sets the flag to ignore the project tag- Parameters:
flag
- to ignore the project tag
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)Called during parsing, stores the prefix to uri mapping.- Parameters:
prefix
- a namespace prefixuri
- a namespace uri
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix)End of prefix to uri mapping.- Parameters:
prefix
- the namespace prefix
-
getPrefixMapping
public java.lang.String getPrefixMapping(java.lang.String prefix)prefix to namespace uri mapping- Parameters:
prefix
- the prefix to map- Returns:
- the uri for this prefix, null if not present
-
getCurrentTargets
Get the targets in the current source file.- Returns:
- the current targets.
-
setCurrentTargets
Set the map of the targets in the current source file.- Parameters:
currentTargets
- a map of targets.
-