public class MailConnection extends AbstractConnection
For configuration details and examples see overview page.
TODO:
AbstractConnection.StatementCounter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SUBJECT
Name of the
subject connection property. |
static java.lang.String |
TYPE
Name of the
type connection property. |
static java.lang.String |
TYPE_HTML |
static java.lang.String |
TYPE_TEXT |
counter
Constructor and Description |
---|
MailConnection(ConnectionParameters parameters)
Creates an email connection.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection and releases all related resources.
|
void |
executeQuery(Resource queryContent,
ParametersCallback parametersCallback,
QueryCallback queryCallback)
Executes a query specified by its content.
|
void |
executeScript(Resource scriptContent,
ParametersCallback parametersCallback)
Executes a script specified by its content.
|
protected javax.mail.internet.MimeMessage |
format(java.io.Reader reader,
PropertiesSubstitutor ps) |
protected void |
send(javax.mail.internet.MimeMessage message)
Template method to decouple transport dependency, overriden in test classes.
|
commit, getDialectIdentifier, getExecutedStatementsCount, isReadonly, rollback, setDialectIdentifier, toString
public static final java.lang.String TYPE
type
connection property.
Specifies type of E-Mail message content: TYPE_TEXT
, TYPE_HTML
.public static final java.lang.String SUBJECT
subject
connection property.
Specifies e-mail subject.public static final java.lang.String TYPE_TEXT
public static final java.lang.String TYPE_HTML
public MailConnection(ConnectionParameters parameters)
parameters
- connection parameters.public void executeScript(Resource scriptContent, ParametersCallback parametersCallback) throws ProviderException
Connection
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 resources
can be safely cached.
scriptContent
- script content. Cannot be null.parametersCallback
- callback to get parameter values. Cannot be null.ProviderException
- if script execution failed.protected javax.mail.internet.MimeMessage format(java.io.Reader reader, PropertiesSubstitutor ps) throws javax.mail.MessagingException, java.io.IOException
javax.mail.MessagingException
java.io.IOException
protected void send(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
message
- message to send.javax.mail.MessagingException
public void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) throws ProviderException
Connection
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.ProviderException
- if query execution failed.Connection.executeScript(scriptella.spi.Resource,scriptella.spi.ParametersCallback)
public void close() throws ProviderException
Connection
ProviderException
- if a critical failure occured.Copyright © Copyright 2006-2019 The Scriptella Project Team.