Package com.jalios.jcms.mail
Class MailAccount
- java.lang.Object
-
- com.jalios.jcms.mail.MailAccount
-
public class MailAccount extends java.lang.Object
- Version:
- $Revision: 107554 $
- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description protected Member
author
protected boolean
enabled
protected boolean
expunge
protected java.util.Set<java.lang.String>
expungeSet
protected int
fetchCount
protected long
fetchDate
protected java.lang.String
host
protected java.lang.String
label
protected java.lang.String
login
protected java.lang.String
mbox
protected java.lang.String
name
protected java.lang.String
password
protected int
port
protected JProperties
properties
protected java.lang.String
protocol
static java.lang.String
REVISION
protected java.lang.String
schedule
protected boolean
ssl
protected Workspace
ws
-
Constructor Summary
Constructors Constructor Description MailAccount()
MailAccount(java.lang.String name, java.lang.String label, Member author, Workspace ws, java.lang.String host, int port, java.lang.String protocol, java.lang.String login, java.lang.String password, java.lang.String mbox, java.lang.String schedule, boolean expunge, boolean ssl)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
closeQuietly(javax.mail.Folder folder, boolean expunge)
Close the given folder catching exceptionsjavax.mail.Store
connect()
javax.mail.Folder
connect(int mode)
Connect to the account, open the store and retrieve the folder.protected java.util.List<javax.mail.Message>
doFetch(javax.mail.Folder folder)
protected boolean
expunged(javax.mail.Message msg, java.lang.String msgId)
Flags the message to remove when the folder is closed Performs additional tasks.java.util.List<javax.mail.Message>
fetch(javax.mail.Folder folder)
Fetch message from the given folder.Member
getAuthor()
int
getDBMailMessageCount()
Returns the count of DBMailMessage stored in DataBase for this accountjava.lang.String
getHost()
java.lang.String
getLabel()
int
getLastFetchCount()
Returns the number of mail fetched on latest fetch with this accountjava.util.Date
getLastFetchDate()
Returns Date of latest fetch with this accountjava.lang.String
getLogin()
static MailAccount
getMailAccount(java.lang.String label, java.lang.String name, LangProperties props)
java.lang.String
getMbox()
java.lang.String
getName()
java.util.Properties
getPorperties()
Deprecated.replace bygetProperties()
, keep for ascendant compatibilityint
getPort()
java.util.Properties
getProperties()
protected java.io.File
getPropertyFile()
java.lang.String
getProtocol()
java.lang.String
getSchedule()
javax.mail.Session
getSession()
Workspace
getWorkspace()
boolean
isEnabled()
Retuns true if this account is enableboolean
isExpunged()
boolean
isImapSSL()
Deprecated.As release of 9.0.5 and 10.0.1, the methodisSSL()
should be used insteadboolean
isSSL()
protected void
loadProperties()
void
markAsExpunge(java.util.Set<java.lang.String> msgIdSet)
Mark given msg Ids as expunge on next fetchprotected void
saveProperties()
void
setAuthor(Member author)
void
setExpunge(boolean expunge)
void
setHost(java.lang.String host)
void
setImapSSL(boolean ssl)
Deprecated.As release of 9.0.5 and 10.0.1, the methodsetImapSSL(boolean)
should be used insteadvoid
setLabel(java.lang.String label)
void
setLogin(java.lang.String login)
void
setMbox(java.lang.String mbox)
void
setName(java.lang.String name)
void
setPassword(java.lang.String password)
void
setPort(int port)
void
setProtocol(java.lang.String protocol)
void
setSchedule(java.lang.String schedule)
void
setSSL(boolean ssl)
void
setWorkspace(Workspace ws)
java.lang.String
toString()
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
name
protected java.lang.String name
-
label
protected java.lang.String label
-
host
protected java.lang.String host
-
port
protected int port
-
protocol
protected java.lang.String protocol
-
login
protected java.lang.String login
-
password
protected java.lang.String password
-
mbox
protected java.lang.String mbox
-
schedule
protected java.lang.String schedule
-
enabled
protected boolean enabled
-
expunge
protected boolean expunge
-
ssl
protected boolean ssl
-
author
protected Member author
-
ws
protected Workspace ws
-
properties
protected JProperties properties
-
fetchDate
protected long fetchDate
-
fetchCount
protected int fetchCount
-
expungeSet
protected java.util.Set<java.lang.String> expungeSet
-
-
Method Detail
-
getMailAccount
public static MailAccount getMailAccount(java.lang.String label, java.lang.String name, LangProperties props)
-
getPropertyFile
protected java.io.File getPropertyFile()
-
loadProperties
protected void loadProperties()
-
saveProperties
protected void saveProperties()
-
fetch
public java.util.List<javax.mail.Message> fetch(javax.mail.Folder folder) throws javax.mail.MessagingException
Fetch message from the given folder. Store stats about message count and last fetching date- Parameters:
folder
- the FOlder to fetch- Returns:
- List of Message
- Throws:
javax.mail.MessagingException
- if an error occured during fetch
-
doFetch
protected java.util.List<javax.mail.Message> doFetch(javax.mail.Folder folder) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
getPorperties
@Deprecated public java.util.Properties getPorperties()
Deprecated.replace bygetProperties()
, keep for ascendant compatibility
-
getProperties
public java.util.Properties getProperties()
-
getSession
public javax.mail.Session getSession()
-
connect
public javax.mail.Store connect() throws javax.mail.NoSuchProviderException, javax.mail.MessagingException
- Throws:
javax.mail.NoSuchProviderException
javax.mail.MessagingException
-
connect
public javax.mail.Folder connect(int mode) throws javax.mail.NoSuchProviderException, javax.mail.MessagingException
Connect to the account, open the store and retrieve the folder. Do not forget to close() folder- Parameters:
mode
- the open mode Folder.READ_ONLY or Folder.READ_WRITE- Returns:
- Folder
- Throws:
javax.mail.NoSuchProviderException
javax.mail.MessagingException
-
closeQuietly
public void closeQuietly(javax.mail.Folder folder, boolean expunge)
Close the given folder catching exceptions- Parameters:
folder
- the Folderexpunge
- Expunge (permanently remove) messages marked DELETED.
-
expunged
protected boolean expunged(javax.mail.Message msg, java.lang.String msgId)
Flags the message to remove when the folder is closed Performs additional tasks. Note: Folder must be opened- Parameters:
msg
- the MessagemsgId
- the Message Id
-
markAsExpunge
public void markAsExpunge(java.util.Set<java.lang.String> msgIdSet)
Mark given msg Ids as expunge on next fetch- Parameters:
msgIdSet
- Set of msgId
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isEnabled
public boolean isEnabled()
Retuns true if this account is enable- Returns:
- boolean
-
getDBMailMessageCount
public int getDBMailMessageCount()
Returns the count of DBMailMessage stored in DataBase for this account- Returns:
- int DB count
-
getLastFetchDate
public java.util.Date getLastFetchDate()
Returns Date of latest fetch with this account- Returns:
- Date last fetch
-
getLastFetchCount
public int getLastFetchCount()
Returns the number of mail fetched on latest fetch with this account- Returns:
- int fetch count
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getLabel
public java.lang.String getLabel()
-
setLabel
public void setLabel(java.lang.String label)
-
getAuthor
public Member getAuthor()
-
setAuthor
public void setAuthor(Member author)
-
getWorkspace
public Workspace getWorkspace()
-
setWorkspace
public void setWorkspace(Workspace ws)
-
getHost
public java.lang.String getHost()
-
setHost
public void setHost(java.lang.String host)
-
getPort
public int getPort()
-
setPort
public void setPort(int port)
-
getProtocol
public java.lang.String getProtocol()
-
setProtocol
public void setProtocol(java.lang.String protocol)
-
getLogin
public java.lang.String getLogin()
-
setLogin
public void setLogin(java.lang.String login)
-
setPassword
public void setPassword(java.lang.String password)
-
getMbox
public java.lang.String getMbox()
-
setMbox
public void setMbox(java.lang.String mbox)
-
getSchedule
public java.lang.String getSchedule()
-
setSchedule
public void setSchedule(java.lang.String schedule)
-
isExpunged
public boolean isExpunged()
-
setExpunge
public void setExpunge(boolean expunge)
-
isSSL
public boolean isSSL()
-
setSSL
public void setSSL(boolean ssl)
-
isImapSSL
@Deprecated public boolean isImapSSL()
Deprecated.As release of 9.0.5 and 10.0.1, the methodisSSL()
should be used instead
-
setImapSSL
@Deprecated public void setImapSSL(boolean ssl)
Deprecated.As release of 9.0.5 and 10.0.1, the methodsetImapSSL(boolean)
should be used instead
-
-