Package org.eclipse.jgit.gitrepo
Class ManifestParser
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.eclipse.jgit.gitrepo.ManifestParser
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class ManifestParser extends org.xml.sax.helpers.DefaultHandler
Repo XML manifest parser.- Since:
- 4.0
- See Also:
- git-repo project page
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ManifestParser.IncludedFileReader
A callback to read included xml files.private static class
ManifestParser.Remote
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor 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
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
filename
private final java.lang.String filename
-
baseUrl
private final java.net.URI baseUrl
-
defaultBranch
private final java.lang.String defaultBranch
-
rootRepo
private final Repository rootRepo
-
remotes
private final java.util.Map<java.lang.String,ManifestParser.Remote> remotes
-
plusGroups
private final java.util.Set<java.lang.String> plusGroups
-
minusGroups
private final java.util.Set<java.lang.String> minusGroups
-
projects
private final java.util.List<RepoProject> projects
-
filteredProjects
private final java.util.List<RepoProject> filteredProjects
-
includedReader
private final ManifestParser.IncludedFileReader includedReader
-
defaultRemote
private java.lang.String defaultRemote
-
defaultRevision
private java.lang.String defaultRevision
-
xmlInRead
private int xmlInRead
-
currentProject
private RepoProject currentProject
-
-
Constructor Detail
-
ManifestParser
public 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- Parameters:
includedReader
- aManifestParser.IncludedFileReader
object.filename
- aString
object.defaultBranch
- aString
object.baseUrl
- aString
object.groups
- aString
object.rootRepo
- aRepository
object.
-
-
Method Detail
-
read
public void read(java.io.InputStream inputStream) throws java.io.IOException
Read the xml file.- Parameters:
inputStream
- aInputStream
object.- Throws:
java.io.IOException
-
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
-
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
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
normalizeEmptyPath
static java.net.URI normalizeEmptyPath(java.net.URI u)
-
getProjects
public java.util.List<RepoProject> getProjects()
Getter for projects.- Returns:
- projects list reference, never null
-
getFilteredProjects
@NonNull public java.util.List<RepoProject> getFilteredProjects()
Getter for filterdProjects.- Returns:
- filtered projects list reference, never null
-
removeNotInGroup
void removeNotInGroup()
Remove projects that are not in our desired groups.
-
removeOverlaps
void removeOverlaps()
Remove projects that sits in a subdirectory of any other project.
-
removeNestedCopyAndLinkfiles
private void removeNestedCopyAndLinkfiles()
-
inGroups
boolean inGroups(RepoProject proj)
-
isNestedReferencefile
private boolean isNestedReferencefile(RepoProject.ReferenceFile referencefile)
-
-