com.funambol.email.engine.source
Class EmailSyncSource

java.lang.Object
  extended by com.funambol.framework.engine.source.AbstractSyncSource
      extended by com.funambol.email.engine.source.EmailSyncSource
All Implemented Interfaces:
com.funambol.framework.engine.source.FilterableSyncSource, com.funambol.framework.engine.source.ServerWinsSyncSource, com.funambol.framework.engine.source.SyncSource, com.funambol.framework.tools.beans.LazyInitBean, java.io.Serializable

public class EmailSyncSource
extends com.funambol.framework.engine.source.AbstractSyncSource
implements com.funambol.framework.engine.source.FilterableSyncSource, com.funambol.framework.engine.source.ServerWinsSyncSource, java.io.Serializable, com.funambol.framework.tools.beans.LazyInitBean

This class implements common methods of MultiEmailSyncSource

version $Id: EmailSyncSource.java,v 1.71 2007/03/21 10:51:48 gbmiglia Exp $

See Also:
Serialized Form

Field Summary
protected  boolean allMailboxActivation
          Should allMailbox sync?
protected  CacheDAO cacheDao
           
protected  DefaultFolder defaultFolder
           
protected  java.util.ArrayList deletedItemKeys
           
protected  java.lang.String deviceCharset
          Property for sync session
protected  java.util.TimeZone deviceTimeZone
          Property for sync session
protected  IEmailGeneric emailhelper
          wrapper for the Email Helper
protected  java.lang.String encryptionKey
           
protected  EmailFilter filter
           
protected  java.lang.String firstname
           
protected  java.lang.String funambolSignature
           
protected static com.funambol.server.tools.id.DBIDGenerator idFolderSpace
           
protected static com.funambol.server.tools.id.DBIDGenerator idSentSpace
           
protected  SyncItemInfo[] invalidItems
          save the invalid items during the cache updating procedure
protected  boolean isSlowOrRefresh
          Should allMailbox sync?
protected  java.lang.String jndiDataSourceName
           
protected  java.lang.String keystoreHome
           
protected  java.lang.String lastname
           
protected  java.util.HashMap localItems
          list of local cached Items
protected  com.funambol.framework.logging.FunambolLogger log
           
protected  MailServerAccount mailServerAccount
          wrapper for the Mail Server Account Wrapper
protected  IMailServerWrapper MSWrapper
          wrapper for the Mail Server
protected  java.util.ArrayList newItemKeys
           
protected  long principalId
           
protected  boolean saveOnlyHeader
           
protected  java.util.ArrayList sentItems
          keep the items id and the result of send operation
protected  java.util.HashMap serverItems
          list of server Items
protected  int syncMode
           
protected  java.util.ArrayList updatedItemKeys
           
protected  java.lang.String userName
           
 
Fields inherited from class com.funambol.framework.engine.source.AbstractSyncSource
howManyAdded, howManyDeleted, howManyUpdated, info, LOG_NAME, name, sourceQuery, sourceURI, type
 
Constructor Summary
EmailSyncSource()
           
 
Method Summary
 com.funambol.framework.engine.SyncItem addSyncItem(com.funambol.framework.engine.SyncItem syncItem)
           
 void beginSync(com.funambol.framework.engine.source.SyncContext context)
          Begin Sync Method before starting sync the method sets the filter
 void endSync()
          End Sync Method
 com.funambol.framework.engine.SyncItemKey[] getAllSyncItemKeys()
           
 com.funambol.framework.engine.SyncItemKey[] getDeletedSyncItemKeys(java.sql.Timestamp since, java.sql.Timestamp to)
           
 java.lang.String getFunambolSignature()
           
 java.lang.String getJndiDataSourceName()
           
 MailServerAccount getMailServerAccount()
           
 IMailServerWrapper getMSWrapper()
           
 com.funambol.framework.engine.SyncItemKey[] getNewSyncItemKeys(java.sql.Timestamp since, java.sql.Timestamp to)
           
 com.funambol.framework.engine.SyncItem getSyncItemFromId(com.funambol.framework.engine.SyncItemKey syncItemKey)
           
 com.funambol.framework.engine.SyncItemKey[] getSyncItemKeysFromTwin(com.funambol.framework.engine.SyncItem syncItem)
           
 char getSyncItemStateFromId(com.funambol.framework.engine.SyncItemKey syncItemKey)
           
 com.funambol.framework.engine.SyncItemKey[] getUpdatedSyncItemKeys(java.sql.Timestamp since, java.sql.Timestamp to)
           
 void init()
           
 boolean isSyncItemInFilterClause(com.funambol.framework.engine.SyncItem syncItem)
           
 boolean isSyncItemInFilterClause(com.funambol.framework.engine.SyncItemKey syncItemKey)
           
 void removeSyncItem(com.funambol.framework.engine.SyncItemKey syncItemKey, java.sql.Timestamp s, boolean engineSoftDelete)
           
 void setFunambolSignature(java.lang.String _funambolSignature)
           
 void setOperationStatus(java.lang.String operation, int statusCode, com.funambol.framework.engine.SyncItemKey[] keys)
           
 com.funambol.framework.engine.SyncItem updateSyncItem(com.funambol.framework.engine.SyncItem syncItem)
           
 
