Class RepositoryManagementServiceInternalImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.repository.internal.RepositoryManagementServiceInternalImpl
- All Implemented Interfaces:
RepositoryManagementServiceInternal
public class RepositoryManagementServiceInternalImpl
extends Object
implements RepositoryManagementServiceInternal
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.core.task.TaskExecutor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addRemote
(String siteId, RemoteRepository remoteRepository) boolean
cancelFailedPull
(String siteId) boolean
commitResolution
(String siteId, String commitMessage) getDiffForConflictedFile
(String siteId, String path) getRepositoryStatus
(String siteId) protected void
Git operation to add all modified filesprotected void
Git operation to commit all pending changesprotected void
Git operation to remove all missing filesboolean
isCorrupted
(String siteId, GitRepositories repositoryType) Checks if a given Git repository is corruptedlistRemotes
(String siteId, String sandboxBranch) pullFromRemote
(String siteId, String remoteName, String remoteBranch, String mergeStrategy) boolean
pushToRemote
(String siteId, String remoteName, String remoteBranch, boolean force) boolean
removeRemote
(String siteId, String remoteName) void
repairCorrupted
(String siteId, GitRepositories repositoryType) Repairs a corrupted Git repositoryboolean
resolveConflict
(String siteId, String path, String resolution) void
setBatchSizeGitLog
(int batchSizeGitLog) void
setContentRepository
(ContentRepository contentRepository) void
setContentRepositoryV2
(ContentRepository contentRepositoryV2) void
setEncryptor
(org.craftercms.commons.crypto.TextEncryptor encryptor) void
setGeneralLockService
(GeneralLockService generalLockService) void
setGitRepositoryHelper
(GitRepositoryHelper gitRepositoryHelper) void
setNotificationService
(NotificationService notificationService) void
setRemoteRepositoryDao
(RemoteRepositoryDAO remoteRepositoryDao) void
setRetryingDatabaseOperationFacade
(RetryingDatabaseOperationFacade retryingDatabaseOperationFacade) void
setRetryingRepositoryOperationFacade
(RetryingRepositoryOperationFacade retryingRepositoryOperationFacade) void
setSecurityService
(SecurityService securityService) void
setSiteService
(SiteService siteService) void
setStudioConfiguration
(StudioConfiguration studioConfiguration) void
setTaskExecutor
(org.springframework.core.task.TaskExecutor taskExecutor) void
setUserServiceInternal
(UserServiceInternal userServiceInternal) boolean
unlockRepository
(String siteId, GitRepositories repositoryType) Unlock local git repository
-
Field Details
-
taskExecutor
protected org.springframework.core.task.TaskExecutor taskExecutor
-
-
Constructor Details
-
RepositoryManagementServiceInternalImpl
public RepositoryManagementServiceInternalImpl()
-
-
Method Details
-
addRemote
public boolean addRemote(String siteId, RemoteRepository remoteRepository) throws ServiceLayerException, InvalidRemoteUrlException, RemoteRepositoryNotFoundException - Specified by:
addRemote
in interfaceRepositoryManagementServiceInternal
- Throws:
ServiceLayerException
InvalidRemoteUrlException
RemoteRepositoryNotFoundException
-
listRemotes
- Specified by:
listRemotes
in interfaceRepositoryManagementServiceInternal
-
pullFromRemote
public MergeResult pullFromRemote(String siteId, String remoteName, String remoteBranch, String mergeStrategy) throws InvalidRemoteUrlException, ServiceLayerException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException -
pushToRemote
public boolean pushToRemote(String siteId, String remoteName, String remoteBranch, boolean force) throws ServiceLayerException, InvalidRemoteUrlException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException -
removeRemote
- Specified by:
removeRemote
in interfaceRepositoryManagementServiceInternal
- Throws:
RemoteNotRemovableException
-
getRepositoryStatus
- Specified by:
getRepositoryStatus
in interfaceRepositoryManagementServiceInternal
- Throws:
ServiceLayerException
-
resolveConflict
public boolean resolveConflict(String siteId, String path, String resolution) throws ServiceLayerException - Specified by:
resolveConflict
in interfaceRepositoryManagementServiceInternal
- Throws:
ServiceLayerException
-
getDiffForConflictedFile
public DiffConflictedFile getDiffForConflictedFile(String siteId, String path) throws ServiceLayerException - Specified by:
getDiffForConflictedFile
in interfaceRepositoryManagementServiceInternal
- Throws:
ServiceLayerException
-
commitResolution
- Specified by:
commitResolution
in interfaceRepositoryManagementServiceInternal
- Throws:
ServiceLayerException
-
gitRemove
protected void gitRemove(org.eclipse.jgit.api.Git git, String siteId, Set<String> files) throws org.eclipse.jgit.api.errors.GitAPIException Git operation to remove all missing files- Parameters:
git
- the git clientsiteId
- the site identifierfiles
- set of files to remove- Throws:
org.eclipse.jgit.api.errors.GitAPIException
-
gitAdd
protected void gitAdd(org.eclipse.jgit.api.Git git, String siteId, Set<String> files) throws org.eclipse.jgit.api.errors.GitAPIException Git operation to add all modified files- Parameters:
git
- the git clientsiteId
- the site identifierfiles
- set of files to add- Throws:
org.eclipse.jgit.api.errors.GitAPIException
-
gitCommit
protected void gitCommit(org.eclipse.jgit.api.Git git, String siteId, String commitMessage) throws UserNotFoundException, ServiceLayerException, org.eclipse.jgit.api.errors.GitAPIException Git operation to commit all pending changes- Parameters:
git
- the git clientsiteId
- the site identifiercommitMessage
- commit message- Throws:
UserNotFoundException
ServiceLayerException
org.eclipse.jgit.api.errors.GitAPIException
-
cancelFailedPull
- Specified by:
cancelFailedPull
in interfaceRepositoryManagementServiceInternal
- Throws:
ServiceLayerException
-
unlockRepository
Description copied from interface:RepositoryManagementServiceInternal
Unlock local git repository- Specified by:
unlockRepository
in interfaceRepositoryManagementServiceInternal
- Parameters:
siteId
- site identifier, if null or empty it is global repositoryrepositoryType
- repository type (GLOBAL, SANDBOX, PUBLISHED)- Returns:
- true if successful
-
isCorrupted
public boolean isCorrupted(String siteId, GitRepositories repositoryType) throws ServiceLayerException Description copied from interface:RepositoryManagementServiceInternal
Checks if a given Git repository is corrupted- Specified by:
isCorrupted
in interfaceRepositoryManagementServiceInternal
- Parameters:
siteId
- the id of the siterepositoryType
- the type of the repository- Returns:
- true if the repo is corrupted
- Throws:
ServiceLayerException
- if there is any error checking the repository
-
repairCorrupted
public void repairCorrupted(String siteId, GitRepositories repositoryType) throws ServiceLayerException Description copied from interface:RepositoryManagementServiceInternal
Repairs a corrupted Git repository- Specified by:
repairCorrupted
in interfaceRepositoryManagementServiceInternal
- Parameters:
siteId
- the id of the siterepositoryType
- the type of the repository- Throws:
ServiceLayerException
- if there is any error repairing the repository
-
setRemoteRepositoryDao
-
setStudioConfiguration
-
setNotificationService
-
setSecurityService
-
setUserServiceInternal
-
setContentRepository
-
setEncryptor
public void setEncryptor(org.craftercms.commons.crypto.TextEncryptor encryptor) -
setGeneralLockService
-
setSiteService
-
setGitRepositoryHelper
-
setContentRepositoryV2
-
setBatchSizeGitLog
public void setBatchSizeGitLog(int batchSizeGitLog) -
setRetryingRepositoryOperationFacade
public void setRetryingRepositoryOperationFacade(RetryingRepositoryOperationFacade retryingRepositoryOperationFacade) -
setRetryingDatabaseOperationFacade
public void setRetryingDatabaseOperationFacade(RetryingDatabaseOperationFacade retryingDatabaseOperationFacade) -
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
-