Class XmlModuleDescriptorParser.Parser
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser.AbstractParser
-
- org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser.Parser
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
- Enclosing class:
- XmlModuleDescriptorParser
public static class XmlModuleDescriptorParser.Parser extends AbstractModuleDescriptorParser.AbstractParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlModuleDescriptorParser.Parser.State
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.List<java.lang.String>
ALLOWED_VERSIONS
-
Constructor Summary
Constructors Constructor Description Parser(ModuleDescriptorParser parser, ParserSettings ivySettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addConfiguration(java.lang.String c)
protected void
addDependencyArtifacts(java.lang.String tag, org.xml.sax.Attributes attributes)
protected void
addExcludeRule(java.lang.String tag, org.xml.sax.Attributes attributes)
protected void
addIncludeRule(java.lang.String tag, org.xml.sax.Attributes attributes)
protected void
artifactStarted(java.lang.String qName, org.xml.sax.Attributes attributes)
void
characters(char[] ch, int start, int length)
protected void
checkConfigurations()
protected void
configurationStarted(org.xml.sax.Attributes attributes)
protected void
confStarted(org.xml.sax.Attributes attributes)
protected void
dependenciesStarted(org.xml.sax.Attributes attributes)
protected void
dependencyStarted(org.xml.sax.Attributes attributes)
void
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
protected void
extendsStarted(org.xml.sax.Attributes attributes)
Handle extends elements.protected MDArtifact
getArtifact()
protected java.lang.StringBuilder
getBuffer()
protected java.lang.String
getConf()
protected ConfigurationAware
getConfAware()
protected DefaultDependencyDescriptor
getDd()
protected PatternMatcher
getDefaultMatcher()
protected java.lang.String
getDefaultParentLocation()
Default parent location to check (for dev ONLY)protected java.io.InputStream
getDescriptorInput()
protected java.net.URL
getDescriptorURL()
protected java.lang.String
getDescriptorVersion()
protected PatternMatcher
getPatternMatcher(java.lang.String m)
protected java.lang.String[]
getPublicationsDefaultConf()
protected java.net.URL
getSchemaURL()
protected ParserSettings
getSettings()
protected int
getState()
protected void
includeConfStarted(org.xml.sax.Attributes attributes)
protected void
infoStarted(org.xml.sax.Attributes attributes)
protected boolean
isArtifactsDeclared()
protected boolean
isOtherNamespace(java.lang.String qName)
protected boolean
isValidate()
protected void
ivyModuleStarted(org.xml.sax.Attributes attributes)
protected void
managerStarted(org.xml.sax.Attributes attributes, java.lang.String managerAtt)
protected void
mediationOverrideStarted(org.xml.sax.Attributes attributes)
protected void
mergeAll(ModuleDescriptor parent)
Merge everything from a given parentprotected void
mergeConfigurations(ModuleDescriptor parent)
Describes how to merge configurations elementsprotected void
mergeDependencies(DependencyDescriptor[] dependencies)
Describes how dependencies should be inheritedprotected void
mergeDescription(java.lang.String description)
Describes how to merge descriptionvoid
mergeExcludes(ExcludeRule[] excludeRules)
Describes how to merge exclude rulesprotected void
mergeInfo(ModuleDescriptor parent)
Explain how to inherit metadata related to info elementvoid
mergeLicenses(License[] licenses)
Describes how to merge licensesprotected void
mergeWithOtherModuleDescriptor(java.util.List<java.lang.String> extendTypes, ModuleDescriptor parent)
Merge current module with a given module descriptor and specify what should be inherited through extendTypes argumentvoid
parse()
protected ModuleDescriptor
parseOtherIvyFile(ModuleRevisionId parentMrid)
Describe how to parse aModuleDescriptor
by asking repositoriesprotected void
parseRule(java.lang.String tag, org.xml.sax.Attributes attributes)
protected void
publicationsStarted(org.xml.sax.Attributes attributes)
protected void
replaceConfigurationWildcards()
protected void
setArtifact(MDArtifact artifact)
protected void
setArtifactsDeclared(boolean artifactsDeclared)
protected void
setBuffer(java.lang.StringBuilder buffer)
protected void
setConf(java.lang.String conf)
protected void
setConfAware(ConfigurationAware confAware)
protected void
setDd(DefaultDependencyDescriptor dd)
protected void
setDescriptorVersion(java.lang.String descriptorVersion)
void
setInput(java.io.InputStream descriptorInput)
void
setInput(java.net.URL descriptorURL)
protected void
setPublicationsDefaultConf(java.lang.String defaultConf)
protected void
setPublicationsDefaultConf(java.lang.String[] publicationsDefaultConf)
protected void
setState(int state)
void
setValidate(boolean validate)
void
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
-
Methods inherited from class org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser.AbstractParser
addError, checkErrors, error, fatalError, getDefaultConf, getDefaultConfMapping, getDefaultConfMappingDescriptor, getDefaultPubDate, getMd, getModuleDescriptor, getModuleDescriptorParser, getResource, parseDepsConfs, parseDepsConfs, parseDepsConfs, parseDepsConfs, parseDepsConfs, setDefaultConf, setDefaultConfMapping, setMd, setResource, warning
-
-
-
-
Constructor Detail
-
Parser
public Parser(ModuleDescriptorParser parser, ParserSettings ivySettings)
-
-
Method Detail
-
setInput
public void setInput(java.io.InputStream descriptorInput)
-
setInput
public void setInput(java.net.URL descriptorURL)
-
setValidate
public void setValidate(boolean validate)
-
parse
public void parse() throws java.text.ParseException
- Throws:
java.text.ParseException
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
getDefaultParentLocation
protected java.lang.String getDefaultParentLocation()
Default parent location to check (for dev ONLY)- Returns:
- a relative path to a parent module descriptor
-
extendsStarted
protected void extendsStarted(org.xml.sax.Attributes attributes) throws java.text.ParseException
Handle extends elements. It checks :- filesystem based on location attribute, if no one is specified it will check the default parent location
- cache to find a resolved parent descriptor
- ask repositories to retrieve the parent module descriptor
- Parameters:
attributes
- Attributes- Throws:
java.text.ParseException
- if something goes wrong
-
mergeWithOtherModuleDescriptor
protected void mergeWithOtherModuleDescriptor(java.util.List<java.lang.String> extendTypes, ModuleDescriptor parent)
Merge current module with a given module descriptor and specify what should be inherited through extendTypes argument- Parameters:
extendTypes
- specify what should be inheritedparent
- a given parent module descriptor
-
mergeAll
protected void mergeAll(ModuleDescriptor parent)
Merge everything from a given parent- Parameters:
parent
- a given parent module descriptor
-
mergeInfo
protected void mergeInfo(ModuleDescriptor parent)
Explain how to inherit metadata related to info element- Parameters:
parent
- a given parent module descriptor
-
mergeConfigurations
protected void mergeConfigurations(ModuleDescriptor parent)
Describes how to merge configurations elements- Parameters:
parent
- the module descriptor
-
mergeDependencies
protected void mergeDependencies(DependencyDescriptor[] dependencies)
Describes how dependencies should be inherited- Parameters:
dependencies
- array of dependencies to inherit
-
mergeDescription
protected void mergeDescription(java.lang.String description)
Describes how to merge description- Parameters:
description
- description going to be inherited
-
mergeLicenses
public void mergeLicenses(License[] licenses)
Describes how to merge licenses- Parameters:
licenses
- licenses going to be inherited
-
mergeExcludes
public void mergeExcludes(ExcludeRule[] excludeRules)
Describes how to merge exclude rules- Parameters:
excludeRules
- exclude rules going to be inherited
-
parseOtherIvyFile
protected ModuleDescriptor parseOtherIvyFile(ModuleRevisionId parentMrid) throws java.text.ParseException
Describe how to parse aModuleDescriptor
by asking repositories- Parameters:
parentMrid
- a givenModuleRevisionId
to find- Returns:
- a
ModuleDescriptor
if found. Return null if noModuleDescriptor
was found - Throws:
java.text.ParseException
- if something goes wrong
-
publicationsStarted
protected void publicationsStarted(org.xml.sax.Attributes attributes)
-
setPublicationsDefaultConf
protected void setPublicationsDefaultConf(java.lang.String defaultConf)
-
isOtherNamespace
protected boolean isOtherNamespace(java.lang.String qName)
-
managerStarted
protected void managerStarted(org.xml.sax.Attributes attributes, java.lang.String managerAtt)
-
mediationOverrideStarted
protected void mediationOverrideStarted(org.xml.sax.Attributes attributes)
-
includeConfStarted
protected void includeConfStarted(org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException, java.text.ParseException
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
java.text.ParseException
-
confStarted
protected void confStarted(org.xml.sax.Attributes attributes)
-
dependencyStarted
protected void dependencyStarted(org.xml.sax.Attributes attributes)
-
artifactStarted
protected void artifactStarted(java.lang.String qName, org.xml.sax.Attributes attributes) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
dependenciesStarted
protected void dependenciesStarted(org.xml.sax.Attributes attributes)
-
configurationStarted
protected void configurationStarted(org.xml.sax.Attributes attributes)
-
infoStarted
protected void infoStarted(org.xml.sax.Attributes attributes)
-
ivyModuleStarted
protected void ivyModuleStarted(org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
addDependencyArtifacts
protected void addDependencyArtifacts(java.lang.String tag, org.xml.sax.Attributes attributes) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
addIncludeRule
protected void addIncludeRule(java.lang.String tag, org.xml.sax.Attributes attributes) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
addExcludeRule
protected void addExcludeRule(java.lang.String tag, org.xml.sax.Attributes attributes) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
parseRule
protected void parseRule(java.lang.String tag, org.xml.sax.Attributes attributes) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
addConfiguration
protected void addConfiguration(java.lang.String c)
-
getPatternMatcher
protected PatternMatcher getPatternMatcher(java.lang.String m)
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
checkConfigurations
protected void checkConfigurations()
-
replaceConfigurationWildcards
protected void replaceConfigurationWildcards()
-
getSettings
protected ParserSettings getSettings()
-
getDescriptorURL
protected java.net.URL getDescriptorURL()
-
getDescriptorInput
protected java.io.InputStream getDescriptorInput()
-
getState
protected int getState()
-
setState
protected void setState(int state)
-
getDefaultMatcher
protected PatternMatcher getDefaultMatcher()
-
getDd
protected DefaultDependencyDescriptor getDd()
-
setDd
protected void setDd(DefaultDependencyDescriptor dd)
-
getConfAware
protected ConfigurationAware getConfAware()
-
setConfAware
protected void setConfAware(ConfigurationAware confAware)
-
getArtifact
protected MDArtifact getArtifact()
-
setArtifact
protected void setArtifact(MDArtifact artifact)
-
getConf
protected java.lang.String getConf()
-
setConf
protected void setConf(java.lang.String conf)
-
isArtifactsDeclared
protected boolean isArtifactsDeclared()
-
setArtifactsDeclared
protected void setArtifactsDeclared(boolean artifactsDeclared)
-
getBuffer
protected java.lang.StringBuilder getBuffer()
-
setBuffer
protected void setBuffer(java.lang.StringBuilder buffer)
-
getDescriptorVersion
protected java.lang.String getDescriptorVersion()
-
setDescriptorVersion
protected void setDescriptorVersion(java.lang.String descriptorVersion)
-
getPublicationsDefaultConf
protected java.lang.String[] getPublicationsDefaultConf()
-
setPublicationsDefaultConf
protected void setPublicationsDefaultConf(java.lang.String[] publicationsDefaultConf)
-
isValidate
protected boolean isValidate()
-
getSchemaURL
protected java.net.URL getSchemaURL()
-
-