Package org.frankframework.filesystem
Class ImapFileSystem
java.lang.Object
org.frankframework.filesystem.AbstractFileSystem<jakarta.mail.Message>
org.frankframework.filesystem.AbstractConnectedFileSystem<jakarta.mail.Message,org.eclipse.angus.mail.imap.IMAPFolder>
org.frankframework.filesystem.AbstractMailFileSystem<jakarta.mail.Message,jakarta.mail.internet.MimeBodyPart,org.eclipse.angus.mail.imap.IMAPFolder>
org.frankframework.filesystem.ImapFileSystem
- All Implemented Interfaces:
AutoCloseable,HasPhysicalDestination,IBasicFileSystem<jakarta.mail.Message>,IMailFileSystem<jakarta.mail.Message,jakarta.mail.internet.MimeBodyPart>
@DestinationType(MAIL)
public class ImapFileSystem
extends AbstractMailFileSystem<jakarta.mail.Message,jakarta.mail.internet.MimeBodyPart,org.eclipse.angus.mail.imap.IMAPFolder>
-
Field Summary
Fields inherited from interface org.frankframework.filesystem.IMailFileSystem
BCC_RECIPIENTS_KEY, BEST_REPLY_ADDRESS_KEY, CC_RECIPIENTS_KEY, DATETIME_RECEIVED_KEY, DATETIME_SENT_KEY, FROM_ADDRESS_KEY, MAIL_MESSAGE_ID, REPLY_ADDRESS_FIELDS_DEFAULT, REPLY_TO_RECIPIENTS_KEY, RETURN_PATH_HEADER, SENDER_ADDRESS_KEY, TO_RECIPIENTS_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseConnection(org.eclipse.angus.mail.imap.IMAPFolder folder) Close connection to the FileSystem, releasing all resources.voidjakarta.mail.MessageCopies the file to another folder.protected org.eclipse.angus.mail.imap.IMAPFolderCreate a fresh connection to the FileSystem.voidcreateFolder(String folderName) voiddeleteFile(jakarta.mail.Message message) booleanexists(jakarta.mail.Message f) voidextractAttachment(jakarta.mail.internet.MimeBodyPart attachment, SaxElementBuilder attachmentsXml) voidextractEmail(jakarta.mail.Message emailMessage, SaxElementBuilder emailXml) booleanfolderExists(String foldername) voidforwardMail(jakarta.mail.Message emailMessage, String destination) getAdditionalAttachmentProperties(jakarta.mail.internet.MimeBodyPart a) getAdditionalFileProperties(jakarta.mail.Message f) getAttachmentContentType(jakarta.mail.internet.MimeBodyPart a) getAttachmentFileName(jakarta.mail.internet.MimeBodyPart a) getAttachmentName(jakarta.mail.internet.MimeBodyPart a) longgetAttachmentSize(jakarta.mail.internet.MimeBodyPart a) getCanonicalName(jakarta.mail.Message f) jakarta.mail.MessagegetFileFromAttachment(jakarta.mail.internet.MimeBodyPart a) longgetFileSize(jakarta.mail.Message f) getMimeContent(jakarta.mail.Message emailMessage) getModificationTime(jakarta.mail.Message message) getName(jakarta.mail.Message f) Get a string representation of an identification of a file.intgetNumberOfFilesInFolder(String foldername) getParentFolder(jakarta.mail.Message f) protected StringFor test purposes only.getSubject(jakarta.mail.Message emailMessage) booleanisFolder(jakarta.mail.Message message) DirectoryStream<jakarta.mail.Message> list(jakarta.mail.Message foldername, TypeFilter filter) Iterator<jakarta.mail.internet.MimeBodyPart> listAttachments(jakarta.mail.Message f) jakarta.mail.MessageMoves the file to another folder.readAttachment(jakarta.mail.internet.MimeBodyPart a) voidremoveFolder(String folderName, boolean removeNonEmptyFolder) voidThe hostname of the IMAP servervoidsetPort(int port) The port of the IMAP serverjakarta.mail.MessageGet a file 'F' representation of an identification of a file.jakarta.mail.MessageCreates a reference to a file.Methods inherited from class org.frankframework.filesystem.AbstractMailFileSystem
setAuthAlias, setBaseFolder, setPassword, setReadMimeContents, setReplyAddressFields, setUsernameMethods inherited from class org.frankframework.filesystem.AbstractConnectedFileSystem
close, getConnection, open, releaseConnectionMethods inherited from class org.frankframework.filesystem.AbstractFileSystem
getMaxNumberOfMessagesToList, isOpen, setMaxNumberOfMessagesToListMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.frankframework.filesystem.IBasicFileSystem
close, getCanonicalNameOrErrorMessage, isOpen, list, openMethods inherited from interface org.frankframework.filesystem.IMailFileSystem
getReplyAddressFields
-
Constructor Details
-
ImapFileSystem
public ImapFileSystem()
-
-
Method Details
-
configure
- Throws:
ConfigurationException
-
getStoreName
For test purposes only. Defaults to IMAPS, but tests use IMAP- Throws:
jakarta.mail.NoSuchProviderException
-
createConnection
Description copied from class:AbstractConnectedFileSystemCreate a fresh connection to the FileSystem.- Specified by:
createConnectionin classAbstractConnectedFileSystem<jakarta.mail.Message,org.eclipse.angus.mail.imap.IMAPFolder> - Throws:
FileSystemException
-
closeConnection
protected void closeConnection(org.eclipse.angus.mail.imap.IMAPFolder folder) throws FileSystemException Description copied from class:AbstractConnectedFileSystemClose connection to the FileSystem, releasing all resources.- Overrides:
closeConnectionin classAbstractConnectedFileSystem<jakarta.mail.Message,org.eclipse.angus.mail.imap.IMAPFolder> - Throws:
FileSystemException
-
getName
Description copied from interface:IBasicFileSystemGet a string representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.toFile(String). Can reflect name a file has in its folder, is not expected to be unique over folders. -
getParentFolder
-
toFile
Description copied from interface:IBasicFileSystemGet a file 'F' representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.getName(Object).- Throws:
FileSystemException
-
toFile
public jakarta.mail.Message toFile(@Nullable String defaultFolder, @Nullable String filename) throws FileSystemException Description copied from interface:IBasicFileSystemCreates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Throws:
FileSystemException
-
exists
- Throws:
FileSystemException
-
isFolder
- Throws:
FileSystemException
-
folderExists
- Throws:
FileSystemException
-
getNumberOfFilesInFolder
- Specified by:
getNumberOfFilesInFolderin interfaceIBasicFileSystem<jakarta.mail.Message>- Overrides:
getNumberOfFilesInFolderin classAbstractFileSystem<jakarta.mail.Message>- Throws:
FileSystemException
-
list
public DirectoryStream<jakarta.mail.Message> list(jakarta.mail.Message foldername, TypeFilter filter) throws FileSystemException - Throws:
FileSystemException
-
deleteFile
- Throws:
FileSystemException
-
moveFile
public jakarta.mail.Message moveFile(jakarta.mail.Message f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystemMoves the file to another folder. Does not need to check for existence of the source or non-existence of the destination. Returns the moved file, or null if no file was moved or there is no reference to the moved file.- Throws:
FileSystemException
-
copyFile
public jakarta.mail.Message copyFile(jakarta.mail.Message f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystemCopies the file to another folder. Does not need to check for existence of the source or non-existence of the destination. Returns the copied file, or null if no file was copied or there is no reference to the copied file.- Throws:
FileSystemException
-
createFolder
- Throws:
FileSystemException
-
removeFolder
public void removeFolder(String folderName, boolean removeNonEmptyFolder) throws FileSystemException - Throws:
FileSystemException
-
readFile
public Message readFile(jakarta.mail.Message f, String charset) throws FileSystemException, IOException - Throws:
FileSystemExceptionIOException
-
listAttachments
public Iterator<jakarta.mail.internet.MimeBodyPart> listAttachments(jakarta.mail.Message f) throws FileSystemException - Throws:
FileSystemException
-
getAttachmentName
- Throws:
FileSystemException
-
readAttachment
-
getAttachmentSize
- Throws:
FileSystemException
-
getAttachmentContentType
public String getAttachmentContentType(jakarta.mail.internet.MimeBodyPart a) throws FileSystemException - Throws:
FileSystemException
-
getAttachmentFileName
public String getAttachmentFileName(jakarta.mail.internet.MimeBodyPart a) throws FileSystemException - Throws:
FileSystemException
-
getFileFromAttachment
public jakarta.mail.Message getFileFromAttachment(jakarta.mail.internet.MimeBodyPart a) throws FileSystemException - Throws:
FileSystemException
-
getAdditionalAttachmentProperties
public Map<String,Object> getAdditionalAttachmentProperties(jakarta.mail.internet.MimeBodyPart a) throws FileSystemException - Throws:
FileSystemException
-
getFileSize
- Throws:
FileSystemException
-
getCanonicalName
-
getModificationTime
-
getAdditionalFileProperties
@Nullable public Map<String,Object> getAdditionalFileProperties(jakarta.mail.Message f) throws FileSystemException - Throws:
FileSystemException
-
forwardMail
public void forwardMail(jakarta.mail.Message emailMessage, String destination) throws FileSystemException - Throws:
FileSystemException
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination- Overrides:
getPhysicalDestinationNamein classAbstractMailFileSystem<jakarta.mail.Message,jakarta.mail.internet.MimeBodyPart, org.eclipse.angus.mail.imap.IMAPFolder>
-
getSubject
- Throws:
FileSystemException
-
getMimeContent
-
extractEmail
public void extractEmail(jakarta.mail.Message emailMessage, SaxElementBuilder emailXml) throws FileSystemException, SAXException - Throws:
FileSystemExceptionSAXException
-
extractAttachment
public void extractAttachment(jakarta.mail.internet.MimeBodyPart attachment, SaxElementBuilder attachmentsXml) throws FileSystemException, SAXException - Throws:
FileSystemExceptionSAXException
-
setHost
The hostname of the IMAP server -
setPort
public void setPort(int port) The port of the IMAP server- Default value
- 993
-