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.
-
Field Summary
Fields inherited from class org.frankframework.filesystem.AbstractFileSystem
log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
copyFile
(MailItemId file, String destinationFolder, boolean createFolder) Copies the file to another folder.void
createFolder
(String folder) void
deleteFile
(MailItemId id) boolean
exists
(MailItemId file) boolean
folderExists
(String folder) getCanonicalName
(MailItemId file) long
getFileSize
(MailItemId file) protected MsalClientAdapter.GraphClient
getName
(MailItemId msg) Get a string representation of an identification of a file.int
getNumberOfFilesInFolder
(String folder) boolean
isFolder
(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).moveFile
(MailItemId file, String destinationFolder, boolean createFolder) Moves the file to another folder.void
open()
readFile
(MailItemId file, String charset) void
removeFolder
(String folder, boolean removeNonEmptyFolder) void
setAuthAlias
(String authAlias) Alias used to obtain client ID and secret or username and password for authentication to Exchange mail server.void
setBaseFolder
(String baseFolder) Folder (subfolder of root or of inbox) to look for mails.void
setClientId
(String clientId) Client ID that represents a registered application in Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Overview.void
setClientSecret
(String clientSecret) Client secret that belongs to registered application in Azure AD which could be found at Azure AD -> App Registrations -> MyApp -> Certificates and Secretsvoid
setMailAddress
(String mailAddress) The mail address of the mailbox connected to (also used for auto discovery)void
setProxyAuthAlias
(String proxyAuthAlias) proxy authAliasvoid
setProxyDomain
(String proxyDomain) proxy domainvoid
setProxyHost
(String proxyHost) proxy hostvoid
setProxyPassword
(String proxyPassword) proxy passwordvoid
setProxyPort
(int proxyPort) proxy portvoid
setProxyUsername
(String proxyUsername) proxy usernamevoid
setReplyAddressFields
(String replyAddressFields) Comma separated list of fields to try as response addressvoid
setTenantId
(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, setMaxNumberOfMessagesToList
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoader
Methods inherited from interface org.frankframework.encryption.HasKeystore
getKeyManagerAlgorithm, getKeystore, getKeystoreAlias, getKeystoreAliasAuthAlias, getKeystoreAliasPassword, getKeystoreAuthAlias, getKeystorePassword, getKeystoreType, setKeyManagerAlgorithm, setKeystore, setKeystoreAlias, setKeystoreAliasAuthAlias, setKeystoreAliasPassword, setKeystoreAuthAlias, setKeystorePassword, setKeystoreType
Methods inherited from interface org.frankframework.core.HasPhysicalDestination
getDomain
Methods inherited from interface org.frankframework.encryption.HasTruststore
getTrustManagerAlgorithm, getTruststore, getTruststoreAuthAlias, getTruststorePassword, getTruststoreType, isAllowSelfSignedCertificates, isIgnoreCertificateExpiredException, isVerifyHostname, setAllowSelfSignedCertificates, setIgnoreCertificateExpiredException, setTrustManagerAlgorithm, setTruststore, setTruststoreAuthAlias, setTruststorePassword, setTruststoreType, setVerifyHostname
Methods inherited from interface org.frankframework.filesystem.IBasicFileSystem
getCanonicalNameOrErrorMessage
-
Constructor Details
-
ExchangeFileSystem
public ExchangeFileSystem()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceIBasicFileSystem<MailItemId>
- Throws:
ConfigurationException
-
getGraphClient
- Throws:
IOException
-
open
public void open()- Specified by:
open
in interfaceIBasicFileSystem<MailItemId>
- Overrides:
open
in classAbstractFileSystem<MailItemId>
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceIBasicFileSystem<MailItemId>
- Overrides:
close
in classAbstractFileSystem<MailItemId>
- Throws:
FileSystemException
-
getNumberOfFilesInFolder
- Specified by:
getNumberOfFilesInFolder
in interfaceIBasicFileSystem<MailItemId>
- Overrides:
getNumberOfFilesInFolder
in classAbstractFileSystem<MailItemId>
- Throws:
FileSystemException
-
list
public DirectoryStream<MailItemId> list(String folderName, TypeFilter filter) throws FileSystemException Description copied from interface:IBasicFileSystem
Lists 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.- Specified by:
list
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
getName
Description copied from interface:IBasicFileSystem
Get 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:
getName
in interfaceIBasicFileSystem<MailItemId>
-
getParentFolder
- Specified by:
getParentFolder
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
toFile
Description copied from interface:IBasicFileSystem
Get a file 'F' representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.getName(Object)
.- Specified by:
toFile
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
toFile
Description copied from interface:IBasicFileSystem
Creates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Specified by:
toFile
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
exists
- Specified by:
exists
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
isFolder
- Specified by:
isFolder
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
folderExists
- Specified by:
folderExists
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
readFile
- Specified by:
readFile
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
IOException
-
deleteFile
- Specified by:
deleteFile
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
moveFile
public MailMessage moveFile(MailItemId file, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystem
Moves 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:
moveFile
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
copyFile
public MailMessage copyFile(MailItemId file, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystem
Copies 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:
copyFile
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolder
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolder
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSize
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
getCanonicalName
- Specified by:
getCanonicalName
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
getModificationTime
- Specified by:
getModificationTime
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
getAdditionalFileProperties
- Specified by:
getAdditionalFileProperties
in interfaceIBasicFileSystem<MailItemId>
- Throws:
FileSystemException
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in 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>
-