com.funambol.email.inboxlistener.msdao
Class MailboxMSDAOCommon

java.lang.Object
  extended by com.funambol.email.inboxlistener.msdao.MailboxMSDAOCommon
All Implemented Interfaces:
IMailboxMSDAO
Direct Known Subclasses:
MailboxMSDAO, MailboxMSDAOGmail

public abstract class MailboxMSDAOCommon
extends java.lang.Object
implements IMailboxMSDAO

This class groups some utility methods for Mail Server invoking


Field Summary
protected  com.funambol.framework.logging.FunambolLogger log
           
protected  MailServerAccount msa
           
protected  MSTools mstools
           
protected  boolean saveSender
           
protected  boolean saveSubject
           
 
Constructor Summary
MailboxMSDAOCommon()
           
MailboxMSDAOCommon(MailServerAccount _msa, boolean _saveSubject, boolean _saveSender)
          Creates a new MSTools with the given MSAccount
 
Method Summary
 void closeConnection(IMailServerWrapper mswf)
          close the Mail Server Connection
protected  java.lang.String createGUID(javax.mail.Message msg)
           
protected  SyncItemInfo createInfo(javax.mail.Message message, java.util.HashMap localInfos)
           
protected  java.util.ArrayList createInfoList(javax.mail.Message[] messages, java.util.HashMap localInfos)
           
abstract  SyncItemInfo[] getEmailsFromInbox(IMailServerWrapper mswf, java.util.HashMap localInfos)
          get messages from inbox folder This method returns all the items in the server inbox folder
 int getMaxEmailNumber()
           
protected  javax.mail.Message[] getMessages(int max)
           
protected  boolean isCorruptedEmail(javax.mail.Message message)
          the message can be all the part empty.
protected  boolean isMessageIDPresent(java.lang.String messageID, java.util.List allSyncItemInfo)
           
protected  boolean isSentEmail(java.lang.String userAddress, javax.mail.Message message)
          the message is a sent email if the userAddress is in the From list and is not in the To list
 void setMaxEmailNumber(int _maxEmailNumber)
           
 void setPassword(java.lang.String _password)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected com.funambol.framework.logging.FunambolLogger log

msa

protected MailServerAccount msa

mstools

protected MSTools mstools

saveSubject

protected boolean saveSubject

saveSender

protected boolean saveSender
Constructor Detail

MailboxMSDAOCommon

public MailboxMSDAOCommon()

MailboxMSDAOCommon

public MailboxMSDAOCommon(MailServerAccount _msa,
                          boolean _saveSubject,
                          boolean _saveSender)
Creates a new MSTools with the given MSAccount

Parameters:
_msa - the DBAccount
Method Detail

setMaxEmailNumber

public void setMaxEmailNumber(int _maxEmailNumber)
Specified by:
setMaxEmailNumber in interface IMailboxMSDAO

getMaxEmailNumber

public int getMaxEmailNumber()
Specified by:
getMaxEmailNumber in interface IMailboxMSDAO

setPassword

public void setPassword(java.lang.String _password)
Specified by:
setPassword in interface IMailboxMSDAO

closeConnection

public void closeConnection(IMailServerWrapper mswf)
                     throws InboxListenerException
close the Mail Server Connection

Specified by:
closeConnection in interface IMailboxMSDAO
Throws:
InboxListenerException

getEmailsFromInbox

public abstract SyncItemInfo[] getEmailsFromInbox(IMailServerWrapper mswf,
                                                  java.util.HashMap localInfos)
                                           throws InboxListenerException
get messages from inbox folder This method returns all the items in the server inbox folder

Specified by:
getEmailsFromInbox in interface IMailboxMSDAO
Parameters:
mswf - IMailServerWrapper
localInfos - map with all the loacal CrcSyncItemInfo
Returns:
CrcSyncItemInfo[]
Throws:
EntityException
InboxListenerException

createInfoList

protected java.util.ArrayList createInfoList(javax.mail.Message[] messages,
                                             java.util.HashMap localInfos)
                                      throws javax.mail.MessagingException
Parameters:
messages - Message[]
localInfos - map with all the loacal SyncItemInfo
Returns:
list with all the server SyncItemInfo
Throws:
javax.mail.MessagingException

createInfo

protected SyncItemInfo createInfo(javax.mail.Message message,
                                  java.util.HashMap localInfos)
                           throws javax.mail.MessagingException
Parameters:
message - Message
localInfos - map with all the loacal SyncItemInfo
Returns:
SyncItemInfo
Throws:
javax.mail.MessagingException

getMessages

protected javax.mail.Message[] getMessages(int max)
                                    throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

isSentEmail

protected boolean isSentEmail(java.lang.String userAddress,
                              javax.mail.Message message)
                       throws javax.mail.MessagingException
the message is a sent email if the userAddress is in the From list and is not in the To list

Parameters:
userAddress - String
message - Message
Returns:
true if is a sent email
Throws:
javax.mail.MessagingException

isCorruptedEmail

protected boolean isCorruptedEmail(javax.mail.Message message)
                            throws javax.mail.MessagingException
the message can be all the part empty. it's a problem happened with the Zimbra Mail Server

Parameters:
message - Message
Returns:
true if is a corrupted email
Throws:
javax.mail.MessagingException

createGUID

protected java.lang.String createGUID(javax.mail.Message msg)
                               throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

isMessageIDPresent

protected boolean isMessageIDPresent(java.lang.String messageID,
                                     java.util.List allSyncItemInfo)


Copyright © 2005-2006 Funambol.