Package scriptella.driver.mail
Class MailConnection
java.lang.Object
scriptella.spi.AbstractConnection
scriptella.driver.mail.MailConnection
- All Implemented Interfaces:
Connection
Represents a JavaMail connection.
For configuration details and examples see overview page.
TODO:
- Support for attachments
- Increase batch send performance by reusing tranport connection
- Version:
- 1.0
- Author:
- Fyodor Kupolov
-
Nested Class Summary
Nested classes/interfaces inherited from class scriptella.spi.AbstractConnection
AbstractConnection.StatementCounter -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of thesubjectconnection property.static final StringName of thetypeconnection property.static final Stringstatic final StringFields inherited from class scriptella.spi.AbstractConnection
counter -
Constructor Summary
ConstructorsConstructorDescriptionMailConnection(ConnectionParameters parameters) Creates an email connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the connection and releases all related resources.voidexecuteQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) Executes a query specified by its content.voidexecuteScript(Resource scriptContent, ParametersCallback parametersCallback) Executes a script specified by its content.protected javax.mail.internet.MimeMessageformat(Reader reader, PropertiesSubstitutor ps) protected voidsend(javax.mail.internet.MimeMessage message) Template method to decouple transport dependency, overriden in test classes.Methods inherited from class scriptella.spi.AbstractConnection
commit, getDialectIdentifier, getExecutedStatementsCount, isReadonly, rollback, setDialectIdentifier, toString
-
Field Details
-
Constructor Details
-
MailConnection
Creates an email connection.- Parameters:
parameters- connection parameters.
-
-
Method Details
-
executeScript
public void executeScript(Resource scriptContent, ParametersCallback parametersCallback) throws ProviderException Description copied from interface:ConnectionExecutes a script specified by its content.scriptContent may be used as a key for caching purposes, i.e. provider may precompile scripts and use compiled versions for subsequent executions. Please note that only inline
text resourcescan be safely cached.- Parameters:
scriptContent- script content. Cannot be null.parametersCallback- callback to get parameter values. Cannot be null.- Throws:
ProviderException- if script execution failed.
-
format
protected javax.mail.internet.MimeMessage format(Reader reader, PropertiesSubstitutor ps) throws javax.mail.MessagingException, IOException - Throws:
javax.mail.MessagingExceptionIOException
-
send
protected void send(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException Template method to decouple transport dependency, overriden in test classes.- Parameters:
message- message to send.- Throws:
javax.mail.MessagingException
-
executeQuery
public void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) throws ProviderException Description copied from interface:ConnectionExecutes a query specified by its content.- Parameters:
queryContent- query content. Cannot be null.parametersCallback- callback to get parameter values. Cannot be null.queryCallback- callback to call for each result set element produced by this query. Cannot be null.- Throws:
ProviderException- if query execution failed.- See Also:
-
close
Description copied from interface:ConnectionCloses the connection and releases all related resources.- Throws:
ProviderException- if a critical failure occured.
-