org.apache.james.mailrepository
Class AvalonSpoolRepository

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.mailrepository.AvalonMailRepository
          extended by org.apache.james.mailrepository.AvalonSpoolRepository
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, SpoolRepository

public class AvalonSpoolRepository
extends AvalonMailRepository
implements SpoolRepository

Implementation of a MailRepository on a FileSystem. Requires a configuration element in the .conf.xml file of the form: <repository destinationURL="file://path-to-root-dir-for-repository" type="MAIL" model="SYNCHRONOUS"/> Requires a logger called MailRepository.

Version:
1.0.0, 24/04/1999

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.james.services.SpoolRepository
SpoolRepository.AcceptFilter
 
Field Summary
 
Fields inherited from class org.apache.james.mailrepository.AvalonMailRepository
DEEP_DEBUG
 
Fields inherited from interface org.apache.james.services.SpoolRepository
ROLE, SPOOL
 
Fields inherited from interface org.apache.james.services.MailRepository
MAIL
 
Constructor Summary
AvalonSpoolRepository()
           
 
Method Summary
 Mail accept()
          Returns an arbitrarily selected mail deposited in this Repository.
 Mail accept(long delay)
          Returns an arbitrarily selected mail deposited in this Repository that is either ready immediately for delivery, or is younger than it's last_updated plus the number of failed attempts times the delay time.
 Mail accept(SpoolRepository.AcceptFilter filter)
          Returns an arbitrarily select mail deposited in this Repository for which the supplied filter's accept method returns true.
 
Methods inherited from class org.apache.james.mailrepository.AvalonMailRepository
configure, initialize, list, lock, remove, remove, remove, retrieve, service, store, unlock
 
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, lock, remove, remove, remove, retrieve, store, unlock
 

Constructor Detail

AvalonSpoolRepository

public AvalonSpoolRepository()
Method Detail

accept

public Mail accept()
            throws java.lang.InterruptedException

Returns an arbitrarily selected mail deposited in this Repository. Usage: SpoolManager calls accept() to see if there are any unprocessed mails in the spool repository.

Synchronized to ensure thread safe access to the underlying spool.

Specified by:
accept in interface SpoolRepository
Returns:
the mail
Throws:
java.lang.InterruptedException

accept

public Mail accept(long delay)
            throws java.lang.InterruptedException

Returns an arbitrarily selected mail deposited in this Repository that is either ready immediately for delivery, or is younger than it's last_updated plus the number of failed attempts times the delay time. Usage: RemoteDeliverySpool calls accept() with some delay and should block until an unprocessed mail is available.

Synchronized to ensure thread safe access to the underlying spool.

Specified by:
accept in interface SpoolRepository
Returns:
the mail
Throws:
java.lang.InterruptedException

accept

public Mail accept(SpoolRepository.AcceptFilter filter)
            throws java.lang.InterruptedException
Returns an arbitrarily select mail deposited in this Repository for which the supplied filter's accept method returns true. Usage: RemoteDeliverySpool calls accept(filter) with some a filter which determines based on number of retries if the mail is ready for processing. If no message is ready the method will block until one is, the amount of time to block is determined by calling the filters getWaitTime method.

Synchronized to ensure thread safe access to the underlying spool.

Specified by:
accept in interface SpoolRepository
Returns:
the mail
Throws:
java.lang.InterruptedException


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