|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.day.cq.mcm.core.importer.AbstractMailImporter
public abstract class AbstractMailImporter
Abstract base class for mail (polling) importers.
Mail importers are reading mails from the given data source and save them to
the repository for later use and processing. Each message polled is stored as
a node, using the message id as node name. Message data is stored in
properties below. See
saveMessage(Message, Node)
for the list of properties.
Data Source: The data source is a mail URI defining all the required parts to connect and get mails from. Since the import is a batch process there is no interactivity to request a password or other configuration options. So all information must go into the data source URI. This mail importer expects the following scheme:
protocol://host:port/folder?username=user&password=secret
More protocol specific configuration can be placed in the query part like this:
protocol://host:port/folder?username=user&password=secret&config.property=configValue
Pop3Importer,
ImapImporter| Field Summary | |
|---|---|
static String |
NODE_MESSAGE
The node name of the message itself = "message" |
static String |
PROPERTY_DATE
The date property on the mail node = "date" |
static String |
PROPERTY_FROM
The from property on the mail node = "from" |
static String |
PROPERTY_SUBJECT
The subject property on the mail node = "subject" |
| Fields inherited from interface com.day.cq.polling.importer.Importer |
|---|
SCHEME_PROPERTY, SERVICE_NAME |
| Constructor Summary | |
|---|---|
AbstractMailImporter()
|
|
| Method Summary | |
|---|---|
protected Folder |
connect(Properties mailProperties,
MailDataSource mailDataSource)
Connect to a mail folder of the mail data source using the given properties. |
protected void |
disconnect(Folder folder)
Disconnect the given mail folder by closing it and also closing the session. |
protected abstract Properties |
getMailProperties(MailDataSource mailDataSource)
Get the properties to use when establishing a mail session. |
protected abstract Message[] |
getMessages(Folder folder,
MailDataSource mailDataSource)
Get the messages from the given folder. |
void |
importData(String scheme,
String dataSource,
Resource target)
Start importing mails by polling from the given mail source and save mails under the given target. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTY_FROM
public static final String PROPERTY_SUBJECT
public static final String PROPERTY_DATE
public static final String NODE_MESSAGE
| Constructor Detail |
|---|
public AbstractMailImporter()
| Method Detail |
|---|
public void importData(String scheme,
String dataSource,
Resource target)
throws ImportException
importData in interface Importerscheme - The actual scheme of the data source. If an
Importer is registered for multiple schemes, this
scheme may for example be used to decide on which data
represenation can be expected. This value is one of the
schemes with which the Importer service has been
configured in the importer.scheme
service property.dataSource - The scheme specific string (generally an URI)
describing the location at which the data is to be polled. The
format of this string is specific to the actual
scheme used. For example, this may be a plain
HTTP URL of the form http://host/some/data.xml.target - The target resource into which the data has to be imported
ImportException - may be thrown in case of problems accessing,
transferring or actually importing the data. If the failure
is caused by an exception, this exception (
Throwable) should be made available as the cause
of this exception.Importer.importData(java.lang.String,
java.lang.String, org.apache.sling.api.resource.Resource)
protected Folder connect(Properties mailProperties,
MailDataSource mailDataSource)
throws MessagingException
mailProperties - mailDataSource -
MessagingException
protected void disconnect(Folder folder)
throws MessagingException
folder -
MessagingException
protected abstract Properties getMailProperties(MailDataSource mailDataSource)
throws ImportException
For example: The IMAP protocol provider properties.
mailDataSource -
ImportException
protected abstract Message[] getMessages(Folder folder,
MailDataSource mailDataSource)
throws MessagingException
folder - mailDataSource -
MessagingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||