com.funambol.email.engine.source
Class EmailSyncSource

java.lang.Object
  extended bycom.funambol.framework.engine.source.AbstractSyncSource
      extended bycom.funambol.email.cache.CrcCachedSyncSource
          extended bycom.funambol.email.engine.source.EmailSyncSource
All Implemented Interfaces:
com.funambol.framework.tools.beans.LazyInitBean, java.io.Serializable, com.funambol.framework.engine.source.SyncSource
Direct Known Subclasses:
PopEmailSyncSource

public abstract class EmailSyncSource
extends CrcCachedSyncSource
implements com.funambol.framework.engine.source.SyncSource, java.io.Serializable

This class implements common methods of

  EmailIMAPSyncSource
  EmailPOPSyncSource
 
version $Id: EmailSyncSource.java,v 1.2 2006/02/06 09:00:20 gbmiglia Exp $

See Also:
Serialized Form

Field Summary
protected  com.funambol.framework.server.Sync4jDevice device
          Property for sync session
protected  java.lang.String deviceCharset
          Property for sync session
protected  java.util.TimeZone deviceTimeZone
          Property for sync session
protected  java.lang.String deviceTimeZoneDescr
          Property for sync session
protected  EntityManager em
           
protected  boolean encode
          Should the content be encoded?
protected  int folderFilter
          filter
protected  java.lang.String idFilter
           
protected  java.lang.String inHost
          Property Incoming Server get from the Connector Panel
protected  java.lang.String inPort
          Property Incoming Server Port
protected  boolean isAttachFieldSet
           
protected  boolean isBodyFieldSet
           
protected  boolean isHeaderFieldSet
           
protected  java.lang.String language
          Property Mail Server Language
protected  java.util.logging.Logger log
           
protected  IMailServerWrapper mswf
          wrapper for the Mail Server
protected  int numBytes
           
protected  java.lang.String outHost
          Property Outgoing Server get from the Connector Panel
protected  java.security.Principal principal
          Property Principal
protected  java.lang.String protocol
          Property Mail Server Server protocol
protected  int sizeFilter
           
protected  boolean ssl
          Should the channel be ssl?
protected  int syncMode
          Property syncMode
protected  java.util.Date timeFilter
           
 
Fields inherited from class com.funambol.email.cache.CrcCachedSyncSource
itemsSent
 
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
 void beginSync(java.security.Principal principal, int syncMode, com.funambol.framework.filter.FilterClause filterClause)
          BeginSync
protected  com.funambol.framework.engine.SyncItem createSyncItem(Email email, char status)
           
protected  com.funambol.framework.engine.SyncItem createSyncItem(java.lang.String uid, char status)
          create a single syncitem with UID and the empty content.
protected  com.funambol.framework.engine.SyncItem[] createSyncItems(java.util.List mails, char status, boolean delete)
          Create SyncItem from Contact
 void endSync()
          EndSync
protected  com.funambol.framework.server.Sync4jDevice getDevice(java.lang.String deviceId)
          Return the device with the given deviceId
protected  Email getFoundationMailFromXML(java.lang.String content)
          Get Data from XML message converting the xml item into a Email object
 java.lang.String getInPort()
          Getter for property Incoming Mail Server Port.
 java.lang.String getLanguage()
          Getter for property Mail Server Language
 java.lang.String getProtocol()
          Getter for property Mail Server protocol.
protected  java.lang.String getXMLFromFoundationMail(Email mail)
          Get Data from sync4j.foundation.pdi.mail.Email converting the Contact object into an xml item
 boolean isEncode()
          Getter for property encode.
 boolean isSSL()
          Getter for property ssl.
 void setEncode(boolean encode)
          Setter for property encode.
 void setInPort(java.lang.String inPort)
          Setter for property Incoming Mail Server Port.
 void setLanguage(java.lang.String language)
          Setter for property Mail Server Language
 void setProtocol(java.lang.String protocol)
          Setter for property Mail Server protocol.
 void setSSL(boolean ssl)
          Setter for property ssl.
 
Methods inherited from class com.funambol.email.cache.CrcCachedSyncSource
getAllSyncItemInfo, getDeletedSyncItemKeys, getNewSyncItemKeys, getSyncItemStateFromId, getUpdatedSyncItemKeys, init, insertSentItem
 
Methods inherited from class com.funambol.framework.engine.source.AbstractSyncSource
addSyncItem, getAllSyncItemKeys, getInfo, getName, getSourceQuery, getSourceURI, getSyncItemFromId, getSyncItemKeysFromTwin, getType, isSyncItemInFilterClause, isSyncItemInFilterClause, mergeSyncItems, removeSyncItem, removeSyncItem, setInfo, setName, setOperationStatus, setSourceURI, setType, toString, updateSyncItem
 
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
addSyncItem, getAllSyncItemKeys, getDeletedSyncItemKeys, getInfo, getName, getNewSyncItemKeys, getSourceQuery, getSourceURI, getSyncItemFromId, getSyncItemKeysFromTwin, getSyncItemStateFromId, getType, getUpdatedSyncItemKeys, isSyncItemInFilterClause, isSyncItemInFilterClause, mergeSyncItems, removeSyncItem, removeSyncItem, setOperationStatus, updateSyncItem
 

Field Detail

log

protected java.util.logging.Logger log

device

protected com.funambol.framework.server.Sync4jDevice device
Property for sync session


deviceTimeZoneDescr

protected java.lang.String deviceTimeZoneDescr
Property for sync session


deviceTimeZone

protected java.util.TimeZone deviceTimeZone
Property for sync session


deviceCharset

protected java.lang.String deviceCharset
Property for sync session


principal

