com.jalios.jcms.mail
Class MailAccount

java.lang.Object
  extended by com.jalios.jcms.mail.MailAccount

public class MailAccount
extends Object

Version:
$Revision: 33598 $
Author:
Jean-Philippe Encausse

Field Summary
protected  Member author
           
protected  boolean enabled
           
protected  boolean expunge
           
protected  Set<String> expungeSet
           
protected  int fetchCount
           
protected  long fetchDate
           
protected  String host
           
protected  boolean imapssl
           
protected  String label
           
protected  String login
           
protected  String mbox
           
protected  String name
           
protected  String password
           
protected  int port
           
protected  JProperties properties
           
protected  String protocol
           
static String REVISION
           
protected  String schedule
           
protected  Workspace ws
           
 
Constructor Summary
MailAccount()
           
MailAccount(String name, String label, Member author, Workspace ws, String host, int port, String protocol, String login, String password, String mbox, String schedule, boolean expunge, boolean imapssl)
           
 
Method Summary
 void closeQuietly(javax.mail.Folder folder, boolean expunge)
          Close the given folder catching exceptions
 javax.mail.Store connect()
           
 javax.mail.Folder connect(int mode)
          Connect to the account, open the store and retrieve the folder.
protected  List<javax.mail.Message> doFetch(javax.mail.Folder folder)
           
protected  boolean expunged(javax.mail.Message msg, String msgId)
          Flags the message to remove when the folder is closed Performs additional tasks.
 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 account
 String getHost()
           
 String getLabel()
           
 int getLastFetchCount()
          Returns the number of mail fetched on latest fetch with this account
 Date getLastFetchDate()
          Returns Date of latest fetch with this account
 String getLogin()
           
static MailAccount getMailAccount(String label, String name, LangProperties props)
           
 String getMbox()
           
 String getName()
           
 Properties getPorperties()
           
 int getPort()
           
protected  File getPropertyFile()
           
 String getProtocol()
           
 String getSchedule()
           
 javax.mail.Session getSession()
           
 Workspace getWorkspace()
           
 boolean isEnabled()
          Retuns true if this account is enable
 boolean isExpunged()
           
 boolean isImapSSL()
           
protected  void loadProperties()
           
 void markAsExpunge(Set<String> msgIdSet)
          Mark given msg Ids as expunge on next fetch
protected  void saveProperties()
           
 void setAuthor(Member author)
           
 void setExpunge(boolean expunge)
           
 void setHost(String host)
           
 void setImapSSL(boolean imapssl)
           
 void setLabel(String label)
           
 void setLogin(String login)
           
 void setMbox(String mbox)
           
 void setName(String name)
           
 void setPassword(String password)
           
 void setPort(int port)
           
 void setProtocol(String protocol)
           
 void setSchedule(String schedule)
           
 void setWorkspace(Workspace ws)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

name

protected String name

label

protected String label

host

protected String host

port

protected int port

protocol

protected String protocol

login

protected String login

password

protected String password

mbox

protected String mbox

schedule

protected String schedule

enabled

protected boolean enabled

expunge

protected boolean expunge

imapssl

protected boolean imapssl

author

protected Member author

ws

protected Workspace ws

properties

protected JProperties properties

fetchDate

protected long fetchDate

fetchCount

protected int fetchCount

expungeSet

protected Set<String> expungeSet
Constructor Detail

MailAccount

public MailAccount()

MailAccount

public MailAccount(String name,
                   String label,
                   Member author,
                   Workspace ws,
                   String host,
                   int port,
                   String protocol,
                   String login,
                   String password,
                   String mbox,
                   String schedule,
                   boolean expunge,
                   boolean imapssl)
Method Detail

getMailAccount

public static MailAccount getMailAccount(String label,
                                         String name,
                                         LangProperties props)

getPropertyFile

protected File getPropertyFile()

loadProperties

protected void loadProperties()

saveProperties

protected void saveProperties()

fetch

public 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

doFetch

protected List<javax.mail.Message> doFetch(javax.mail.Folder folder)
                                    throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getPorperties

public Properties getPorperties()

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 Folder
expunge - Expunge (permanently remove) messages marked DELETED.

expunged

protected boolean expunged(javax.mail.Message msg,
                           String msgId)
Flags the message to remove when the folder is closed Performs additional tasks. Note: Folder must be opened

Parameters:
msg - the Message
msgId - the Message Id

markAsExpunge

public void markAsExpunge(Set<String> msgIdSet)
Mark given msg Ids as expunge on next fetch

Parameters:
msgIdSet - Set of msgId

toString

public String toString()
Overrides:
toString in class 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 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 String getName()

setName

public void setName(String name)

getLabel

public String getLabel()

setLabel

public void setLabel(String label)

getAuthor

public Member getAuthor()

setAuthor

public void setAuthor(Member author)

getWorkspace

public Workspace getWorkspace()

setWorkspace

public void setWorkspace(Workspace ws)

getHost

public String getHost()

setHost

public void setHost(String host)

getPort

public int getPort()

setPort

public void setPort(int port)

getProtocol

public String getProtocol()

setProtocol

public void setProtocol(String protocol)

getLogin

public String getLogin()

setLogin

public void setLogin(String login)

setPassword

public void setPassword(String password)

getMbox

public String getMbox()

setMbox

public void setMbox(String mbox)

getSchedule

public String getSchedule()

setSchedule

public void setSchedule(String schedule)

isExpunged

public boolean isExpunged()

setExpunge

public void setExpunge(boolean expunge)

isImapSSL

public boolean isImapSSL()

setImapSSL

public void setImapSSL(boolean imapssl)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.