com.funambol.email.items.dao
Class EntityDAO

java.lang.Object
  extended bycom.funambol.email.items.dao.EntityDAO
Direct Known Subclasses:
PopEntityDAO

public class EntityDAO
extends java.lang.Object

This class implements methods to access data in Mail Server datastore.


Field Summary
protected  javax.sql.DataSource dataSource
           
protected  java.lang.String jndiDataSourceName
           
protected  java.util.logging.Logger log
           
 
Constructor Summary
EntityDAO()
           
EntityDAO(java.lang.String jndiDataSourceName)
           
 
Method Summary
 javax.mail.Folder getDefaultFolder(IMailServerWrapper msw, java.lang.String fullpath)
          check if the Folder is in the mail server
 ItemFolder getFolderFromUID(java.lang.String GUID, java.lang.String source_uri, long principalId)
          serch a folder using the GUID in the local DB
 java.lang.String getFullPathFromFID(java.lang.String FID, java.lang.String source_uri, long principalId)
          gets the folder fullpath from the local DB In the local db the GUID is composed by: parentId + separator + objectId This method look up the item with the GUID = '%/FID'
 java.lang.String getFullPathFromGUID(java.lang.String GUID, java.lang.String source_uri, long principalId)
          gets the folder fullpath from the local DB
 java.lang.String getGUIDFromFullPath(java.lang.String fullpath, java.lang.String source_uri, long principalId)
          gets the Folder id from the local DB
 void insertCustomFolder(com.sun.mail.imap.IMAPFolder folder, java.lang.String defFullpath, com.funambol.server.tools.IdSpaceGenerator idFolderSpace, java.lang.String source_uri, long principalId)
          insert a custom folder
 void insertDefaultFolderInDB(java.lang.String GUID, java.lang.String parentId, java.lang.String fullPath, java.lang.String source_uri, long principalId)
          This method inserts one of the default folders if needed
 void insertDefaultFolderInMailServer(CommonMailServerWrapper cmsw, java.lang.String folderName)
          This method inserts the folder in the MailServer
 java.lang.String insertFolder(java.lang.String fullPath, java.lang.String parentId, com.funambol.server.tools.IdSpaceGenerator idFolderSpace, java.lang.String source_uri, long principalId)
           
