Class RepositoryManagementServiceImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.repository.RepositoryManagementServiceImpl
- All Implemented Interfaces:
RepositoryManagementService
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryManagementServiceImpl
(RepositoryManagementServiceInternal repositoryManagementServiceInternal, SiteService siteService, AuditServiceInternal auditServiceInternal, SecurityService securityService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addRemote
(String siteId, RemoteRepository remoteRepository) cancelFailedPull
(String siteId) commitResolution
(String siteId, String commitMessage) getDiffForConflictedFile
(String siteId, String path) getRepositoryStatus
(String siteId) boolean
isCorrupted
(String siteId, GitRepositories repositoryType) Checks if a given Git repository is corruptedlistRemotes
(String siteId) 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 repositoryresolveConflict
(String siteId, String path, String resolution) boolean
unlockRepository
(String siteId, GitRepositories repositoryType) Unlock local git repository
-
Constructor Details
-
RepositoryManagementServiceImpl
@ConstructorProperties({"repositoryManagementServiceInternal","siteService","auditServiceInternal","securityService"}) public RepositoryManagementServiceImpl(RepositoryManagementServiceInternal repositoryManagementServiceInternal, SiteService siteService, AuditServiceInternal auditServiceInternal, SecurityService securityService)
-
-
Method Details
-
addRemote
public boolean addRemote(String siteId, RemoteRepository remoteRepository) throws ServiceLayerException, InvalidRemoteUrlException, RemoteRepositoryNotFoundException - Specified by:
addRemote
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
InvalidRemoteUrlException
RemoteRepositoryNotFoundException
-
listRemotes
- Specified by:
listRemotes
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
-
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 InvalidRemoteUrlException, ServiceLayerException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException -
removeRemote
public boolean removeRemote(String siteId, String remoteName) throws SiteNotFoundException, RemoteNotRemovableException - Specified by:
removeRemote
in interfaceRepositoryManagementService
- Throws:
SiteNotFoundException
RemoteNotRemovableException
-
getRepositoryStatus
- Specified by:
getRepositoryStatus
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
-
resolveConflict
public RepositoryStatus resolveConflict(String siteId, String path, String resolution) throws ServiceLayerException - Specified by:
resolveConflict
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
-
getDiffForConflictedFile
public DiffConflictedFile getDiffForConflictedFile(String siteId, String path) throws ServiceLayerException - Specified by:
getDiffForConflictedFile
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
-
commitResolution
public RepositoryStatus commitResolution(String siteId, String commitMessage) throws ServiceLayerException - Specified by:
commitResolution
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
-
cancelFailedPull
- Specified by:
cancelFailedPull
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
-
unlockRepository
public boolean unlockRepository(String siteId, GitRepositories repositoryType) throws SiteNotFoundException Description copied from interface:RepositoryManagementService
Unlock local git repository- Specified by:
unlockRepository
in interfaceRepositoryManagementService
- Parameters:
siteId
- site identifier, if null or empty it is global repositoryrepositoryType
- repository type (GLOBAL, SANDBOX, PUBLISHED)- Returns:
- true if successful
- Throws:
SiteNotFoundException
-
isCorrupted
public boolean isCorrupted(String siteId, GitRepositories repositoryType) throws ServiceLayerException Description copied from interface:RepositoryManagementService
Checks if a given Git repository is corrupted- Specified by:
isCorrupted
in interfaceRepositoryManagementService
- 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:RepositoryManagementService
Repairs a corrupted Git repository- Specified by:
repairCorrupted
in interfaceRepositoryManagementService
- Parameters:
siteId
- the id of the siterepositoryType
- the type of the repository- Throws:
ServiceLayerException
- if there is any error repairing the repository
-