Class JGitEnvironmentRepository
- java.lang.Object
-
- org.springframework.cloud.config.server.support.AbstractScmAccessor
-
- org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository
-
- org.springframework.cloud.config.server.environment.JGitEnvironmentRepository
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,EnvironmentRepository,SearchPathLocator,org.springframework.context.ResourceLoaderAware,org.springframework.core.Ordered
- Direct Known Subclasses:
MultipleJGitEnvironmentRepository,MultipleJGitEnvironmentRepository.PatternMatchingJGitEnvironmentRepository
public class JGitEnvironmentRepository extends AbstractScmEnvironmentRepository implements EnvironmentRepository, SearchPathLocator, org.springframework.beans.factory.InitializingBean
AnEnvironmentRepositorybacked by a single git repository.- Author:
- Dave Syer, Roy Clarkson, Marcos Barbero, Daniel Lavoie, Ryan Lynch, Gareth Clay, ChaoDong Xi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJGitEnvironmentRepository.JGitFactoryWraps the static method calls toGitandCloneCommandallowing for easier unit testing.-
Nested classes/interfaces inherited from interface org.springframework.cloud.config.server.environment.SearchPathLocator
SearchPathLocator.Locations
-
-
Field Summary
Fields Modifier and Type Field Description static StringMESSAGEError message for URI for git repo.-
Fields inherited from class org.springframework.cloud.config.server.support.AbstractScmAccessor
logger
-
-
Constructor Summary
Constructors Constructor Description JGitEnvironmentRepository(org.springframework.core.env.ConfigurableEnvironment environment, JGitEnvironmentProperties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected org.eclipse.jgit.transport.FetchResultfetch(org.eclipse.jgit.api.Git git, String label)StringgetDefaultLabel()JGitEnvironmentRepository.JGitFactorygetGitFactory()longgetLastRefresh()SearchPathLocator.LocationsgetLocations(String application, String profile, String label)intgetRefreshRate()intgetTimeout()org.eclipse.jgit.api.TransportConfigCallbackgetTransportConfigCallback()booleanisCloneOnStart()booleanisDeleteUntrackedBranches()booleanisForcePull()booleanisSkipSslValidation()booleanisTryMasterBranch()protected voidonPullInvalidIndex(org.eclipse.jgit.api.Git git, org.eclipse.jgit.api.errors.JGitInternalException e)Stringrefresh(String label)Get the working directory ready.voidsetCloneOnStart(boolean cloneOnStart)voidsetDefaultLabel(String defaultLabel)voidsetDeleteUntrackedBranches(boolean deleteUntrackedBranches)voidsetForcePull(boolean forcePull)voidsetGitCredentialsProviderFactory(GitCredentialsProviderFactory gitCredentialsProviderFactory)voidsetGitFactory(JGitEnvironmentRepository.JGitFactory gitFactory)voidsetLastRefresh(long lastRefresh)voidsetRefreshRate(int refreshRate)voidsetSkipSslValidation(boolean skipSslValidation)voidsetTimeout(int timeout)voidsetTransportConfigCallback(org.eclipse.jgit.api.TransportConfigCallback transportConfigCallback)voidsetTryMasterBranch(boolean tryMasterBranch)protected booleanshouldPull(org.eclipse.jgit.api.Git git)protected voidwarn(String message, Exception ex)-
Methods inherited from class org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository
findOne, findOne, getOrder, setOrder
-
Methods inherited from class org.springframework.cloud.config.server.support.AbstractScmAccessor
createBaseDir, getBasedir, getEnvironment, getPassphrase, getPassword, getSearchLocations, getSearchPaths, getUri, getUsername, getWorkingDirectory, isStrictHostKeyChecking, setBasedir, setEnvironment, setPassphrase, setPassword, setResourceLoader, setSearchPaths, setStrictHostKeyChecking, setUri, setUsername
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.cloud.config.server.environment.EnvironmentRepository
findOne, findOne
-
-
-
-
Field Detail
-
MESSAGE
public static final String MESSAGE
Error message for URI for git repo.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JGitEnvironmentRepository
public JGitEnvironmentRepository(org.springframework.core.env.ConfigurableEnvironment environment, JGitEnvironmentProperties properties)
-
-
Method Detail
-
isTryMasterBranch
public boolean isTryMasterBranch()
-
setTryMasterBranch
public void setTryMasterBranch(boolean tryMasterBranch)
-
isCloneOnStart
public boolean isCloneOnStart()
-
setCloneOnStart
public void setCloneOnStart(boolean cloneOnStart)
-
getTimeout
public int getTimeout()
-
setTimeout
public void setTimeout(int timeout)
-
getRefreshRate
public int getRefreshRate()
-
setRefreshRate
public void setRefreshRate(int refreshRate)
-
getTransportConfigCallback
public org.eclipse.jgit.api.TransportConfigCallback getTransportConfigCallback()
-
setTransportConfigCallback
public void setTransportConfigCallback(org.eclipse.jgit.api.TransportConfigCallback transportConfigCallback)
-
getGitFactory
public JGitEnvironmentRepository.JGitFactory getGitFactory()
-
setGitFactory
public void setGitFactory(JGitEnvironmentRepository.JGitFactory gitFactory)
-
setGitCredentialsProviderFactory
public void setGitCredentialsProviderFactory(GitCredentialsProviderFactory gitCredentialsProviderFactory)
-
getDefaultLabel
public String getDefaultLabel()
-
setDefaultLabel
public void setDefaultLabel(String defaultLabel)
-
isForcePull
public boolean isForcePull()
-
setForcePull
public void setForcePull(boolean forcePull)
-
isDeleteUntrackedBranches
public boolean isDeleteUntrackedBranches()
-
setDeleteUntrackedBranches
public void setDeleteUntrackedBranches(boolean deleteUntrackedBranches)
-
isSkipSslValidation
public boolean isSkipSslValidation()
-
setSkipSslValidation
public void setSkipSslValidation(boolean skipSslValidation)
-
getLocations
public SearchPathLocator.Locations getLocations(String application, String profile, String label)
- Specified by:
getLocationsin interfaceSearchPathLocator
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
refresh
public String refresh(String label)
Get the working directory ready.- Parameters:
label- label to refresh- Returns:
- head id
-
shouldPull
protected boolean shouldPull(org.eclipse.jgit.api.Git git) throws org.eclipse.jgit.api.errors.GitAPIException- Throws:
org.eclipse.jgit.api.errors.GitAPIException
-
onPullInvalidIndex
protected void onPullInvalidIndex(org.eclipse.jgit.api.Git git, org.eclipse.jgit.api.errors.JGitInternalException e)
-
fetch
protected org.eclipse.jgit.transport.FetchResult fetch(org.eclipse.jgit.api.Git git, String label)
-
getLastRefresh
public long getLastRefresh()
-
setLastRefresh
public void setLastRefresh(long lastRefresh)
-
-