org.apache.james.mailrepository
Class AbstractMailRepository

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.mailrepository.AbstractMailRepository
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, MailRepository
Direct Known Subclasses:
AvalonMailRepository, JDBCMailRepository

public abstract class AbstractMailRepository
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements MailRepository, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable

This class represent an AbstractMailRepository. All MailRepositories should extend this class.


Field Summary
protected static boolean DEEP_DEBUG
          Whether 'deep debugging' is turned on.
protected  org.apache.avalon.cornerstone.services.store.Store store
           
 
Fields inherited from interface org.apache.james.services.MailRepository
MAIL, ROLE
 
Constructor Summary
AbstractMailRepository()
           
 
Method Summary
 void initialize()
           
protected abstract  void internalRemove(java.lang.String key)
           
protected abstract  void internalStore(org.apache.mailet.Mail mc)
           
 boolean lock(java.lang.String key)
          Obtains a lock on a message identified by key
 void remove(java.util.Collection mails)
          Remove an Collection of mails from the repository
 void remove(org.apache.mailet.Mail mail)
          Removes a specified message
 void remove(java.lang.String key)
          Removes a message identified by key.
 void service(org.apache.avalon.framework.service.ServiceManager componentManager)
           
 void store(org.apache.mailet.Mail mc)
          Stores a message in this repository.
 boolean unlock(java.lang.String key)
          Releases a lock on a message identified the key
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.james.services.MailRepository
list, retrieve
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable
configure
 

Field Detail

DEEP_DEBUG

protected static final boolean DEEP_DEBUG
Whether 'deep debugging' is turned on.

See Also:
Constant Field Values

store

protected org.apache.avalon.cornerstone.services.store.Store store
Constructor Detail

AbstractMailRepository

public AbstractMailRepository()
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception
See Also:
Initializable.initialize()

service

public void service(org.apache.avalon.framework.service.ServiceManager componentManager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(ServiceManager )

unlock

public boolean unlock(java.lang.String key)
Description copied from interface: MailRepository
Releases a lock on a message identified the key

Specified by:
unlock in interface MailRepository
Parameters:
key - the key of the message to be unlocked
Returns:
true if successfully released the lock, false otherwise
See Also:
MailRepository.unlock(String)

lock

public boolean lock(java.lang.String key)
Description copied from interface: MailRepository
Obtains a lock on a message identified by key

Specified by:
lock in interface MailRepository
Parameters:
key - the key of the message to be locked
Returns:
true if successfully obtained the lock, false otherwise
See Also:
MailRepository.lock(String)

store

public void store(org.apache.mailet.Mail mc)
           throws javax.mail.MessagingException
Description copied from interface: MailRepository
Stores a message in this repository. Shouldn't this return the key under which it is stored?

Specified by:
store in interface MailRepository
Parameters:
mc - the mail message to store
Throws:
javax.mail.MessagingException
See Also:
MailRepository.store(Mail)

internalStore

protected abstract void internalStore(org.apache.mailet.Mail mc)
                               throws javax.mail.MessagingException,
                                      java.io.IOException
Throws:
javax.mail.MessagingException
java.io.IOException
See Also:
store(Mail)

remove

public void remove(org.apache.mailet.Mail mail)
            throws javax.mail.MessagingException
Description copied from interface: MailRepository
Removes a specified message

Specified by:
remove in interface MailRepository
Parameters:
mail - the message to be removed from the repository
Throws:
javax.mail.MessagingException
See Also:
MailRepository.remove(Mail)

remove

public void remove(java.util.Collection mails)
            throws javax.mail.MessagingException
Description copied from interface: MailRepository
Remove an Collection of mails from the repository

Specified by:
remove in interface MailRepository
Parameters:
mails - The Collection of MailImpl's to delete
Throws:
javax.mail.MessagingException
See Also:
MailRepository.remove(Collection)

remove

public void remove(java.lang.String key)
            throws javax.mail.MessagingException
Description copied from interface: MailRepository
Removes a message identified by key.

Specified by:
remove in interface MailRepository
Parameters:
key - the key of the message to be removed from the repository
Throws:
javax.mail.MessagingException
See Also:
MailRepository.remove(String)

internalRemove

protected abstract void internalRemove(java.lang.String key)
                                throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException
See Also:
remove(String)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.