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 classWraps the static method calls toGitandCloneCommandallowing for easier unit testing.Nested classes/interfaces inherited from interface SearchPathLocator
SearchPathLocator.Locations -
Field Summary
FieldsFields inherited from class AbstractScmAccessor
loggerFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionJGitEnvironmentRepository(org.springframework.core.env.ConfigurableEnvironment environment, JGitEnvironmentProperties properties, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.eclipse.jgit.transport.FetchResultorg.springframework.cloud.config.environment.EnvironmentlonggetLocations(String application, String profile, String label) intintorg.eclipse.jgit.api.TransportConfigCallbackbooleanbooleanbooleanbooleanbooleanprotected voidonPullInvalidIndex(org.eclipse.jgit.api.Git git, org.eclipse.jgit.api.errors.JGitInternalException e) 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 voidMethods inherited from class AbstractScmEnvironmentRepository
findOne, getOrder, setOrderMethods inherited from class AbstractScmAccessor
createBaseDir, getBasedir, getEnvironment, getPassphrase, getPassword, getSearchLocations, getSearchPaths, getUri, getUsername, getWorkingDirectory, isStrictHostKeyChecking, setBasedir, setEnvironment, setPassphrase, setPassword, setResourceLoader, setSearchPaths, setStrictHostKeyChecking, setUri, setUsernameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EnvironmentRepository
findOne
-
Field Details
-
MESSAGE
-
-
Constructor Details
-
JGitEnvironmentRepository
public JGitEnvironmentRepository(org.springframework.core.env.ConfigurableEnvironment environment, JGitEnvironmentProperties properties, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
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) -
findOne
public org.springframework.cloud.config.environment.Environment findOne(String application, String profile, String label, boolean includeOrigin) - Specified by:
findOnein interfaceEnvironmentRepository- Overrides:
findOnein classAbstractScmEnvironmentRepository
-
getLocations
- Specified by:
getLocationsin interfaceSearchPathLocator
-
afterPropertiesSet
-
refresh
-
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)
-