Class ExchangeFileSystem
java.lang.Object
org.frankframework.filesystem.AbstractFileSystem<MailItemId>
org.frankframework.filesystem.exchange.ExchangeFileSystem
- All Implemented Interfaces:
AutoCloseable,HasApplicationContext,HasPhysicalDestination,IScopeProvider,HasKeystore,HasTruststore,IBasicFileSystem<MailItemId>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class ExchangeFileSystem
extends AbstractFileSystem<MailItemId>
implements HasKeystore, HasTruststore, org.springframework.context.ApplicationContextAware
Implementation of a
To make use of oauth authentication:
IBasicFileSystem of an Exchange Mailbox.
To make use of oauth authentication:
- Create an application in Azure AD -> App Registrations. For more information please read how-to-authenticate-an-ews-application-by-using-oauth
- Request the required API permissions within desired scope
https://outlook.office365.com/in Azure AD -> App Registrations -> MyApp -> API Permissions. - Create a secret for your application in Azure AD -> App Registrations -> MyApp -> Certificates and Secrets
- Configure the clientSecret directly as password or as the password of a JAAS entry referred to by authAlias. Only available upon creation of your secret in the previous step.
- Configure the clientId directly as username or as the username of a JAAS entry referred to by authAlias which could be retrieved from Azure AD -> App Registrations -> MyApp -> Overview
- Configure the tenantId which could be retrieved from Azure AD -> App Registrations -> MyApp -> Overview
- Make sure your application is able to reach
https://login.microsoftonline.com. Required for token retrieval.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcopyFile(MailItemId file, String destinationFolder, boolean createFolder) Copies the file to another folder.voidcreateFolder(String folder) voiddeleteFile(MailItemId id) booleanexists(MailItemId file) booleanfolderExists(String folder) getCanonicalName(MailItemId file) longgetFileSize(MailItemId file) protected MsalClientAdapter.GraphClientgetName(MailItemId msg) Get a string representation of an identification of a file.intgetNumberOfFilesInFolder(String folder) booleanisFolder(MailItemId file) list(String folderName, TypeFilter filter) Lists files, directories or both, from a 'folder' or in the 'root' of the filesystem (when folder is null).list(MailItemId folderName, TypeFilter filter) moveFile(MailItemId file, String destinationFolder, boolean createFolder) Moves the file to another folder.voidopen()readFile(MailItemId file, String charset) voidremoveFolder(String folder, boolean removeNonEmptyFolder) voidsetAuthAlias(String authAlias) Alias used to obtain client ID and secret or username and password for authentication to Exchange mail server.voidsetBaseFolder(String baseFolder) Folder (subfolder of root or of inbox) to look for mails.voidsetClientId(String clientId) Client ID that represents a registered application in Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Overview.voidsetClientSecret(String clientSecret) Client secret that belongs to registered application in Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Certificates and SecretsvoidsetMailAddress(String mailAddress) The mail address of the mailbox connected to (also used for auto discovery)voidsetProxyAuthAlias(String proxyAuthAlias) proxy authAliasvoidsetProxyDomain(String proxyDomain) proxy domainvoidsetProxyHost(String proxyHost) proxy hostvoidsetProxyPassword(String proxyPassword) proxy passwordvoidsetProxyPort(int proxyPort) proxy portvoidsetProxyUsername(String proxyUsername) proxy usernamevoidsetReplyAddressFields(String replyAddressFields) Comma separated list of fields to try as response addressvoidsetTenantId(String tenantId) Tenant ID that represents the tenant in which the registered application exists within Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Overview.Get a file 'F' representation of an identification of a file.Creates a reference to a file.Methods 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.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.encryption.HasKeystore
getKeyManagerAlgorithm, getKeystore, getKeystoreAlias, getKeystoreAliasAuthAlias, getKeystoreAliasPassword, getKeystoreAuthAlias, getKeystorePassword, getKeystoreType, setKeyManagerAlgorithm, setKeystore, setKeystoreAlias, setKeystoreAliasAuthAlias, setKeystoreAliasPassword, setKeystoreAuthAlias, setKeystorePassword, setKeystoreTypeMethods inherited from interface org.frankframework.encryption.HasTruststore
getTrustManagerAlgorithm, getTruststore, getTruststoreAuthAlias, getTruststorePassword, getTruststoreType, isAllowSelfSignedCertificates, isIgnoreCertificateExpiredException, isVerifyHostname, setAllowSelfSignedCertificates, setIgnoreCertificateExpiredException, setTrustManagerAlgorithm, setTruststore, setTruststoreAuthAlias, setTruststorePassword, setTruststoreType, setVerifyHostnameMethods inherited from interface org.frankframework.filesystem.IBasicFileSystem
getCanonicalNameOrErrorMessage
-
Constructor Details
-
ExchangeFileSystem
public ExchangeFileSystem()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceIBasicFileSystem<MailItemId>- Throws:
ConfigurationException
-
getGraphClient
- Throws:
IOException
-
open
public void open()- Specified by:
openin interfaceIBasicFileSystem<MailItemId>- Overrides:
openin classAbstractFileSystem<MailItemId>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIBasicFileSystem<MailItemId>- Overrides:
closein classAbstractFileSystem<MailItemId>- Throws:
FileSystemException
-
getNumberOfFilesInFolder
- Specified by:
getNumberOfFilesInFolderin interfaceIBasicFileSystem<MailItemId>- Overrides:
getNumberOfFilesInFolderin classAbstractFileSystem<MailItemId>- Throws:
FileSystemException
-
list
public DirectoryStream<MailItemId> list(MailItemId folderName, TypeFilter filter) throws FileSystemException - Specified by:
listin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
list
public DirectoryStream<MailItemId> list(String folderName, TypeFilter filter) throws FileSystemException Description copied from interface:IBasicFileSystemLists files, directories or both, from a 'folder' or in the 'root' of the filesystem (when folder is null). Only lists the objects as defined by the type filter.
Temporary default method until all implementations useIBasicFileSystem.list(F, TypeFilter)TODO: See Issue 7193- Specified by:
listin interfaceIBasicFileSystem<MailItemId>- 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.- Specified by:
getNamein interfaceIBasicFileSystem<MailItemId>
-
getParentFolder
- Specified by:
getParentFolderin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
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).- Specified by:
toFilein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
toFile
Description copied from interface:IBasicFileSystemCreates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Specified by:
toFilein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
exists
- Specified by:
existsin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
isFolder
- Specified by:
isFolderin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
folderExists
- Specified by:
folderExistsin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
readFile
- Specified by:
readFilein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemExceptionIOException
-
deleteFile
- Specified by:
deleteFilein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
moveFile
public MailMessage moveFile(MailItemId file, 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.- Specified by:
moveFilein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
copyFile
public MailMessage copyFile(MailItemId file, 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.- Specified by:
copyFilein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolderin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolderin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSizein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
getCanonicalName
- Specified by:
getCanonicalNamein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
getModificationTime
- Specified by:
getModificationTimein interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
getAdditionalFileProperties
- Specified by:
getAdditionalFilePropertiesin interfaceIBasicFileSystem<MailItemId>- Throws:
FileSystemException
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination
-
setMailAddress
The mail address of the mailbox connected to (also used for auto discovery) -
setBaseFolder
Folder (subfolder of root or of inbox) to look for mails. If empty, the inbox folder is used -
setClientId
Client ID that represents a registered application in Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Overview. -
setClientSecret
Client secret that belongs to registered application in Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Certificates and Secrets -
setTenantId
Tenant ID that represents the tenant in which the registered application exists within Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Overview. -
setAuthAlias
Alias used to obtain client ID and secret or username and password for authentication to Exchange mail server. If the attribute tenantId is empty, the deprecated Basic Authentication method is used. If the attribute tenantId is not empty, the username and password are treated as the client ID and secret. -
setProxyHost
proxy host -
setProxyPort
public void setProxyPort(int proxyPort) proxy port- Default value
- 8080
-
setProxyUsername
proxy username -
setProxyPassword
proxy password -
setProxyAuthAlias
proxy authAlias -
setProxyDomain
proxy domain -
setReplyAddressFields
Comma separated list of fields to try as response address- Default value
- "replyTo,from,sender,Return-Path"<M,
A>
-