Class GitConfigSource

  • All Implemented Interfaces:
    org.github.gestalt.config.source.ConfigSource

    public final class GitConfigSource
    extends java.lang.Object
    implements org.github.gestalt.config.source.ConfigSource
    Loads a file from git.
    • Constructor Summary

      Constructors 
      Constructor Description
      GitConfigSource​(java.lang.String repoURI, java.nio.file.Path localRepoDirectory, java.lang.String configFilePath, java.lang.String branch, org.eclipse.jgit.transport.CredentialsProvider credentials, org.eclipse.jgit.transport.SshSessionFactory sshSessionFactory)
      Create a new GitConfigSources.
      GitConfigSource​(java.lang.String repoURI, java.nio.file.Path localRepoDirectory, java.lang.String configFilePath, java.lang.String branch, org.eclipse.jgit.transport.CredentialsProvider credentials, org.eclipse.jgit.transport.SshSessionFactory sshSessionFactory, org.github.gestalt.config.tag.Tags tags)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tags should be added via the builder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String format()  
      org.github.gestalt.config.tag.Tags getTags()  
      int hashCode()  
      boolean hasList()  
      boolean hasStream()  
      java.util.UUID id()  
      java.util.List<org.github.gestalt.config.utils.Pair<java.lang.String,​java.lang.String>> loadList()  
      java.io.InputStream loadStream()  
      java.lang.String name()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.github.gestalt.config.source.ConfigSource

        failOnErrors
    • Constructor Detail

      • GitConfigSource

        public GitConfigSource​(java.lang.String repoURI,
                               java.nio.file.Path localRepoDirectory,
                               java.lang.String configFilePath,
                               java.lang.String branch,
                               org.eclipse.jgit.transport.CredentialsProvider credentials,
                               org.eclipse.jgit.transport.SshSessionFactory sshSessionFactory)
                        throws org.github.gestalt.config.exceptions.GestaltException
        Create a new GitConfigSources.
        Parameters:
        repoURI - the URI to the git repo
        localRepoDirectory - the local directory you want to save the git repo to.
        configFilePath - the path to the config file in the git repo
        branch - the branch you want to pull from git
        credentials - If authenticating with credentials, the CredentialsProvider such as UsernamePasswordCredentialsProvider
        sshSessionFactory - If using sshd the SshSessionFactory, this uses apache mina-sshd. The easiest way is to use the apache mina-sshd SshdSessionFactoryBuilder.
        Throws:
        org.github.gestalt.config.exceptions.GestaltException - if there is a badly configured git repo
      • GitConfigSource

        @Deprecated(since="0.26.0",
                    forRemoval=true)
        public GitConfigSource​(java.lang.String repoURI,
                               java.nio.file.Path localRepoDirectory,
                               java.lang.String configFilePath,
                               java.lang.String branch,
                               org.eclipse.jgit.transport.CredentialsProvider credentials,
                               org.eclipse.jgit.transport.SshSessionFactory sshSessionFactory,
                               org.github.gestalt.config.tag.Tags tags)
                        throws org.github.gestalt.config.exceptions.GestaltException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Tags should be added via the builder. Storage of the tags have been moved to ConfigSourcePackage.getTags().
        Create a new GitConfigSources.
        Parameters:
        repoURI - the URI to the git repo
        localRepoDirectory - the local directory you want to save the git repo to.
        configFilePath - the path to the config file in the git repo
        branch - the branch you want to pull from git
        credentials - If authenticating with credentials, the CredentialsProvider such as UsernamePasswordCredentialsProvider
        sshSessionFactory - If using sshd the SshSessionFactory, this uses apache mina-sshd. The easiest way is to use the apache mina-sshd SshdSessionFactoryBuilder.
        tags - tags associated with the source
        Throws:
        org.github.gestalt.config.exceptions.GestaltException - if there is a badly configured git repo
    • Method Detail

      • hasStream

        public boolean hasStream()
        Specified by:
        hasStream in interface org.github.gestalt.config.source.ConfigSource
      • loadStream

        public java.io.InputStream loadStream()
                                       throws org.github.gestalt.config.exceptions.GestaltException
        Specified by:
        loadStream in interface org.github.gestalt.config.source.ConfigSource
        Throws:
        org.github.gestalt.config.exceptions.GestaltException
      • hasList

        public boolean hasList()
        Specified by:
        hasList in interface org.github.gestalt.config.source.ConfigSource
      • loadList

        public java.util.List<org.github.gestalt.config.utils.Pair<java.lang.String,​java.lang.String>> loadList()
                                                                                                               throws org.github.gestalt.config.exceptions.GestaltException
        Specified by:
        loadList in interface org.github.gestalt.config.source.ConfigSource
        Throws:
        org.github.gestalt.config.exceptions.GestaltException
      • format

        public java.lang.String format()
        Specified by:
        format in interface org.github.gestalt.config.source.ConfigSource
      • name

        public java.lang.String name()
        Specified by:
        name in interface org.github.gestalt.config.source.ConfigSource
      • id

        public java.util.UUID id()
        Specified by:
        id in interface org.github.gestalt.config.source.ConfigSource
      • getTags

        public org.github.gestalt.config.tag.Tags getTags()
        Specified by:
        getTags in interface org.github.gestalt.config.source.ConfigSource
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object