@Component(value="cuba_FileLoader") public class FileLoaderClientImpl extends java.lang.Object implements FileLoader
FileLoader.InputStreamSupplierException, FileLoader.RetryUnsupportedException, FileLoader.SingleInputStreamSupplier, FileLoader.StreamingProgressListener
Modifier and Type | Field and Description |
---|---|
protected Configuration |
configuration |
protected FileStorageService |
fileStorageService |
protected ServerSelector |
serverSelector |
protected UserSessionSource |
userSessionSource |
NAME
Constructor and Description |
---|
FileLoaderClientImpl() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
failAndGetNextUrl(java.lang.Object context) |
boolean |
fileExists(FileDescriptor fd)
Tests whether the file denoted by this file descriptor exists.
|
java.io.InputStream |
openStream(FileDescriptor fd)
Return an input stream to load a file contents from middleware.
|
protected java.io.InputStream |
openStreamLocally(FileDescriptor fd) |
protected java.io.InputStream |
openStreamWithServlet(FileDescriptor fd) |
void |
removeFile(FileDescriptor fd)
Remove a file from the file storage.
|
void |
saveStream(FileDescriptor fd,
java.util.function.Supplier<java.io.InputStream> inputStreamSupplier)
Save an InputStream contents into file storage on middleware.
|
void |
saveStream(FileDescriptor fd,
java.util.function.Supplier<java.io.InputStream> inputStreamSupplier,
FileLoader.StreamingProgressListener streamingListener)
Save an InputStream contents into file storage on middleware.
|
protected void |
saveStreamLocally(FileDescriptor fd,
java.util.function.Supplier<java.io.InputStream> inputStream) |
protected void |
saveStreamWithServlet(FileDescriptor fd,
java.util.function.Supplier<java.io.InputStream> inputStreamSupplier,
FileLoader.StreamingProgressListener streamingListener) |
protected ServerSelector serverSelector
@Inject protected UserSessionSource userSessionSource
@Inject protected Configuration configuration
@Inject protected FileStorageService fileStorageService
public void saveStream(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier) throws FileStorageException
FileLoader
saveStream
in interface FileLoader
fd
- file descriptorinputStreamSupplier
- input stream supplier
May throw FileLoader.RetryUnsupportedException
if supplier cannot provide stream twice.
May throw FileLoader.InputStreamSupplierException
in case of exception in supplier.FileStorageException
- if something goes wrongpublic void saveStream(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, @Nullable FileLoader.StreamingProgressListener streamingListener) throws FileStorageException, java.lang.InterruptedException
FileLoader
saveStream
in interface FileLoader
fd
- file descriptorinputStreamSupplier
- input stream supplier.
May throw FileLoader.RetryUnsupportedException
if supplier cannot provide stream twice.
May throw FileLoader.InputStreamSupplierException
in case of exception in supplier.streamingListener
- streaming progress listenerFileStorageException
- if something goes wrongjava.lang.InterruptedException
- if current thread is interrupted during streaming processpublic java.io.InputStream openStream(FileDescriptor fd) throws FileStorageException
FileLoader
openStream
in interface FileLoader
fd
- file descriptorFileStorageException
- if something goes wrongpublic void removeFile(FileDescriptor fd) throws FileStorageException
FileLoader
removeFile
in interface FileLoader
fd
- file descriptorFileStorageException
- if something goes wrongpublic boolean fileExists(FileDescriptor fd) throws FileStorageException
FileLoader
fileExists
in interface FileLoader
fd
- file descriptorFileStorageException
- if something goes wrong@throws FileStorageExceptionprotected void saveStreamWithServlet(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, @Nullable FileLoader.StreamingProgressListener streamingListener) throws FileStorageException, java.lang.InterruptedException
FileStorageException
java.lang.InterruptedException
protected void saveStreamLocally(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStream) throws FileStorageException
FileStorageException
protected java.io.InputStream openStreamLocally(FileDescriptor fd) throws FileStorageException
FileStorageException
protected java.io.InputStream openStreamWithServlet(FileDescriptor fd) throws FileStorageException
FileStorageException
@Nullable protected java.lang.String failAndGetNextUrl(java.lang.Object context)