Class RemoteRepositoryProvider


  • public class RemoteRepositoryProvider
    extends java.lang.Object
    Class for process some repository commands. Path, local path, repository path can be directory or one file only. Directory should be declared like 'source/', file should be declared like 'source/text.po'.
    • Constructor Detail

      • RemoteRepositoryProvider

        public RemoteRepositoryProvider​(java.io.File projectRoot,
                                        java.util.List<RepositoryDefinition> repositoriesDefinitions,
                                        ProjectProperties props)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • RemoteRepositoryProvider

        public RemoteRepositoryProvider​(java.io.File projectRoot,
                                        java.util.List<RepositoryDefinition> repositoriesDefinitions)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • setForceExcludesFromProjectProperties

        public void setForceExcludesFromProjectProperties​(ProjectProperties props)
      • isUnderMapping

        public boolean isUnderMapping​(java.lang.String path)
        Checks if path is under mapping.
      • cleanPrepared

        public void cleanPrepared()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • toPrepared

        public java.io.File toPrepared​(java.io.File inFile)
                                throws java.io.IOException
        Saves file into 'prepared' dir.
        Throws:
        java.io.IOException
      • switchAllToLatest

        public void switchAllToLatest()
                               throws java.lang.Exception
        Switch all repositories into latest version. Will continue in the event of an error, unless that error is a IRemoteRepository2.NetworkException in which case it will throw immediately. If any other exceptions occur while updating the repos, the first will be thrown after all repos have been processed.
        Throws:
        java.lang.Exception
      • switchToVersion

        public java.io.File switchToVersion​(java.lang.String filePath,
                                            java.lang.String version)
                                     throws java.lang.Exception
        Switch repository that contains path to specified version. If version is null, need to switch to latest version. Returns the path in the remote repository ( /path/to/omegatproject/.repositories/url/filepath
        Throws:
        java.lang.Exception
      • commitFileAfterVersion

        public java.lang.String commitFileAfterVersion​(java.lang.String path,
                                                       java.lang.String commentText,
                                                       java.lang.String... onVersions)
                                                throws java.lang.Exception
        Commit specific file after rebase. Used for omegat/project_save.tmx, glossaries, etc.
        Throws:
        java.lang.Exception
      • commitFiles

        public void commitFiles​(java.lang.String path,
                                java.lang.String commentText)
                         throws java.lang.Exception
        Commit set of files without rebase - just local version. Used for target/*, etc.
        Throws:
        java.lang.Exception
      • copyFilesFromReposToProject

        public void copyFilesFromReposToProject​(java.lang.String localPath)
                                         throws java.io.IOException
        Copies all files under specified path that are mapped to local directory. If path is empty (i.e. full project), also file deletions since last copy are propagated, i.e. if remote repo has file deletions, those files are deleted locally as well.
        Parameters:
        localPath - directory name or file name
        Throws:
        java.io.IOException
      • copyFilesFromReposToProject

        public void copyFilesFromReposToProject​(java.lang.String localPath,
                                                java.lang.String postfix,
                                                boolean propagateDelete)
                                         throws java.io.IOException
        Copies all files under specified path that are mapped to local directory.

        If propagateDelete flag is set true and path is empty (i.e. full project), also file deletions since last copy are propagated, i.e. if remote repo has file deletions, those files are deleted locally as well.

        Parameters:
        localPath - directory name or file name
        Throws:
        java.io.IOException
      • copyFilesFromProjectToRepos

        public void copyFilesFromProjectToRepos​(java.lang.String localPath,
                                                java.lang.String eolConversionCharset)
                                         throws java.lang.Exception
        Copy all mappings that under specified directory path into repository directory.
        Parameters:
        localPath - directory name or file name
        eolConversionCharset - not null if EOL conversion required. EOL will be converted to repository-specific for existing files, and to platform-specific for new files
        Throws:
        java.lang.Exception
      • getVersion

        public java.lang.String getVersion​(java.lang.String file)
                                    throws java.lang.Exception
        Get version of specified file.
        Throws:
        java.lang.Exception