Search in sources :

Example 1 with EMPTY_FILE

use of org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.EMPTY_FILE in project studio by craftercms.

the class GitContentRepository method deleteParentFolder.

private String deleteParentFolder(Git git, Path parentFolder, boolean wasPage) throws GitAPIException, IOException {
    String parent = parentFolder.toString();
    String toRet = parent;
    try {
        GitRepositoryHelper helper = GitRepositoryHelper.getHelper(studioConfiguration, securityService, userServiceInternal, encryptor, generalLockService, retryingRepositoryOperationFacade);
        String folderToDelete = helper.getGitPath(parent);
        Path toDelete = Paths.get(git.getRepository().getDirectory().getParent(), parent);
        if (Files.exists(toDelete)) {
            List<String> dirs = Files.walk(toDelete).filter(x -> !x.equals(toDelete)).filter(Files::isDirectory).map(y -> y.getFileName().toString()).collect(Collectors.toList());
            List<String> files = Files.walk(toDelete, 1).filter(x -> !x.equals(toDelete)).filter(Files::isRegularFile).map(y -> y.getFileName().toString()).collect(Collectors.toList());
            if (wasPage || (CollectionUtils.isEmpty(dirs) && (CollectionUtils.isEmpty(files) || files.size() < 2 && files.get(0).equals(EMPTY_FILE)))) {
                if (CollectionUtils.isNotEmpty(dirs)) {
                    for (String child : dirs) {
                        Path childToDelete = Paths.get(folderToDelete, child);
                        deleteParentFolder(git, childToDelete, false);
                        RmCommand rmCommand = git.rm().addFilepattern(folderToDelete + FILE_SEPARATOR + child + FILE_SEPARATOR + "*").setCached(false);
                        retryingRepositoryOperationFacade.call(rmCommand);
                    }
                }
                if (CollectionUtils.isNotEmpty(files)) {
                    for (String child : files) {
                        RmCommand rmCommand = git.rm().addFilepattern(folderToDelete + FILE_SEPARATOR + child).setCached(false);
                        retryingRepositoryOperationFacade.call(rmCommand);
                    }
                }
            }
        }
    } catch (CryptoException e) {
        logger.error("Error deleting parent folder " + parentFolder.toString(), e);
    }
    return toRet;
}
Also used : Path(java.nio.file.Path) UserServiceInternal(org.craftercms.studio.api.v2.service.security.internal.UserServiceInternal) TextEncryptor(org.craftercms.commons.crypto.TextEncryptor) ZonedDateTime(java.time.ZonedDateTime) OBJ_TREE(org.eclipse.jgit.lib.Constants.OBJ_TREE) StringUtils(org.apache.commons.lang3.StringUtils) RevWalk(org.eclipse.jgit.revwalk.RevWalk) User(org.craftercms.studio.api.v2.dal.User) MOVE(org.craftercms.studio.api.v2.dal.RepoOperation.Action.MOVE) ResetCommand(org.eclipse.jgit.api.ResetCommand) Matcher(java.util.regex.Matcher) Map(java.util.Map) CommitTimeRevFilter(org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter) ClusterDAO(org.craftercms.studio.api.v2.dal.ClusterDAO) Path(java.nio.file.Path) TagCommand(org.eclipse.jgit.api.TagCommand) INDEX_FILE(org.craftercms.studio.api.v1.constant.StudioConstants.INDEX_FILE) GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) CommitCommand(org.eclipse.jgit.api.CommitCommand) Set(java.util.Set) HEAD(org.eclipse.jgit.lib.Constants.HEAD) SiteService(org.craftercms.studio.api.v1.service.site.SiteService) Constants(org.eclipse.jgit.lib.Constants) RevTree(org.eclipse.jgit.revwalk.RevTree) PersonIdent(org.eclipse.jgit.lib.PersonIdent) MASTER(org.eclipse.jgit.lib.Constants.MASTER) FILE_SEPARATOR(org.craftercms.studio.api.v1.constant.StudioConstants.FILE_SEPARATOR) PATTERN_SITE(org.craftercms.studio.api.v1.constant.StudioConstants.PATTERN_SITE) REPO_COMMIT_MESSAGE_POSTSCRIPT(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_COMMIT_MESSAGE_POSTSCRIPT) ServiceLayerException(org.craftercms.studio.api.v1.exception.ServiceLayerException) RemoteRepositoryDAO(org.craftercms.studio.api.v2.dal.RemoteRepositoryDAO) HARD(org.eclipse.jgit.api.ResetCommand.ResetType.HARD) DeploymentItemTO(org.craftercms.studio.api.v1.to.DeploymentItemTO) SiteFeedMapper(org.craftercms.studio.api.v1.dal.SiteFeedMapper) RetryingOperationFacade(org.craftercms.studio.api.v2.dal.RetryingOperationFacade) RevCommit(org.eclipse.jgit.revwalk.RevCommit) ClusterMember(org.craftercms.studio.api.v2.dal.ClusterMember) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) EMPTY_FILE(org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.EMPTY_FILE) MergeCommand(org.eclipse.jgit.api.MergeCommand) DmFilterWrapper(org.craftercms.studio.api.v1.util.filter.DmFilterWrapper) ImmutableNode(org.apache.commons.configuration2.tree.ImmutableNode) GitLogDAO(org.craftercms.studio.api.v2.dal.GitLogDAO) StudioUtils(org.craftercms.studio.impl.v2.utils.StudioUtils) IGNORE_FILES(org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.IGNORE_FILES) RemoteRepository(org.craftercms.studio.api.v2.dal.RemoteRepository) MessageRevFilter(org.eclipse.jgit.revwalk.filter.MessageRevFilter) TreeWalk(org.eclipse.jgit.treewalk.TreeWalk) RevFilter(org.eclipse.jgit.revwalk.filter.RevFilter) Files(java.nio.file.Files) REPO_SYNC_DB_COMMIT_MESSAGE_NO_PROCESSING(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_SYNC_DB_COMMIT_MESSAGE_NO_PROCESSING) ReverseListIterator(org.apache.commons.collections4.iterators.ReverseListIterator) IOException(java.io.IOException) CLUSTERING_NODE_REGISTRATION(org.craftercms.studio.api.v2.utils.StudioConfiguration.CLUSTERING_NODE_REGISTRATION) File(java.io.File) RefNotFoundException(org.eclipse.jgit.api.errors.RefNotFoundException) RetryingOperation(org.craftercms.studio.api.v2.annotation.RetryingOperation) R_HEADS(org.eclipse.jgit.lib.Constants.R_HEADS) SecurityService(org.craftercms.studio.api.v1.service.security.SecurityService) TreeMap(java.util.TreeMap) Paths(java.nio.file.Paths) ObjectMetadataManager(org.craftercms.studio.api.v1.service.content.ObjectMetadataManager) RemoteRepositoryNotFoundException(org.craftercms.studio.api.v1.exception.repository.RemoteRepositoryNotFoundException) ObjectReader(org.eclipse.jgit.lib.ObjectReader) Repository(org.eclipse.jgit.lib.Repository) RingBuffer(org.craftercms.studio.impl.v2.utils.RingBuffer) PUBLISHED(org.craftercms.studio.api.v1.constant.GitRepositories.PUBLISHED) DELETE(org.craftercms.studio.api.v2.dal.RepoOperation.Action.DELETE) RetryingRepositoryOperationFacade(org.craftercms.studio.api.v2.repository.RetryingRepositoryOperationFacade) PullCommand(org.eclipse.jgit.api.PullCommand) PublishingHistoryItem(org.craftercms.studio.api.v2.dal.PublishingHistoryItem) RemoteRemoveCommand(org.eclipse.jgit.api.RemoteRemoveCommand) REPO_COMMIT_MESSAGE_PROLOGUE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_COMMIT_MESSAGE_PROLOGUE) DeploymentSyncHistory(org.craftercms.studio.api.v1.dal.DeploymentSyncHistory) AddCommand(org.eclipse.jgit.api.AddCommand) CREATE(org.craftercms.studio.api.v2.dal.RepoOperation.Action.CREATE) UserNotFoundException(org.craftercms.studio.api.v1.exception.security.UserNotFoundException) SITE_PUBLISHED_REPOSITORY_GIT_LOCK(org.craftercms.studio.api.v1.constant.StudioConstants.SITE_PUBLISHED_REPOSITORY_GIT_LOCK) RepoOperation(org.craftercms.studio.api.v2.dal.RepoOperation) REPO_PUBLISHED_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_PUBLISHED_COMMIT_MESSAGE) GLOBAL(org.craftercms.studio.api.v1.constant.GitRepositories.GLOBAL) TRACK(org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode.TRACK) ContentRepository(org.craftercms.studio.api.v2.repository.ContentRepository) HierarchicalConfiguration(org.apache.commons.configuration2.HierarchicalConfiguration) DeleteBranchCommand(org.eclipse.jgit.api.DeleteBranchCommand) COPY(org.craftercms.studio.api.v2.dal.RepoOperation.Action.COPY) REPO_SANDBOX_BRANCH(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_SANDBOX_BRANCH) Instant(java.time.Instant) SITE_SANDBOX_REPOSITORY_GIT_LOCK(org.craftercms.studio.api.v1.constant.StudioConstants.SITE_SANDBOX_REPOSITORY_GIT_LOCK) Collectors(java.util.stream.Collectors) REVERSE(org.eclipse.jgit.revwalk.RevSort.REVERSE) Objects(java.util.Objects) List(java.util.List) StudioConfiguration(org.craftercms.studio.api.v2.utils.StudioConfiguration) IN_PROGRESS_BRANCH_NAME_SUFFIX(org.craftercms.studio.api.v1.constant.StudioConstants.IN_PROGRESS_BRANCH_NAME_SUFFIX) Ref(org.eclipse.jgit.lib.Ref) UTC(java.time.ZoneOffset.UTC) ListBranchCommand(org.eclipse.jgit.api.ListBranchCommand) Pattern(java.util.regex.Pattern) FilenameUtils(org.apache.commons.io.FilenameUtils) RmCommand(org.eclipse.jgit.api.RmCommand) UPDATE(org.craftercms.studio.api.v2.dal.RepoOperation.Action.UPDATE) THEIRS(org.eclipse.jgit.merge.MergeStrategy.THEIRS) CanonicalTreeParser(org.eclipse.jgit.treewalk.CanonicalTreeParser) GitLog(org.craftercms.studio.api.v2.dal.GitLog) Logger(org.craftercms.studio.api.v1.log.Logger) ArrayUtils(org.apache.commons.lang3.ArrayUtils) HashMap(java.util.HashMap) FetchCommand(org.eclipse.jgit.api.FetchCommand) HashSet(java.util.HashSet) REPO_INITIAL_COMMIT_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_INITIAL_COMMIT_COMMIT_MESSAGE) CLUSTER_MEMBER_LOCAL_ADDRESS(org.craftercms.studio.api.v1.constant.StudioConstants.CLUSTER_MEMBER_LOCAL_ADDRESS) AndRevFilter(org.eclipse.jgit.revwalk.filter.AndRevFilter) LoggerFactory(org.craftercms.studio.api.v1.log.LoggerFactory) EMPTY(org.apache.commons.lang3.StringUtils.EMPTY) AuthorRevFilter(org.eclipse.jgit.revwalk.filter.AuthorRevFilter) ObjectLoader(org.eclipse.jgit.lib.ObjectLoader) NotRevFilter(org.eclipse.jgit.revwalk.filter.NotRevFilter) Iterator(java.util.Iterator) DeploymentException(org.craftercms.studio.api.v1.service.deployment.DeploymentException) SiteNotFoundException(org.craftercms.studio.api.v1.exception.SiteNotFoundException) CryptoException(org.craftercms.commons.crypto.CryptoException) CheckoutCommand(org.eclipse.jgit.api.CheckoutCommand) ObjectId(org.eclipse.jgit.lib.ObjectId) DEFAULT_REMOTE_NAME(org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME) DOT_GIT_IGNORE(org.eclipse.jgit.lib.Constants.DOT_GIT_IGNORE) DuplicateKeyException(org.springframework.dao.DuplicateKeyException) SANDBOX(org.craftercms.studio.api.v1.constant.GitRepositories.SANDBOX) DeploymentHistoryProvider(org.craftercms.studio.api.v2.service.deployment.DeploymentHistoryProvider) GitRepositoryHelper(org.craftercms.studio.api.v2.utils.GitRepositoryHelper) GeneralLockService(org.craftercms.studio.api.v1.service.GeneralLockService) DateTimeFormatter(java.time.format.DateTimeFormatter) InvalidRemoteRepositoryCredentialsException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryCredentialsException) Git(org.eclipse.jgit.api.Git) DiffEntry(org.eclipse.jgit.diff.DiffEntry) InvalidRemoteRepositoryException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryException) GitRepositories(org.craftercms.studio.api.v1.constant.GitRepositories) RmCommand(org.eclipse.jgit.api.RmCommand) GitRepositoryHelper(org.craftercms.studio.api.v2.utils.GitRepositoryHelper) Files(java.nio.file.Files) CryptoException(org.craftercms.commons.crypto.CryptoException)

