Class XmlModuleDescriptorParser
- java.lang.Object
-
- org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser
-
- org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser
-
- All Implemented Interfaces:
ModuleDescriptorParser
public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser
Parses an xml ivy file and output a ModuleDescriptor. For dependency and performance reasons, it uses only the SAX API, which makes the parsing code harder to understand.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlModuleDescriptorParser.Parser
-
Nested classes/interfaces inherited from class org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser
AbstractModuleDescriptorParser.AbstractParser
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.List<java.lang.String>
DEPENDENCY_REGULAR_ATTRIBUTES
private static XmlModuleDescriptorParser
INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description protected
XmlModuleDescriptorParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Resource res)
static XmlModuleDescriptorParser
getInstance()
protected XmlModuleDescriptorParser.Parser
newParser(ParserSettings ivySettings)
Instantiates a Parser instance responsible for actual parsing of Ivy files.(package private) ModuleDescriptor
parseDescriptor(ParserSettings ivySettings, java.io.InputStream descriptor, Resource res, boolean validate)
Used for test purposeModuleDescriptor
parseDescriptor(ParserSettings ivySettings, java.net.URL xmlURL, Resource res, boolean validate)
void
toIvyFile(java.io.InputStream is, Resource res, java.io.File destFile, ModuleDescriptor md)
Convert a module descriptor to an ivy file.java.lang.String
toString()
-
Methods inherited from class org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser
getMetadataArtifact, getType, parseDescriptor
-
-
-
-
Field Detail
-
DEPENDENCY_REGULAR_ATTRIBUTES
static final java.util.List<java.lang.String> DEPENDENCY_REGULAR_ATTRIBUTES
-
INSTANCE
private static final XmlModuleDescriptorParser INSTANCE
-
-
Method Detail
-
getInstance
public static XmlModuleDescriptorParser getInstance()
-
parseDescriptor
public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, java.net.URL xmlURL, Resource res, boolean validate) throws java.text.ParseException, java.io.IOException
- Parameters:
ivySettings
- ParserSettingsxmlURL
- the url pointing to the file to parseres
- the real resource to parse, used for log onlyvalidate
- boolean- Returns:
- ModuleDescriptor
- Throws:
java.text.ParseException
- if something goes wrongjava.io.IOException
- if something goes wrong
-
parseDescriptor
ModuleDescriptor parseDescriptor(ParserSettings ivySettings, java.io.InputStream descriptor, Resource res, boolean validate) throws java.text.ParseException
Used for test purpose- Throws:
java.text.ParseException
-
newParser
protected XmlModuleDescriptorParser.Parser newParser(ParserSettings ivySettings)
Instantiates a Parser instance responsible for actual parsing of Ivy files.Override this method if you want to use a custom Parser.
- Parameters:
ivySettings
- the settings to use during parsing- Returns:
- the Parser instance used for parsing Ivy files
-
accept
public boolean accept(Resource res)
-
toIvyFile
public void toIvyFile(java.io.InputStream is, Resource res, java.io.File destFile, ModuleDescriptor md) throws java.io.IOException, java.text.ParseException
Description copied from interface:ModuleDescriptorParser
Convert a module descriptor to an ivy file. This method MUST close the given input stream when job is finished- Parameters:
is
- input stream with opened on original module descriptor resourceres
- ResourcedestFile
- Filemd
- ModuleDescriptor- Throws:
java.io.IOException
- if something goes wrongjava.text.ParseException
- if something goes wrong
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-