Package com.axelor.file.store
Interface Store
- All Known Implementing Classes:
FileSystemStore
,S3Store
public interface Store
Represents an interface for managing file storage.
-
Method Summary
Modifier and TypeMethodDescriptiondefault UploadedFile
Adds a file to the store using the specified file and file name.addFile
(InputStream inputStream, String fileName) Adds a file to the store using the provided input stream and file name.Adds a file to the store using the specified file path and file name.void
deleteFile
(String fileName) Deletes a file with the specified name from the store.default File
Retrieves aFile
representation of the specified file in the store.default File
Retrieves aFile
representation of the specified file in the store.default Path
Retrieves aPath
representation of the specified file in the store.Retrieves aPath
representation of the specified file in the store.Retrieves the type of store being used.default InputStream
Retrieves an input stream for the specified file.Retrieves an input stream for the specified file.boolean
Checks if a file with the specified name exists in the store.void
shutdown()
Performs the necessary cleanup or resource release operations to gracefully shut down the storage.
-
Method Details
-
hasFile
Checks if a file with the specified name exists in the store.- Parameters:
fileName
- the name of the file to check for existence- Returns:
- true if a file with the specified name exists, false otherwise
-
addFile
Adds a file to the store using the provided input stream and file name.- Parameters:
inputStream
- the input stream containing the file datafileName
- the name of the file to be stored- Returns:
- an
UploadedFile
object representing the details of the uploaded file
-
addFile
Adds a file to the store using the specified file path and file name.- Parameters:
path
- thePath
of the file to be addedfileName
- the name under which the file should be stored- Returns:
- an
UploadedFile
object containing the details of the uploaded file
-
addFile
Adds a file to the store using the specified file and file name.- Parameters:
file
- theFile
object to be added to the storefileName
- the name under which the file should be stored- Returns:
- an
UploadedFile
object containing the details of the uploaded file
-
deleteFile
Deletes a file with the specified name from the store.- Parameters:
fileName
- the name of the file to be deleted
-
getPath
Retrieves aPath
representation of the specified file in the store.- Parameters:
fileName
- the name of the file whose path is to be retrieved- Returns:
- the
Path
object representing the storage location of the file
-
getPath
Retrieves aPath
representation of the specified file in the store.- Parameters:
fileName
- the name of the file whose path is to be retrievedcache
- whether to use cached storage for retrieving the file path- Returns:
- the
Path
object representing the storage location of the file
-
getFile
Retrieves aFile
representation of the specified file in the store.- Parameters:
fileName
- the name of the file to retrieve- Returns:
- the
File
object representing the specified file, or null if the file does not exist
-
getFile
Retrieves aFile
representation of the specified file in the store.- Parameters:
fileName
- the name of the file to retrievecache
- whether to use cached storage for retrieving the file- Returns:
- the
File
object representing the specified file, or null if the file does not exist
-
getStream
Retrieves an input stream for the specified file.- Parameters:
fileName
- the name of the file to retrieve the input stream for- Returns:
- an
InputStream
for the specified file
-
getStream
Retrieves an input stream for the specified file.- Parameters:
fileName
- the name of the file to retrieve the input stream forcache
- whether the file should be retrieved from a cached source- Returns:
- an
InputStream
for the specified file
-
getStoreType
StoreType getStoreType()Retrieves the type of store being used.- Returns:
- the
StoreType
representing the type of storage
-
shutdown
void shutdown()Performs the necessary cleanup or resource release operations to gracefully shut down the storage.
-