public class GitHubFileSystem extends HttpFileSystem
| Modifier and Type | Class and Description |
|---|---|
static class |
GitHubFileSystem.Forge |
FileSystem.DirectoryEntry, FileSystem.FileSystemOfflineExceptionHTTP_CHECK_TIMESTAMP_LIMIT_MS, id, LISTING_TIMEOUT_MS, localRoot, MEMORY_LISTING_TIMEOUT_MS, offline, offlineMessage, offlineResponseCode, PROP_OFFLINE, PROP_READ_ONLY_CACHE, protocolloggerUrl, NULL, PROP_CASE_INSENSITIVE, properties| Modifier | Constructor and Description |
|---|---|
protected |
GitHubFileSystem(java.net.URI root,
java.io.File localRoot,
java.lang.String branch,
int baseOffset)
Create a new GitHubFileSystem mirroring the root, a URL pointing to
"http" or "https", in the local folder.
|
| Modifier and Type | Method and Description |
|---|---|
static GitHubFileSystem |
createGitHubFileSystem(java.net.URI root)
create GitLabs instance
|
static GitHubFileSystem |
createGitHubFileSystem(java.net.URI root,
int baseOffset) |
static GitHubFileSystem.Forge |
detectForge(java.net.URI root)
detect if the URI is a GitHub or GitLab instance.
|
protected java.util.Map<java.lang.String,java.lang.String> |
downloadFile(java.lang.String filename,
java.io.File targetFile,
java.io.File partFile,
ProgressMonitor monitor)
Transfers the file from the remote store to a local copy f.
|
static java.lang.String |
getDefaultBranch(java.net.URI root,
java.lang.String project)
return the default branch (e.g.
|
static java.lang.String |
getDefaultBranchGitHub(java.net.URI root,
java.lang.String project)
Return the default branch (e.g.
|
static java.lang.String |
getDefaultBranchGitLab(java.net.URI root,
java.lang.String project)
Return the default branch (e.g.
|
FileObject |
getFileObject(java.lang.String filename)
Return the handle for this file.
|
static java.io.File |
getLocalRoot(java.net.URI root)
return the location within the file cache of this GitHub filesystem.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getRequestProperties()
set the cookie if cookies are being used.
|
java.net.URI |
getURI(java.lang.String filename)
return the URI for the internal filename
|
java.net.URL |
getURL(java.lang.String filename)
return the URL for the internal filename
|
java.net.URL |
gitHubMapDir(java.net.URI root,
java.lang.String filename)
github puts directories for each project under "tree/master".
|
java.net.URL |
gitHubMapFile(java.net.URI root,
java.lang.String filename)
Given the URI, convert this to the link which will download the file.
|
static java.lang.String |
isGithubFileSystem(java.lang.String h,
java.lang.String path)
one place that lists the GitHub (GitLab) filesystems.
|
java.lang.String[] |
listDirectory(java.lang.String directory)
list the directory, using the cached entry from listDirectoryFromMemory, or
by HtmlUtil.getDirectoryListing.
|
java.lang.String[] |
listDirectoryGithub(java.lang.String directory)
Use GitHub's API to list the directory.
|
java.lang.String[] |
listDirectoryGitLab(java.lang.String directory)
Use GitLab's API to list the directory.
|
java.lang.String[] |
listDirectoryGitLabHowever(java.lang.String directory)
At some point, Gitlab started returning the filename listing in a
separate JSON response.
|
static java.lang.String |
strjoin(java.lang.String[] c,
java.lang.String delim,
int start,
int end)
this will be replaced in Java 8.
|
java.lang.String |
toString() |
createHttpFileSystem, getCookie, getHeadMeta, isDirectory, isRegexNoWild, listDirectory, maybeUpdateDirectoryEntry, reduceMetaaddPropertyChangeListener, addRoCacheEntries, cacheListing, consumeStream, copyStream, getDownloadDirectory, getDownloadLock, getLastAccessed, getLocalName, getLocalName, getLocalRoot, getLocalRootAbsPath, getOfflineMessage, getOfflineResponseCode, getPartFile, getProtocol, getReadOnlyCache, getRootURL, isAppletMode, isGitClone, isListingCached, isOffline, listDirectoryFromMemory, listingFile, localRoot, removePropertyChangeListener, resetListCache, resetListingCache, setAppletMode, setOffline, setReadOnlyCachecreate, create, create, create, create, create, createFileSystem, getExceptionHandler, getListing, getListing, getProperty, getRootURI, listDirectory, listDirectory, listDirectoryDeep, peek, peekInstances, recreate, recreate, registerFileSystemFactory, reset, reset, setExceptionHandler, settings, splitUrl, toCanonicalFilename, toCanonicalFolderName, toCanonicalFolderName, toCanonicalFolderNameStringprotected GitHubFileSystem(java.net.URI root,
java.io.File localRoot,
java.lang.String branch,
int baseOffset)
root - the root of the filesystemlocalRoot - the local root where files are downloaded.branch - the branch, typically "master", and "" if the default branch is not yet known.baseOffset - index of the first folder of the GitLabs server.protected java.util.Map<java.lang.String,java.lang.String> getRequestProperties()
HttpFileSystemgetRequestProperties in class HttpFileSystempublic static GitHubFileSystem createGitHubFileSystem(java.net.URI root)
root - the rootpublic static GitHubFileSystem.Forge detectForge(java.net.URI root)
root - public static java.io.File getLocalRoot(java.net.URI root)
root - public static java.lang.String isGithubFileSystem(java.lang.String h,
java.lang.String path)
h - the hostpath - path to the top of the GitLabs instance.public static GitHubFileSystem createGitHubFileSystem(java.net.URI root, int baseOffset)
root - the rootbaseOffset - the number of folders after the host in the root, for
this GitLabs instance.public java.lang.String[] listDirectoryGitLabHowever(java.lang.String directory)
throws java.io.IOException
directory - java.io.IOExceptionpublic java.lang.String[] listDirectoryGithub(java.lang.String directory)
throws java.io.IOException
directory - within the filesystemjava.io.IOExceptionpublic java.lang.String[] listDirectoryGitLab(java.lang.String directory)
throws java.io.IOException
directory - within the filesystemjava.io.IOExceptionpublic static java.lang.String getDefaultBranchGitLab(java.net.URI root,
java.lang.String project)
throws java.io.IOException
root - the GitLab root (e.g. https://research-git.uiowa.edu/)project - the project (e.g. 'space-physics/rbsp/ap-script')java.io.IOExceptionpublic static java.lang.String getDefaultBranchGitHub(java.net.URI root,
java.lang.String project)
throws java.io.IOException
root - the GitHub root (e.g. https://github.com/autoplot/)project - the project (e.g. 'autoplot/dev')java.io.IOExceptionpublic static java.lang.String getDefaultBranch(java.net.URI root,
java.lang.String project)
throws java.io.IOException
root - project - java.io.IOExceptionpublic java.lang.String[] listDirectory(java.lang.String directory)
throws java.io.IOException
HttpFileSystemlistDirectory in class HttpFileSystemdirectory - name within the filesystemjava.io.IOExceptionfor listings constrained by regular expressions.public static java.lang.String strjoin(java.lang.String[] c,
java.lang.String delim,
int start,
int end)
c - delim - start - positive index, or negative from end.end - positive index, or negative from end.public java.net.URL gitHubMapFile(java.net.URI root,
java.lang.String filename)
throws java.net.MalformedURLException
root - the Das2 FileSystem root, which can be a directory within a repo.filename - the filename to download, not containing any slashes.java.net.MalformedURLExceptionhttps://github.com/autoplot/dev/blob/master/bugs/ghdas2/demo173.jypublic java.net.URL gitHubMapDir(java.net.URI root,
java.lang.String filename)
throws java.net.MalformedURLException
root - filename - java.net.MalformedURLExceptionpublic java.net.URI getURI(java.lang.String filename)
WebFileSystemgetURI in class WebFileSystemfilename - internal filenamepublic java.net.URL getURL(java.lang.String filename)
getURL in class WebFileSystemfilename - internal filenameDefaultHttpProtocol.urlEncodeSansSlash(java.lang.String)protected java.util.Map<java.lang.String,java.lang.String> downloadFile(java.lang.String filename,
java.io.File targetFile,
java.io.File partFile,
ProgressMonitor monitor)
throws java.io.IOException
WebFileSystemdownloadFile in class HttpFileSystemfilename - filename within the filesystem.targetFile - the target filename where the file is to be download.partFile - use this file to stage the downloadmonitor - monitor the progress.java.io.IOExceptionWebProtocol.getMetadata(org.das2.util.filesystem.WebFileObject)public FileObject getFileObject(java.lang.String filename)
WebFileSystemgetFileObject in class WebFileSystemfilename - the name of the file within the filesystem.public java.lang.String toString()
toString in class WebFileSystem