|
|||||||||||
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
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 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 String |
repositoryName
The repository name parsed from the destination URL |
protected SqlResources |
sqlQueries
Contains all of the sql strings for this component. |
protected 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(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(Object obj)
|
protected 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. 1) Tests the connection to the database. 2) Loads SQL strings from the SQL definition file, choosing the appropriate SQL for this connection, and performing paramter substitution, 3) Initialises the database with the required tables, if necessary. |
Iterator |
list()
Gets a list of message keys stored in this repository. |
boolean |
lock(String key)
Obtains a lock on a message identified by a key |
void |
remove(Collection mails)
Removes a Collection of mails from the repository |
void |
remove(Mail mail)
Removes a specified message |
void |
remove(String key)
Removes a message identified by a key. |
Mail |
retrieve(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(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 String tableName
protected String repositoryName
protected org.apache.avalon.cornerstone.services.datasources.DataSourceSelector datasources
protected org.apache.avalon.excalibur.datasource.DataSourceComponent datasource
protected 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.Contextualizable
org.apache.avalon.framework.context.ContextException
Contextualizable.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.Serviceable
org.apache.avalon.framework.service.ServiceException
org.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.Configurable
org.apache.avalon.framework.configuration.ConfigurationException
Configurable.configure(Configuration)
public void initialize() throws Exception
initialize
in interface org.apache.avalon.framework.activity.Initializable
Exception
- if an error occursprotected void checkJdbcAttributesSupport(DatabaseMetaData dbMetaData) throws SQLException
dbMetaData
- the database metadata to be used to look up the column
SQLException
- if a fatal situation is metpublic boolean unlock(String key)
unlock
in interface MailRepository
key
- the key of the message to be unlocked
public boolean lock(String key)
lock
in interface MailRepository
key
- the key of the message to be locked
public void store(Mail mc) throws MessagingException
store
in interface MailRepository
mc
- the mail message to store
MessagingException
public Mail retrieve(String key) throws MessagingException
retrieve
in interface MailRepository
key
- the key of the message to retrieve
MessagingException
public void remove(Mail mail) throws MessagingException
remove
in interface MailRepository
mail
- the message to be removed from the repository
MessagingException
public void remove(Collection mails) throws MessagingException
remove
in interface MailRepository
mails
- The Collection of MailImpl
's to delete
MessagingException
public void remove(String key) throws MessagingException
remove
in interface MailRepository
key
- the key of the message to be removed from the repository
MessagingException
public Iterator list() throws MessagingException
list
in interface MailRepository
MessagingException
protected Connection getConnection() throws SQLException
SQLException
- if there is an issue with getting the connectionpublic boolean equals(Object obj)
Object.equals(Object)
public int hashCode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |