|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knuth.chkupdate.Provider
org.knuth.chkupdate.provider.GitHubProvider
public class GitHubProvider
A Provider used to check for a new Update on GitHub.
Nested Class Summary | |
---|---|
private class |
GitHubProvider.TagWrapper
Wrapper which is used to wrap the commit-ID and it's date in one Object. |
Field Summary | |
---|---|
private java.lang.String |
BASE_URL
The Base of the Request-URL |
private java.lang.String |
COMMIT_START
|
private java.lang.String |
repo
The given Repo from "username" |
private java.lang.String |
TAG_COMMAND
|
private java.lang.String |
TAG_START
|
private java.lang.String |
username
The given UserName |
Constructor Summary | |
---|---|
GitHubProvider(java.lang.String username,
java.lang.String repo)
Creates a new Provider for GitHub |
Method Summary | |
---|---|
private java.net.URL |
createCommitURL(java.lang.String commit_id)
Creates an "URL"-Object to query the GitHub API for a single commit. |
private java.net.URL |
createListURL()
Creates an "URL"-Object from the given URL-parts to query the GitHub API for a list of tags. |
UpdateResult |
doCheck()
Performs the Update-Check. |
java.lang.String |
getName()
Returns the Name of the Service used by this Provider |
private java.util.Date |
parseCommitDate(java.lang.String response)
Parses the JSON-Response to a "Date"-Object. |
private GitHubProvider.TagWrapper |
parseList(java.lang.String response)
Parses the tag-list JSON-String and returns the first (last added) item of it. |
private java.lang.String |
requestReader(java.net.URL url)
Reads the plain-text response of the GitHub API for the given request-URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.lang.String BASE_URL
private final java.lang.String TAG_START
private final java.lang.String TAG_COMMAND
private final java.lang.String COMMIT_START
private java.lang.String username
private java.lang.String repo
Constructor Detail |
---|
public GitHubProvider(java.lang.String username, java.lang.String repo)
username
- The user-name on GitHub.repo
- The Repo's name on GitHub.Method Detail |
---|
public UpdateResult doCheck() throws UpdateRequestException, UpdateResponseException
Provider
doCheck
in class Provider
UpdateRequestException
- Thrown when
there was a problem requesting informations
from the Provider.
UpdateResponseException
- Thrown when
there was a problem parsing the response
from the Provider.private java.util.Date parseCommitDate(java.lang.String response) throws UpdateResponseException
response
- The JSON-String.
UpdateResponseException
- Thrown when the
Date could not be parsed.private GitHubProvider.TagWrapper parseList(java.lang.String response) throws UpdateResponseException
response
- The JSON-String.
UpdateResponseException
- Thrown when the JSON-
String could not be parsed.private java.lang.String requestReader(java.net.URL url) throws UpdateRequestException
url
- The request-URL.
UpdateRequestException
- Thrown when the GitHub
API could not be reached.private java.net.URL createListURL() throws java.net.MalformedURLException
java.net.MalformedURLException
- Thrown when the URL
could not be created.private java.net.URL createCommitURL(java.lang.String commit_id) throws java.net.MalformedURLException
commit_id
- The ID of the commit.
java.net.MalformedURLException
- Thrown when the URL
could not be created.public java.lang.String getName()
Provider
getName
in class Provider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |