Package de.dlr.proseo.storagemgr.s3
Klasse S3Storage
java.lang.Object
de.dlr.proseo.storagemgr.s3.S3Storage
- Alle implementierten Schnittstellen:
Storage
An implementation of the Storage interface for a S3-based file system,
providing functionality to interact with the storage system, that is
retrieving information about the storage, performing file operations, and
path conversion.
- Autor:
- Denys Chaykovskiy
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungaddFSPrefix(String path) Adds the file system prefix to the path.addFSPrefix(List<String> paths) Adds the file system prefix to paths.booleanbucketExists(String bucketName) Checks if the bucket exists.createStorageFile(String relativePath, String content) Creates the physical storage file.delete(StorageFile storageFileOrDir) Deletes the file or directory recursively from the storage.Deletes the file or directory recursively from the storage.voiddeleteBucket(String bucketName) Deletes the bucket in storage.deleteFile(StorageFile storageFile) Deletes the storage file from storage.download(StorageFile sourceFileOrDir, StorageFile targetFileOrDir) Downloads the file or directory recursively.downloadFile(StorageFile sourceFile, StorageFile targetFileOrDir) Downloads the file from storage.booleanfileExists(StorageFile storageFile) Checks if the file exists.Gets the absolute base path (fs prefix + bucket + base path), depends on fs.Gets all files (absolute paths) from storage.getAbsoluteFiles(String relativePath) Gets files (absolute paths) from storage with the given relative path.getAbsolutePath(String relativePath) Gets the absolute path (s3://<bucket>/<relativePath>).getAbsolutePath(List<String> relativePaths) Gets the absolute paths (s3://<bucket>/<relativePath>).Gets the base path.Gets the bucket.Gets the buckets from storage.getFileContent(StorageFile storageFile) Gets the file content.longgetFileSize(StorageFile storageFile) Gets the file size.getInputStream(StorageFile storageFile) Gets the input stream from the file.Gets all files from storage.getRelativeFiles(String folder) Gets the files from storage with the given prefix (folder).getRelativePath(String absolutePath) Gets the relative path from the absolute path by removing the S3 prefix, bucket, and left slash.getRelativePath(List<String> absolutePaths) Gets the relative paths from the absolute paths by removing the S3 prefix, bucket, and left slash.Gets the source path.getStorageFile(String relativePath) Gets the Storage File.Gets the storage files.Gets the storage type.booleanisDirectory(StorageFile storageFileOrDir) Checks if the storage file or directory is a directory.booleanisFile(StorageFile storageFileOrDir) Checks if the storage file or directory is a file (no slash at the end of the path).voidSets the bucket.upload(StorageFile sourceFileOrDir) Uploads the file or directory recursively to the storage.upload(StorageFile sourceFileOrDir, StorageFile targetFileOrDir) Uploads the file or directory recursively to storage.uploadFile(StorageFile sourceFile) Uploads the file to the storage.uploadFile(StorageFile sourceFile, StorageFile targetFileOrDir) Uploads the file to storage.uploadSourceFile(String relativeSourceFile) Uploads the source file.uploadSourceFileOrDir(String relativeSourceFileOrDir) Uploads the source file or directory recursively to the storage.
-
Konstruktordetails
-
S3Storage
Constructor with the s3 configuration- Parameter:
cfg- s3 configuration- Löst aus:
IOException- if an I/O exception occurs
-
-
Methodendetails
-
getStorageType
Gets the storage type.- Angegeben von:
getStorageTypein SchnittstelleStorage- Gibt zurück:
- the storage type
-
getBasePath
Gets the base path.- Angegeben von:
getBasePathin SchnittstelleStorage- Gibt zurück:
- the base path
-
getAbsoluteBasePath
Gets the absolute base path (fs prefix + bucket + base path), depends on fs. In other words, it is the absolute path without the relative path in this S3 version. s3://bucket/- Angegeben von:
getAbsoluteBasePathin SchnittstelleStorage- Gibt zurück:
- the absolute base path
-
getSourcePath
Gets the source path.- Angegeben von:
getSourcePathin SchnittstelleStorage- Gibt zurück:
- the source path
-
setBucket
Sets the bucket.- Angegeben von:
setBucketin SchnittstelleStorage- Parameter:
bucket- the bucket to set- Löst aus:
IOException- if an I/O exception occurs
-
getBucket
Gets the bucket. -
getBuckets
Gets the buckets from storage.- Angegeben von:
getBucketsin SchnittstelleStorage- Gibt zurück:
- the list of buckets
- Löst aus:
IOException- if an I/O exception occurs
-
bucketExists
Checks if the bucket exists.- Angegeben von:
bucketExistsin SchnittstelleStorage- Parameter:
bucketName- the name of the bucket- Gibt zurück:
- true if the bucket exists
- Löst aus:
IOException- if an I/O exception occurs
-
deleteBucket
Deletes the bucket in storage.- Angegeben von:
deleteBucketin SchnittstelleStorage- Parameter:
bucketName- the bucket to delete- Löst aus:
IOException- if the bucket cannot be deleted
-
getRelativeFiles
Gets the files from storage with the given prefix (folder).- Angegeben von:
getRelativeFilesin SchnittstelleStorage- Parameter:
folder- the prefix (folder) for search in storage- Gibt zurück:
- the list of files with the given prefix
- Löst aus:
IOException- if an I/O exception occurs
-
getRelativeFiles
Gets all files from storage.- Angegeben von:
getRelativeFilesin SchnittstelleStorage- Gibt zurück:
- the list of all files from storage
- Löst aus:
IOException- if an I/O exception occurs
-
getAbsoluteFiles
Gets files (absolute paths) from storage with the given relative path.- Angegeben von:
getAbsoluteFilesin SchnittstelleStorage- Parameter:
relativePath- the relative path for search in storage- Gibt zurück:
- the list of files with the given prefix
- Löst aus:
IOException- if an I/O exception occurs
-
getAbsoluteFiles
Gets all files (absolute paths) from storage.- Angegeben von:
getAbsoluteFilesin SchnittstelleStorage- Gibt zurück:
- the list of all files from storage
- Löst aus:
IOException- if an I/O exception occurs
-
getRelativePath
Gets the relative path from the absolute path by removing the S3 prefix, bucket, and left slash.- Angegeben von:
getRelativePathin SchnittstelleStorage- Parameter:
absolutePath- the absolute path- Gibt zurück:
- the relative path
-
getRelativePath
Gets the relative paths from the absolute paths by removing the S3 prefix, bucket, and left slash.- Angegeben von:
getRelativePathin SchnittstelleStorage- Parameter:
absolutePaths- the absolute paths- Gibt zurück:
- the relative paths
-
getAbsolutePath
Gets the absolute path (s3://<bucket>/<relativePath>).- Angegeben von:
getAbsolutePathin SchnittstelleStorage- Parameter:
relativePath- the relative path- Gibt zurück:
- the absolute file depending on the storage file system
-
getAbsolutePath
Gets the absolute paths (s3://<bucket>/<relativePath>).- Angegeben von:
getAbsolutePathin SchnittstelleStorage- Parameter:
relativePaths- the relative paths- Gibt zurück:
- the absolute paths depending on the storage file system
-
getStorageFile
Gets the Storage File.- Angegeben von:
getStorageFilein SchnittstelleStorage- Parameter:
relativePath- the relative path in storage to the file- Gibt zurück:
- the storage file object
-
getStorageFiles
Gets the storage files.- Angegeben von:
getStorageFilesin SchnittstelleStorage- Gibt zurück:
- the list of storage files
- Löst aus:
IOException- if an I/O exception occurs
-
createStorageFile
Creates the physical storage file.- Angegeben von:
createStorageFilein SchnittstelleStorage- 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 the file cannot be created
-
fileExists
Checks if the file exists.- Angegeben von:
fileExistsin SchnittstelleStorage- Parameter:
storageFile- the storage file to check- Gibt zurück:
- true if the file exists physically
- Löst aus:
IOException- if an I/O exception occurs
-
isFile
Checks if the storage file or directory is a file (no slash at the end of the path).- Angegeben von:
isFilein SchnittstelleStorage- Parameter:
storageFileOrDir- the storage file or directory- Gibt zurück:
- true if the storage file is a file
- Löst aus:
IOException- if an I/O exception occurs
-
isDirectory
Checks if the storage file or directory is a directory.- Angegeben von:
isDirectoryin SchnittstelleStorage- Parameter:
storageFileOrDir- the storage file or directory- Gibt zurück:
- true if the storage file is a file
- Löst aus:
IOException- if an I/O exception occurs
-
getFileSize
Gets the file size.- Angegeben von:
getFileSizein SchnittstelleStorage- Parameter:
storageFile- the storage file- Gibt zurück:
- the file size of the storage file
- Löst aus:
IOException- if an I/O exception occurs
-
getFileContent
Gets the file content.- Angegeben von:
getFileContentin SchnittstelleStorage- Parameter:
storageFile- the storage file- Gibt zurück:
- the file content
- Löst aus:
IOException- if an error occurs while getting the file content
-
uploadFile
Uploads the file to storage.- Angegeben von:
uploadFilein SchnittstelleStorage- Parameter:
sourceFile- the source file to uploadtargetFileOrDir- the target file or directory in the storage- Gibt zurück:
- the uploaded storage file
- Löst aus:
IOException- if the file cannot be uploaded
-
upload
public List<String> upload(StorageFile sourceFileOrDir, StorageFile targetFileOrDir) throws IOException Uploads the file or directory recursively to storage.- Angegeben von:
uploadin SchnittstelleStorage- 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 the file or directory cannot be uploaded
-
upload
Uploads the file or directory recursively to the storage.- Angegeben von:
uploadin SchnittstelleStorage- Parameter:
sourceFileOrDir- the source file or dir to upload- Gibt zurück:
- the list of uploaded files
- Löst aus:
IOException- if the file or directory cannot be uploaded
-
uploadFile
Uploads the file to the storage.- Angegeben von:
uploadFilein SchnittstelleStorage- Parameter:
sourceFile- the source file to upload- Gibt zurück:
- the path of the uploaded file
- Löst aus:
IOException- if the file cannot be uploaded
-
uploadSourceFileOrDir
Uploads the source file or directory recursively to the storage.- Angegeben von:
uploadSourceFileOrDirin SchnittstelleStorage- Parameter:
relativeSourceFileOrDir- the relative path to source file or directory- Gibt zurück:
- the list of uploaded to storage source files
- Löst aus:
IOException- if the file cannot be uploaded
-
uploadSourceFile
Uploads the source file.- Angegeben von:
uploadSourceFilein SchnittstelleStorage- Parameter:
relativeSourceFile- the relative path to source file- Gibt zurück:
- the uploaded to storage source file
- Löst aus:
IOException- if the file cannot be uploaded
-
download
public List<String> download(StorageFile sourceFileOrDir, StorageFile targetFileOrDir) throws IOException Downloads the file or directory recursively.- Angegeben von:
downloadin SchnittstelleStorage- 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 the file cannot be downloaded
-
downloadFile
Downloads the file from storage.- Angegeben von:
downloadFilein SchnittstelleStorage- Parameter:
sourceFile- the storage source file to downloadtargetFileOrDir- the target file or directory- Gibt zurück:
- the Storage File object with the downloaded file
- Löst aus:
IOException- if the file cannot be downloaded
-
delete
Deletes the file or directory recursively from the storage.- Angegeben von:
deletein SchnittstelleStorage- Parameter:
storageFileOrDir- the Storage file or directory to delete- Gibt zurück:
- the list of deleted files from storage
- Löst aus:
IOException- if the file or directory cannot be deleted
-
deleteFile
Deletes the storage file from storage.- Angegeben von:
deleteFilein SchnittstelleStorage- Parameter:
storageFile- the storage file to delete- Gibt zurück:
- the deleted storage file
- Löst aus:
IOException- if the file cannot be deleted
-
delete
Deletes the file or directory recursively from the storage.- Angegeben von:
deletein SchnittstelleStorage- Parameter:
relativeFileOrDir- the Storage file or directory to delete- Gibt zurück:
- the list of deleted files from storage
- Löst aus:
IOException- if the file or directory cannot be deleted
-
addFSPrefix
Adds the file system prefix to the path.- Angegeben von:
addFSPrefixin SchnittstelleStorage- Parameter:
path- the path to extend- Gibt zurück:
- the file system prefix + "|" + path
-
addFSPrefix
Adds the file system prefix to paths.- Angegeben von:
addFSPrefixin SchnittstelleStorage- Parameter:
paths- the paths to extend- Gibt zurück:
- the list of file system prefix + path
-
getInputStream
Gets the input stream from the file.- Angegeben von:
getInputStreamin SchnittstelleStorage- 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
-