org.apache.james.mailboxmanager.torque
Class TorqueMailboxManager

java.lang.Object
  extended by org.apache.james.mailboxmanager.torque.TorqueMailboxManager
All Implemented Interfaces:
MailboxManager

public class TorqueMailboxManager
extends java.lang.Object
implements MailboxManager


Field Summary
protected  org.apache.commons.logging.Log log
           
 
Fields inherited from interface org.apache.james.mailboxmanager.manager.MailboxManager
HIERARCHY_DELIMITER, INBOX, USER_NAMESPACE
 
Constructor Summary
TorqueMailboxManager(UserManager userManager)
           
 
Method Summary
 void copyMessages(MessageRange set, java.lang.String from, java.lang.String to, MailboxSession session)
          this is done by the MailboxRepository because maybe this operation could be optimized in the corresponding store.
 void createMailbox(java.lang.String namespaceName)
          Creates a new mailbox.
 MailboxSession createSession()
          Creates a new session.
 void deleteEverything()
           
 void deleteMailbox(java.lang.String mailboxName, MailboxSession session)
           
 boolean existsMailbox(java.lang.String mailboxName)
           
protected  org.apache.commons.logging.Log getLog()
           
 Mailbox getMailbox(java.lang.String mailboxName, boolean autoCreate)
          Gets an session suitable for IMAP.
 boolean isAuthentic(java.lang.String userid, java.lang.String passwd)
          Autenticates the given user against the given password.
 ListResult[] list(MailboxExpression mailboxExpression)
          TODO: Expression requires parsing.
 void renameMailbox(java.lang.String from, java.lang.String to)
          Renames a mailbox.
 java.lang.String resolve(java.lang.String userName, java.lang.String mailboxPath)
           Resolves a path for the given user.
 void setSubscription(java.lang.String mailboxName, boolean value)
           
 void subscribe(java.lang.String user, java.lang.String mailbox)
          Subscribes the user to the given mailbox.
 java.util.Collection subscriptions(java.lang.String user)
          Lists current subscriptions for the given user.
 void unsubscribe(java.lang.String user, java.lang.String mailbox)
          Unsubscribes the user from the given mailbox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
Constructor Detail

TorqueMailboxManager

public TorqueMailboxManager(UserManager userManager)
Method Detail

getMailbox

public Mailbox getMailbox(java.lang.String mailboxName,
                          boolean autoCreate)
                   throws MailboxManagerException
Description copied from interface: MailboxManager
Gets an session suitable for IMAP.

Specified by:
getMailbox in interface MailboxManager
Parameters:
mailboxName - the name of the mailbox, not null
autoCreate - create this mailbox if it doesn't exist
Returns:
ImapMailboxSession, not null
Throws:
MailboxManagerException - when the mailbox cannot be opened
MailboxNotFoundException - when the given mailbox does not exist

createMailbox

public void createMailbox(java.lang.String namespaceName)
                   throws MailboxManagerException
Description copied from interface: MailboxManager
Creates a new mailbox. Any intermediary mailboxes missing from the hierarchy should be created.

Specified by:
createMailbox in interface MailboxManager
Parameters:
namespaceName - name, not null
Throws:
MailboxManagerException

deleteMailbox

public void deleteMailbox(java.lang.String mailboxName,
                          MailboxSession session)
                   throws MailboxManagerException
Specified by:
deleteMailbox in interface MailboxManager
Throws:
MailboxManagerException

renameMailbox

public void renameMailbox(java.lang.String from,
                          java.lang.String to)
                   throws MailboxManagerException
Description copied from interface: MailboxManager
Renames a mailbox.

Specified by:
renameMailbox in interface MailboxManager
Parameters:
from - original name for the mailbox
to - new name for the mailbox
Throws:
MailboxManagerException
MailboxExistsException - when the to mailbox exists

copyMessages

public void copyMessages(MessageRange set,
                         java.lang.String from,
                         java.lang.String to,
                         MailboxSession session)
                  throws MailboxManagerException
Description copied from interface: MailboxManager
this is done by the MailboxRepository because maybe this operation could be optimized in the corresponding store.

Specified by:
copyMessages in interface MailboxManager
Parameters:
set - messages to copy
from - name of the source mailbox
to - name of the destination mailbox
session - MailboxSession, not null
Throws:
MailboxManagerException

list

public ListResult[] list(MailboxExpression mailboxExpression)
                  throws MailboxManagerException
Description copied from interface: MailboxManager
TODO: Expression requires parsing. Probably easier for the caller to parse the expression into an object representation and use that instead.

Specified by:
list in interface MailboxManager
Parameters:
mailboxExpression - MailboxExpression used to select mailboxes to be returned
Throws:
MailboxManagerException

setSubscription

public void setSubscription(java.lang.String mailboxName,
                            boolean value)

existsMailbox

public boolean existsMailbox(java.lang.String mailboxName)
                      throws MailboxManagerException
Specified by:
existsMailbox in interface MailboxManager
Throws:
MailboxManagerException

deleteEverything

public void deleteEverything()
                      throws MailboxManagerException
Throws:
MailboxManagerException

getLog

protected org.apache.commons.logging.Log getLog()

createSession

public MailboxSession createSession()
Description copied from interface: MailboxManager
Creates a new session.

Specified by:
createSession in interface MailboxManager
Returns:
MailboxSession, not null

resolve

public java.lang.String resolve(java.lang.String userName,
                                java.lang.String mailboxPath)
Description copied from interface: MailboxManager

Resolves a path for the given user.

TODO: Think about replacing this operation TODO: More elegant to pass in the username TODO: Or switch to URLs

Specified by:
resolve in interface MailboxManager

isAuthentic

public boolean isAuthentic(java.lang.String userid,
                           java.lang.String passwd)
Description copied from interface: MailboxManager
Autenticates the given user against the given password.

Specified by:
isAuthentic in interface MailboxManager
Parameters:
userid - user name
passwd - password supplied
Returns:
true if the user is authenticated

subscribe

public void subscribe(java.lang.String user,
                      java.lang.String mailbox)
               throws SubscriptionException
Description copied from interface: MailboxManager
Subscribes the user to the given mailbox.

Specified by:
subscribe in interface MailboxManager
Parameters:
user - the user name, not null
mailbox - the mailbox name, not null
Throws:
SubscriptionException

subscriptions

public java.util.Collection subscriptions(java.lang.String user)
                                   throws SubscriptionException
Description copied from interface: MailboxManager
Lists current subscriptions for the given user.

Specified by:
subscriptions in interface MailboxManager
Parameters:
user - the user name, not null
Returns:
a Collection of mailbox names
Throws:
SubscriptionException

unsubscribe

public void unsubscribe(java.lang.String user,
                        java.lang.String mailbox)
                 throws SubscriptionException
Description copied from interface: MailboxManager
Unsubscribes the user from the given mailbox.

Specified by:
unsubscribe in interface MailboxManager
Parameters:
user - the user name, not null
mailbox - the mailbox name, not null
Throws:
SubscriptionException


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.