Package de.dlr.proseo.storagemgr.model
Schnittstelle Storage
- Alle bekannten Implementierungsklassen:
PosixStorage
,S3Storage
public interface Storage
A high-level interface for performing common operations on a storage system,
abstracting away the underlying implementation details. It provides methods
for retrieving information on the storage, managing buckets, and working with
files and directories, as well as utility methods to add a file system prefix
to a path and a list of paths.
Implementations of this interface should provide the necessary logic to
interact with specific storage systems, such as POSIX or S3.
- Autor:
- Denys Chaykovskiy
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungaddFSPrefix
(String path) Adds a file system prefix to the path.addFSPrefix
(List<String> paths) Adds a file system prefix and bucket to paths.boolean
bucketExists
(String bucketName) Checks if the bucket exists.createStorageFile
(String relativePath, String content) Physically creates a storage file.delete
(StorageFile storageFileOrDir) Deletes a file or directory recursively from the storage.Deletes a file or directory recursively from the storage.void
deleteBucket
(String bucket) Deletes a bucket in the storage.deleteFile
(StorageFile storageFileOrDir) Deletes a storage file from the storage.download
(StorageFile sourceFileOrDir, StorageFile targetFileOrDir) Downloads a file or directory recursively from the storage.downloadFile
(StorageFile sourceFile, StorageFile targetFileOrDir) Downloads a file from the storage.boolean
fileExists
(StorageFile storageFile) Checks if a file exists.Gets the absolute base path (file system prefix + bucket + base path), depending on the file system.Gets all files (absolute paths) from the storage.getAbsoluteFiles
(String prefix) Gets the files (absolute paths) from the storage with the given prefix (folder).getAbsolutePath
(String relativePath) Gets the absolute path depending on the storage file system.getAbsolutePath
(List<String> relativePaths) Gets the absolute paths depending on the storage file system.Gets the base path, which is the root directory of the storage system.Gets the current bucket.Gets the buckets from the storage.getFileContent
(StorageFile storageFile) Gets the content of the specified storage file.long
getFileSize
(StorageFile storageFile) Gets the file size.getInputStream
(StorageFile storageFile) Gets the input stream from a file.Gets all files (relative paths) from the storage.getRelativeFiles
(String prefix) Gets files (relative paths) from the storage with the given prefix (folder).getRelativePath
(String absolutePath) Gets the relative path from the absolute path.getRelativePath
(List<String> absolutePaths) Gets the relative paths from the absolute paths.Gets the source path.getStorageFile
(String relativePath) Gets the storage file.Gets the storage files.Gets the storage type, e.g.boolean
isDirectory
(StorageFile storageFileOrDir) Checks if the storage file or directory is a directory.boolean
isFile
(StorageFile storageFileOrDir) Checks if a storage file or directory is a file (i.e., no slash at the end of the path).void
Sets the bucket.upload
(StorageFile sourceFileOrDir) Uploads a file or directory recursively to the storage.upload
(StorageFile sourceFileOrDir, StorageFile targetFileOrDir) Uploads a file or directory recursively to the storage.uploadFile
(StorageFile sourceFile) Uploads a file to the storage.uploadFile
(StorageFile sourceFile, StorageFile targetFileOrDir) Uploads a file to the storage.uploadSourceFile
(String relativeSourceFile) Uploads a source file to the storage.uploadSourceFileOrDir
(String relativeSourceFileOrDir) Uploads a source file or directory recursively to the storage.
-
Methodendetails
-
getStorageType
StorageType getStorageType()Gets the storage type, e.g. POSIX or S3.- Gibt zurück:
- the storage type
-
getBasePath
String getBasePath()Gets the base path, which is the root directory of the storage system.- Gibt zurück:
- the base path
-
getAbsoluteBasePath
String getAbsoluteBasePath()Gets the absolute base path (file system prefix + bucket + base path), depending on the file system.- Gibt zurück:
- the absolute base path
-
getSourcePath
String getSourcePath()Gets the source path.- Gibt zurück:
- the source path
-
setBucket
Sets the bucket.- Parameter:
bucket
- the bucket to set- Löst aus:
IOException
- if an error occurs while setting the bucket
-
getBucket
String getBucket()Gets the current bucket.- Gibt zurück:
- the current bucket
-
getBuckets
Gets the buckets from the storage.- Gibt zurück:
- the list of buckets
- Löst aus:
IOException
- if an error occurs while getting the buckets
-
bucketExists
Checks if the bucket exists.- Parameter:
bucketName
- the name of the bucket- Gibt zurück:
- true if the bucket exists
- Löst aus:
IOException
- if an error occurs while checking the bucket existence
-
deleteBucket
Deletes a bucket in the storage.- Parameter:
bucket
- the bucket to delete- Löst aus:
IOException
- if an error occurs while deleting the bucket
-
getRelativeFiles
Gets files (relative paths) from the storage with the given prefix (folder).- Parameter:
prefix
- the prefix (folder) to search in the storage- Gibt zurück:
- the list of files starting with the given prefix
- Löst aus:
IOException
- if an error occurs while getting the relative files
-
getRelativeFiles
Gets all files (relative paths) from the storage.- Gibt zurück:
- the list of all files from the storage
- Löst aus:
IOException
- if an error occurs while getting the relative files
-
getAbsoluteFiles
Gets the files (absolute paths) from the storage with the given prefix (folder).- Parameter:
prefix
- the prefix (folder) to search in the storage- Gibt zurück:
- the list of files starting with the given prefix
- Löst aus:
IOException
- if an error occurs while getting the absolute files
-
getAbsoluteFiles
Gets all files (absolute paths) from the storage.- Gibt zurück:
- the list of all files from the storage
- Löst aus:
IOException
- if an error occurs while getting the absolute files
-
getRelativePath
Gets the relative path from the absolute path.- Parameter:
absolutePath
- the absolute path- Gibt zurück:
- the relative path
-
getRelativePath
Gets the relative paths from the absolute paths.- Parameter:
absolutePaths
- the absolute paths- Gibt zurück:
- the relative paths
-
getAbsolutePath
Gets the absolute path depending on the storage file system.- Parameter:
relativePath
- the relative path- Gibt zurück:
- the absolute file depending on the storage file system
-
getAbsolutePath
Gets the absolute paths depending on the storage file system.- Parameter:
relativePaths
- the relative paths- Gibt zurück:
- the absolute paths depending on the storage file system
-
getStorageFile
Gets the storage file.- Parameter:
relativePath
- the relative path in the storage to the file- Gibt zurück:
- the storage file object
-
getStorageFiles
Gets the storage files.- Gibt zurück:
- the list of storage files
- Löst aus:
IOException
- if an error occurs while getting the storage files
-
createStorageFile
Physically creates a storage file.- Parameter:
relativePath
- the relative path of the filecontent
- the content of the file- Gibt zurück:
- the storage file object of the created file
- Löst aus:
IOException
- if an error occurs while creating the storage file
-
fileExists
Checks if a file exists.- Parameter:
storageFile
- the storage file to check- Gibt zurück:
- true if the file exists physically
- Löst aus:
IOException
- if an error occurs while checking the file existence
-
isFile
Checks if a storage file or directory is a file (i.e., no slash at the end of the path).- Parameter:
storageFileOrDir
- the storage file or directory- Gibt zurück:
- true if the storage file is a file
- Löst aus:
IOException
- if an error occurs while checking if the storage file is a file
-
isDirectory
Checks if the storage file or directory is a directory.- Parameter:
storageFileOrDir
- the storage file or directory- Gibt zurück:
- true if the storage file is a directory
- Löst aus:
IOException
- if an error occurs while checking if the storage file is a directory
-
getFileSize
Gets the file size.- Parameter:
storageFile
- the storage file- Gibt zurück:
- the file size of the storage file
- Löst aus:
IOException
- if an error occurs while getting the file size
-
getFileContent
Gets the content of the specified storage file.- Parameter:
storageFile
- the storage file from which to retrieve the content- Gibt zurück:
- the file content
- Löst aus:
IOException
- if an error occurs while getting the file content
-
uploadFile
Uploads a file to the storage.- Parameter:
sourceFile
- the source file to uploadtargetFileOrDir
- the target file or directory in the storage- Gibt zurück:
- the path of the uploaded file
- Löst aus:
IOException
- if an error occurs while uploading the file
-
upload
Uploads a file or directory recursively to the storage.- Parameter:
sourceFileOrDir
- the source file or directorytargetFileOrDir
- the target file or directory in the storage- Gibt zurück:
- the list of uploaded files
- Löst aus:
IOException
- if an error occurs while uploading the file or directory
-
upload
Uploads a file or directory recursively to the storage.- Parameter:
sourceFileOrDir
- the source file or directory to upload- Gibt zurück:
- the list of uploaded files
- Löst aus:
IOException
- if an error occurs while uploading the file or directory
-
uploadFile
Uploads a file to the storage.- Parameter:
sourceFile
- the source file to upload- Gibt zurück:
- the path of the uploaded file
- Löst aus:
IOException
- if an error occurs while uploading the file
-
uploadSourceFileOrDir
Uploads a source file or directory recursively to the storage.- Parameter:
relativeSourceFileOrDir
- the relative path to the source file or directory- Gibt zurück:
- the list of uploaded source files to the storage
- Löst aus:
IOException
- if an error occurs while uploading the file
-
uploadSourceFile
Uploads a source file to the storage.- Parameter:
relativeSourceFile
- the relative path to the source file- Gibt zurück:
- the uploaded source file in the storage
- Löst aus:
IOException
- if an error occurs while uploading the file
-
download
Downloads a file or directory recursively from the storage.- Parameter:
sourceFileOrDir
- the source file or directory in the storagetargetFileOrDir
- the target file or directory- Gibt zurück:
- the list of downloaded files
- Löst aus:
IOException
- if an error occurs while downloading the file or directory
-
downloadFile
Downloads a file from the storage.- Parameter:
sourceFile
- the source file in the storage to downloadtargetFileOrDir
- the target file or directory- Gibt zurück:
- the downloaded storage file
- Löst aus:
IOException
- if an error occurs while downloading the file
-
delete
Deletes a file or directory recursively from the storage.- Parameter:
storageFileOrDir
- the storage file or directory to delete- Gibt zurück:
- the list of deleted files from the storage
- Löst aus:
IOException
- if an error occurs while deleting the file or directory
-
deleteFile
Deletes a storage file from the storage.- Parameter:
storageFileOrDir
- the storage file to delete- Gibt zurück:
- the deleted storage file
- Löst aus:
IOException
- if an error occurs while deleting the file
-
delete
Deletes a file or directory recursively from the storage.- Parameter:
relativeFileOrDir
- the relative path to the storage file or directory to delete- Gibt zurück:
- the list of deleted files from the storage
- Löst aus:
IOException
- if an error occurs while deleting the file or directory
-
addFSPrefix
Adds a file system prefix to the path.- Parameter:
path
- the path to extend- Gibt zurück:
- the file system prefix + path
-
addFSPrefix
Adds a file system prefix and bucket to paths.- Parameter:
paths
- the paths to extend- Gibt zurück:
- the list of file system prefix + path
-
getInputStream
Gets the input stream from a file.- Parameter:
storageFile
- the storage file- Gibt zurück:
- the input stream from the file
- Löst aus:
IOException
- if an error occurs while getting the input stream
-