protected java.security.Principal principal
Property Principal


syncMode

protected int syncMode
Property syncMode


mswf

protected IMailServerWrapper mswf
wrapper for the Mail Server


em

protected EntityManager em

inHost

protected java.lang.String inHost
Property Incoming Server get from the Connector Panel


outHost

protected java.lang.String outHost
Property Outgoing Server get from the Connector Panel


folderFilter

protected int folderFilter
filter


idFilter

protected java.lang.String idFilter

timeFilter

protected java.util.Date timeFilter

sizeFilter

protected int sizeFilter

numBytes

protected int numBytes

isHeaderFieldSet

protected boolean isHeaderFieldSet

isBodyFieldSet

protected boolean isBodyFieldSet

isAttachFieldSet

protected boolean isAttachFieldSet

ssl

protected boolean ssl
Should the channel be ssl?


inPort

protected java.lang.String inPort
Property Incoming Server Port


protocol

protected java.lang.String protocol
Property Mail Server Server protocol


language

protected java.lang.String language
Property Mail Server Language


encode

protected boolean encode
Should the content be encoded?

Constructor Detail

EmailSyncSource

public EmailSyncSource()
Method Detail

isSSL

public boolean isSSL()
Getter for property ssl.

Returns:
Value of property ssl.

setSSL

public void setSSL(boolean ssl)
Setter for property ssl.

Parameters:
ssl - New value of property ssl.

getInPort

public java.lang.String getInPort()
Getter for property Incoming Mail Server Port.

Returns:
Value of property Incoming Mail Server Port.

setInPort

public void setInPort(java.lang.String inPort)
Setter for property Incoming Mail Server Port.

Parameters:
inPort - String New value of property Incoming Mail Server Port.

getProtocol

public java.lang.String getProtocol()
Getter for property Mail Server protocol.

Returns:
Value of property Mail Server protocol.

setProtocol

public void setProtocol(java.lang.String protocol)
Setter for property Mail Server protocol.

Parameters:
protocol - String. New value of property Mail Server protocol.

getLanguage

public java.lang.String getLanguage()
Getter for property Mail Server Language

Returns:
Value of property Mail Server Language

setLanguage

public void setLanguage(java.lang.String language)
Setter for property Mail Server Language

Parameters:
language - String New value of property Mail Server Language

isEncode

public boolean isEncode()
Getter for property encode.

Returns:
Value of property encode.

setEncode

public void setEncode(boolean encode)
Setter for property encode.

Parameters:
encode - New value of property encode.

beginSync

public void beginSync(java.security.Principal principal,
                      int syncMode,
                      com.funambol.framework.filter.FilterClause filterClause)
               throws com.funambol.framework.engine.source.SyncSourceException
Description copied from class: CrcCachedSyncSource
BeginSync

Specified by:
beginSync in interface com.funambol.framework.engine.source.SyncSource
Overrides:
beginSync in class CrcCachedSyncSource
Parameters:
principal - Principal
syncMode - int
filterClause - FilterClause
Throws:
com.funambol.framework.engine.source.SyncSourceException
See Also:
set the filter folder filter T D S O I 0 0 0 0 1 --> 1 inbox 0 0 0 1 1 --> 3 inbox + outbox 0 0 1 1 1 --> 7 inbox + outbox + sent ... 1 1 1 1 1 --> 31 all time filter (timeFilter) null --> all "i.e. 20-10-2005" --> filter size filter (sizeFilter / numbytes) 000001 = 1 FILTER_SIZE_H 000011 = 3 FILTER_SIZE_HPERC 000101 = 5 FILTER_SIZE_H_B 001111 = 15 FILTER_SIZE_H_BPERC 010101 = 21 FILTER_SIZE_H_B_A 111111 = 63 FILTER_SIZE_H_B_APERC

endSync

public void endSync()
             throws com.funambol.framework.engine.source.SyncSourceException
Description copied from class: CrcCachedSyncSource
EndSync

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

getDevice

protected com.funambol.framework.server.Sync4jDevice getDevice(java.lang.String deviceId)
                                                        throws com.funambol.framework.server.store.PersistentStoreException
Return the device with the given deviceId

Parameters:
deviceId - String
Returns:
Sync4jDevice
Throws:
com.funambol.framework.server.store.PersistentStoreException

createSyncItem

protected com.funambol.framework.engine.SyncItem createSyncItem(java.lang.String uid,
                                                                char status)
create a single syncitem with UID and the empty content. This SyncItem is used in the getDeleted operation

Parameters:
uid - String
status - char
Returns:
SyncItem

createSyncItems

protected com.funambol.framework.engine.SyncItem[] createSyncItems(java.util.List mails,
                                                                   char status,
                                                                   boolean delete)
                                                            throws EntityException
Create SyncItem from Contact

Parameters:
mails - List
status - char
delete - boolean
Returns:
SyncItem[]
Throws:
EntityException

getFoundationMailFromXML

protected Email getFoundationMailFromXML(java.lang.String content)
                                  throws EntityException
Get Data from XML message converting the xml item into a Email object

Parameters:
content - String
Returns:
Email
Throws:
EntityException

getXMLFromFoundationMail

protected java.lang.String getXMLFromFoundationMail(Email mail)
                                             throws EntityException
Get Data from sync4j.foundation.pdi.mail.Email converting the Contact object into an xml item

Parameters:
mail - Email
Returns:
String
Throws:
EntityException

createSyncItem

protected com.funambol.framework.engine.SyncItem createSyncItem(Email email,
                                                                char status)
                                                         throws EntityException
Parameters:
email - Email
status - char
Returns:
SyncItem
Throws:
EntityException


Copyright © 2003-2006 Funambol.