Example 2 with EMPTY_FILE

use of org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.EMPTY_FILE in project studio by craftercms.

the class GitContentRepository method deleteParentFolder.

private String deleteParentFolder(Git git, Path parentFolder, boolean wasPage) throws GitAPIException, CryptoException, IOException {
    String parent = parentFolder.toString();
    String toRet = parent;
    GitRepositoryHelper helper = GitRepositoryHelper.getHelper(studioConfiguration, securityService, userServiceInternal, encryptor, generalLockService, retryingRepositoryOperationFacade);
    String folderToDelete = helper.getGitPath(parent);
    Path toDelete = Paths.get(git.getRepository().getDirectory().getParent(), parent);
    if (toDelete.toFile().exists()) {
        List<String> dirs = Files.walk(toDelete).filter(x -> !x.equals(toDelete)).filter(Files::isDirectory).map(y -> y.getFileName().toString()).collect(Collectors.toList());
        List<String> files = Files.walk(toDelete, 1).filter(x -> !x.equals(toDelete)).filter(Files::isRegularFile).map(y -> y.getFileName().toString()).collect(Collectors.toList());
        if (wasPage || (CollectionUtils.isEmpty(dirs) && (CollectionUtils.isEmpty(files) || files.size() < 2 && files.get(0).equals(EMPTY_FILE)))) {
            if (CollectionUtils.isNotEmpty(dirs)) {
                for (String child : dirs) {
                    Path childToDelete = Paths.get(folderToDelete, child);
                    deleteParentFolder(git, childToDelete, false);
                    RmCommand rmCommand = git.rm().addFilepattern(folderToDelete + FILE_SEPARATOR + child + FILE_SEPARATOR + "*").setCached(false);
                    retryingRepositoryOperationFacade.call(rmCommand);
                }
            }
            if (CollectionUtils.isNotEmpty(files)) {
                for (String child : files) {
                    git.rm().addFilepattern(folderToDelete + FILE_SEPARATOR + child).setCached(false).call();
                }
            }
        }
    }
    return toRet;
}
Also used : Path(java.nio.file.Path) Arrays(java.util.Arrays) UserServiceInternal(org.craftercms.studio.api.v2.service.security.internal.UserServiceInternal) Status(org.eclipse.jgit.api.Status) TextEncryptor(org.craftercms.commons.crypto.TextEncryptor) ZonedDateTime(java.time.ZonedDateTime) MAX_VALUE(java.lang.Integer.MAX_VALUE) SITES_REPOS_PATH(org.craftercms.studio.api.v2.utils.StudioConfiguration.SITES_REPOS_PATH) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) OBJ_TREE(org.eclipse.jgit.lib.Constants.OBJ_TREE) StringUtils(org.apache.commons.lang3.StringUtils) SshTransport(org.eclipse.jgit.transport.SshTransport) RevWalk(org.eclipse.jgit.revwalk.RevWalk) Config(org.eclipse.jgit.lib.Config) PathFilter(org.eclipse.jgit.treewalk.filter.PathFilter) REPO_DELETE_CONTENT_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_DELETE_CONTENT_COMMIT_MESSAGE) Map(java.util.Map) PullResult(org.eclipse.jgit.api.PullResult) URIish(org.eclipse.jgit.transport.URIish) ClusterDAO(org.craftercms.studio.api.v2.dal.ClusterDAO) RemoteAddCommand(org.eclipse.jgit.api.RemoteAddCommand) REJECTED_NODELETE(org.eclipse.jgit.transport.RemoteRefUpdate.Status.REJECTED_NODELETE) Path(java.nio.file.Path) EnumSet(java.util.EnumSet) TagCommand(org.eclipse.jgit.api.TagCommand) INDEX_FILE(org.craftercms.studio.api.v1.constant.StudioConstants.INDEX_FILE) GIT_COMMIT_ALL_ITEMS(org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.GIT_COMMIT_ALL_ITEMS) NONE(org.craftercms.studio.api.v2.dal.RemoteRepository.AuthenticationType.NONE) GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) R_REMOTES(org.eclipse.jgit.lib.Constants.R_REMOTES) RefSpec(org.eclipse.jgit.transport.RefSpec) CommitCommand(org.eclipse.jgit.api.CommitCommand) Set(java.util.Set) OpenSshConfig(org.eclipse.jgit.transport.OpenSshConfig) HEAD(org.eclipse.jgit.lib.Constants.HEAD) Constants(org.eclipse.jgit.lib.Constants) RevTree(org.eclipse.jgit.revwalk.RevTree) PersonIdent(org.eclipse.jgit.lib.PersonIdent) FILE_SEPARATOR(org.craftercms.studio.api.v1.constant.StudioConstants.FILE_SEPARATOR) PATTERN_SITE(org.craftercms.studio.api.v1.constant.StudioConstants.PATTERN_SITE) Session(com.jcraft.jsch.Session) REPO_CREATE_FOLDER_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_CREATE_FOLDER_COMMIT_MESSAGE) PushResult(org.eclipse.jgit.transport.PushResult) ServiceLayerException(org.craftercms.studio.api.v1.exception.ServiceLayerException) RemoteRepositoryDAO(org.craftercms.studio.api.v2.dal.RemoteRepositoryDAO) FS(org.eclipse.jgit.util.FS) JSchException(com.jcraft.jsch.JSchException) SiteFeedMapper(org.craftercms.studio.api.v1.dal.SiteFeedMapper) REPO_COMMIT_MESSAGE_USERNAME_VAR(org.craftercms.studio.api.v1.constant.StudioConstants.REPO_COMMIT_MESSAGE_USERNAME_VAR) RetryingOperationFacade(org.craftercms.studio.api.v2.dal.RetryingOperationFacade) GLOBAL_REPOSITORY_GIT_LOCK(org.craftercms.studio.api.v1.constant.StudioConstants.GLOBAL_REPOSITORY_GIT_LOCK) RevCommit(org.eclipse.jgit.revwalk.RevCommit) REPO_SANDBOX_WRITE_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_SANDBOX_WRITE_COMMIT_MESSAGE) ClusterMember(org.craftercms.studio.api.v2.dal.ClusterMember) REPO_COMMIT_MESSAGE_PATH_VAR(org.craftercms.studio.api.v1.constant.StudioConstants.REPO_COMMIT_MESSAGE_PATH_VAR) Transport(org.eclipse.jgit.transport.Transport) SimpleDateFormat(java.text.SimpleDateFormat) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) EMPTY_FILE(org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.EMPTY_FILE) BLUE_PRINTS_PATH(org.craftercms.studio.api.v2.utils.StudioConfiguration.BLUE_PRINTS_PATH) VersionTO(org.craftercms.studio.api.v1.to.VersionTO) Calendar(java.util.Calendar) ImmutableNode(org.apache.commons.configuration2.tree.ImmutableNode) GitLogDAO(org.craftercms.studio.api.v2.dal.GitLogDAO) StatusCommand(org.eclipse.jgit.api.StatusCommand) IGNORE_FILES(org.craftercms.studio.impl.v1.repository.git.GitContentRepositoryConstants.IGNORE_FILES) PushCommand(org.eclipse.jgit.api.PushCommand) RemoteRepository(org.craftercms.studio.api.v2.dal.RemoteRepository) REJECTED_NONFASTFORWARD(org.eclipse.jgit.transport.RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD) TreeWalk(org.eclipse.jgit.treewalk.TreeWalk) Properties(java.util.Properties) Files(java.nio.file.Files) FOLLOW_LINKS(java.nio.file.FileVisitOption.FOLLOW_LINKS) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) RemoteRepositoryInfoTO(org.craftercms.studio.api.v1.to.RemoteRepositoryInfoTO) UnknownHostException(java.net.UnknownHostException) CLUSTERING_NODE_REGISTRATION(org.craftercms.studio.api.v2.utils.StudioConfiguration.CLUSTERING_NODE_REGISTRATION) File(java.io.File) RefNotFoundException(org.eclipse.jgit.api.errors.RefNotFoundException) RetryingOperation(org.craftercms.studio.api.v2.annotation.RetryingOperation) TreeMap(java.util.TreeMap) SecurityService(org.craftercms.studio.api.v1.service.security.SecurityService) REMOTE(org.eclipse.jgit.api.ListBranchCommand.ListMode.REMOTE) Paths(java.nio.file.Paths) RemoteRepositoryNotFoundException(org.craftercms.studio.api.v1.exception.repository.RemoteRepositoryNotFoundException) RepositoryItem(org.craftercms.studio.api.v1.repository.RepositoryItem) TOKEN(org.craftercms.studio.api.v2.dal.RemoteRepository.AuthenticationType.TOKEN) REPO_BASE_PATH(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_BASE_PATH) ServletContext(javax.servlet.ServletContext) Repository(org.eclipse.jgit.lib.Repository) PUBLISHED(org.craftercms.studio.api.v1.constant.GitRepositories.PUBLISHED) RetryingRepositoryOperationFacade(org.craftercms.studio.api.v2.repository.RetryingRepositoryOperationFacade) PullCommand(org.eclipse.jgit.api.PullCommand) ServletContextAware(org.springframework.web.context.ServletContextAware) RemoteRemoveCommand(org.eclipse.jgit.api.RemoteRemoveCommand) URISyntaxException(java.net.URISyntaxException) BOOTSTRAP_REPO(org.craftercms.studio.api.v2.utils.StudioConfiguration.BOOTSTRAP_REPO) GarbageCollectCommand(org.eclipse.jgit.api.GarbageCollectCommand) AddCommand(org.eclipse.jgit.api.AddCommand) UserNotFoundException(org.craftercms.studio.api.v1.exception.security.UserNotFoundException) InvalidRemoteUrlException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteUrlException) SITE_PUBLISHED_REPOSITORY_GIT_LOCK(org.craftercms.studio.api.v1.constant.StudioConstants.SITE_PUBLISHED_REPOSITORY_GIT_LOCK) GLOBAL(org.craftercms.studio.api.v1.constant.GitRepositories.GLOBAL) REJECTED_REMOTE_CHANGED(org.eclipse.jgit.transport.RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED) TRACK(org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode.TRACK) DateFormat(java.text.DateFormat) REPO_MOVE_CONTENT_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_MOVE_CONTENT_COMMIT_MESSAGE) HierarchicalConfiguration(org.apache.commons.configuration2.HierarchicalConfiguration) REJECTED_OTHER_REASON(org.eclipse.jgit.transport.RemoteRefUpdate.Status.REJECTED_OTHER_REASON) DeleteBranchCommand(org.eclipse.jgit.api.DeleteBranchCommand) Collection(java.util.Collection) REPO_COPY_CONTENT_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_COPY_CONTENT_COMMIT_MESSAGE) UUID(java.util.UUID) REPO_SANDBOX_BRANCH(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_SANDBOX_BRANCH) Instant(java.time.Instant) SITE_SANDBOX_REPOSITORY_GIT_LOCK(org.craftercms.studio.api.v1.constant.StudioConstants.SITE_SANDBOX_REPOSITORY_GIT_LOCK) Collectors(java.util.stream.Collectors) REVERSE(org.eclipse.jgit.revwalk.RevSort.REVERSE) List(java.util.List) ServicesConfig(org.craftercms.studio.api.v1.service.configuration.ServicesConfig) StudioConfiguration(org.craftercms.studio.api.v2.utils.StudioConfiguration) BOOTSTRAP_REPO_PATH(org.craftercms.studio.api.v1.constant.StudioConstants.BOOTSTRAP_REPO_PATH) Ref(org.eclipse.jgit.lib.Ref) BASIC(org.craftercms.studio.api.v2.dal.RemoteRepository.AuthenticationType.BASIC) UTC(java.time.ZoneOffset.UTC) ListBranchCommand(org.eclipse.jgit.api.ListBranchCommand) RmCommand(org.eclipse.jgit.api.RmCommand) ContentNotFoundException(org.craftercms.studio.api.v1.exception.ContentNotFoundException) TransportConfigCallback(org.eclipse.jgit.api.TransportConfigCallback) RemoteAlreadyExistsException(org.craftercms.studio.api.v1.exception.repository.RemoteAlreadyExistsException) THEIRS(org.eclipse.jgit.merge.MergeStrategy.THEIRS) JSch(com.jcraft.jsch.JSch) UsernamePasswordCredentialsProvider(org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider) PATTERN_FROM_PATH(org.craftercms.studio.api.v1.constant.StudioConstants.PATTERN_FROM_PATH) GitLog(org.craftercms.studio.api.v2.dal.GitLog) Logger(org.craftercms.studio.api.v1.log.Logger) HashMap(java.util.HashMap) ArrayUtils(org.apache.commons.lang3.ArrayUtils) REPO_INITIAL_COMMIT_COMMIT_MESSAGE(org.craftercms.studio.api.v2.utils.StudioConfiguration.REPO_INITIAL_COMMIT_COMMIT_MESSAGE) CLUSTER_MEMBER_LOCAL_ADDRESS(org.craftercms.studio.api.v1.constant.StudioConstants.CLUSTER_MEMBER_LOCAL_ADDRESS) PATTERN_PATH(org.craftercms.studio.api.v1.constant.StudioConstants.PATTERN_PATH) SshSessionFactory(org.eclipse.jgit.transport.SshSessionFactory) LoggerFactory(org.craftercms.studio.api.v1.log.LoggerFactory) EMPTY(org.apache.commons.lang3.StringUtils.EMPTY) BOOTSTRAP_REPO_GLOBAL_PATH(org.craftercms.studio.api.v1.constant.StudioConstants.BOOTSTRAP_REPO_GLOBAL_PATH) ObjectLoader(org.eclipse.jgit.lib.ObjectLoader) Iterator(java.util.Iterator) CreateBranchCommand(org.eclipse.jgit.api.CreateBranchCommand) PRIVATE_KEY(org.craftercms.studio.api.v2.dal.RemoteRepository.AuthenticationType.PRIVATE_KEY) StudioClusterUtils(org.craftercms.studio.impl.v2.service.cluster.StudioClusterUtils) DeploymentException(org.craftercms.studio.api.v1.service.deployment.DeploymentException) ContentRepository(org.craftercms.studio.api.v1.repository.ContentRepository) CryptoException(org.craftercms.commons.crypto.CryptoException) CheckoutCommand(org.eclipse.jgit.api.CheckoutCommand) ObjectId(org.eclipse.jgit.lib.ObjectId) TransportException(org.eclipse.jgit.api.errors.TransportException) DEFAULT_REMOTE_NAME(org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME) SANDBOX(org.craftercms.studio.api.v1.constant.GitRepositories.SANDBOX) GitRepositoryHelper(org.craftercms.studio.api.v2.utils.GitRepositoryHelper) PATTERN_TO_PATH(org.craftercms.studio.api.v1.constant.StudioConstants.PATTERN_TO_PATH) FileVisitOption(java.nio.file.FileVisitOption) RemoteRepositoryNotBareException(org.craftercms.studio.api.v1.exception.repository.RemoteRepositoryNotBareException) InvalidRemoteException(org.eclipse.jgit.api.errors.InvalidRemoteException) JGitInternalException(org.eclipse.jgit.api.errors.JGitInternalException) RemoteRefUpdate(org.eclipse.jgit.transport.RemoteRefUpdate) DateTimeFormatter(java.time.format.DateTimeFormatter) GeneralLockService(org.craftercms.studio.api.v1.service.GeneralLockService) LsRemoteCommand(org.eclipse.jgit.api.LsRemoteCommand) InvalidRemoteRepositoryCredentialsException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryCredentialsException) Git(org.eclipse.jgit.api.Git) LockFile(org.eclipse.jgit.internal.storage.file.LockFile) InvalidRemoteRepositoryException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryException) JschConfigSessionFactory(org.eclipse.jgit.transport.JschConfigSessionFactory) InputStream(java.io.InputStream) GitRepositories(org.craftercms.studio.api.v1.constant.GitRepositories) RmCommand(org.eclipse.jgit.api.RmCommand) GitRepositoryHelper(org.craftercms.studio.api.v2.utils.GitRepositoryHelper) Files(java.nio.file.Files)

Aggregations

File (java.io.File)2 IOException (java.io.IOException)2 Files (java.nio.file.Files)2 Path (java.nio.file.Path)2 Paths (java.nio.file.Paths)2 Instant (java.time.Instant)2 UTC (java.time.ZoneOffset.UTC)2 ZonedDateTime (java.time.ZonedDateTime)2 DateTimeFormatter (java.time.format.DateTimeFormatter)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 TreeMap (java.util.TreeMap)2 Collectors (java.util.stream.Collectors)2 CollectionUtils (org.apache.commons.collections4.CollectionUtils)2 HierarchicalConfiguration (org.apache.commons.configuration2.HierarchicalConfiguration)2 ImmutableNode (org.apache.commons.configuration2.tree.ImmutableNode)2