org.alfresco.repo.imap
Class AlfrescoImapHostManager

java.lang.Object
  extended by org.alfresco.repo.imap.AlfrescoImapHostManager
All Implemented Interfaces:
com.icegreen.greenmail.imap.ImapHostManager

public class AlfrescoImapHostManager
extends java.lang.Object
implements com.icegreen.greenmail.imap.ImapHostManager


Constructor Summary
AlfrescoImapHostManager()
           
 
Method Summary
 com.icegreen.greenmail.store.MailFolder createMailbox(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailboxName)
          Returns a reference to a newly created mailbox.
 void createPrivateMailAccount(com.icegreen.greenmail.user.GreenMailUser user)
          Not supported.
 void deleteMailbox(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailboxName)
          Deletes an existing MailBox.
 java.util.List getAllMessages()
          Not supported.
 com.icegreen.greenmail.store.MailFolder getFolder(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailboxName)
          Returns a reference to an existing Mailbox.
 com.icegreen.greenmail.store.MailFolder getFolder(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailboxName, boolean mustExist)
          Simply calls AlfrescoImapHostManager.getFolder(GreenMailUser, String).
 char getHierarchyDelimiter()
          Returns the hierarchy delimiter for mailboxes on this host.
 ImapService getImapService()
           
 com.icegreen.greenmail.store.MailFolder getInbox(com.icegreen.greenmail.user.GreenMailUser user)
          Returns a reference to the user's INBOX.
 TransactionService getTransactionService()
           
 java.util.Collection listMailboxes(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailboxPattern)
          Returns an collection of mailboxes.
 java.util.Collection listSubscribedMailboxes(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailboxPattern)
          Returns an collection of subscribed mailboxes.
 void renameMailbox(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String oldMailboxName, java.lang.String newMailboxName)
          Renames an existing mailbox.
 void setImapService(ImapService imapService)
           
 void setTransactionService(TransactionService transactionService)
           
 void subscribe(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailbox)
          Subscribes a user to a mailbox.
 void unsubscribe(com.icegreen.greenmail.user.GreenMailUser user, java.lang.String mailbox)
          Unsubscribes from a given mailbox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlfrescoImapHostManager

public AlfrescoImapHostManager()
Method Detail

getHierarchyDelimiter

public char getHierarchyDelimiter()
Returns the hierarchy delimiter for mailboxes on this host.

Specified by:
getHierarchyDelimiter in interface com.icegreen.greenmail.imap.ImapHostManager
Returns:
The hierarchy delimiter character.

listMailboxes

public java.util.Collection listMailboxes(com.icegreen.greenmail.user.GreenMailUser user,
                                          java.lang.String mailboxPattern)
                                   throws com.icegreen.greenmail.store.FolderException
Returns an collection of mailboxes. Method searches mailboxes under mount points defined for a specific user. Mount points include user's IMAP Virtualised Views and Email Archive Views. This method serves LIST command of the IMAP protocol.

Specified by:
listMailboxes in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request
mailboxPattern - String name of a mailbox possible including a wildcard.
Returns:
Collection of mailboxes matching the pattern.
Throws:
com.icegreen.greenmail.store.FolderException

listSubscribedMailboxes

public java.util.Collection listSubscribedMailboxes(com.icegreen.greenmail.user.GreenMailUser user,
                                                    java.lang.String mailboxPattern)
                                             throws com.icegreen.greenmail.store.FolderException
