Top Description Fields Constructors Methods
org.apache.tools.ant.helper

public Class AntXMLContext

extends Object
Class Inheritance
Imports
java.io.File, java.net.MalformedURLException, .URL, java.util.ArrayList, .HashMap, .List, .Map, .Vector, org.apache.tools.ant.BuildException, .Location, .Project, .RuntimeConfigurable, .Target, org.apache.tools.ant.util.FileUtils, org.xml.sax.Attributes, .Locator

Context information for the ant processing.

Field Summary

Modifier and TypeField and Description
private File
buildFile

The configuration file to parse.

private File
buildFileParent

Parent directory of the build file.

private URL
buildFileParentURL

Parent directory of the build file.

private URL
buildFileURL

The configuration file to parse.

private String
currentProjectName

Name of the current project

private Target
currentTarget

Current target (no need for a stack as the processing model allows only one level of target)

private Map<String, Target>
currentTargets

Keeps track of targets in files

private boolean
ignoreProjectTag

Indicates whether the project tag attributes are to be ignored when processing a particular build file.

private Target
implicitTarget

Target that all other targets will depend upon implicitly.

private Locator
locator

Locator for the configuration file parser.

private Map<String, List<String>>
prefixMapping

Keeps track of prefix -> uri mapping during parsing

private Project
project

The project to configure.

private Vector<Target>
targetVector

Vector with all the targets, in the order they are defined.

private Vector<RuntimeConfigurable>
wStack

The stack of RuntimeConfigurable2 wrapping the objects.

Constructor Summary

AccessConstructor and Description
public
AntXMLContext(Project
the project to which this antxml context belongs to
project
)

constructor

Method Summary

Modifier and TypeMethod and Description
public void
addTarget(Target
target to add
target
)

add a new target

public void
configureId(Object
the current element
element
,
Attributes
attributes of the current element
attr
)

Scans an attribute list for the id attribute and stores a reference to the target object in the project if an id is found.

public RuntimeConfigurable

Returns:

runtime configurable wrapper
currentWrapper
()

get the current runtime configurable wrapper can return null

public void
endPrefixMapping(String
the namespace prefix
prefix
)

End of prefix to uri mapping.

public File

Returns:

the build file to which the XML context belongs
getBuildFile
()

find out the build file

public File

Returns:

the parent build file of this build file
getBuildFileParent
()

find out the parent build file of this build file

public URL

Returns:

the parent build file of this build file
getBuildFileParentURL
()

find out the parent build file of this build file

public URL

Returns:

the build file to which the xml context belongs
getBuildFileURL
()

find out the build file

public String

Returns:

current project name
getCurrentProjectName
()

find out the current project name

public Target

Returns:

current target
getCurrentTarget
()

get the current target

public Map<String, Target>

Returns:

the current targets.
getCurrentTargets
()

Get the targets in the current source file.

public Target

Returns:

implicit target
getImplicitTarget
()

get the implicit target

public Locator

Returns:

locator
getLocator
()

access the locator

public String

Returns:

the uri for this prefix, null if not present
getPrefixMapping
(String
the prefix to map
prefix
)

prefix to namespace uri mapping

public Project

Returns:

project
getProject
()

find out the project to which this antxml context belongs

public Vector<Target>

Returns:

vector of targets
getTargets
()

access the vector of targets

public Vector<RuntimeConfigurable>

Returns:

the stack of wrappers
getWrapperStack
()

access the stack of wrappers

public boolean

Returns:

whether the project tag is being ignored
isIgnoringProjectTag
()

tells whether the project tag is being ignored

public RuntimeConfigurable

Returns:

runtime configurable wrapper of the parent project
parentWrapper
()

get the runtime configurable wrapper of the parent project can return null

public void
popWrapper()

remove a runtime configurable wrapper from the stack

public void
pushWrapper(RuntimeConfigurable
runtime configurable wrapper
wrapper
)

add a runtime configurable wrapper to the internal stack

public void
setBuildFile(File
ant build file
buildFile
)

sets the build file to which the XML context belongs

public void
setBuildFile(URL
Ant build file
buildFile
)

sets the build file to which the XML context belongs

public void
setCurrentProjectName(String
name of the current project
name
)

set the name of the current project

public void
setCurrentTarget(Target
current target
target
)

sets the current target

public void
setCurrentTargets(Map<String, Target>
a map of targets.
currentTargets
)

Set the map of the targets in the current source file.

public void
setIgnoreProjectTag(boolean
to ignore the project tag
flag
)

sets the flag to ignore the project tag

public void
setImplicitTarget(Target
the implicit target
target
)

sets the implicit target

public void
setLocator(Locator
locator
locator
)

sets the locator

public void
startPrefixMapping(String
a namespace prefix
prefix
,
String
a namespace uri
uri
)

Called during parsing, stores the prefix to uri mapping.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

buildFileback to summary
private File buildFile

The configuration file to parse.

buildFileParentback to summary
private File buildFileParent

Parent directory of the build file. Used for resolving entities and setting the project's base directory.

buildFileParentURLback to summary
private URL buildFileParentURL

Parent directory of the build file. Used for resolving entities and setting the project's base directory.

buildFileURLback to summary
private URL buildFileURL

The configuration file to parse.

currentProjectNameback to summary
private String currentProjectName

Name of the current project

currentTargetback to summary
private Target currentTarget

Current target (no need for a stack as the processing model allows only one level of target)

currentTargetsback to summary
private Map<String, Target> currentTargets

Keeps track of targets in files

ignoreProjectTagback to summary
private boolean ignoreProjectTag

