Class DelegatingBackupRepository

    • Constructor Detail

      • DelegatingBackupRepository

        public DelegatingBackupRepository()
    • Method Detail

      • getDelegateInitArgs

        protected org.apache.solr.common.util.NamedList<?> getDelegateInitArgs​(org.apache.solr.common.util.NamedList<?> initArgs)
      • getBackupLocation

        public String getBackupLocation​(String override)
        Description copied from interface: BackupRepository
        This method returns the location where the backup should be stored (or restored from).
        Specified by:
        getBackupLocation in interface BackupRepository
        Parameters:
        override - The location parameter supplied by the user.
        Returns:
        If override is not null then return the same value Otherwise return the default configuration value for the CoreAdminParams.BACKUP_LOCATION parameter.
      • createURI

        public URI createURI​(String path)
        Description copied from interface: BackupRepository
        This method returns the URI representation for the specified path. Note - the specified path could be a fully qualified URI OR a relative path for a file-system.
        Specified by:
        createURI in interface BackupRepository
        Parameters:
        path - The path specified by the user.
        Returns:
        the URI representation of the user supplied value
      • createDirectoryURI

        public URI createDirectoryURI​(String path)
        Description copied from interface: BackupRepository
        This method returns the directory URI representation for the specified path. Note - the specified path could be a fully qualified URI OR a relative path for a file-system.
        Specified by:
        createDirectoryURI in interface BackupRepository
        Parameters:
        path - The path specified by the user.
        Returns:
        the URI representation of the user supplied value, ensured to look like a directory.
      • resolve

        public URI resolve​(URI baseUri,
                           String... pathComponents)
        Description copied from interface: BackupRepository
        This method resolves a URI using the specified path components (as method arguments).
        Specified by:
        resolve in interface BackupRepository
        Parameters:
        baseUri - The base URI to use for creating the path
        pathComponents - The directory (or file-name) to be included in the URI.
        Returns:
        A URI containing absolute path
      • resolveDirectory

        public URI resolveDirectory​(URI baseUri,
                                    String... pathComponents)
        Description copied from interface: BackupRepository
        This method resolves a directory URI using the specified path components (as method arguments).
        Specified by:
        resolveDirectory in interface BackupRepository
        Parameters:
        baseUri - The base URI to use for creating the path
        pathComponents - The directory (or file-name) to be included in the URI.
        Returns:
        A URI containing absolute path, ensured to look like a directory
      • exists

        public boolean exists​(URI path)
                       throws IOException
        Description copied from interface: BackupRepository
        This method checks if the specified path exists in this repository.
        Specified by:
        exists in interface BackupRepository
        Parameters:
        path - The path whose existence needs to be checked.
        Returns:
        if the specified path exists in this repository.
        Throws:
        IOException - in case of errors
      • listAll

        public String[] listAll​(URI path)
                         throws IOException
        Description copied from interface: BackupRepository
        This method returns all the entries (files and directories) in the specified directory.
        Specified by:
        listAll in interface BackupRepository
        Parameters:
        path - The directory path
        Returns:
        an array of strings, one for each entry in the directory
        Throws:
        IOException - in case of errors
      • openInput

        public org.apache.lucene.store.IndexInput openInput​(URI dirPath,
                                                            String fileName,
                                                            org.apache.lucene.store.IOContext ctx)
                                                     throws IOException
        Description copied from interface: BackupRepository
        This method returns a Lucene input stream reading an existing file.
        Specified by:
        openInput in interface BackupRepository
        Parameters:
        dirPath - The parent directory of the file to be read
        fileName - The name of the file to be read
        ctx - the Lucene IO context
        Returns:
        Lucene IndexInput reference
        Throws:
        IOException - in case of errors
      • createDirectory

        public void createDirectory​(URI path)
                             throws IOException
        Description copied from interface: BackupRepository
        This method creates a directory at the specified path. If the directory already exist, this will be a no-op.
        Specified by:
        createDirectory in interface BackupRepository
        Parameters:
        path - The path where the directory needs to be created.
        Throws:
        IOException - in case of errors
      • deleteDirectory

        public void deleteDirectory​(URI path)
                             throws IOException
        Description copied from interface: BackupRepository
        This method deletes a directory at the specified path.
        Specified by:
        deleteDirectory in interface BackupRepository
        Parameters:
        path - The path referring to the directory to be deleted.
        Throws:
        IOException - in case of errors
      • copyFileFrom

        public void copyFileFrom​(org.apache.lucene.store.Directory sourceDir,
                                 String fileName,
                                 URI dest)
                          throws IOException
        Description copied from interface: BackupRepository
        Copy a file from specified sourceDir to the destination repository (i.e. backup).
        Specified by:
        copyFileFrom in interface BackupRepository
        Parameters:
        sourceDir - The source directory hosting the file to be copied.
        fileName - The name of the file to be copied
        dest - The destination backup location.
        Throws:
        IOException - in case of errors
      • copyFileTo

        public void copyFileTo​(URI sourceRepo,
                               String fileName,
                               org.apache.lucene.store.Directory dest)
                        throws IOException
        Description copied from interface: BackupRepository
        Copy a file from specified sourceRepo to the destination directory (i.e. restore).
        Specified by:
        copyFileTo in interface BackupRepository
        Parameters:
        sourceRepo - The source URI hosting the file to be copied.
        fileName - The name of the file to be copied
        dest - The destination where the file should be copied.
        Throws:
        IOException - in case of errors.
      • listAllOrEmpty

        public String[] listAllOrEmpty​(URI path)
        Description copied from interface: BackupRepository
        List all files or directories directly under path.
        Specified by:
        listAllOrEmpty in interface BackupRepository
        Returns:
        an empty array in case of IOException
      • copyIndexFileFrom

        public void copyIndexFileFrom​(org.apache.lucene.store.Directory sourceDir,
                                      String sourceFileName,
                                      org.apache.lucene.store.Directory destDir,
                                      String destFileName)
                               throws IOException
        Description copied from interface: BackupRepository
        Copies an index file from a specified Directory to a destination Directory.
        Specified by:
        copyIndexFileFrom in interface BackupRepository
        Parameters:
        sourceDir - The source directory hosting the file to be copied.
        sourceFileName - The name of the file to be copied
        destDir - The destination directory.
        Throws:
        org.apache.lucene.index.CorruptIndexException - in case checksum of the file does not match with precomputed checksum stored at the end of the file
        IOException
      • copyIndexFileFrom

        public void copyIndexFileFrom​(org.apache.lucene.store.Directory sourceDir,
                                      String sourceFileName,
                                      URI destDir,
                                      String destFileName)
                               throws IOException
        Description copied from interface: BackupRepository
        Copy an index file from specified sourceDir to the destination repository (i.e. backup).
        Specified by:
        copyIndexFileFrom in interface BackupRepository
        Parameters:
        sourceDir - The source directory hosting the file to be copied.
        sourceFileName - The name of the file to be copied
        destDir - The destination backup location.
        Throws:
        IOException - in case of errors
        org.apache.lucene.index.CorruptIndexException - in case checksum of the file does not match with precomputed checksum stored at the end of the file
      • copyIndexFileTo

        public void copyIndexFileTo​(URI sourceRepo,
                                    String sourceFileName,
                                    org.apache.lucene.store.Directory dest,
                                    String destFileName)
                             throws IOException
        Description copied from interface: BackupRepository
        Copy an index file from specified sourceRepo to the destination directory (i.e. restore).
        Specified by:
        copyIndexFileTo in interface BackupRepository
        Parameters:
        sourceRepo - The source URI hosting the file to be copied.
        dest - The destination where the file should be copied.
        Throws:
        IOException - in case of errors.