Class LfsConnectionFactory

  • public class LfsConnectionFactory
    extends Object
    Provides means to get a valid LFS connection for a given repository.
    • Constructor Detail

      • LfsConnectionFactory

        public LfsConnectionFactory()
    • Method Detail

      • getLfsConnection

        public static HttpConnection getLfsConnection​(Repository db,
                                                      String method,
                                                      String purpose)
                                               throws IOException
        Determine URL of LFS server by looking into config parameters lfs.url, lfs.[remote].url or remote.[remote].url. The LFS server URL is computed from remote.[remote].url by appending "/info/lfs". In case there is no URL configured, a SSH remote URI can be used to auto-detect the LFS URI by using the remote "git-lfs-authenticate" command.
        db - the repository to work with
        method - the method (GET,PUT,...) of the request this connection will be used for
        purpose - the action, e.g. Protocol.OPERATION_DOWNLOAD
        the connection for the lfs server. e.g. ""
      • getLfsContentConnection

        public static HttpConnection getLfsContentConnection​(Repository repo,
                                                             Protocol.Action action,
                                                             String method)
                                                      throws IOException
        Create a connection for the specified Protocol.Action.
        repo - the repo to fetch required configuration from
        action - the action for which to create a connection
        method - the target method (GET or PUT)
        a connection. output mode is not set.
        IOException - in case of any error.
      • toRequest

        public static Protocol.Request toRequest​(String operation,
                                                 LfsPointer... resources)
        operation - the operation to perform, e.g. Protocol.OPERATION_DOWNLOAD
        resources - the LFS resources affected
        a request that can be serialized to JSON