Interface StorageService
- All Known Implementing Classes:
JpaDataFeedFileLobStorageService
public interface StorageService
A component abstraction that can be used to store and retrieve file contents. The API contract is
intentionally simple to allow for maximum flexibility.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDeletes the content from the backing provider.booleanreadToDestination(String uniqueFileNameInContext, String tenantId, OutputStream destination) Reads and transfers the data content of the specified file directly into the specifiedOutputStream.booleanstore(String uniqueFileNameInContext, InputStream content, long contentSizeInBytes, String tenantId) Stores a data stream to a backing provider.
-
Method Details
-
store
boolean store(String uniqueFileNameInContext, InputStream content, long contentSizeInBytes, String tenantId) Stores a data stream to a backing provider. The operation will not be successful if there is already data at the specified location.- Parameters:
uniqueFileNameInContext- a file name to uniquely identify the file in the given context (ex: unique in the given tenant)content- the data to store. This will always be closed by the implementation.contentSizeInBytes- the size of thecontentstream in bytestenantId- the tenant ID to store the file under- Returns:
- whether the operation was successful
-
readToDestination
boolean readToDestination(String uniqueFileNameInContext, String tenantId, OutputStream destination) Reads and transfers the data content of the specified file directly into the specifiedOutputStream.- Parameters:
uniqueFileNameInContext- a file name to uniquely identify the file in the given context (ex: unique in the given tenant)tenantId- the tenant ID the file is stored underdestination- the destination to write the data to. This will always be closed by the implementation.- Returns:
- whether the operation was successful
-
delete
Deletes the content from the backing provider.- Parameters:
uniqueFileNameInContext- a file name to uniquely identify the file in the given context (ex: unique in the given tenant)tenantId- the tenant ID the file is stored under- Returns:
- whether the operation was successful
-