Package de.dlr.proseo.storagemgr
Klasse StorageProvider
java.lang.Object
de.dlr.proseo.storagemgr.StorageProvider
A central manager for different types of storage in the application. It
handles the creation, retrieval, and management of storage instances,
provides file-related operations and paths, and offers various utility
methods related to storage management.
This class acts as a singleton and manages the storage configuration, source
paths, and storage operations.
Author: Denys Chaykovskiy
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungcopyAbsoluteFilesToCache
(String sourceFileOrDir, Long productId) createStorageFile
(String relativePath, String content) Creates a physical file in the storage based on the relative path and content.getAbsoluteCachePath
(String relativePath) Gets the absolute cache path from the relative path.getAbsoluteFile
(String absolutePath) Gets a file as a StorageFile from the absolute path.getAbsolutePosixStoragePath
(String relativePath) Gets the absolute posix storage path from the relative path.getAbsoluteSourcePath
(String relativePath) Gets the absolute source path from the relative path.Gets the list of base paths.getCacheFile
(String relativePath) Gets the cache file as a StorageFile from the relative path.long
getCacheFileSize
(String relativePath) Gets the file size of the cache file specified by the relative path.Gets the cache path.getFileSize
(StorageFile storageFile) Gets the file size of the storage file specified by the StorageFile instance.getInputStream
(StorageFile storageFile) Gets an input stream from the storage file specified by the StorageFile instance.static StorageProvider
Returns the instance of the storage provider (singleton).Gets the POSIX configuration from the file.getPosixFile
(String basePath, String relativePath) Gets the posix file as a StorageFile from the relative path.long
getPosixFileSize
(String absolutePath) Gets the file size of the posix file specified by the absolute path.getRelativePath
(String absolutePath) Gets the relative path from the absolute path using the base path list.Gets the S3 configuration from the file.getSourceFile
(String relativePath) Gets the source file as a StorageFile from the relative path.long
getSourceFileSize
(String relativePath) Gets the file size of the source file specified by the relative path.Gets the source path.Gets the current storage instance.getStorage
(StorageType storageType) Gets the desired storage instance based on the specified storage type.getStorage
(String absolutePath) Gets the storage instance based on the specified absolute path.getStorageFile
(String relativePath) Gets the storage file as a StorageFile from the relative path.Gets the storage path.void
Load default source, storage, and cache pathsvoid
setCachePath
(String cachePath) Sets the cache path.void
setSourcePath
(String sourcePath) Sets the source path.setStorage
(StorageType storageType) Sets the default storage type and creates the corresponding storage instance.void
setStoragePath
(String storagePath) Sets the storage path.
-
Felddetails
-
basePaths
Base Paths are used to get relative path from absolute path
-
-
Konstruktordetails
-
StorageProvider
public StorageProvider()Simple default constructor
-
-
Methodendetails
-
getInstance
Returns the instance of the storage provider (singleton).- Gibt zurück:
- the storage provider singleton instance
-
loadDefaultPaths
public void loadDefaultPaths()Load default source, storage, and cache paths -
setSourcePath
Sets the source path.- Parameter:
sourcePath
- the source path to set
-
setStoragePath
Sets the storage path.- Parameter:
storagePath
- the storage path to set
-
setCachePath
Sets the cache path.- Parameter:
cachePath
- the cache path to set
-
getSourcePath
Gets the source path.- Gibt zurück:
- the source path
-
getStoragePath
Gets the storage path.- Gibt zurück:
- the storage path
-
getCachePath
Gets the cache path.- Gibt zurück:
- the cache path
-
getStorage
Gets the current storage instance.- Gibt zurück:
- the current storage instance
-
getStorage
Gets the desired storage instance based on the specified storage type.- Parameter:
storageType
- the storage type- Gibt zurück:
- the storage instance
- Löst aus:
IOException
- if an error occurs during storage creation
-
getStorage
Gets the storage instance based on the specified absolute path.- Parameter:
absolutePath
- the absolute path- Gibt zurück:
- the storage instance
- Löst aus:
IOException
- if an error occurs during storage retrieval
-
setStorage
Sets the default storage type and creates the corresponding storage instance.- Parameter:
storageType
- the storage type to set- Gibt zurück:
- the created storage instance
- Löst aus:
IOException
- if an error occurs during storage creation
-
getBasePaths
Gets the list of base paths.- Gibt zurück:
- the list of base paths
-
getCacheFileSize
Gets the file size of the cache file specified by the relative path.- Parameter:
relativePath
- the relative path of the cache file- Gibt zurück:
- the file size in bytes
- Löst aus:
IOException
- if an error occurs while getting the file size
-
getSourceFileSize
Gets the file size of the source file specified by the relative path.- Parameter:
relativePath
- the relative path of the source file- Gibt zurück:
- the file size in bytes
- Löst aus:
IOException
- if an error occurs while getting the file size
-
getPosixFileSize
Gets the file size of the posix file specified by the absolute path.- Parameter:
absolutePath
- the absolute path of the posix file- Gibt zurück:
- the file size in bytes
- Löst aus:
IOException
- if an error occurs while getting the file size
-
getCacheFile
Gets the cache file as a StorageFile from the relative path. The path can be virtual.- Parameter:
relativePath
- the relative path of the cache file- Gibt zurück:
- the StorageFile representing the cache file
-
getSourceFile
Gets the source file as a StorageFile from the relative path. The path can be virtual.- Parameter:
relativePath
- the relative path of the source file- Gibt zurück:
- the StorageFile representing the source file
-
getPosixFile
Gets the posix file as a StorageFile from the relative path. The path can be virtual.- Parameter:
basePath
- the base path of the posix storagerelativePath
- the relative path of the file- Gibt zurück:
- the StorageFile representing the posix file
-
getStorageFile
Gets the storage file as a StorageFile from the relative path. The path can be virtual.- Parameter:
relativePath
- the relative path of the file- Gibt zurück:
- the StorageFile representing the storage file
-
getFileSize
Gets the file size of the storage file specified by the StorageFile instance.- Parameter:
storageFile
- the StorageFile instance- Gibt zurück:
- the file size in bytes
- Löst aus:
IOException
- if an error occurs while getting the file size
-
getInputStream
Gets an input stream from the storage file specified by the StorageFile instance.- Parameter:
storageFile
- the StorageFile instance- Gibt zurück:
- the input stream
- Löst aus:
IOException
- if an error occurs while getting the input stream
-
getAbsoluteFile
Gets a file as a StorageFile from the absolute path. The path to the file can be virtual.- Parameter:
absolutePath
- the absolute path to the file- Gibt zurück:
- the StorageFile representing the file
-
getAbsoluteSourcePath
Gets the absolute source path from the relative path.- Parameter:
relativePath
- the relative path to the file- Gibt zurück:
- the absolute source path from the relative path
-
getAbsoluteCachePath
Gets the absolute cache path from the relative path.- Parameter:
relativePath
- the relative path to the file- Gibt zurück:
- the absolute cache path from the relative path
-
getAbsolutePosixStoragePath
Gets the absolute posix storage path from the relative path.- Parameter:
relativePath
- the relative path- Gibt zurück:
- the absolute posix storage path from the relative path
-
getRelativePath
Gets the relative path from the absolute path using the base path list.- Parameter:
absolutePath
- the absolute path- Gibt zurück:
- the relative path
- Löst aus:
IOException
- if an error occurs while getting the relative path
-
createStorageFile
Creates a physical file in the storage based on the relative path and content.- Parameter:
relativePath
- the relative path to the filecontent
- the content of the file- Gibt zurück:
- the StorageFile representing the physically created file
- Löst aus:
IOException
- if an error occurs while creating the storage file
-
getPosixConfigurationFromFile
Gets the POSIX configuration from the file.- Gibt zurück:
- the POSIX configuration
-
getS3ConfigurationFromFile
Gets the S3 configuration from the file.- Gibt zurück:
- the S3 configuration
-
copyAbsoluteFilesToCache
public List<String> copyAbsoluteFilesToCache(String sourceFileOrDir, Long productId) throws IOException - Parameter:
sourceFileOrDir
-- Gibt zurück:
- Löst aus:
IOException
-