Methods inherited from class com.funambol.framework.engine.source.AbstractSyncSource
commitSync, getInfo, getName, getSourceQuery, getSourceURI, getType, setInfo, setName, setSourceURI, setType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.funambol.framework.engine.source.SyncSource
commitSync, getInfo, getName, getSourceURI
 

Field Detail

log

protected com.funambol.framework.logging.FunambolLogger log

jndiDataSourceName

protected java.lang.String jndiDataSourceName

encryptionKey

protected java.lang.String encryptionKey

keystoreHome

protected java.lang.String keystoreHome

funambolSignature

protected java.lang.String funambolSignature

saveOnlyHeader

protected boolean saveOnlyHeader

principalId

protected long principalId

syncMode

protected int syncMode

userName

protected java.lang.String userName

firstname

protected java.lang.String firstname

lastname

protected java.lang.String lastname

deviceTimeZone

protected java.util.TimeZone deviceTimeZone
Property for sync session


deviceCharset

protected java.lang.String deviceCharset
Property for sync session


MSWrapper

protected IMailServerWrapper MSWrapper
wrapper for the Mail Server


filter

protected EmailFilter filter

emailhelper

protected IEmailGeneric emailhelper
wrapper for the Email Helper


mailServerAccount

protected MailServerAccount mailServerAccount
wrapper for the Mail Server Account Wrapper


cacheDao

protected CacheDAO cacheDao

idSentSpace

protected static com.funambol.server.tools.id.DBIDGenerator idSentSpace

idFolderSpace

protected static com.funambol.server.tools.id.DBIDGenerator idFolderSpace

newItemKeys

protected java.util.ArrayList newItemKeys

deletedItemKeys

protected java.util.ArrayList deletedItemKeys

updatedItemKeys

protected java.util.ArrayList updatedItemKeys

sentItems

protected java.util.ArrayList sentItems
keep the items id and the result of send operation


localItems

protected java.util.HashMap localItems
list of local cached Items


serverItems

protected java.util.HashMap serverItems
list of server Items


invalidItems

protected SyncItemInfo[] invalidItems
save the invalid items during the cache updating procedure


allMailboxActivation

protected boolean allMailboxActivation
Should allMailbox sync?


isSlowOrRefresh

protected boolean isSlowOrRefresh
Should allMailbox sync?


defaultFolder

protected DefaultFolder defaultFolder
Constructor Detail

EmailSyncSource

public EmailSyncSource()
Method Detail

getJndiDataSourceName

public java.lang.String getJndiDataSourceName()
Returns:
jndiDataSourceName String

getFunambolSignature

public java.lang.String getFunambolSignature()
Returns:
funambolSignature String

setFunambolSignature

public void setFunambolSignature(java.lang.String _funambolSignature)
Parameters:
_funambolSignature - String

getMSWrapper

public IMailServerWrapper getMSWrapper()
Returns:
IMailServerWrapper

getMailServerAccount

public MailServerAccount getMailServerAccount()
Returns:
MailServerAccount

init

public void init()
          throws com.funambol.framework.tools.beans.BeanInitializationException
Specified by:
init in interface com.funambol.framework.tools.beans.LazyInitBean
Throws:
com.funambol.framework.tools.beans.BeanInitializationException

beginSync

public void beginSync(com.funambol.framework.engine.source.SyncContext context)
               throws com.funambol.framework.engine.source.SyncSourceException
Begin Sync Method before starting sync the method sets the filter

main folder filter

time filter (timeFilter)

size filter (sizeFilter / numbytes)

Specified by:
beginSync in interface com.funambol.framework.engine.source.SyncSource
Overrides:
beginSync in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
context - SyncContext
Throws:
com.funambol.framework.engine.source.SyncSourceException

endSync

public void endSync()
             throws com.funambol.framework.engine.source.SyncSourceException
End Sync Method

Specified by:
endSync in interface com.funambol.framework.engine.source.SyncSource
Overrides:
endSync in class com.funambol.framework.engine.source.AbstractSyncSource
Throws:
com.funambol.framework.engine.source.SyncSourceException

getAllSyncItemKeys

public com.funambol.framework.engine.SyncItemKey[] getAllSyncItemKeys()
                                                               throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getAllSyncItemKeys in interface com.funambol.framework.engine.source.SyncSource
Specified by:
getAllSyncItemKeys in class com.funambol.framework.engine.source.AbstractSyncSource
Returns:
SyncItemKey[]
Throws:
com.funambol.framework.engine.source.SyncSourceException

getSyncItemFromId

public com.funambol.framework.engine.SyncItem getSyncItemFromId(com.funambol.framework.engine.SyncItemKey syncItemKey)
                                                         throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getSyncItemFromId in interface com.funambol.framework.engine.source.SyncSource
