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
An
EnvironmentRepository
backed by a single git repository.- Author:
- Dave Syer, Roy Clarkson, Marcos Barbero, Daniel Lavoie, Ryan Lynch, Gareth Clay, ChaoDong Xi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Wraps the static method calls toGit
andCloneCommand
allowing for easier unit testing.Nested classes/interfaces inherited from interface org.springframework.cloud.config.server.environment.SearchPathLocator
SearchPathLocator.Locations
-
Field Summary
FieldsFields inherited from class org.springframework.cloud.config.server.support.AbstractScmAccessor
logger
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorsConstructorDescriptionJGitEnvironmentRepository
(org.springframework.core.env.ConfigurableEnvironment environment, JGitEnvironmentProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected org.eclipse.jgit.transport.FetchResult
long
getLocations
(String application, String profile, String label) int
int
org.eclipse.jgit.api.TransportConfigCallback
boolean
boolean
boolean
boolean
boolean
protected void
onPullInvalidIndex
(org.eclipse.jgit.api.Git git, org.eclipse.jgit.api.errors.JGitInternalException e) Get the working directory ready.void
setCloneOnStart
(boolean cloneOnStart) void
setDefaultLabel
(String defaultLabel) void
setDeleteUntrackedBranches
(boolean deleteUntrackedBranches) void
setForcePull
(boolean forcePull) void
setGitCredentialsProviderFactory
(GitCredentialsProviderFactory gitCredentialsProviderFactory) void
setGitFactory
(JGitEnvironmentRepository.JGitFactory gitFactory) void
setLastRefresh
(long lastRefresh) void
setRefreshRate
(int refreshRate) void
setSkipSslValidation
(boolean skipSslValidation) void
setTimeout
(int timeout) void
setTransportConfigCallback
(org.eclipse.jgit.api.TransportConfigCallback transportConfigCallback) void
setTryMasterBranch
(boolean tryMasterBranch) protected boolean
shouldPull
(org.eclipse.jgit.api.Git git) protected void
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 Details
-
MESSAGE
Error message for URI for git repo.- See Also:
-
-
Constructor Details
-
JGitEnvironmentRepository
public JGitEnvironmentRepository(org.springframework.core.env.ConfigurableEnvironment environment, JGitEnvironmentProperties properties)
-
-
Method Details
-
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
-
setGitFactory
-
setGitCredentialsProviderFactory
public void setGitCredentialsProviderFactory(GitCredentialsProviderFactory gitCredentialsProviderFactory) -
getDefaultLabel
-
setDefaultLabel
-
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
- Specified by:
getLocations
in interfaceSearchPathLocator
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
refresh
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
-
warn
-
getLastRefresh
public long getLastRefresh() -
setLastRefresh
public void setLastRefresh(long lastRefresh)
-