Class GitScmProviderRepository
- java.lang.Object
-
- org.apache.maven.scm.provider.ScmProviderRepository
-
- org.apache.maven.scm.provider.ScmProviderRepositoryWithHost
-
- org.apache.maven.scm.provider.git.repository.GitScmProviderRepository
-
public class GitScmProviderRepository extends ScmProviderRepositoryWithHost
-
-
Field Summary
Fields Modifier and Type Field Description private RepositoryUrlfetchInfoThe URL used to fetch from the upstream repository.private static java.util.regex.PatternHOST_AND_PORT_EXTRACTORstatic java.lang.StringPROTOCOL_FILEUse local file as transport.static java.lang.StringPROTOCOL_GITUse gits internal protocol.static java.lang.StringPROTOCOL_HTTPUse the standard port 80 http protocol.static java.lang.StringPROTOCOL_HTTPSUse the standard port 443 https protocol.static java.lang.StringPROTOCOL_NONENo special protocol specified.static java.lang.StringPROTOCOL_RSYNCUse rsync for retrieving the data TODO implement!static java.lang.StringPROTOCOL_SEPARATORThis trails every protocol.static java.lang.StringPROTOCOL_SSHUse secure shell protocol.private java.lang.StringproviderThis may either 'git' or 'jgit' depending on the underlying implementation being used.private RepositoryUrlpushInfoThe URL used to push to the upstream repository.static java.lang.StringURL_DELIMITER_FETCHSequence used to delimit the fetch URL.static java.lang.StringURL_DELIMITER_PUSHSequence used to delimit the push URL.
-
Constructor Summary
Constructors Constructor Description GitScmProviderRepository(java.lang.String url)GitScmProviderRepository(java.lang.String url, java.lang.String user, java.lang.String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RepositoryUrlgetFetchInfo()java.lang.StringgetFetchUrl()java.lang.StringgetFetchUrlWithMaskedPassword()java.lang.StringgetProvider()RepositoryUrlgetPushInfo()java.lang.StringgetPushUrl()java.lang.StringgetPushUrlWithMaskedPassword()java.lang.StringgetRelativePath(ScmProviderRepository ancestor)Get the relative path between the repository provided as argument and the current repository.private java.lang.StringgetUrl(RepositoryUrl repoUrl)private java.lang.StringparseHostAndPort(RepositoryUrl repoUrl, java.lang.String url)Parse server and port from the given url and fill it into the given RepositoryUrl.private java.lang.StringparseProtocol(RepositoryUrl repoUrl, java.lang.String url)Parse the protocol from the given url and fill it into the given RepositoryUrl.private RepositoryUrlparseUrl(java.lang.String url)Parse the given url string and store all the extracted information in aRepositoryUrlprivate java.lang.StringparseUserInfo(RepositoryUrl repoUrl, java.lang.String url)Parse the user information from the given url and fill user name and password into the given RepositoryUrl.java.lang.StringtoString()-
Methods inherited from class org.apache.maven.scm.provider.ScmProviderRepositoryWithHost
getHost, getPassphrase, getPort, getPrivateKey, setHost, setPassphrase, setPort, setPrivateKey
-
Methods inherited from class org.apache.maven.scm.provider.ScmProviderRepository
getParent, getPassword, getUser, getWorkItem, isPersistCheckout, isPushChanges, setPassword, setPersistCheckout, setPushChanges, setUser, setWorkItem
-
-
-
-
Field Detail
-
URL_DELIMITER_FETCH
public static final java.lang.String URL_DELIMITER_FETCH
Sequence used to delimit the fetch URL.- See Also:
- Constant Field Values
-
URL_DELIMITER_PUSH
public static final java.lang.String URL_DELIMITER_PUSH
Sequence used to delimit the push URL.- See Also:
- Constant Field Values
-
PROTOCOL_SEPARATOR
public static final java.lang.String PROTOCOL_SEPARATOR
This trails every protocol.- See Also:
- Constant Field Values
-
PROTOCOL_FILE
public static final java.lang.String PROTOCOL_FILE
Use local file as transport.- See Also:
- Constant Field Values
-
PROTOCOL_GIT
public static final java.lang.String PROTOCOL_GIT
Use gits internal protocol.- See Also:
- Constant Field Values
-
PROTOCOL_SSH
public static final java.lang.String PROTOCOL_SSH
Use secure shell protocol.- See Also:
- Constant Field Values
-
PROTOCOL_HTTP
public static final java.lang.String PROTOCOL_HTTP
Use the standard port 80 http protocol.- See Also:
- Constant Field Values
-
PROTOCOL_HTTPS
public static final java.lang.String PROTOCOL_HTTPS
Use the standard port 443 https protocol.- See Also:
- Constant Field Values
-
PROTOCOL_RSYNC
public static final java.lang.String PROTOCOL_RSYNC
Use rsync for retrieving the data TODO implement!- See Also:
- Constant Field Values
-
HOST_AND_PORT_EXTRACTOR
private static final java.util.regex.Pattern HOST_AND_PORT_EXTRACTOR
-
PROTOCOL_NONE
public static final java.lang.String PROTOCOL_NONE
No special protocol specified. Git will either use git:// or ssh:// depending on whether we work locally or over the network.- See Also:
- Constant Field Values
-
provider
private java.lang.String provider
This may either 'git' or 'jgit' depending on the underlying implementation being used.
-
fetchInfo
private RepositoryUrl fetchInfo
The URL used to fetch from the upstream repository.
-
pushInfo
private RepositoryUrl pushInfo
The URL used to push to the upstream repository.
-
-
Constructor Detail
-
GitScmProviderRepository
public GitScmProviderRepository(java.lang.String url) throws ScmException- Throws:
ScmException
-
GitScmProviderRepository
public GitScmProviderRepository(java.lang.String url, java.lang.String user, java.lang.String password) throws ScmException- Throws:
ScmException
-
-
Method Detail
-
getProvider
public java.lang.String getProvider()
- Returns:
- either 'git' or 'jgit' depending on the underlying implementation being used
-
getFetchInfo
public RepositoryUrl getFetchInfo()
-
getPushInfo
public RepositoryUrl getPushInfo()
-
getFetchUrl
public java.lang.String getFetchUrl()
- Returns:
- the URL used to fetch from the upstream repository
-
getFetchUrlWithMaskedPassword
public java.lang.String getFetchUrlWithMaskedPassword()
- Returns:
- the URL to fetch from with masked password used for logging purposes only
-
getPushUrl
public java.lang.String getPushUrl()
- Returns:
- the URL used to push to the upstream repository
-
getPushUrlWithMaskedPassword
public java.lang.String getPushUrlWithMaskedPassword()
- Returns:
- the URL to push to with masked password used for logging purposes only
-
parseUrl
private RepositoryUrl parseUrl(java.lang.String url) throws ScmException
Parse the given url string and store all the extracted information in aRepositoryUrl- Parameters:
url- to parse- Returns:
- filled with the information from the given URL
- Throws:
ScmException
-
getUrl
private java.lang.String getUrl(RepositoryUrl repoUrl)
- Parameters:
repoUrl-- Returns:
- TODO
-
parseProtocol
private java.lang.String parseProtocol(RepositoryUrl repoUrl, java.lang.String url) throws ScmException
Parse the protocol from the given url and fill it into the given RepositoryUrl.- Parameters:
repoUrl-url-- Returns:
- the given url with the protocol parts removed
- Throws:
ScmException
-
parseUserInfo
private java.lang.String parseUserInfo(RepositoryUrl repoUrl, java.lang.String url) throws ScmException
Parse the user information from the given url and fill user name and password into the given RepositoryUrl.- Parameters:
repoUrl-url-- Returns:
- the given url with the user parts removed
- Throws:
ScmException
-
parseHostAndPort
private java.lang.String parseHostAndPort(RepositoryUrl repoUrl, java.lang.String url) throws ScmException
Parse server and port from the given url and fill it into the given RepositoryUrl.- Parameters:
repoUrl-url-- Returns:
- the given url with the server parts removed
- Throws:
ScmException
-
getRelativePath
public java.lang.String getRelativePath(ScmProviderRepository ancestor)
Get the relative path between the repository provided as argument and the current repository.- Overrides:
getRelativePathin classScmProviderRepository- Parameters:
ancestor- another repository that should be ancestor of this one- Returns:
- the relative path or
nullif it can't be resolved
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-