Package org.apache.tools.ant.helper
Class ProjectHelper2
java.lang.Object
org.apache.tools.ant.ProjectHelper
org.apache.tools.ant.helper.ProjectHelper2
public class ProjectHelper2 extends ProjectHelper
Sax2 based project reader
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProjectHelper2.AntHandler
The common superclass for all SAX event handlers used to parse the configuration file.static class
ProjectHelper2.ElementHandler
Handler for all project elements (tasks, data types)static class
ProjectHelper2.MainHandler
The main handler - it handles the <project> tag.static class
ProjectHelper2.ProjectHandler
Handler for the top level "project" element.static class
ProjectHelper2.RootHandler
Handler for ant processing.static class
ProjectHelper2.TargetHandler
Handler for "target" and "extension-point" elements.Nested classes/interfaces inherited from class org.apache.tools.ant.ProjectHelper
ProjectHelper.OnMissingExtensionPoint
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REFID_TARGETS
Reference holding the (ordered) target VectorFields inherited from class org.apache.tools.ant.ProjectHelper
ANT_ATTRIBUTE_URI, ANT_CORE_URI, ANT_CURRENT_URI, ANT_TYPE, ANTLIB_URI, HELPER_PROPERTY, PROJECTHELPER_REFERENCE, SERVICE_ID, USE_PROJECT_NAME_AS_TARGET_PREFIX
-
Constructor Summary
Constructors Constructor Description ProjectHelper2()
-
Method Summary
Modifier and Type Method Description boolean
canParseAntlibDescriptor(Resource resource)
Whether this instance of ProjectHelper can parse an Antlib descriptor given by the URL and return its content as an UnknownElement ready to be turned into an Antlib task.protected static ProjectHelper2.AntHandler
getElementHandler()
Returns element handlerprotected static ProjectHelper2.AntHandler
getMainHandler()
Returns main handlerprotected static ProjectHelper2.AntHandler
getProjectHandler()
Returns project handlerprotected static ProjectHelper2.AntHandler
getTargetHandler()
Returns target handlervoid
parse(Project project, java.lang.Object source)
Parse a source xml input.void
parse(Project project, java.lang.Object source, ProjectHelper2.RootHandler handler)
Parses the project file, configuring the project as it goes.UnknownElement
parseAntlibDescriptor(Project containingProject, Resource resource)
Parse the given URL as an antlib descriptor and return the content as something that can be turned into an Antlib task.UnknownElement
parseUnknownElement(Project project, java.net.URL source)
Parse an unknown element from a urlprotected static void
setElementHandler(ProjectHelper2.AntHandler handler)
Sets element handlerprotected static void
setMainHandler(ProjectHelper2.AntHandler handler)
Sets main handlerprotected static void
setProjectHandler(ProjectHelper2.AntHandler handler)
Sets project handlerprotected static void
setTargetHandler(ProjectHelper2.AntHandler handler)
Sets target handlerMethods inherited from class org.apache.tools.ant.ProjectHelper
addLocationToBuildException, addText, addText, canParseBuildFile, configure, configureProject, extractNameFromComponentName, extractUriFromComponentName, genComponentName, getContextClassLoader, getCurrentPrefixSeparator, getCurrentTargetPrefix, getDefaultBuildFile, getExtensionStack, getImportStack, getProjectHelper, isInIncludeMode, nsToComponentName, parsePropertyString, replaceProperties, replaceProperties, resolveExtensionOfAttributes, setCurrentPrefixSeparator, setCurrentTargetPrefix, setInIncludeMode, storeChild
-
Field Details
-
REFID_TARGETS
public static final java.lang.String REFID_TARGETSReference holding the (ordered) target Vector- See Also:
- Constant Field Values
-
-
Constructor Details
-
ProjectHelper2
public ProjectHelper2()
-
-
Method Details
-
canParseAntlibDescriptor
Whether this instance of ProjectHelper can parse an Antlib descriptor given by the URL and return its content as an UnknownElement ready to be turned into an Antlib task.This implementation returns true.
- Overrides:
canParseAntlibDescriptor
in classProjectHelper
- Parameters:
resource
- Resource- Returns:
- boolean
- Since:
- Ant 1.8.0
-
parseAntlibDescriptor
Parse the given URL as an antlib descriptor and return the content as something that can be turned into an Antlib task.simply delegates to
parseUnknownElement
if the resource provides an URL and throws an exception otherwise.- Overrides:
parseAntlibDescriptor
in classProjectHelper
- Parameters:
containingProject
- Projectresource
- Resource- Returns:
- UnknownElement
- Since:
- Ant 1.8.0
-
parseUnknownElement
public UnknownElement parseUnknownElement(Project project, java.net.URL source) throws BuildExceptionParse an unknown element from a url- Parameters:
project
- the current projectsource
- the url containing the task- Returns:
- a configured task
- Throws:
BuildException
- if an error occurs
-
parse
Parse a source xml input.- Overrides:
parse
in classProjectHelper
- Parameters:
project
- the current projectsource
- the xml source- Throws:
BuildException
- if an error occurs
-
parse
public void parse(Project project, java.lang.Object source, ProjectHelper2.RootHandler handler) throws BuildExceptionParses the project file, configuring the project as it goes.- Parameters:
project
- the current projectsource
- the xml sourcehandler
- the root handler to use (contains the current context)- Throws:
BuildException
- if the configuration is invalid or cannot be read
-
getMainHandler
Returns main handler- Returns:
- main handler
-
setMainHandler
Sets main handler- Parameters:
handler
- new main handler
-
getProjectHandler
Returns project handler- Returns:
- project handler
-
setProjectHandler
Sets project handler- Parameters:
handler
- new project handler
-
getTargetHandler
Returns target handler- Returns:
- target handler
-
setTargetHandler
Sets target handler- Parameters:
handler
- new target handler
-
getElementHandler
Returns element handler- Returns:
- element handler
-
setElementHandler
Sets element handler- Parameters:
handler
- new element handler
-