public final class MailProviderRegistry
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static MailProvider |
getMailProvider(java.lang.String protocolName)
Gets the mail provider appropriate for specified protocol.
|
static MailProvider |
getMailProviderBySession(com.openexchange.session.Session session,
int accountId)
Gets the mail provider appropriate for specified session.
|
static MailProvider |
getMailProviderByURL(java.lang.String serverUrl)
Gets the mail provider appropriate for specified mail server URL.
|
static java.util.List<Protocol> |
getProtocols()
Gets registered mail providers' protocols
|
static MailProvider |
getRealMailProvider(java.lang.String protocolName)
Gets the real mail provider for specified protocol name.
|
static boolean |
registerMailProvider(java.lang.String protocol,
MailProvider provider)
Registers a mail provider and performs its start-up actions
|
static void |
unregisterAll()
Unregisters all mail providers
|
static MailProvider |
unregisterMailProvider(MailProvider provider)
Unregisters the mail provider
|
static MailProvider |
unregisterMailProviderByProtocol(java.lang.String protocol)
Unregisters the mail provider supporting specified protocol
|
public static java.util.List<Protocol> getProtocols()
public static MailProvider getMailProviderBySession(com.openexchange.session.Session session, int accountId) throws com.openexchange.exception.OXException
session - The sessionaccountId - The account IDcom.openexchange.exception.OXException - If no supporting mail provider can be foundpublic static MailProvider getMailProviderByURL(java.lang.String serverUrl)
The given URL should match pattern
<protocol>://<host>(:<port>)?The protocol should be present. Otherwise the configured fallback is used as protocol.
serverUrl - The mail server URLpublic static MailProvider getMailProvider(java.lang.String protocolName)
protocolName - The mail protocol; e.g. "imap"nullpublic static MailProvider getRealMailProvider(java.lang.String protocolName)
protocolName - The protocol namenullpublic static boolean registerMailProvider(java.lang.String protocol,
MailProvider provider)
throws com.openexchange.exception.OXException
protocol - The mail protocol's string representation; e.g. "imap_imaps"provider - The mail provider to registertrue if mail provider has been successfully registered and no other mail provider supports the same protocol;
otherwise falsecom.openexchange.exception.OXException - If provider's start-up failspublic static void unregisterAll()
public static MailProvider unregisterMailProvider(MailProvider provider) throws com.openexchange.exception.OXException
provider - The mail provider to unregisternullcom.openexchange.exception.OXException - If provider's shut-down failspublic static MailProvider unregisterMailProviderByProtocol(java.lang.String protocol) throws com.openexchange.exception.OXException
protocol - The protocolMailProvider, or null if there was no provider supporting specified
protocolcom.openexchange.exception.OXException - If provider's shut-down fails