public class GitHubFileSystem extends HttpFileSystem
FileSystem.DirectoryEntry, FileSystem.FileSystemOfflineException
HTTP_CHECK_TIMESTAMP_LIMIT_MS, id, LISTING_TIMEOUT_MS, localRoot, MEMORY_LISTING_TIMEOUT_MS, offline, offlineMessage, offlineResponseCode, PROP_OFFLINE, PROP_READ_ONLY_CACHE, protocol
loggerUrl, 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) |
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.
|
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.
|
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[] |
listDirectoryGitlab(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, reduceMeta
addPropertyChangeListener, 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, setReadOnlyCache
create, 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
protected 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".baseOffset
- index of the first folder of the GitLabs server.public static GitHubFileSystem createGitHubFileSystem(java.net.URI root)
root
- the rootpublic 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[] listDirectoryGitlab(java.lang.String directory) throws java.io.IOException
directory
- java.io.IOException
public java.lang.String[] listDirectory(java.lang.String directory) throws java.io.IOException
HttpFileSystem
listDirectory
in class HttpFileSystem
directory
- name within the filesystemjava.io.IOException
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
- filename
- %{code https://abbith.physics.uiowa.edu/jbf/myawesomepublicproject/blob/24dff04b9bcb275d8bfd85b38e0e8b039b21d655/sayAwesome.jy to
https://abbith.physics.uiowa.edu/jbf/myawesomepublicproject/raw/24dff04b9bcb275d8bfd85b38e0e8b039b21d655/sayAwesome.jy https://github.com/autoplot/app/raw/master/Autoplot/src/resources/badge_ok.png to https://github.com/autoplot/app/master/Autoplot/src/resources/badge_ok.png https://jfaden.net/git/jbfaden/public/blob/master/u/jeremy/2019/20191023/updates.jy https://research-git.uiowa.edu/space-physics/juno/ap-script/master/test/testap.jy to https://research-git.uiowa.edu/space-physics/juno/ap-script/-/raw/master/test/testap.jy https://research-git.uiowa.edu/jbf/testproject/-/blob/master/script/testScript.jy to https://research-git.uiowa.edu/jbf/testproject/master/script/testScript.jy }
java.net.MalformedURLException
public java.net.URL gitHubMapDir(java.net.URI root, java.lang.String filename) throws java.net.MalformedURLException
root
- filename
- java.net.MalformedURLException
public java.net.URI getURI(java.lang.String filename)
WebFileSystem
getURI
in class WebFileSystem
filename
- internal filenamepublic java.net.URL getURL(java.lang.String filename)
getURL
in class WebFileSystem
filename
- 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
WebFileSystem
downloadFile
in class HttpFileSystem
filename
- 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.IOException
WebProtocol.getMetadata(org.das2.util.filesystem.WebFileObject)
public FileObject getFileObject(java.lang.String filename)
WebFileSystem
getFileObject
in class WebFileSystem
filename
- the name of the file within the filesystem.public java.lang.String toString()
toString
in class WebFileSystem