|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.james.mailrepository.JDBCMailRepository
public class JDBCMailRepository
Implementation of a MailRepository on a database.
Requires a configuration element in the .conf.xml file of the form:
<repository destinationURL="db://<datasource>/<table_name>/<repository_name>"
type="MAIL"
model="SYNCHRONOUS"/>
</repository>
destinationURL specifies..(Serge??)
Type can be SPOOL or MAIL
Model is currently not used and may be dropped
Requires a logger called MailRepository.
| Field Summary | |
|---|---|
protected org.apache.avalon.framework.context.Context |
context
The Avalon context used by the instance |
protected org.apache.avalon.excalibur.datasource.DataSourceComponent |
datasource
The JDBC datasource that provides the JDBC connection |
protected java.lang.String |
datasourceName
The name of the datasource used by this repository |
protected org.apache.avalon.cornerstone.services.datasources.DataSourceSelector |
datasources
The selector used to obtain the JDBC datasource |
protected boolean |
jdbcMailAttributesReady
"Support for Mail Attributes under JDBC repositories is ready" indicator. |
protected java.lang.String |
repositoryName
The repository name parsed from the destination URL |
protected SqlResources |
sqlQueries
Contains all of the sql strings for this component. |
protected java.lang.String |
tableName
The table name parsed from the destination URL |
protected JDBCUtil |
theJDBCUtil
The JDBCUtil helper class |
| Fields inherited from interface org.apache.james.services.MailRepository |
|---|
MAIL, ROLE |
| Constructor Summary | |
|---|---|
JDBCMailRepository()
|
|
| Method Summary | |
|---|---|
protected void |
checkJdbcAttributesSupport(java.sql.DatabaseMetaData dbMetaData)
Checks whether support for JDBC Mail atributes is activated for this repository and if everything is consistent. |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
|
void |
contextualize(org.apache.avalon.framework.context.Context context)
|
boolean |
equals(java.lang.Object obj)
|
protected java.sql.Connection |
getConnection()
Gets the SQL connection to be used by this JDBCMailRepository |
int |
hashCode()
Provide a hash code that is consistent with equals for this class |
void |
initialize()
Initialises the JDBC repository. |
java.util.Iterator |
list()
Gets a list of message keys stored in this repository. |
boolean |
lock(java.lang.String key)
Obtains a lock on a message identified by a key |
void |
remove(java.util.Collection mails)
Removes a Collection of mails from the repository |
void |
remove(Mail mail)
Removes a specified message |
void |
remove(java.lang.String key)
Removes a message identified by a key. |
Mail |
retrieve(java.lang.String key)
Retrieves a message given a key. |
void |
service(org.apache.avalon.framework.service.ServiceManager componentManager)
|
void |
store(Mail mc)
Store this message to the database. |
boolean |
unlock(java.lang.String key)
Releases a lock on a message identified by a key |
| 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 |
| Field Detail |
|---|
protected org.apache.avalon.framework.context.Context context
protected java.lang.String tableName
protected java.lang.String repositoryName
protected org.apache.avalon.cornerstone.services.datasources.DataSourceSelector datasources
protected org.apache.avalon.excalibur.datasource.DataSourceComponent datasource
protected java.lang.String datasourceName
protected SqlResources sqlQueries
protected JDBCUtil theJDBCUtil
protected boolean jdbcMailAttributesReady
| Constructor Detail |
|---|
public JDBCMailRepository()
| Method Detail |
|---|
public void contextualize(org.apache.avalon.framework.context.Context context)
throws org.apache.avalon.framework.context.ContextException
contextualize in interface org.apache.avalon.framework.context.Contextualizableorg.apache.avalon.framework.context.ContextExceptionContextualizable.contextualize(Context)
public void service(org.apache.avalon.framework.service.ServiceManager componentManager)
throws org.apache.avalon.framework.service.ServiceException
service in interface org.apache.avalon.framework.service.Serviceableorg.apache.avalon.framework.service.ServiceExceptionorg.apache.avalon.framework.service.Servicable#service(ServiceManager)
public void configure(org.apache.avalon.framework.configuration.Configuration conf)
throws org.apache.avalon.framework.configuration.ConfigurationException
configure in interface org.apache.avalon.framework.configuration.Configurableorg.apache.avalon.framework.configuration.ConfigurationExceptionConfigurable.configure(Configuration)
public void initialize()
throws java.lang.Exception
initialize in interface org.apache.avalon.framework.activity.Initializablejava.lang.Exception - if an error occurs
protected void checkJdbcAttributesSupport(java.sql.DatabaseMetaData dbMetaData)
throws java.sql.SQLException
dbMetaData - the database metadata to be used to look up the column
java.sql.SQLException - if a fatal situation is metpublic boolean unlock(java.lang.String key)
unlock in interface MailRepositorykey - the key of the message to be unlocked
public boolean lock(java.lang.String key)
lock in interface MailRepositorykey - the key of the message to be locked
public void store(Mail mc)
throws javax.mail.MessagingException
store in interface MailRepositorymc - the mail message to store
javax.mail.MessagingException
public Mail retrieve(java.lang.String key)
throws javax.mail.MessagingException
retrieve in interface MailRepositorykey - the key of the message to retrieve
javax.mail.MessagingException
public void remove(Mail mail)
throws javax.mail.MessagingException
remove in interface MailRepositorymail - the message to be removed from the repository
javax.mail.MessagingException
public void remove(java.util.Collection mails)
throws javax.mail.MessagingException
remove in interface MailRepositorymails - The Collection of MailImpl's to delete
javax.mail.MessagingException
public void remove(java.lang.String key)
throws javax.mail.MessagingException
remove in interface MailRepositorykey - the key of the message to be removed from the repository
javax.mail.MessagingException
public java.util.Iterator list()
throws javax.mail.MessagingException
list in interface MailRepositoryjavax.mail.MessagingException
protected java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLException - if there is an issue with getting the connectionpublic boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(Object)public int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||