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 UploadedFileAdds 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.voiddeleteFile(String fileName) Deletes a file with the specified name from the store.default FileRetrieves aFilerepresentation of the specified file in the store.default FileRetrieves aFilerepresentation of the specified file in the store.default PathRetrieves aPathrepresentation of the specified file in the store.Retrieves aPathrepresentation of the specified file in the store.Retrieves the type of store being used.default InputStreamRetrieves an input stream for the specified file.Retrieves an input stream for the specified file.booleanChecks if a file with the specified name exists in the store.voidshutdown()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
UploadedFileobject representing the details of the uploaded file
-
addFile
Adds a file to the store using the specified file path and file name.- Parameters:
path- thePathof the file to be addedfileName- the name under which the file should be stored- Returns:
- an
UploadedFileobject containing the details of the uploaded file
-
addFile
Adds a file to the store using the specified file and file name.- Parameters:
file- theFileobject to be added to the storefileName- the name under which the file should be stored- Returns:
- an
UploadedFileobject 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 aPathrepresentation of the specified file in the store.- Parameters:
fileName- the name of the file whose path is to be retrieved- Returns:
- the
Pathobject representing the storage location of the file
-
getPath
Retrieves aPathrepresentation 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
Pathobject representing the storage location of the file
-
getFile
Retrieves aFilerepresentation of the specified file in the store.- Parameters:
fileName- the name of the file to retrieve- Returns:
- the
Fileobject representing the specified file, or null if the file does not exist
-
getFile
Retrieves aFilerepresentation 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
Fileobject 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
InputStreamfor 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
InputStreamfor the specified file
-
getStoreType
StoreType getStoreType()Retrieves the type of store being used.- Returns:
- the
StoreTyperepresenting the type of storage
-
shutdown
void shutdown()Performs the necessary cleanup or resource release operations to gracefully shut down the storage.
-