T - the type used to retrieve file contents and attributespublic abstract class AbstractConnectedFileInputStreamSupplier<T extends FileSystem> extends AbstractFileInputStreamSupplier
AbstractFileInputStreamSupplier, this supplier can be used when you need a
FileSystem in order to get the file attributes and the file content. This class implements the logic to retrieve
and release the needed fileSystems, and the developer will be given the fileSystem to get the attributes and contents without
to worry about how to get and retrieve connections.attributes, FILE_NO_LONGER_EXISTS_MESSAGE| Constructor and Description |
|---|
AbstractConnectedFileInputStreamSupplier(FileAttributes attributes,
org.mule.runtime.core.api.connector.ConnectionManager connectionManager,
Long timeBetweenSizeCheck,
FileConnectorConfig config) |
AbstractConnectedFileInputStreamSupplier(FileAttributes attributes,
Long timeBetweenSizeCheck,
ConnectionSource<T> connectionSource) |
AbstractConnectedFileInputStreamSupplier(FileAttributes attributes,
Long timeBetweenSizeCheck,
T fileSystem) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
fileWasDeleted(org.mule.runtime.api.exception.MuleRuntimeException e)
This method will be called when a
MuleRuntimeException is thrown while retrieving the content of the file
and its implementation will return whether the file was deleted or not based on the exception thrown. |
Optional<T> |
getConnectionUsedForContentInputStream()
If the content of the file was retrieved, this method will return the
FileSystem used to retrieve that
content. |
protected InputStream |
getContentInputStream()
Gets the
InputStream of the file described by the attributes passed to the constructor |
protected abstract InputStream |
getContentInputStream(T fileSystem)
Gets the
InputStream of the file described by the attributes passed to the constructor |
protected FileAttributes |
getUpdatedAttributes()
Gets the updated attributes of the file.
|
protected abstract FileAttributes |
getUpdatedAttributes(T fileSystem)
Gets the updated attributes of the file.
|
void |
releaseConnectionUsedForContentInputStream()
If the content of the file was retrieved, this method will release the connection used to get that content.
|
get, onFileDeleted, onFileDeletedpublic AbstractConnectedFileInputStreamSupplier(FileAttributes attributes, Long timeBetweenSizeCheck, ConnectionSource<T> connectionSource)
public AbstractConnectedFileInputStreamSupplier(FileAttributes attributes, Long timeBetweenSizeCheck, T fileSystem)
public AbstractConnectedFileInputStreamSupplier(FileAttributes attributes, org.mule.runtime.core.api.connector.ConnectionManager connectionManager, Long timeBetweenSizeCheck, FileConnectorConfig config)
protected final FileAttributes getUpdatedAttributes()
getUpdatedAttributes in class AbstractFileInputStreamSupplierprotected final InputStream getContentInputStream()
InputStream of the file described by the attributes passed to the constructorgetContentInputStream in class AbstractFileInputStreamSupplierInputStream of the filepublic void releaseConnectionUsedForContentInputStream()
public Optional<T> getConnectionUsedForContentInputStream() throws org.mule.runtime.api.connection.ConnectionException
FileSystem used to retrieve that
content.Optional that contains the FileSystem or Optional.empty()org.mule.runtime.api.connection.ConnectionExceptionprotected abstract FileAttributes getUpdatedAttributes(T fileSystem)
fileSystem - the FileSystem to be used to gather the updated attributesprotected abstract InputStream getContentInputStream(T fileSystem)
InputStream of the file described by the attributes passed to the constructorfileSystem - the FileSystem to be used to get the content of the fileInputStream of the fileprotected abstract boolean fileWasDeleted(org.mule.runtime.api.exception.MuleRuntimeException e)
MuleRuntimeException is thrown while retrieving the content of the file
and its implementation will return whether the file was deleted or not based on the exception thrown.e - the thrown MuleRuntimeExceptionCopyright © 2003–2019 MuleSoft, Inc.. All rights reserved.