public class ManifestParser
extends org.xml.sax.helpers.DefaultHandler
Modifier and Type | Class and Description |
---|---|
static interface |
ManifestParser.IncludedFileReader
A callback to read included xml files.
|
private static class |
ManifestParser.Remote |
Modifier and Type | Field and Description |
---|---|
private java.net.URI |
baseUrl |
private RepoProject |
currentProject |
private java.lang.String |
defaultBranch |
private java.lang.String |
defaultRemote |
private java.lang.String |
defaultRevision |
private java.lang.String |
filename |
private java.util.List<RepoProject> |
filteredProjects |
private ManifestParser.IncludedFileReader |
includedReader |
private java.util.Set<java.lang.String> |
minusGroups |
private java.util.Set<java.lang.String> |
plusGroups |
private java.util.List<RepoProject> |
projects |
private java.util.Map<java.lang.String,ManifestParser.Remote> |
remotes |
private Repository |
rootRepo |
private int |
xmlInRead |
Constructor and Description |
---|
ManifestParser(ManifestParser.IncludedFileReader includedReader,
java.lang.String filename,
java.lang.String defaultBranch,
java.lang.String baseUrl,
java.lang.String groups,
Repository rootRepo)
Constructor for ManifestParser
|
Modifier and Type | Method and Description |
---|---|
void |
endDocument() |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName) |
java.util.List<RepoProject> |
getFilteredProjects()
Getter for filterdProjects.
|
java.util.List<RepoProject> |
getProjects()
Getter for projects.
|
(package private) boolean |
inGroups(RepoProject proj) |
private boolean |
isNestedReferencefile(RepoProject.ReferenceFile referencefile) |
(package private) static java.net.URI |
normalizeEmptyPath(java.net.URI u) |
void |
read(java.io.InputStream inputStream)
Read the xml file.
|
private void |
removeNestedCopyAndLinkfiles() |
(package private) void |
removeNotInGroup()
Remove projects that are not in our desired groups.
|
(package private) void |
removeOverlaps()
Remove projects that sits in a subdirectory of any other project.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes) |
private final java.lang.String filename
private final java.net.URI baseUrl
private final java.lang.String defaultBranch
private final Repository rootRepo
private final java.util.Map<java.lang.String,ManifestParser.Remote> remotes
private final java.util.Set<java.lang.String> plusGroups
private final java.util.Set<java.lang.String> minusGroups
private final java.util.List<RepoProject> projects
private final java.util.List<RepoProject> filteredProjects
private final ManifestParser.IncludedFileReader includedReader
private java.lang.String defaultRemote
private java.lang.String defaultRevision
private int xmlInRead
private RepoProject currentProject
public ManifestParser(ManifestParser.IncludedFileReader includedReader, java.lang.String filename, java.lang.String defaultBranch, java.lang.String baseUrl, java.lang.String groups, Repository rootRepo)
includedReader
- a
ManifestParser.IncludedFileReader
object.filename
- a String
object.defaultBranch
- a String
object.baseUrl
- a String
object.groups
- a String
object.rootRepo
- a Repository
object.public void read(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- a InputStream
object.java.io.IOException
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
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
static java.net.URI normalizeEmptyPath(java.net.URI u)
public java.util.List<RepoProject> getProjects()
@NonNull public java.util.List<RepoProject> getFilteredProjects()
void removeNotInGroup()
void removeOverlaps()
private void removeNestedCopyAndLinkfiles()
boolean inGroups(RepoProject proj)
private boolean isNestedReferencefile(RepoProject.ReferenceFile referencefile)