Specified by:
getSyncItemFromId in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
syncItemKey - SyncItemKey
Returns:
SyncItem
Throws:
com.funambol.framework.engine.source.SyncSourceException

getSyncItemKeysFromTwin

public com.funambol.framework.engine.SyncItemKey[] getSyncItemKeysFromTwin(com.funambol.framework.engine.SyncItem syncItem)
                                                                    throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getSyncItemKeysFromTwin in interface com.funambol.framework.engine.source.SyncSource
Specified by:
getSyncItemKeysFromTwin in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
syncItem - SyncItem
Returns:
SyncItemKey[]
Throws:
com.funambol.framework.engine.source.SyncSourceException

isSyncItemInFilterClause

public boolean isSyncItemInFilterClause(com.funambol.framework.engine.SyncItem syncItem)
                                 throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
isSyncItemInFilterClause in interface com.funambol.framework.engine.source.FilterableSyncSource
Parameters:
syncItem - SyncItem
Returns:
boolean
Throws:
com.funambol.framework.engine.source.SyncSourceException

isSyncItemInFilterClause

public boolean isSyncItemInFilterClause(com.funambol.framework.engine.SyncItemKey syncItemKey)
                                 throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
isSyncItemInFilterClause in interface com.funambol.framework.engine.source.FilterableSyncSource
Parameters:
syncItemKey - SyncItemKey
Returns:
boolean
Throws:
com.funambol.framework.engine.source.SyncSourceException

removeSyncItem

public void removeSyncItem(com.funambol.framework.engine.SyncItemKey syncItemKey,
                           java.sql.Timestamp s,
                           boolean engineSoftDelete)
                    throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
removeSyncItem in interface com.funambol.framework.engine.source.SyncSource
Specified by:
removeSyncItem in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
syncItemKey - SyncItemKey
s - Timestamp
engineSoftDelete - boolean
Throws:
com.funambol.framework.engine.source.SyncSourceException

setOperationStatus

public void setOperationStatus(java.lang.String operation,
                               int statusCode,
                               com.funambol.framework.engine.SyncItemKey[] keys)
Specified by:
setOperationStatus in interface com.funambol.framework.engine.source.SyncSource
Specified by:
setOperationStatus in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
operation - String
statusCode - int
keys - SyncItemKey[]

updateSyncItem

public com.funambol.framework.engine.SyncItem updateSyncItem(com.funambol.framework.engine.SyncItem syncItem)
                                                      throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
updateSyncItem in interface com.funambol.framework.engine.source.SyncSource
Specified by:
updateSyncItem in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
syncItem - SyncItem
Returns:
SyncItem
Throws:
com.funambol.framework.engine.source.SyncSourceException

addSyncItem

public com.funambol.framework.engine.SyncItem addSyncItem(com.funambol.framework.engine.SyncItem syncItem)
                                                   throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
addSyncItem in interface com.funambol.framework.engine.source.SyncSource
Specified by:
addSyncItem in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
syncItem - SyncItem
Returns:
SyncItem
Throws:
com.funambol.framework.engine.source.SyncSourceException

getDeletedSyncItemKeys

public com.funambol.framework.engine.SyncItemKey[] getDeletedSyncItemKeys(java.sql.Timestamp since,
                                                                          java.sql.Timestamp to)
                                                                   throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getDeletedSyncItemKeys in interface com.funambol.framework.engine.source.SyncSource
Specified by:
getDeletedSyncItemKeys in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
since - Timestamp
to - Timestamp
Returns:
SyncItemKey[]
Throws:
com.funambol.framework.engine.source.SyncSourceException

getNewSyncItemKeys

public com.funambol.framework.engine.SyncItemKey[] getNewSyncItemKeys(java.sql.Timestamp since,
                                                                      java.sql.Timestamp to)
                                                               throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getNewSyncItemKeys in interface com.funambol.framework.engine.source.SyncSource
Specified by:
getNewSyncItemKeys in class com.funambol.framework.engine.source.AbstractSyncSource
Parameters:
since - Timestamp
to - Timestamp
Returns:
SyncItemKey[]
Throws:
com.funambol.framework.engine.source.SyncSourceException

getUpdatedSyncItemKeys

public com.funambol.framework.engine.SyncItemKey[] getUpdatedSyncItemKeys(java.sql.Timestamp since,
                                                                          java.sql.Timestamp to)
                                                                   throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getUpdatedSyncItemKeys in interface com.funambol.framework.engine.source.SyncSource
Parameters:
since - Timestamp
to - Timestamp
Returns:
SyncItemKey[]
Throws:
com.funambol.framework.engine.source.SyncSourceException

getSyncItemStateFromId

public char getSyncItemStateFromId(com.funambol.framework.engine.SyncItemKey syncItemKey)
                            throws com.funambol.framework.engine.source.SyncSourceException
Specified by:
getSyncItemStateFromId in interface com.funambol.framework.engine.source.FilterableSyncSource
Parameters:
syncItemKey - SyncItemKey
Returns:
char
Throws:
com.funambol.framework.engine.source.SyncSourceException


Copyright © 2005-2006 Funambol.