Package org.eclipse.jgit.lfs.internal
Class LfsConnectionFactory
- java.lang.Object
-
- org.eclipse.jgit.lfs.internal.LfsConnectionFactory
-
public class LfsConnectionFactory extends Object
Provides means to get a valid LFS connection for a given repository.
-
-
Constructor Summary
Constructors Constructor Description LfsConnectionFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpConnection
getLfsConnection(Repository db, String method, String purpose)
Determine URL of LFS server by looking into config parameters lfs.url, lfs.[remote].url or remote.[remote].url.static HttpConnection
getLfsContentConnection(Repository repo, Protocol.Action action, String method)
Create a connection for the specifiedProtocol.Action
.static Protocol.Request
toRequest(String operation, LfsPointer... resources)
-
-
-
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.- Parameters:
db
- the repository to work withmethod
- the method (GET,PUT,...) of the request this connection will be used forpurpose
- the action, e.g. Protocol.OPERATION_DOWNLOAD- Returns:
- the connection for the lfs server. e.g. "https://github.com/github/git-lfs.git/info/lfs"
- Throws:
IOException
-
getLfsContentConnection
@NonNull public static HttpConnection getLfsContentConnection(Repository repo, Protocol.Action action, String method) throws IOException
Create a connection for the specifiedProtocol.Action
.- Parameters:
repo
- the repo to fetch required configuration fromaction
- the action for which to create a connectionmethod
- the target method (GET or PUT)- Returns:
- a connection. output mode is not set.
- Throws:
IOException
- in case of any error.
-
toRequest
public static Protocol.Request toRequest(String operation, LfsPointer... resources)
- Parameters:
operation
- the operation to perform, e.g. Protocol.OPERATION_DOWNLOADresources
- the LFS resources affected- Returns:
- a request that can be serialized to JSON
-
-