public class JDBCMailRepository extends AbstractMailRepository
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.
Modifier and Type | Field and Description |
---|---|
protected DataSource |
datasource
The JDBC datasource that provides the JDBC connection
|
protected String |
datasourceName
The name of the datasource used by this repository
|
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
|
DEEP_DEBUG
Constructor and Description |
---|
JDBCMailRepository() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkJdbcAttributesSupport(DatabaseMetaData dbMetaData)
Checks whether support for JDBC Mail atributes is activated for this
repository and if everything is consistent.
Looks for both the "updateMessageAttributesSQL" and "retrieveMessageAttributesSQL" statements in sqlResources and for a table column named "message_attributes". |
protected void |
doConfigure(org.apache.commons.configuration.HierarchicalConfiguration configuration) |
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 |
init()
Initialises the JDBC repository.
|
protected void |
internalRemove(String key) |
protected void |
internalStore(org.apache.mailet.Mail mc) |
Iterator |
list()
List string keys of messages in repository.
|
org.apache.mailet.Mail |
retrieve(String key)
Retrieves a message given a key.
|
void |
setDatasource(DataSource datasource) |
void |
setFileSystem(FileSystem fileSystem) |
protected String tableName
protected String repositoryName
protected DataSource datasource
protected String datasourceName
protected SqlResources sqlQueries
protected JDBCUtil theJDBCUtil
protected boolean jdbcMailAttributesReady
public void setDatasource(DataSource datasource)
public void setFileSystem(FileSystem fileSystem)
protected void doConfigure(org.apache.commons.configuration.HierarchicalConfiguration configuration) throws org.apache.commons.configuration.ConfigurationException
doConfigure
in class AbstractMailRepository
org.apache.commons.configuration.ConfigurationException
@PostConstruct public void init() throws Exception
Exception
- if an error occursprotected void checkJdbcAttributesSupport(DatabaseMetaData dbMetaData) throws SQLException
dbMetaData
- the database metadata to be used to look up the columnSQLException
- if a fatal situation is metprotected void internalStore(org.apache.mailet.Mail mc) throws IOException, javax.mail.MessagingException
internalStore
in class AbstractMailRepository
IOException
javax.mail.MessagingException
AbstractMailRepository.internalStore(Mail)
public org.apache.mailet.Mail retrieve(String key) throws javax.mail.MessagingException
MailRepository
key
- the key of the message to retrievejavax.mail.MessagingException
MailRepository.retrieve(String)
protected void internalRemove(String key) throws javax.mail.MessagingException
internalRemove
in class AbstractMailRepository
javax.mail.MessagingException
AbstractMailRepository.internalRemove(String)
public Iterator list() throws javax.mail.MessagingException
MailRepository
Iterator
over the list of keys in the repositoryjavax.mail.MessagingException
MailRepository.list()
protected Connection getConnection() throws SQLException
SQLException
- if there is an issue with getting the connectionpublic boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.