Returns an collection of subscribed mailboxes. To appear in search result mailboxes should have {http://www.alfresco.org/model/imap/1.0}subscribed property specified for user. Method searches subscribed mailboxes under mount points defined for a specific user. Mount points include user's IMAP Virtualised Views and Email Archive Views. This method serves LSUB command of the IMAP protocol.

Specified by:
listSubscribedMailboxes in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request
mailboxPattern - String name of a mailbox possible including a wildcard.
Returns:
Collection of mailboxes matching the pattern.
Throws:
com.icegreen.greenmail.store.FolderException

renameMailbox

public void renameMailbox(com.icegreen.greenmail.user.GreenMailUser user,
                          java.lang.String oldMailboxName,
                          java.lang.String newMailboxName)
                   throws com.icegreen.greenmail.store.FolderException,
                          com.icegreen.greenmail.imap.AuthorizationException
Renames an existing mailbox. The specified mailbox must already exist, the requested name must not exist already but must be able to be created and the user must have rights to delete the existing mailbox and create a mailbox with the new name. Any inferior hierarchical names must also be renamed. If INBOX is renamed, the contents of INBOX are transferred to a new mailbox with the new name, but INBOX is not deleted. If INBOX has inferior mailbox these are not renamed. This method serves RENAME command of the IMAP protocol.

Method searches mailbox under mount points defined for a specific user. Mount points include user's IMAP Virtualised Views and Email Archive Views.

Specified by:
renameMailbox in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request.
oldMailboxName - String name of the existing folder
newMailboxName - String target new name
Throws:
com.icegreen.greenmail.store.FolderException - if an existing folder with the new name.
AlfrescoImapFolderException - if user does not have rights to create the new mailbox.
com.icegreen.greenmail.imap.AuthorizationException

createMailbox

public com.icegreen.greenmail.store.MailFolder createMailbox(com.icegreen.greenmail.user.GreenMailUser user,
                                                             java.lang.String mailboxName)
                                                      throws com.icegreen.greenmail.imap.AuthorizationException,
                                                             com.icegreen.greenmail.store.FolderException
Returns a reference to a newly created mailbox. The request should specify a mailbox that does not already exist on this server, that could exist on this server and that the user has rights to create. This method serves CREATE command of the IMAP protocol.

Specified by:
createMailbox in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request.
mailboxName - String name of the target
Returns:
an Mailbox reference.
Throws:
com.icegreen.greenmail.store.FolderException - if mailbox already exists
AlfrescoImapFolderException - if user does not have rights to create the new mailbox.
com.icegreen.greenmail.imap.AuthorizationException

deleteMailbox

public void deleteMailbox(com.icegreen.greenmail.user.GreenMailUser user,
                          java.lang.String mailboxName)
                   throws com.icegreen.greenmail.store.FolderException,
                          com.icegreen.greenmail.imap.AuthorizationException
Deletes an existing MailBox. Specified mailbox must already exist on this server, and the user must have rights to delete it.

This method serves DELETE command of the IMAP protocol.

Specified by:
deleteMailbox in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request.
mailboxName - String name of the target
Throws:
com.icegreen.greenmail.store.FolderException - if mailbox has a non-selectable store with children
com.icegreen.greenmail.imap.AuthorizationException

getFolder

public com.icegreen.greenmail.store.MailFolder getFolder(com.icegreen.greenmail.user.GreenMailUser user,
                                                         java.lang.String mailboxName)
Returns a reference to an existing Mailbox. The requested mailbox must already exists on this server and the requesting user must have at least lookup rights.

It is also can be used by to obtain hierarchy delimiter by the LIST command:

C: 2 list "" ""

S: * LIST () "." ""

S: 2 OK LIST completed.

Method searches mailbox under mount points defined for a specific user. Mount points include user's IMAP Virtualised Views and Email Archive Views.

Specified by:
getFolder in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request.
mailboxName - String name of the target.
Returns:
an Mailbox reference.

getFolder

public com.icegreen.greenmail.store.MailFolder getFolder(com.icegreen.greenmail.user.GreenMailUser user,
                                                         java.lang.String mailboxName,
                                                         boolean mustExist)
                                                  throws com.icegreen.greenmail.store.FolderException
Simply calls AlfrescoImapHostManager.getFolder(GreenMailUser, String).

Added to implement ImapHostManager.

Specified by:
getFolder in interface com.icegreen.greenmail.imap.ImapHostManager
Throws:
com.icegreen.greenmail.store.FolderException

getInbox

public com.icegreen.greenmail.store.MailFolder getInbox(com.icegreen.greenmail.user.GreenMailUser user)
                                                 throws com.icegreen.greenmail.store.FolderException
Returns a reference to the user's INBOX.

Specified by:
getInbox in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - The user making the request.
Returns:
The user's Inbox.
Throws:
com.icegreen.greenmail.store.FolderException

createPrivateMailAccount

public void createPrivateMailAccount(com.icegreen.greenmail.user.GreenMailUser user)
                              throws com.icegreen.greenmail.store.FolderException
Not supported. May be used by GreenMailUser.create() method.

Added to implement ImapHostManager.

Specified by:
createPrivateMailAccount in interface com.icegreen.greenmail.imap.ImapHostManager
Throws:
com.icegreen.greenmail.store.FolderException

subscribe

public void subscribe(com.icegreen.greenmail.user.GreenMailUser user,
                      java.lang.String mailbox)
               throws com.icegreen.greenmail.store.FolderException
Subscribes a user to a mailbox. The mailbox must exist locally and the user must have rights to modify it.

This method serves SUBSCRIBE command of the IMAP protocol.

Specified by:
subscribe in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request
mailbox - String representation of a mailbox name.
Throws:
com.icegreen.greenmail.store.FolderException

unsubscribe

public void unsubscribe(com.icegreen.greenmail.user.GreenMailUser user,
                        java.lang.String mailbox)
                 throws com.icegreen.greenmail.store.FolderException
Unsubscribes from a given mailbox.

This method serves UNSUBSCRIBE command of the IMAP protocol.

Specified by:
unsubscribe in interface com.icegreen.greenmail.imap.ImapHostManager
Parameters:
user - User making the request
mailbox - String representation of a mailbox name.
Throws:
com.icegreen.greenmail.store.FolderException

getAllMessages

public java.util.List getAllMessages()
Not supported. Used by GreenMail class.

Specified by:
getAllMessages in interface com.icegreen.greenmail.imap.ImapHostManager

getImapService

public ImapService getImapService()

setImapService

public void setImapService(ImapService imapService)

getTransactionService

public TransactionService getTransactionService()

setTransactionService

public void setTransactionService(TransactionService transactionService)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.