public class GitlabControllerImpl extends Object implements GitlabController
| Constructor and Description |
|---|
GitlabControllerImpl() |
GitlabControllerImpl(boolean startFetchingProjects,
boolean useCache) |
GitlabControllerImpl(String token,
boolean startFetchingProjects,
boolean useCache) |
| Modifier and Type | Method and Description |
|---|---|
List<Project> |
getAllProjects() |
org.apache.jena.rdf.model.Model |
getCheckedModel(byte[] modelData,
String modelType,
String projectName) |
protected Set<String> |
getProjectsOfUser(String mail)
If the Gitlab API is used with an admin account, this method returns the
names of the projects that are visible for this user.
|
protected List<org.gitlab.api.models.GitlabProject> |
getProjectsVisibleForUser(org.gitlab.api.models.GitlabUser user) |
List<Project> |
getProjectsVisibleForUser(String mail) |
protected org.gitlab.api.models.GitlabUser |
getUserByMail(String mail)
Tries to find the GitlabUser with the given mail address.
|
Project |
gitlabToProject(org.gitlab.api.models.GitlabProject project) |
protected void |
handleErrorMsg(String message,
Exception e,
boolean logMsgIfAlreadyKnown)
Method for handling errors occurring when crawling gitlab (mainly parsing
errors).
|
protected static Stream<org.apache.commons.lang3.tuple.Pair<String,Project>> |
listUris(Project p)
Collects the URIs of benchmarks and systems defined within the given project
element and streams them as pairs of the benchmark and system URIs as keys
and the given project object as value.
|
static void |
main(String[] args) |
void |
runAfterFirstFetch(Runnable r) |
void |
startFetchingProjects() |
void |
stopFetchingProjects() |
private static final org.slf4j.Logger LOGGER
public static final String GITLAB_URL_KEY
public static final String GITLAB_TOKEN_KEY
private static final String GITLAB_URL
private static final String GITLAB_TOKEN
private static final String GITLAB_DEFAULT_GUEST_TOKEN
private static final String SYSTEM_CONFIG_FILENAME
private static final String BENCHMARK_CONFIG_FILENAME
private static final int MAX_PARSING_ERRORS
private static final int MAX_SIZE_OF_PROJECT_VISIBILITY_CHACHE
private static final int VISIBILITY_CACHE_ELEMENT_LIFETIME_IN_SECS
protected static final int GITLAB_VISIBILITY_PUBLIC_ID
protected static final int GITLAB_VISIBILITY_PROTECTED_ID
protected static final int GITLAB_VISIBILITY_PRIVATE_ID
private org.gitlab.api.GitlabAPI api
private Timer timer
private int repeatInterval
private boolean projectsFetched
public GitlabControllerImpl()
public GitlabControllerImpl(boolean startFetchingProjects,
boolean useCache)
public GitlabControllerImpl(String token, boolean startFetchingProjects, boolean useCache)
public void runAfterFirstFetch(Runnable r)
public void startFetchingProjects()
protected static Stream<org.apache.commons.lang3.tuple.Pair<String,Project>> listUris(Project p)
p - the project from which the benchmark and system URIs should be
readpublic void stopFetchingProjects()
stopFetchingProjects in interface GitlabControllerpublic List<Project> getAllProjects()
getAllProjects in interface GitlabControllerpublic Project gitlabToProject(org.gitlab.api.models.GitlabProject project)
gitlabToProject in interface GitlabControllerpublic static void main(String[] args) throws InterruptedException, IOException
InterruptedExceptionIOExceptionpublic org.apache.jena.rdf.model.Model getCheckedModel(byte[] modelData,
String modelType,
String projectName)
getCheckedModel in interface GitlabControllerprotected void handleErrorMsg(String message, Exception e, boolean logMsgIfAlreadyKnown)
message - the error message that should be loggede - the exception that should be logged (only if the error hasn't been
logged before). Can be null.logMsgIfAlreadyKnown - if true the message will be logged even if it has been
logged before. If the flag is set to false redundant
messages will be ignored.protected Set<String> getProjectsOfUser(String mail) throws IOException
mail - the e-mail address of the user for which the project names should
be retrievedIOException - If the Gitlab API throws an IOExceptionprotected org.gitlab.api.models.GitlabUser getUserByMail(String mail) throws IOException
mail - the mail address of the usernull if it could not be
found.IOException - If the Gitlab API throws an IOExceptionprotected List<org.gitlab.api.models.GitlabProject> getProjectsVisibleForUser(org.gitlab.api.models.GitlabUser user) throws IOException
IOExceptionCopyright © 2017–2018. All rights reserved.