Package com.jalios.jcms.mail
Class AbstractMailProvider
java.lang.Object
com.jalios.jcms.mail.AbstractMailProvider
- All Implemented Interfaces:
GenericProvider
- Direct Known Subclasses:
LegacyMailProvider
- Since:
- jcms-10.0.8 / JCMS-8473
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidendFetchTransaction(FetchMailTransaction mailTransaction) End aFetchMailTransactionexpunge(FetchMailTransaction mailTransaction, Set<MailMessage> messageToExpunge) expunge the provided message from the remote mailbox servicefetch(FetchMailTransaction mailTransaction, boolean expungeOnFetch) Fetch MailMessage from a mail boxClass<? extends AbstractMailEditHandler> Returns the set of features current provider does support.returns the label of the providergetName()returns the name of the providervoidinit(String providerName, JProperties properties) this method is called on provider's initializationbooleanindicate if the provider is correctly initialized for fetching emailbooleanindicate if the provider is correctly initialized for sending emailsendMessages(MailMessage[] msg, boolean catchMailErrors) Send given messages.protected voidstartFetchTransaction(String mbox) Start aFetchMailTransactionobject (end of this transaction is the responsibility of the caller).booleanReturns true if current provider does support given feature.booleansupportFeature(String featureName) Returns true if current provider does support given feature.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jalios.jcms.GenericProvider
isInitialized
-
Field Details
-
MAIL_PROVIDER_PROP_PREFIX
-
MAIL_ACCOUNT_REQUEST_ATTRIBUTE
-
-
Constructor Details
-
AbstractMailProvider
public AbstractMailProvider()
-
-
Method Details
-
supportFeature
Returns true if current provider does support given feature.To be overridden by each provider implementation to indicate which features are supported.
Return false by default.
- Parameters:
featureName- the name of the feature to test- Returns:
- true if the given feature is supported by the current provider.
-
supportFeature
Returns true if current provider does support given feature.Feature is checked to be contained in
getFeatureSet().- Parameters:
feature- feature to test- Returns:
- true if the given feature is supported by the current provider.
-
getFeatureSet
Returns the set of features current provider does support.By default, returns null.
Has to be override by each provider for real feature support detection.
- Returns:
- provider supported features set
-
getName
Description copied from interface:GenericProviderreturns the name of the provider- Specified by:
getNamein interfaceGenericProvider- Returns:
- the name of the provider
-
setName
-
getLabel
Description copied from interface:GenericProviderreturns the label of the provider- Specified by:
getLabelin interfaceGenericProvider- Parameters:
lang- the language of the label- Returns:
- the label of the provider
-
init
Description copied from interface:GenericProviderthis method is called on provider's initialization- Specified by:
initin interfaceGenericProvider- Parameters:
providerName- the name of the provider, from class configuration propertyproperties- the properties with the same prefix than the property describing the provider class
-
isSendFeatureInitialized
public boolean isSendFeatureInitialized()indicate if the provider is correctly initialized for sending email- Returns:
- true if the provider is correctly initialized for sending email, false otherwise
-
isFetchFeatureInitialized
public boolean isFetchFeatureInitialized()indicate if the provider is correctly initialized for fetching email- Returns:
- true if the provider is correctly initialized for fetching email, false otherwise
-
sendMessages
public List<MailMessage> sendMessages(MailMessage[] msg, boolean catchMailErrors) throws ServiceException Send given messages.- Parameters:
msg- array of MailMessage to be sentcatchMailErrors- set to true to prevent this method to throw exception when sending messages- Returns:
- null or empty list if catchMailErrors is false, a List of Message that could not be sent if catchMailErrors is true
- Throws:
ServiceException- if any exception occurs in send process
-
startFetchTransaction
Start aFetchMailTransactionobject (end of this transaction is the responsibility of the caller).- Parameters:
mbox- the mail box name (may be null if not needed)- Returns:
- the
FetchMailTransactioninstance - Throws:
ServiceException- if any exception occurs
-
endFetchTransaction
End aFetchMailTransaction- Parameters:
mailTransaction- theFetchMailTransactioninstance to end- Throws:
ServiceException- if any exception occurs
-
fetch
public List<MailMessage> fetch(FetchMailTransaction mailTransaction, boolean expungeOnFetch) throws ServiceException Fetch MailMessage from a mail box- Parameters:
mailTransaction- theFetchMailTransactionin which fetch should be done (seestartFetchTransaction(java.lang.String)andendFetchTransaction(com.jalios.jcms.mail.FetchMailTransaction)expungeOnFetch- expunge after mail fetch- Returns:
- The list of MailMessage read from the mailbox service
- Throws:
ServiceException- if any exception occurs in fetch process
-
expunge
public Set<MailMessage> expunge(FetchMailTransaction mailTransaction, Set<MailMessage> messageToExpunge) throws ServiceException expunge the provided message from the remote mailbox service- Parameters:
mailTransaction- theFetchMailTransactionin which fetch should be done (seestartFetchTransaction(java.lang.String)andendFetchTransaction(com.jalios.jcms.mail.FetchMailTransaction)messageToExpunge- the Set ofMailMessageto expunge- Returns:
- the Set of MailMessage which has been successfully expunged
- Throws:
ServiceException- if any exception occurs in expunge process
-
getEditHandlerClass
-
getMailInfoJsp
-