Package com.jalios.jcms.mail.providers
Class LegacyMailProvider
- java.lang.Object
-
- com.jalios.jcms.mail.AbstractMailProvider
-
- com.jalios.jcms.mail.providers.LegacyMailProvider
-
- All Implemented Interfaces:
GenericProvider
public class LegacyMailProvider extends AbstractMailProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.jalios.jcms.mail.AbstractMailProvider
AbstractMailProvider.Feature
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADDITIONALS_PROPERTIES_SUFFIX
static java.lang.String
FETCHER_PREFIX
static java.lang.String
HOST_SUFFIX
static java.lang.String
LOGIN_SUFFIX
static java.lang.String
PASSWORD_SUFFIX
static java.lang.String
PORT_SUFFIX
static java.lang.String
PROTOCOL_SUFFIX
static java.lang.String
SMTP_PREFIX
static java.lang.String
SSL_SUFFIX
-
Fields inherited from class com.jalios.jcms.mail.AbstractMailProvider
MAIL_ACCOUNT_REQUEST_ATTRIBUTE, MAIL_PROVIDER_PROP_PREFIX
-
-
Constructor Summary
Constructors Constructor Description LegacyMailProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endFetchTransaction(FetchMailTransaction mailTransaction)
End aFetchMailTransaction
java.util.Set<MailMessage>
expunge(FetchMailTransaction mailTransaction, java.util.Set<MailMessage> messageToExpunge)
expunge the provided message from the remote mailbox servicejava.util.List<MailMessage>
fetch(FetchMailTransaction mailTransaction, boolean expungeOnFetch)
Fetch MailMessage from a mail boxjava.lang.Class<? extends AbstractMailEditHandler>
getEditHandlerClass()
java.util.Set<AbstractMailProvider.Feature>
getFeatureSet()
Returns the set of features current provider does support.java.util.Properties
getFetcherAdditionalsProperties()
java.lang.String
getFetcherHost()
java.lang.String
getFetcherLogin()
java.lang.String
getFetcherPassword()
int
getFetcherPort()
java.lang.String
getFetcherProtocol()
java.lang.String
getMailInfoJsp()
java.util.Properties
getSmtpAdditionalsProperties()
java.lang.String
getSmtpHost()
java.lang.String
getSmtpLogin()
java.lang.String
getSmtpPassword()
int
getSmtpPort()
void
init(java.lang.String providerName, JProperties properties)
this method is called on provider's initializationboolean
isFetcherSsl()
boolean
isFetchFeatureInitialized()
indicate if the provider is correctly initialized for fetching emailboolean
isSendFeatureInitialized()
indicate if the provider is correctly initialized for sending emailjava.util.List<MailMessage>
sendMessages(MailMessage[] messages, boolean catchMailErrors)
Send given messages.void
setFetcherAdditionalsProperties(java.util.Properties fetcherAdditionalsProperties)
void
setFetcherHost(java.lang.String fetcherHost)
void
setFetcherLogin(java.lang.String fetcherLogin)
void
setFetcherPassword(java.lang.String fetcherPassword)
void
setFetcherPort(int fetcherPort)
void
setFetcherProtocol(java.lang.String fetcherProtocol)
void
setFetcherSsl(boolean fetcherSsl)
void
setSmtpAdditionalsProperties(java.util.Properties smtpAdditionalsProperties)
void
setSmtpHost(java.lang.String smtpHost)
void
setSmtpLogin(java.lang.String smtpLogin)
void
setSmtpPassword(java.lang.String smtpPassword)
protected void
setSmtpPort(int smtpPort)
FetchMailTransaction
startFetchTransaction(java.lang.String mbox)
Start aFetchMailTransaction
object (end of this transaction is the responsibility of the caller).-
Methods inherited from class com.jalios.jcms.mail.AbstractMailProvider
getLabel, getName, setName, supportFeature, supportFeature
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jalios.jcms.GenericProvider
isInitialized
-
-
-
-
Field Detail
-
FETCHER_PREFIX
public static final java.lang.String FETCHER_PREFIX
- See Also:
- Constant Field Values
-
SMTP_PREFIX
public static final java.lang.String SMTP_PREFIX
- See Also:
- Constant Field Values
-
HOST_SUFFIX
public static final java.lang.String HOST_SUFFIX
- See Also:
- Constant Field Values
-
PORT_SUFFIX
public static final java.lang.String PORT_SUFFIX
- See Also:
- Constant Field Values
-
LOGIN_SUFFIX
public static final java.lang.String LOGIN_SUFFIX
- See Also:
- Constant Field Values
-
PASSWORD_SUFFIX
public static final java.lang.String PASSWORD_SUFFIX
- See Also:
- Constant Field Values
-
ADDITIONALS_PROPERTIES_SUFFIX
public static final java.lang.String ADDITIONALS_PROPERTIES_SUFFIX
- See Also:
- Constant Field Values
-
PROTOCOL_SUFFIX
public static final java.lang.String PROTOCOL_SUFFIX
- See Also:
- Constant Field Values
-
SSL_SUFFIX
public static final java.lang.String SSL_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(java.lang.String providerName, JProperties properties)
Description copied from interface:GenericProvider
this method is called on provider's initialization- Specified by:
init
in interfaceGenericProvider
- Overrides:
init
in classAbstractMailProvider
- Parameters:
providerName
- the name of the provider, from class configuration propertyproperties
- the properties with the same prefix than the property describing the provider class
-
getEditHandlerClass
public java.lang.Class<? extends AbstractMailEditHandler> getEditHandlerClass()
- Overrides:
getEditHandlerClass
in classAbstractMailProvider
-
getMailInfoJsp
public java.lang.String getMailInfoJsp()
- Overrides:
getMailInfoJsp
in classAbstractMailProvider
-
getFeatureSet
public java.util.Set<AbstractMailProvider.Feature> getFeatureSet()
Description copied from class:AbstractMailProvider
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.
- Overrides:
getFeatureSet
in classAbstractMailProvider
- Returns:
- provider supported features set
-
isSendFeatureInitialized
public boolean isSendFeatureInitialized()
Description copied from class:AbstractMailProvider
indicate if the provider is correctly initialized for sending email- Overrides:
isSendFeatureInitialized
in classAbstractMailProvider
- Returns:
- true if the provider is correctly initialized for sending email, false otherwise
-
isFetchFeatureInitialized
public boolean isFetchFeatureInitialized()
Description copied from class:AbstractMailProvider
indicate if the provider is correctly initialized for fetching email- Overrides:
isFetchFeatureInitialized
in classAbstractMailProvider
- Returns:
- true if the provider is correctly initialized for fetching email, false otherwise
-
sendMessages
public java.util.List<MailMessage> sendMessages(MailMessage[] messages, boolean catchMailErrors) throws ServiceException
Description copied from class:AbstractMailProvider
Send given messages.- Overrides:
sendMessages
in classAbstractMailProvider
- Parameters:
messages
- 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
public FetchMailTransaction startFetchTransaction(java.lang.String mbox) throws ServiceException
Description copied from class:AbstractMailProvider
Start aFetchMailTransaction
object (end of this transaction is the responsibility of the caller).- Overrides:
startFetchTransaction
in classAbstractMailProvider
- Parameters:
mbox
- the mail box name (may be null if not needed)- Returns:
- the
FetchMailTransaction
instance - Throws:
ServiceException
- if any exception occurs
-
endFetchTransaction
public void endFetchTransaction(FetchMailTransaction mailTransaction) throws ServiceException
Description copied from class:AbstractMailProvider
End aFetchMailTransaction
- Overrides:
endFetchTransaction
in classAbstractMailProvider
- Parameters:
mailTransaction
- theFetchMailTransaction
instance to end- Throws:
ServiceException
- if any exception occurs
-
fetch
public java.util.List<MailMessage> fetch(FetchMailTransaction mailTransaction, boolean expungeOnFetch) throws ServiceException
Description copied from class:AbstractMailProvider
Fetch MailMessage from a mail box- Overrides:
fetch
in classAbstractMailProvider
- Parameters:
mailTransaction
- theFetchMailTransaction
in which fetch should be done (seeAbstractMailProvider.startFetchTransaction(java.lang.String)
andAbstractMailProvider.endFetchTransaction(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 java.util.Set<MailMessage> expunge(FetchMailTransaction mailTransaction, java.util.Set<MailMessage> messageToExpunge) throws ServiceException
Description copied from class:AbstractMailProvider
expunge the provided message from the remote mailbox service- Overrides:
expunge
in classAbstractMailProvider
- Parameters:
mailTransaction
- theFetchMailTransaction
in which fetch should be done (seeAbstractMailProvider.startFetchTransaction(java.lang.String)
andAbstractMailProvider.endFetchTransaction(com.jalios.jcms.mail.FetchMailTransaction)
messageToExpunge
- the Set ofMailMessage
to expunge- Returns:
- the Set of MailMessage which has been successfully expunged
- Throws:
ServiceException
- if any exception occurs in expunge process
-
getSmtpHost
public java.lang.String getSmtpHost()
-
setSmtpHost
public void setSmtpHost(java.lang.String smtpHost)
-
getSmtpPort
public int getSmtpPort()
-
setSmtpPort
protected void setSmtpPort(int smtpPort)
-
getSmtpLogin
public java.lang.String getSmtpLogin()
-
setSmtpLogin
public void setSmtpLogin(java.lang.String smtpLogin)
-
getSmtpPassword
public java.lang.String getSmtpPassword()
-
setSmtpPassword
public void setSmtpPassword(java.lang.String smtpPassword)
-
getSmtpAdditionalsProperties
public java.util.Properties getSmtpAdditionalsProperties()
-
setSmtpAdditionalsProperties
public void setSmtpAdditionalsProperties(java.util.Properties smtpAdditionalsProperties)
-
getFetcherHost
public java.lang.String getFetcherHost()
-
setFetcherHost
public void setFetcherHost(java.lang.String fetcherHost)
-
getFetcherPort
public int getFetcherPort()
-
setFetcherPort
public void setFetcherPort(int fetcherPort)
-
getFetcherProtocol
public java.lang.String getFetcherProtocol()
-
setFetcherProtocol
public void setFetcherProtocol(java.lang.String fetcherProtocol)
-
getFetcherLogin
public java.lang.String getFetcherLogin()
-
setFetcherLogin
public void setFetcherLogin(java.lang.String fetcherLogin)
-
getFetcherPassword
public java.lang.String getFetcherPassword()
-
setFetcherPassword
public void setFetcherPassword(java.lang.String fetcherPassword)
-
isFetcherSsl
public boolean isFetcherSsl()
-
setFetcherSsl
public void setFetcherSsl(boolean fetcherSsl)
-
getFetcherAdditionalsProperties
public java.util.Properties getFetcherAdditionalsProperties()
-
setFetcherAdditionalsProperties
public void setFetcherAdditionalsProperties(java.util.Properties fetcherAdditionalsProperties)
-
-