public class LocalFileSystemRepository extends Object implements BackupRepository
BackupRepository.PathType
Constructor and Description |
---|
LocalFileSystemRepository() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
copyIndexFileFrom(Directory sourceDir,
String sourceFileName,
URI destDir,
String destFileName)
Copy an index file from specified
sourceDir to the destination repository (i.e. |
void |
copyIndexFileTo(URI sourceDir,
String sourceFileName,
Directory dest,
String destFileName)
Copy an index file from specified
sourceRepo to the destination directory (i.e. |
void |
createDirectory(URI path)
This method creates a directory at the specified path.
|
OutputStream |
createOutput(URI path)
This method returns a OutputStream instance for the specified
path |
URI |
createURI(String location)
This method returns the URI representation for the specified path.
|
void |
delete(URI path,
Collection<String> files,
boolean ignoreNoSuchFileException)
Delete
files at path |
void |
deleteDirectory(URI path)
This method deletes a directory at the specified path.
|
boolean |
exists(URI path)
This method checks if the specified path exists in this repository.
|
<T> T |
getConfigProperty(String name)
This method returns the value of the specified configuration property.
|
BackupRepository.PathType |
getPathType(URI path)
This method returns the type of a specified path
|
void |
init(NamedList args) |
String[] |
listAll(URI dirPath)
This method returns all the entries (files and directories) in the specified directory.
|
IndexInput |
openInput(URI dirPath,
String fileName,
IOContext ctx)
This method returns a Lucene input stream reading an existing file.
|
URI |
resolve(URI baseUri,
String... pathComponents)
This method resolves a URI using the specified path components (as method arguments).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checksum, copyFileFrom, copyFileTo, copyIndexFileFrom, createDirectoryURI, getBackupLocation, listAllOrEmpty, resolveDirectory
public void init(NamedList args)
init
in interface NamedListInitializedPlugin
public <T> T getConfigProperty(String name)
BackupRepository
getConfigProperty
in interface BackupRepository
public URI createURI(String location)
BackupRepository
createURI
in interface BackupRepository
location
- The path specified by the user.public URI resolve(URI baseUri, String... pathComponents)
BackupRepository
resolve
in interface BackupRepository
baseUri
- The base URI to use for creating the pathpathComponents
- The directory (or file-name) to be included in the URI.public void createDirectory(URI path) throws IOException
BackupRepository
createDirectory
in interface BackupRepository
path
- The path where the directory needs to be created.IOException
- in case of errorspublic void deleteDirectory(URI path) throws IOException
BackupRepository
deleteDirectory
in interface BackupRepository
path
- The path referring to the directory to be deleted.IOException
- in case of errorspublic boolean exists(URI path) throws IOException
BackupRepository
exists
in interface BackupRepository
path
- The path whose existence needs to be checked.IOException
- in case of errorspublic IndexInput openInput(URI dirPath, String fileName, IOContext ctx) throws IOException
BackupRepository
openInput
in interface BackupRepository
dirPath
- The parent directory of the file to be readfileName
- The name of the file to be readctx
- the Lucene IO contextIOException
- in case of errorspublic OutputStream createOutput(URI path) throws IOException
BackupRepository
path
createOutput
in interface BackupRepository
path
- The path for which OutputStream needs to be createdpath
IOException
- in case of errorspublic String[] listAll(URI dirPath) throws IOException
BackupRepository
listAll
in interface BackupRepository
dirPath
- The directory pathIOException
- in case of errorspublic BackupRepository.PathType getPathType(URI path) throws IOException
BackupRepository
getPathType
in interface BackupRepository
path
- The path whose type needs to be checked.IOException
- in case of errorspublic void copyIndexFileFrom(Directory sourceDir, String sourceFileName, URI destDir, String destFileName) throws IOException
BackupRepository
sourceDir
to the destination repository (i.e. backup).copyIndexFileFrom
in interface BackupRepository
sourceDir
- The source directory hosting the file to be copied.sourceFileName
- The name of the file to by copieddestDir
- The destination backup location.IOException
- in case of errorsCorruptIndexException
- in case checksum of the file does not match with precomputed checksum stored at the end of the filepublic void copyIndexFileTo(URI sourceDir, String sourceFileName, Directory dest, String destFileName) throws IOException
BackupRepository
sourceRepo
to the destination directory (i.e. restore).copyIndexFileTo
in interface BackupRepository
sourceDir
- The source URI hosting the file to be copied.dest
- The destination where the file should be copied.IOException
- in case of errors.public void delete(URI path, Collection<String> files, boolean ignoreNoSuchFileException) throws IOException
BackupRepository
files
at path
delete
in interface BackupRepository
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.