public final class TransportProviderRegistry
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static TransportProvider |
getTransportProvider(java.lang.String protocol)
Gets the transport provider appropriate for specified protocol.
|
static TransportProvider |
getTransportProviderBySession(com.openexchange.session.Session session,
int accountId)
Gets the transport provider appropriate for specified session
|
static TransportProvider |
getTransportProviderByURL(java.lang.String serverUrl)
Gets the transport provider appropriate for specified mail server URL.
|
static boolean |
isEmpty()
Checks if transport provider registry is empty.
|
static boolean |
registerTransportProvider(java.lang.String protocol,
TransportProvider provider)
Registers a transport provider and performs its start-up actions
|
static void |
unregisterAll()
Unregisters all transport providers
|
static TransportProvider |
unregisterTransportProvider(TransportProvider provider)
Unregisters the transport provider
|
static TransportProvider |
unregisterTransportProviderByProtocol(java.lang.String protocol)
Unregisters the transport provider supporting specified protocol
|
public static TransportProvider getTransportProviderBySession(com.openexchange.session.Session session, int accountId) throws com.openexchange.exception.OXException
session
- The sessionaccountId
- The account IDcom.openexchange.exception.OXException
- If no supporting transport provider can be foundpublic static TransportProvider getTransportProviderByURL(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 transport server URLpublic static TransportProvider getTransportProvider(java.lang.String protocol)
protocol
- The mail protocolpublic static boolean isEmpty()
true
if empty; otherwise false
public static boolean registerTransportProvider(java.lang.String protocol, TransportProvider provider) throws com.openexchange.exception.OXException
protocol
- The transport protocol's string representation; e.g. "smtp_smtps"
provider
- The transport provider to registertrue
if transport provider has been successfully registered and no other transport provider supports the same
protocol; otherwise false
com.openexchange.exception.OXException
- If provider's start-up failspublic static void unregisterAll()
public static TransportProvider unregisterTransportProvider(TransportProvider provider) throws com.openexchange.exception.OXException
provider
- The transport provider to unregisternull
com.openexchange.exception.OXException
- If provider's shut-down failspublic static TransportProvider unregisterTransportProviderByProtocol(java.lang.String protocol) throws com.openexchange.exception.OXException
protocol
- The protocolTransportProvider
, or null
if there was no provider supporting specified
protocolcom.openexchange.exception.OXException
- If provider's shut-down fails