Search in sources :

Example 1 with ClasspathRepositoryLocation

use of org.phoenicis.repository.location.ClasspathRepositoryLocation in project phoenicis by PhoenicisOrg.

the class FilesystemJsonRepositoryLocationLoader method loadRepositoryLocations.

@Override
public List<RepositoryLocation<? extends Repository>> loadRepositoryLocations() {
    List<RepositoryLocation<? extends Repository>> result = new ArrayList<>();
    File repositoryListFile = new File(repositoryListPath);
    if (repositoryListFile.exists()) {
        try {
            result = this.objectMapper.readValue(new File(repositoryListPath), TypeFactory.defaultInstance().constructParametricType(List.class, RepositoryLocation.class));
        } catch (IOException e) {
            LOGGER.error("Couldn't load repository location list", e);
        }
    } else {
        try {
            result.add(new GitRepositoryLocation.Builder().withGitRepositoryUri(new URL("https://github.com/PhoenicisOrg/scripts").toURI()).withBranch("master").build());
            result.add(new ClasspathRepositoryLocation("/org/phoenicis/repository"));
        } catch (URISyntaxException | MalformedURLException e) {
            LOGGER.error("Couldn't create default repository location list", e);
        }
    }
    return result;
}
Also used : Repository(org.phoenicis.repository.types.Repository) MalformedURLException(java.net.MalformedURLException) ArrayList(java.util.ArrayList) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) File(java.io.File) GitRepositoryLocation(org.phoenicis.repository.location.GitRepositoryLocation) RepositoryLocation(org.phoenicis.repository.location.RepositoryLocation) ClasspathRepositoryLocation(org.phoenicis.repository.location.ClasspathRepositoryLocation) URL(java.net.URL) ClasspathRepositoryLocation(org.phoenicis.repository.location.ClasspathRepositoryLocation)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 ClasspathRepositoryLocation (org.phoenicis.repository.location.ClasspathRepositoryLocation)1 GitRepositoryLocation (org.phoenicis.repository.location.GitRepositoryLocation)1 RepositoryLocation (org.phoenicis.repository.location.RepositoryLocation)1 Repository (org.phoenicis.repository.types.Repository)1