Indicates whether the project tag attributes are to be ignored when processing a particular build file.

implicitTargetback to summary
private Target implicitTarget

Target that all other targets will depend upon implicitly.

This holds all tasks and data type definitions that have been placed outside of targets.

locatorback to summary
private Locator locator

Locator for the configuration file parser. Used for giving locations of errors etc.

prefixMappingback to summary
private Map<String, List<String>> prefixMapping

Keeps track of prefix -> uri mapping during parsing

projectback to summary
private Project project

The project to configure.

targetVectorback to summary
private Vector<Target> targetVector

Vector with all the targets, in the order they are defined. Project maintains a Hashtable, which is not ordered. This will allow description to know the original order.

wStackback to summary
private Vector<RuntimeConfigurable> wStack

The stack of RuntimeConfigurable2 wrapping the objects.

Constructor Detail

AntXMLContextback to summary
public AntXMLContext(Project project)

constructor

Parameters
project:Project

the project to which this antxml context belongs to

Method Detail

addTargetback to summary
public void addTarget(Target target)

add a new target

Parameters
target:Target

target to add

configureIdback to summary
public void configureId(Object element, Attributes attr)

Scans an attribute list for the id 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:Object

the current element

attr:Attributes

attributes of the current element

currentWrapperback to summary
public RuntimeConfigurable currentWrapper()

get the current runtime configurable wrapper can return null

Returns:RuntimeConfigurable

runtime configurable wrapper

endPrefixMappingback to summary
public void endPrefixMapping(String prefix)

End of prefix to uri mapping.

Parameters
prefix:String

the namespace prefix

getBuildFileback to summary
public File getBuildFile()

find out the build file

Returns:File

the build file to which the XML context belongs

getBuildFileParentback to summary
public File getBuildFileParent()

find out the parent build file of this build file

Returns:File

the parent build file of this build file

getBuildFileParentURLback to summary
public URL getBuildFileParentURL()

find out the parent build file of this build file

Returns:URL

the parent build file of this build file

Since
Ant 1.8.0
getBuildFileURLback to summary
public URL getBuildFileURL()

find out the build file

Returns:URL

the build file to which the xml context belongs

Since
Ant 1.8.0
getCurrentProjectNameback to summary
public String getCurrentProjectName()

find out the current project name

Returns:String

current project name

getCurrentTargetback to summary
public Target getCurrentTarget()

get the current target

Returns:Target

current target

getCurrentTargetsback to summary
public Map<String, Target> getCurrentTargets()

Get the targets in the current source file.

Returns:Map<String, Target>

the current targets.

getImplicitTargetback to summary
public Target getImplicitTarget()

get the implicit target

Returns:Target

implicit target

getLocatorback to summary
public Locator getLocator()

access the locator

Returns:Locator

locator

getPrefixMappingback to summary
public String getPrefixMapping(String prefix)

prefix to namespace uri mapping

Parameters
prefix:String

the prefix to map

Returns:String

the uri for this prefix, null if not present

getProjectback to summary
public Project getProject()

find out the project to which this antxml context belongs

Returns:Project

project

getTargetsback to summary
public Vector<Target> getTargets()

access the vector of targets

Returns:Vector<Target>

vector of targets

getWrapperStackback to summary
public Vector<RuntimeConfigurable> getWrapperStack()

access the stack of wrappers

Returns:Vector<RuntimeConfigurable>

the stack of wrappers

isIgnoringProjectTagback to summary
public boolean isIgnoringProjectTag()

tells whether the project tag is being ignored

Returns:boolean

whether the project tag is being ignored

parentWrapperback to summary
public RuntimeConfigurable parentWrapper()

get the runtime configurable wrapper of the parent project can return null

Returns:RuntimeConfigurable

runtime configurable wrapper of the parent project

popWrapperback to summary
public void popWrapper()

remove a runtime configurable wrapper from the stack

pushWrapperback to summary
public void pushWrapper(RuntimeConfigurable wrapper)

add a runtime configurable wrapper to the internal stack

Parameters
wrapper:RuntimeConfigurable

runtime configurable wrapper

setBuildFileback to summary
public void setBuildFile(File buildFile)

sets the build file to which the XML context belongs

Parameters
buildFile:File

ant build file

setBuildFileback to summary
public void setBuildFile(URL buildFile) throws MalformedURLException

sets the build file to which the XML context belongs

Parameters
buildFile:URL

Ant build file

Exceptions
MalformedURLException:
if parent URL cannot be constructed
Since
Ant 1.8.0
setCurrentProjectNameback to summary
public void setCurrentProjectName(String name)

set the name of the current project

Parameters
name:String

name of the current project

setCurrentTargetback to summary
public void setCurrentTarget(Target target)

sets the current target

Parameters
target:Target

current target

setCurrentTargetsback to summary
public void setCurrentTargets(Map<String, Target> currentTargets)

Set the map of the targets in the current source file.

Parameters
currentTargets:Map<String, Target>

a map of targets.

setIgnoreProjectTagback to summary
public void setIgnoreProjectTag(boolean flag)

sets the flag to ignore the project tag

Parameters
flag:boolean

to ignore the project tag

setImplicitTargetback to summary
public void setImplicitTarget(Target target)

sets the implicit target

Parameters
target:Target

the implicit target

setLocatorback to summary
public void setLocator(Locator locator)

sets the locator

Parameters
locator:Locator

locator

startPrefixMappingback to summary
public void startPrefixMapping(String prefix, String uri)

Called during parsing, stores the prefix to uri mapping.

Parameters
prefix:String

a namespace prefix

uri:String

a namespace uri