protected  void lookupDataSource()
          Lookups the datasource JBOSS private String jndiDataSourceName = "java:jdbc/sync4j"; TOMCAT private String jndiDataSourceName = "java:comp/env/jdbc/sync4j";
 void removeFolder(java.lang.String GUID, java.lang.String source_uri, long principalId)
           
 void removeImapOutboxItem(com.sun.mail.imap.IMAPFolder f, java.lang.String GUID, java.lang.String source_uri, long principalId)
           
 void removePopOutboxItem(java.lang.String GUID, java.lang.String source_uri, long principalId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected java.util.logging.Logger log

jndiDataSourceName

protected java.lang.String jndiDataSourceName

dataSource

protected javax.sql.DataSource dataSource
Constructor Detail

EntityDAO

public EntityDAO()

EntityDAO

public EntityDAO(java.lang.String jndiDataSourceName)
Parameters:
jndiDataSourceName - String
Method Detail

insertCustomFolder

public void insertCustomFolder(com.sun.mail.imap.IMAPFolder folder,
                               java.lang.String defFullpath,
                               com.funambol.server.tools.IdSpaceGenerator idFolderSpace,
                               java.lang.String source_uri,
                               long principalId)
                        throws EntityException
insert a custom folder

Parameters:
folder - IMAPFolder
defFullpath - String
idFolderSpace - IdSpaceGenerator
source_uri - String
principalId - long
Throws:
EntityException

getFullPathFromGUID

public java.lang.String getFullPathFromGUID(java.lang.String GUID,
                                            java.lang.String source_uri,
                                            long principalId)
                                     throws EntityException
gets the folder fullpath from the local DB

Parameters:
GUID - folder id
source_uri - String
principalId - long
Returns:
String
Throws:
EntityException

getFullPathFromFID

public java.lang.String getFullPathFromFID(java.lang.String FID,
                                           java.lang.String source_uri,
                                           long principalId)
                                    throws EntityException
gets the folder fullpath from the local DB In the local db the GUID is composed by: parentId + separator + objectId This method look up the item with the GUID = '%/FID'

Parameters:
FID - folder id
source_uri - String
principalId - long
Returns:
String
Throws:
EntityException

getGUIDFromFullPath

public java.lang.String getGUIDFromFullPath(java.lang.String fullpath,
                                            java.lang.String source_uri,
                                            long principalId)
                                     throws EntityException
gets the Folder id from the local DB

Parameters:
fullpath - folder full path
source_uri - String
principalId - long
Returns:
String
Throws:
EntityException

insertDefaultFolderInMailServer

public void insertDefaultFolderInMailServer(CommonMailServerWrapper cmsw,
                                            java.lang.String folderName)
                                     throws EntityException
This method inserts the folder in the MailServer

Parameters:
cmsw - CommonMailServerWrapper
folderName - String
Throws:
EntityException

getFolderFromUID

public ItemFolder getFolderFromUID(java.lang.String GUID,
                                   java.lang.String source_uri,
                                   long principalId)
                            throws EntityException
serch a folder using the GUID in the local DB

Parameters:
GUID - folder id
source_uri - String
principalId - long
Returns:
ItemFolder
Throws:
EntityException

insertFolder

public java.lang.String insertFolder(java.lang.String fullPath,
                                     java.lang.String parentId,
                                     com.funambol.server.tools.IdSpaceGenerator idFolderSpace,
                                     java.lang.String source_uri,
                                     long principalId)
                              throws EntityException
Parameters:
fullPath - folder full path
parentId - parent folder id
idFolderSpace - IdSpaceGenerator
source_uri - String
principalId - long
Returns:
String
Throws:
EntityException

removePopOutboxItem

public void removePopOutboxItem(java.lang.String GUID,
                                java.lang.String source_uri,
                                long principalId)
                         throws EntityException
Parameters:
GUID - the Global Unique ID.
source_uri - the SyncSource URI.
principalId - The principal ID.
Throws:
EntityException

getDefaultFolder

public javax.mail.Folder getDefaultFolder(IMailServerWrapper msw,
                                          java.lang.String fullpath)
                                   throws EntityException
check if the Folder is in the mail server

Parameters:
msw - - IMailServerWrapper .
fullpath - - String .
Returns:
true if the folder is in the Mail Server - boolean.
Throws:
EntityException

removeImapOutboxItem

public void removeImapOutboxItem(com.sun.mail.imap.IMAPFolder f,
                                 java.lang.String GUID,
                                 java.lang.String source_uri,
                                 long principalId)
                          throws EntityException
Parameters:
f - IMAPFolder the server outbox folder.
GUID - the Global Unique ID.
source_uri - the SyncSource URI.
principalId - The principal ID.
Throws:
EntityException

removeFolder

public void removeFolder(java.lang.String GUID,
                         java.lang.String source_uri,
                         long principalId)
                  throws EntityException
Parameters:
GUID - String
source_uri - String
principalId - long
Throws:
EntityException

insertDefaultFolderInDB

public void insertDefaultFolderInDB(java.lang.String GUID,
                                    java.lang.String parentId,
                                    java.lang.String fullPath,
                                    java.lang.String source_uri,
                                    long principalId)
                             throws EntityException
This method inserts one of the default folders if needed

Parameters:
GUID - String
parentId - String
fullPath - String
source_uri - String
principalId - long
Throws:
EntityException

lookupDataSource

protected void lookupDataSource()
                         throws java.lang.Exception
Lookups the datasource JBOSS private String jndiDataSourceName = "java:jdbc/sync4j"; TOMCAT private String jndiDataSourceName = "java:comp/env/jdbc/sync4j";

Throws:
java.lang.Exception - if a error occurs during lookup


Copyright © 2003-2006 Funambol.