Class RepositoryManagementServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v2.service.repository.RepositoryManagementServiceImpl
-
- All Implemented Interfaces:
RepositoryManagementService
public class RepositoryManagementServiceImpl extends Object implements RepositoryManagementService
-
-
Constructor Summary
Constructors Constructor Description RepositoryManagementServiceImpl(RepositoryManagementServiceInternal repositoryManagementServiceInternal, SiteService siteService, AuditServiceInternal auditServiceInternal, SecurityService securityService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addRemote(String siteId, RemoteRepository remoteRepository)
RepositoryStatus
cancelFailedPull(String siteId)
RepositoryStatus
commitResolution(String siteId, String commitMessage)
DiffConflictedFile
getDiffForConflictedFile(String siteId, String path)
RepositoryStatus
getRepositoryStatus(String siteId)
boolean
isCorrupted(String siteId, GitRepositories repositoryType)
Checks if a given Git repository is corruptedList<RemoteRepositoryInfo>
listRemotes(String siteId)
MergeResult
pullFromRemote(String siteId, String remoteName, String remoteBranch, String mergeStrategy)
boolean
pushToRemote(String siteId, String remoteName, String remoteBranch, boolean force)
void
rebuildDatabase(String siteId)
boolean
removeRemote(String siteId, String remoteName)
void
repairCorrupted(String siteId, GitRepositories repositoryType)
Repairs a corrupted Git repositoryRepositoryStatus
resolveConflict(String siteId, String path, String resolution)
boolean
unlockRepository(String siteId, GitRepositories repositoryType)
Unlock local git repository
-
-
-
Constructor Detail
-
RepositoryManagementServiceImpl
@ConstructorProperties({"repositoryManagementServiceInternal","siteService","auditServiceInternal","securityService"}) public RepositoryManagementServiceImpl(RepositoryManagementServiceInternal repositoryManagementServiceInternal, SiteService siteService, AuditServiceInternal auditServiceInternal, SecurityService securityService)
-
-
Method Detail
-
addRemote
public boolean addRemote(String siteId, RemoteRepository remoteRepository) throws ServiceLayerException, InvalidRemoteUrlException, RemoteRepositoryNotFoundException
- Specified by:
addRemote
in interfaceRepositoryManagementService
- Throws:
ServiceLayerException
InvalidRemoteUrlException
RemoteRepositoryNotFoundException
-
listRemotes
public List<RemoteRepositoryInfo> listRemotes(String siteId) throws ServiceLayerException
- 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
-
rebuildDatabase
public void rebuildDatabase(String siteId) throws SiteNotFoundException
- Specified by:
rebuildDatabase
in interfaceRepositoryManagementService
- Throws:
SiteNotFoundException
-
removeRemote
public boolean removeRemote(String siteId, String remoteName) throws SiteNotFoundException, RemoteNotRemovableException
- Specified by:
removeRemote
in interfaceRepositoryManagementService
- Throws:
SiteNotFoundException
RemoteNotRemovableException
-
getRepositoryStatus
public RepositoryStatus getRepositoryStatus(String siteId) throws ServiceLayerException
- 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
public RepositoryStatus cancelFailedPull(String siteId) throws ServiceLayerException
- 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
-
-