|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.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:
model="SYNCHRONOUS"/>
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 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 DataSourceSelector |
datasources
The selector used to obtain the JDBC datasource |
protected String |
destination
Destination URL for the repository. |
protected String |
filestore
The name of the filestore to be used to store mail when configured to use dbfile mode. |
protected String |
repositoryName
The repository name parsed from the destination URL |
protected String |
sqlFileName
The name of the SQL configuration file to be used to configure this repository. |
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 |
Constructor Summary | |
JDBCMailRepository()
|
Method Summary | |
void |
compose(ComponentManager componentManager)
|
void |
configure(Configuration conf)
|
void |
contextualize(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(MailImpl mail)
Removes a specified message |
void |
remove(String key)
Removes a message identified by a key. |
MailImpl |
retrieve(String key)
Retrieves a message given a key. |
void |
store(MailImpl 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 Context context
protected String destination
protected String tableName
protected String repositoryName
protected String filestore
protected String sqlFileName
protected DataSourceSelector datasources
protected org.apache.avalon.excalibur.datasource.DataSourceComponent datasource
protected String datasourceName
protected SqlResources sqlQueries
protected JDBCUtil theJDBCUtil
Constructor Detail |
public JDBCMailRepository()
Method Detail |
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
Contextualizable.contextualize(Context)
public void compose(ComponentManager componentManager) throws ComponentException
compose
in interface Composable
ComponentException
Composable.compose(ComponentManager)
public void configure(Configuration conf) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
Configurable.configure(Configuration)
public void initialize() throws Exception
initialize
in interface Initializable
Exception
- if an error occurspublic 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(MailImpl mc)
store
in interface MailRepository
mc
- the mail message to storepublic MailImpl retrieve(String key)
retrieve
in interface MailRepository
key
- the key of the message to retrieve
public void remove(MailImpl mail)
remove
in interface MailRepository
mail
- the message to be removed from the repositorypublic void remove(String key)
remove
in interface MailRepository
key
- the key of the message to be removed from the repositorypublic Iterator list()
list
in interface MailRepository
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)
public int hashCode()
hashCode
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |