com.openexchange.mail.api
Class MailProvider

java.lang.Object
  extended by com.openexchange.mail.api.MailProvider
Direct Known Subclasses:
AllMailProvider

public abstract class MailProvider
extends java.lang.Object

MailProvider - The main intention of the provider class is to make the implementing classes available which define the abstract classes of mail API.

Author:
Thorben Betten

Method Summary
abstract  MailAccess<?,?> createNewMailAccess(com.openexchange.session.Session session)
          Gets a newly created mail access with default account ID.
abstract  MailAccess<? extends IMailFolderStorage,? extends IMailMessageStorage> createNewMailAccess(com.openexchange.session.Session session, int accountId)
          Gets a newly created mail access.
 MailPermission createNewMailPermission()
          Gets a newly created mail permission.
 boolean equals(java.lang.Object obj)
           
abstract  Protocol getProtocol()
          Gets this mail provider's protocol
 AbstractProtocolProperties getProtocolProps()
          Gets the protocol properties
 com.openexchange.spamhandler.SpamHandler getSpamHandler()
          Gets the spam handler used by this mail provider.
 int hashCode()
           
 boolean isDeprecated()
          Checks if this provider is deprecated; any cached references should be discarded
 void setDeprecated(boolean deprecated)
          Sets the deprecated flag
 void shutDown()
          Performs provider's shut-down
 void startUp()
          Performs provider's start-up
 boolean supportsProtocol(java.lang.String protocol)
          Checks if this mail provider supports the given protocol (which is either in secure or non-secure notation).
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

isDeprecated

public boolean isDeprecated()
Checks if this provider is deprecated; any cached references should be discarded

Returns:
true if deprecated; otherwise false

setDeprecated

public void setDeprecated(boolean deprecated)
Sets the deprecated flag

Parameters:
deprecated - true if deprecated; otherwise false

startUp

public void startUp()
             throws MailException
Performs provider's start-up

Throws:
MailException - If start-up fails

shutDown

public void shutDown()
              throws MailException
Performs provider's shut-down

Throws:
MailException - if shut-down fails

createNewMailPermission

public MailPermission createNewMailPermission()
Gets a newly created mail permission.

Returns a default permission instance if mailing system does not support permission(s). Overwrite if needed.

Returns:
A newly created mail permission.

getSpamHandler

public com.openexchange.spamhandler.SpamHandler getSpamHandler()
Gets the spam handler used by this mail provider.

Returns:
The spam handler

getProtocol

public abstract Protocol getProtocol()
Gets this mail provider's protocol

Returns:
The protocol

supportsProtocol

public final boolean supportsProtocol(java.lang.String protocol)
Checks if this mail provider supports the given protocol (which is either in secure or non-secure notation).

This is a convenience method that invokes Protocol.isSupported(String)

Parameters:
protocol - The protocol
Returns:
true if supported; otherwise false

createNewMailAccess

public abstract MailAccess<?,?> createNewMailAccess(com.openexchange.session.Session session)
                                             throws MailException
Gets a newly created mail access with default account ID.

If specified session is null, a dummy instance for initialization purpose is supposed to be returned. Implementation may return null in this case if no start-up/shut-down actions are needed.

Parameters:
session - The session providing needed user data; may be null to obtain a dummy instance for initialization purpose
Returns:
The newly created mail access.
Throws:
MailException - If new mail access instance cannot be created

createNewMailAccess

public abstract MailAccess<? extends IMailFolderStorage,? extends IMailMessageStorage> createNewMailAccess(com.openexchange.session.Session session,
                                                                                                           int accountId)
                                                                                                    throws MailException
Gets a newly created mail access.

If specified session is null, a dummy instance for initialization purpose is supposed to be returned. Implementation may return null in this case if no start-up/shut-down actions are needed.

Parameters:
session - The session providing needed user data; may be null to obtain a dummy instance for initialization purpose
accountId - The account ID
Returns:
The newly created mail access.
Throws:
MailException - If new mail access instance cannot be created

getProtocolProps

public AbstractProtocolProperties getProtocolProps()
Gets the protocol properties

Returns:
The protocol properties