public class JDBCMailRepository extends org.apache.james.mailrepository.lib.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 org.apache.james.util.sql.SqlResources |
sqlQueries
Contains all of the sql strings for this component.
|
protected String |
tableName
The table name parsed from the destination URL
|
protected org.apache.james.util.sql.JDBCUtil |
theJDBCUtil
The JDBCUtil helper class
|
| 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.
|
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<String> |
list() |
org.apache.mailet.Mail |
retrieve(String key) |
void |
setDatasource(DataSource datasource) |
void |
setFileSystem(org.apache.james.filesystem.api.FileSystem fileSystem) |
protected String repositoryName
protected DataSource datasource
protected String datasourceName
protected org.apache.james.util.sql.SqlResources sqlQueries
protected org.apache.james.util.sql.JDBCUtil theJDBCUtil
protected boolean jdbcMailAttributesReady
public JDBCMailRepository()
@Inject public void setDatasource(DataSource datasource)
@Inject public void setFileSystem(org.apache.james.filesystem.api.FileSystem fileSystem)
protected void doConfigure(org.apache.commons.configuration.HierarchicalConfiguration configuration) throws org.apache.commons.configuration.ConfigurationException
doConfigure in class org.apache.james.mailrepository.lib.AbstractMailRepositoryorg.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 org.apache.james.mailrepository.lib.AbstractMailRepositoryIOExceptionjavax.mail.MessagingExceptionAbstractMailRepository.internalStore(Mail)public org.apache.mailet.Mail retrieve(String key) throws javax.mail.MessagingException
javax.mail.MessagingExceptionMailRepository.retrieve(String)protected void internalRemove(String key) throws javax.mail.MessagingException
internalRemove in class org.apache.james.mailrepository.lib.AbstractMailRepositoryjavax.mail.MessagingExceptionAbstractMailRepository.internalRemove(String)public Iterator<String> list() throws javax.mail.MessagingException
javax.mail.MessagingExceptionMailRepository.list()protected Connection getConnection() throws SQLException
SQLException - if there is an issue with getting the connectionpublic boolean equals(Object obj)
equals in class ObjectObject.equals(Object)Copyright © 2002-2017 The Apache Software Foundation. All Rights Reserved.