org.apache.james.mailrepository
Class JDBCSpoolRepository

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.james.mailrepository.JDBCMailRepository
              |
              +--org.apache.james.mailrepository.JDBCSpoolRepository
All Implemented Interfaces:
Component, Composable, Configurable, Contextualizable, Initializable, LogEnabled, MailRepository, SpoolRepository

public class JDBCSpoolRepository
extends JDBCMailRepository
implements SpoolRepository

Implementation of a SpoolRepository on a database.

Requires a configuration element in the .conf.xml file of the form:
type="MAIL"
model="SYNCHRONOUS"/>
sun.jdbc.odbc.JdbcOdbcDriver
jdbc:odbc:LocalDB
Message

destinationURL specifies..(Serge??)
Type can be SPOOL or MAIL
Model is currently not used and may be dropped
conn is the location of the ...(Serge)
table is the name of the table in the Database to be used

Requires a logger called MailRepository.

Approach for spool manager: PendingMessage inner class accept() is called.... checks whether needs to load PendingMessages() tries to get a message() if none, wait 60 accept(long) is called checks whether needs to load PendingMessages tries to get a message(long) if none, wait accordingly sync checkswhetherneedstoloadPendingMessages() if pending messages has messages in immediate process, return immediately if run query in last WAIT_LIMIT time, return immediately query and build 2 vectors of Pending messages. Ones that need immediate processing Ones that are delayed. put them in time order return get_a_message() loop through immediate messages. - remove top message - try to lock. if successful, return. otherwise loop. if nothing, return null get_a_message(long) try get_a_message() check top message in pending. if ready, then remove, try to lock, return if lock. return null.

Version:
1.0.0, 24/04/1999
Author:
Serge Knystautas

Field Summary
 
Fields inherited from class org.apache.james.mailrepository.JDBCMailRepository
context, datasource, datasourceName, datasources, destination, filestore, repositoryName, sqlFileName, sqlQueries, tableName, theJDBCUtil
 
Fields inherited from interface org.apache.james.services.SpoolRepository
SPOOL
 
Fields inherited from interface org.apache.james.services.MailRepository
MAIL
 
Constructor Summary
JDBCSpoolRepository()
           
 
Method Summary
 String accept()
          Return the key of a message to process.
 String accept(long delay)
          Return the key of a message that's ready to process.
 void store(MailImpl mc)
          Needs to override this method and reset the time to load to zero.
 
Methods inherited from class org.apache.james.mailrepository.JDBCMailRepository
compose, configure, contextualize, equals, getConnection, hashCode, initialize, list, lock, remove, remove, retrieve, unlock
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.james.services.MailRepository
list, lock, remove, remove, retrieve, unlock
 

Constructor Detail

JDBCSpoolRepository

public JDBCSpoolRepository()
Method Detail

accept

public String accept()
Return the key of a message to process. This is a message in the spool that is not locked.

Specified by:
accept in interface SpoolRepository
Returns:
the key for the mail

accept

public String accept(long delay)
Return the key of a message that's ready to process. If a message is of type "error" then check the last updated time, and don't try it until the long 'delay' parameter milliseconds has passed.

Specified by:
accept in interface SpoolRepository
Returns:
the key for the mail

store

public void store(MailImpl mc)
Needs to override this method and reset the time to load to zero. This will force a reload of the pending messages queue once that is empty... a message that gets added will sit here until that queue time has passed and the list is then reloaded.

Specified by:
store in interface MailRepository
Overrides:
store in class JDBCMailRepository
Parameters:
mc - the mail message to store


"Copyright © 1999-2002 Apache Jakarta Project. All Rights Reserved."