Top Description Inners Fields Constructors Methods
org.eclipse.jgit.gitrepo

public Class ManifestParser

extends DefaultHandler
Class Inheritance
Imports
java.io.FileInputStream, .IOException, .InputStream, java.net.URI, .URISyntaxException, java.text.MessageFormat, java.util.ArrayList, .Collections, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, javax.xml.parsers.ParserConfigurationException, .SAXParserFactory, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.api.errors.GitAPIException, org.eclipse.jgit.gitrepo.RepoProject.CopyFile, .RepoProject.LinkFile, .RepoProject.ReferenceFile, org.eclipse.jgit.gitrepo.internal.RepoText, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Repository, org.xml.sax.Attributes, .InputSource, .SAXException, .XMLReader, org.xml.sax.helpers.DefaultHandler

Repo XML manifest parser.
Since
4.0
See Also
git-repo project page

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ManifestParser.IncludedFileReader

A callback to read included xml files.

private static class

Field Summary

Modifier and TypeField and Description
private final URI
private RepoProject
private final String
private String
private String
private final String
private final List<RepoProject>
private final ManifestParser.IncludedFileReader
private final Set<String>
private final Set<String>
private final List<RepoProject>
private final Map<String, ManifestParser.Remote>
private final Repository
private int

Constructor Summary

AccessConstructor and Description
public
ManifestParser(ManifestParser.IncludedFileReader includedReader, String filename, String defaultBranch, String baseUrl, String groups, Repository rootRepo)

Constructor for ManifestParser

Method Summary

Modifier and TypeMethod and Description
public void
endDocument()

Overrides org.xml.sax.helpers.DefaultHandler.endDocument.

Implements org.xml.sax.ContentHandler.endDocument.

Receive notification of the end of the document.

public void
endElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
)

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

public List<RepoProject>

Returns:

filtered projects list reference, never null
getFilteredProjects
()

Getter for filterdProjects.

public List<RepoProject>

Returns:

projects list reference, never null
getProjects
()

Getter for projects.

pack-priv boolean
private boolean
pack-priv static URI
public void
read(InputStream inputStream)

Read the xml file.

private void
pack-priv void
removeNotInGroup()

Remove projects that are not in our desired groups.

pack-priv void
removeOverlaps()

Remove projects that sits in a subdirectory of any other project.

public void
startElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
,
Attributes
The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
attributes
)

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the start of an element.

Inherited from org.xml.sax.helpers.DefaultHandler:
charactersendPrefixMappingerrorfatalErrorignorableWhitespacenotationDeclprocessingInstructionresolveEntitysetDocumentLocatorskippedEntitystartDocumentstartPrefixMappingunparsedEntityDeclwarning

Field Detail

baseUrlback to summary
private final URI baseUrl
currentProjectback to summary
private RepoProject currentProject
defaultBranchback to summary
private final String defaultBranch
defaultRemoteback to summary
private String defaultRemote
defaultRevisionback to summary
private String defaultRevision
filenameback to summary
private final String filename
filteredProjectsback to summary
private final List<RepoProject> filteredProjects
includedReaderback to summary
private final ManifestParser.IncludedFileReader includedReader
minusGroupsback to summary
private final Set<String> minusGroups
plusGroupsback to summary
private final Set<String> plusGroups
projectsback to summary
private final List<RepoProject> projects
remotesback to summary
private final Map<String, ManifestParser.Remote> remotes
rootRepoback to summary
private final Repository rootRepo
xmlInReadback to summary
private int xmlInRead

Constructor Detail

ManifestParserback to summary
public ManifestParser(ManifestParser.IncludedFileReader includedReader, String filename, String defaultBranch, String baseUrl, String groups, Repository rootRepo)

Constructor for ManifestParser

Parameters
includedReader:ManifestParser.IncludedFileReader

a org.eclipse.jgit.gitrepo.ManifestParser.IncludedFileReader object.

filename:String

a java.lang.String object.

defaultBranch:String

a java.lang.String object.

baseUrl:String

a java.lang.String object.

groups:String

a java.lang.String object.

rootRepo:Repository

a org.eclipse.jgit.lib.Repository object.

Method Detail

endDocumentback to summary
public void endDocument() throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.endDocument.

Implements org.xml.sax.ContentHandler.endDocument.

Doc from org.xml.sax.helpers.DefaultHandler.endDocument.

Receive notification of the end of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
endElementback to summary
public void endElement(String uri, String localName, String qName) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.helpers.DefaultHandler.endElement.

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Parameters
uri:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

localName:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName:String

The qualified name (with prefix), or the empty string if qualified names are not available.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
getFilteredProjectsback to summary
public List<RepoProject> getFilteredProjects()

Getter for filterdProjects.

Returns:List<RepoProject>

filtered projects list reference, never null

Annotations
@NonNull
getProjectsback to summary
public List<RepoProject> getProjects()

Getter for projects.

Returns:List<RepoProject>

projects list reference, never null

inGroupsback to summary
pack-priv boolean inGroups(RepoProject proj)
isNestedReferencefileback to summary
private boolean isNestedReferencefile(RepoProject.ReferenceFile referencefile)
normalizeEmptyPathback to summary
pack-priv static URI normalizeEmptyPath(URI u)
readback to summary
public void read(InputStream inputStream) throws IOException

Read the xml file.

Parameters
inputStream:InputStream

a java.io.InputStream object.

Exceptions
IOException:
if an IO error occurred
removeNestedCopyAndLinkfilesback to summary
private void removeNestedCopyAndLinkfiles()
removeNotInGroupback to summary
pack-priv void removeNotInGroup()

Remove projects that are not in our desired groups.

removeOverlapsback to summary
pack-priv void removeOverlaps()

Remove projects that sits in a subdirectory of any other project.

startElementback to summary
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.DefaultHandler.startElement.

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Parameters
uri:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

localName:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName:String

The qualified name (with prefix), or the empty string if qualified names are not available.

attributes:Attributes

The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.

Annotations
@SuppressWarnings:nls
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
org.eclipse.jgit.gitrepo back to summary

public Interface ManifestParser.IncludedFileReader


A callback to read included xml files.

Method Summary

Modifier and TypeMethod and Description
public InputStream

Returns:

the InputStream of the file.
readIncludeFile
(String
The relative path to the file to read
path
)

Read a file from the same base dir of the manifest xml file.

Method Detail

readIncludeFileback to summary
public InputStream readIncludeFile(String path) throws GitAPIException, IOException

Read a file from the same base dir of the manifest xml file.

Parameters
path:String

The relative path to the file to read

Returns:InputStream

the InputStream of the file.

Exceptions
GitAPIException:
a JGit API exception
IOException:
if an IO error occurred
org.eclipse.jgit.gitrepo back to summary

private Class ManifestParser.Remote

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final String
pack-priv final String

Constructor Summary

AccessConstructor and Description
pack-priv
Remote(String fetch, String revision)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fetchback to summary
pack-priv final String fetch
revisionback to summary
pack-priv final String revision

Constructor Detail

Remoteback to summary
pack-priv Remote(String fetch, String revision)