Class ProjectHelper2
java.lang.Object
org.apache.tools.ant.ProjectHelper
org.apache.tools.ant.helper.ProjectHelper2
Sax2 based project reader
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe common superclass for all SAX event handlers used to parse the configuration file.static classHandler for all project elements (tasks, data types)static classThe main handler - it handles the <project> tag.static classHandler for the top level "project" element.static classHandler for ant processing.static classHandler for "target" and "extension-point" elements.Nested classes/interfaces inherited from class ProjectHelper
ProjectHelper.OnMissingExtensionPointModifier and TypeClassDescriptionstatic final classPossible value for target's onMissingExtensionPoint attribute. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReference holding the (ordered) target VectorFields inherited from class 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_PREFIXModifier and TypeFieldDescriptionstatic final StringThe URI for ant specific attributesstatic final StringThe URI for ant name spacestatic final StringThe URI for antlib current definitionsstatic final StringPolymorphic attributestatic final StringDeprecated.use MagicNames.ANTLIB_PREFIXstatic final StringDeprecated.use MagicNames.PROJECT_HELPER_CLASSstatic final StringDeprecated.use MagicNames.REFID_PROJECT_HELPERstatic final StringDeprecated.use MagicNames.PROJECT_HELPER_SERVICEstatic final Stringconstant to denote use project name as target prefix -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanParseAntlibDescriptor(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.AntHandlerReturns element handlerprotected static ProjectHelper2.AntHandlerReturns main handlerprotected static ProjectHelper2.AntHandlerReturns project handlerprotected static ProjectHelper2.AntHandlerReturns target handlervoidParse a source xml input.voidparse(Project project, Object source, ProjectHelper2.RootHandler handler) Parses the project file, configuring the project as it goes.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.parseUnknownElement(Project project, URL source) Parse an unknown element from a urlprotected static voidSets element handlerprotected static voidsetMainHandler(ProjectHelper2.AntHandler handler) Sets main handlerprotected static voidSets project handlerprotected static voidSets target handlerMethods inherited from class 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, storeChildModifier and TypeMethodDescriptionstatic BuildExceptionaddLocationToBuildException(BuildException ex, Location newLocation) Add location to build exception.static voidAdds the content of #PCDATA sections to an element.static voidAdds the content of #PCDATA sections to an element.booleancanParseBuildFile(Resource buildFile) Check if the helper supports the kind of file.static voidconfigure(Object target, AttributeList attrs, Project project) Deprecated.since 1.6.x.static voidconfigureProject(Project project, File buildFile) Configures the project with the contents of the specified build file.static StringextractNameFromComponentName(String componentName) extract the element name from a component namestatic StringextractUriFromComponentName(String componentName) extract a uri from a component namestatic StringgenComponentName(String uri, String name) Map a namespaced {uri,name} to an internal string format.static ClassLoaderDeprecated.since 1.6.x.static StringThe separator between the prefix and the target name.static StringThe prefix to prepend to imported target names.The file name of the build script to be parsed if none specified on the command lineExtension stack.Import stack.static ProjectHelperGet the first project helper found in the classpathstatic booleanWhether the current file should be read in include as opposed to import mode.static StringConvert an attribute namespace to a "component name".static voidDeprecated.since 1.6.x.static StringreplaceProperties(Project project, String value) Deprecated.since 1.6.x.static StringDeprecated.since 1.6.x.voidresolveExtensionOfAttributes(Project project) Check extensionStack and inject all targets having extensionOf attributes into extensionPoint.static voidSets the separator between the prefix and the target name.static voidsetCurrentTargetPrefix(String prefix) Sets the prefix to prepend to imported target names.static voidsetInIncludeMode(boolean includeMode) Sets whether the current file should be read in include as opposed to import mode.static voidstoreChild(Project project, Object parent, Object child, String tag) Stores a configured child element within its parent object.
-
Field Details
-
REFID_TARGETS
-
-
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:
canParseAntlibDescriptorin 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
parseUnknownElementif the resource provides an URL and throws an exception otherwise.- Overrides:
parseAntlibDescriptorin classProjectHelper- Parameters:
containingProject- Projectresource- Resource- Returns:
- UnknownElement
- Since:
- Ant 1.8.0
-
parseUnknownElement
Parse 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:
parsein classProjectHelper- Parameters:
project- the current projectsource- the xml source- Throws:
BuildException- if an error occurs
-
parse
public void parse(Project project, Object source, ProjectHelper2.RootHandler handler) throws BuildException Parses 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
-