public class EmailConnector extends BaseRepositoryConnector
| Modifier and Type | Class and Description |
|---|---|
protected static class |
EmailConnector.CheckConnectionThread
Class to check the connection.
|
protected static class |
EmailConnector.CloseFolderThread
Class to close a folder.
|
protected static class |
EmailConnector.CloseSessionThread
Class to close the session.
|
protected static class |
EmailConnector.ConnectThread
Class to set up connection.
|
protected static class |
EmailConnector.GetMessagesThread
Class to get all messages from a folder.
|
protected static class |
EmailConnector.ListFoldersThread
Class to list all folders.
|
protected static class |
EmailConnector.OpenFolderThread
Class to open a folder.
|
protected static class |
EmailConnector.SearchMessagesThread
Class to search for messages in a folder.
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
password |
protected String |
portString |
protected Properties |
properties |
protected String |
protocol |
protected String |
server |
protected EmailSession |
session |
protected static long |
SESSION_EXPIRATION_MILLISECONDS |
protected long |
sessionExpiration |
protected String |
urlTemplate |
protected String |
username |
_rcsidcurrentContext, paramsGLOBAL_DENY_TOKEN, JOBMODE_CONTINUOUS, JOBMODE_ONCEONLY, MODEL_ADD, MODEL_ADD_CHANGE, MODEL_ADD_CHANGE_DELETE, MODEL_ALL, MODEL_CHAINED_ADD, MODEL_CHAINED_ADD_CHANGE, MODEL_CHAINED_ADD_CHANGE_DELETE, MODEL_PARTIAL| Constructor and Description |
|---|
EmailConnector() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addFindParameterNode(ConfigParams parameters,
String findParameterName,
String findParameterValue) |
protected static void |
addFindParameterNode(Specification ds,
String findParameterName,
String findParameterValue) |
protected static void |
addFolderNode(Specification ds,
String folderName) |
protected static void |
addIncludedMetadataNode(Specification ds,
String metadataName) |
String |
addSeedDocuments(ISeedingActivity activities,
Specification spec,
String lastSeedVersion,
long seedTime,
int jobMode)
Queue "seed" documents.
|
String |
check()
Test the connection.
|
protected void |
checkConnection() |
void |
connect(ConfigParams configParameters)
Connect.
|
protected static String |
createDocumentIdentifier(String folderName,
String emailID)
Create a document identifier from a folder name and an email ID
|
void |
disconnect()
Close the connection.
|
protected static String |
extractEmailIDFromDocumentIdentifier(String di)
Find an email ID in a document identifier
|
protected static String |
extractFolderNameFromDocumentIdentifier(String di)
Find a folder name in a document identifier
|
protected static void |
fillInFilterTab(Map<String,Object> paramMap,
Specification ds) |
protected void |
fillInMetadataAttributes(Map<String,Object> paramMap)
Fill in Velocity context with data to permit attribute selection.
|
protected static void |
fillInMetadataTab(Map<String,Object> paramMap,
Specification ds)
Fill in Velocity context for Metadata tab.
|
protected void |
finalizeConnection() |
String[] |
getActivitiesList()
Return the list of activities that this connector supports (i.e.
|
String[] |
getBinNames(String documentIdentifier)
Get the bin name strings for a document identifier.
|
int |
getConnectorModel() |
protected String[] |
getFolderNames()
Get a sorted list of folder names
|
String |
getFormCheckJavascriptMethodName(int connectionSequenceNumber)
Obtain the name of the form check javascript method to call.
|
String |
getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
Obtain the name of the form presave check javascript method to call.
|
int |
getMaxDocumentRequest()
Get the maximum number of documents to amalgamate together into one batch, for this connector.
|
protected void |
getSession() |
protected static void |
handleIOException(IOException e,
String context)
Handle IO Exception
|
protected static void |
handleMessagingException(javax.mail.MessagingException e,
String context)
Handle Messaging exceptions in a consistent global manner
|
protected static String |
makeDocumentURI(String urlTemplate,
String folderName,
String id)
Create a document's URI given a template, a folder name, and a message ID
|
protected static String |
makeSafeFolderName(String folderName)
Create a safe folder name (which doesn't contain colons)
|
void |
outputConfigurationBody(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters,
String tabName) |
void |
outputConfigurationHeader(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters,
List<String> tabsArray)
Output the configuration header section.
|
protected void |
outputFilterTab(IHTTPOutput out,
Locale locale,
Specification ds,
String tabName,
int connectionSequenceNumber,
int actualSequenceNumber) |
protected void |
outputMetadataTab(IHTTPOutput out,
Locale locale,
Specification ds,
String tabName,
int connectionSequenceNumber,
int actualSequenceNumber)
Take care of "Metadata" tab.
|
void |
outputSpecificationBody(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber,
int actualSequenceNumber,
String tabName)
Output the specification body section.
|
void |
outputSpecificationHeader(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber,
List<String> tabsArray)
Output the specification header section.
|
void |
poll()
This method is periodically called for all connectors that are connected but not
in active use.
|
String |
processConfigurationPost(IThreadContext threadContext,
IPostParameters variableContext,
ConfigParams parameters)
Process a configuration post.
|
void |
processDocuments(String[] documentIdentifiers,
IExistingVersions statuses,
Specification spec,
IProcessActivity activities,
int jobMode,
boolean usesDefaultAuthority)
Process a set of documents.
|
protected String |
processFilterTab(IPostParameters variableContext,
Specification ds,
int connectionSequenceNumber) |
protected String |
processMetadataTab(IPostParameters variableContext,
Specification ds,
int connectionSequenceNumber) |
String |
processSpecificationPost(IPostParameters variableContext,
Locale locale,
Specification ds,
int connectionSequenceNumber)
Process a specification post.
|
protected static void |
removeNodes(ConfigParams parameters,
String nodeTypeName) |
protected static void |
removeNodes(Specification ds,
String nodeTypeName) |
protected static String |
substitute(String template,
Map<String,String> map) |
protected static String |
unpackSafeFolderName(String packedFolderName)
Unpack a safe folder name
|
void |
viewConfiguration(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters)
View configuration.
|
void |
viewSpecification(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber)
View specification.
|
addSeedDocuments, addSeedDocuments, addSeedDocuments, getDocumentIdentifiers, getDocumentIdentifiers, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getRelationshipTypes, getRemainingDocumentIdentifiers, outputSpecificationBody, outputSpecificationBody, outputSpecificationHeader, outputSpecificationHeader, outputSpecificationHeader, processDocuments, processDocuments, processDocuments, processDocuments, processSpecificationPost, processSpecificationPost, releaseDocumentVersions, releaseDocumentVersions, requestInfo, viewSpecification, viewSpecificationclearThreadContext, deinstall, getConfiguration, install, isConnected, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, processConfigurationPost, setThreadContext, unpack, unpackFixedList, unpackList, viewConfigurationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearThreadContext, deinstall, getConfiguration, install, isConnected, processConfigurationPost, setThreadContextprotected static final long SESSION_EXPIRATION_MILLISECONDS
protected long sessionExpiration
protected String server
protected String portString
protected String username
protected String password
protected String protocol
protected Properties properties
protected String urlTemplate
protected EmailSession session
public void connect(ConfigParams configParameters)
connect in interface IConnectorconnect in class BaseConnectorconfigParameters - is the set of configuration parameters, which
in this case describe the root directory.public void disconnect()
throws ManifoldCFException
disconnect in interface IConnectordisconnect in class BaseConnectorManifoldCFExceptionpublic void poll()
throws ManifoldCFException
poll in interface IConnectorpoll in class BaseConnectorManifoldCFExceptionpublic String check() throws ManifoldCFException
check in interface IConnectorcheck in class BaseConnectorManifoldCFExceptionprotected void checkConnection()
throws ManifoldCFException,
ServiceInterruption
public int getConnectorModel()
getConnectorModel in interface IRepositoryConnectorgetConnectorModel in class BaseRepositoryConnectorpublic String[] getActivitiesList()
getActivitiesList in interface IRepositoryConnectorgetActivitiesList in class BaseRepositoryConnectorpublic String[] getBinNames(String documentIdentifier)
getBinNames in interface IRepositoryConnectorgetBinNames in class BaseRepositoryConnectordocumentIdentifier - is the document identifier.public int getMaxDocumentRequest()
getMaxDocumentRequest in interface IRepositoryConnectorgetMaxDocumentRequest in class BaseRepositoryConnectorpublic String addSeedDocuments(ISeedingActivity activities, Specification spec, String lastSeedVersion, long seedTime, int jobMode) throws ManifoldCFException, ServiceInterruption
addSeedDocuments in interface IRepositoryConnectoraddSeedDocuments in class BaseRepositoryConnectoractivities - is the interface this method should use to perform whatever framework actions are desired.spec - is a document specification (that comes from the job).seedTime - is the end of the time range of documents to consider, exclusive.lastSeedVersionString - is the last seeding version string for this job, or null if the job has no previous seeding version string.jobMode - is an integer describing how the job is being run, whether continuous or once-only.ManifoldCFExceptionServiceInterruptionprotected void getSession()
throws ManifoldCFException,
ServiceInterruption
protected void finalizeConnection()
public void processDocuments(String[] documentIdentifiers, IExistingVersions statuses, Specification spec, IProcessActivity activities, int jobMode, boolean usesDefaultAuthority) throws ManifoldCFException, ServiceInterruption
processDocuments in interface IRepositoryConnectorprocessDocuments in class BaseRepositoryConnectordocumentIdentifiers - is the set of document identifiers to process.statuses - are the currently-stored document versions for each document in the set of document identifiers
passed in above.activities - is the interface this method should use to queue up new document references
and ingest documents.jobMode - is an integer describing how the job is being run, whether continuous or once-only.usesDefaultAuthority - will be true only if the authority in use for these documents is the default one.ManifoldCFExceptionServiceInterruptionpublic void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters, List<String> tabsArray) throws ManifoldCFException, IOException
outputConfigurationHeader in interface IConnectoroutputConfigurationHeader in class BaseConnectorthreadContext - is the local thread context.out - is the output to which any HTML should be sent.locale - is the desired locale.parameters - are the configuration parameters, as they currently exist, for this connection being configured.tabsArray - is an array of tab names. Add to this array any tab names that are specific to the connector.ManifoldCFExceptionIOExceptionpublic void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters, String tabName) throws ManifoldCFException, IOException
outputConfigurationBody in interface IConnectoroutputConfigurationBody in class BaseConnectorManifoldCFExceptionIOExceptionpublic String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, ConfigParams parameters) throws ManifoldCFException
processConfigurationPost in class BaseConnectorthreadContext - is the local thread context.variableContext - is the set of variables available from the post, including binary file post information.parameters - are the configuration parameters, as they currently exist, for this connection being configured.ManifoldCFExceptionpublic void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters) throws ManifoldCFException, IOException
viewConfiguration in interface IConnectorviewConfiguration in class BaseConnectorthreadContext - is the local thread context.out - is the output to which any HTML should be sent.parameters - are the configuration parameters, as they currently exist, for
this connection being configured.ManifoldCFExceptionIOExceptionpublic String getFormCheckJavascriptMethodName(int connectionSequenceNumber)
getFormCheckJavascriptMethodName in interface IRepositoryConnectorgetFormCheckJavascriptMethodName in class BaseRepositoryConnectorconnectionSequenceNumber - is the unique number of this connection within the job.public String getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
getFormPresaveCheckJavascriptMethodName in interface IRepositoryConnectorgetFormPresaveCheckJavascriptMethodName in class BaseRepositoryConnectorconnectionSequenceNumber - is the unique number of this connection within the job.public void outputSpecificationHeader(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber, List<String> tabsArray) throws ManifoldCFException, IOException
outputSpecificationHeader in interface IRepositoryConnectoroutputSpecificationHeader in class BaseRepositoryConnectorout - is the output to which any HTML should be sent.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.tabsArray - is an array of tab names. Add to this array any tab names that are specific to the connector.ManifoldCFExceptionIOExceptionpublic void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber, int actualSequenceNumber, String tabName) throws ManifoldCFException, IOException
outputSpecificationBody in interface IRepositoryConnectoroutputSpecificationBody in class BaseRepositoryConnectorout - is the output to which any HTML should be sent.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.actualSequenceNumber - is the connection within the job that has currently been selected.tabName - is the current tab name. (actualSequenceNumber, tabName) form a unique tuple within
the job.ManifoldCFExceptionIOExceptionprotected void outputMetadataTab(IHTTPOutput out, Locale locale, Specification ds, String tabName, int connectionSequenceNumber, int actualSequenceNumber) throws ManifoldCFException, IOException
ManifoldCFExceptionIOExceptionprotected static void fillInMetadataTab(Map<String,Object> paramMap, Specification ds)
protected void fillInMetadataAttributes(Map<String,Object> paramMap)
protected void outputFilterTab(IHTTPOutput out, Locale locale, Specification ds, String tabName, int connectionSequenceNumber, int actualSequenceNumber) throws ManifoldCFException, IOException
ManifoldCFExceptionIOExceptionprotected static void fillInFilterTab(Map<String,Object> paramMap, Specification ds)
public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds, int connectionSequenceNumber) throws ManifoldCFException
processSpecificationPost in interface IRepositoryConnectorprocessSpecificationPost in class BaseRepositoryConnectorvariableContext - contains the post data, including binary file-upload information.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.ManifoldCFExceptionprotected String processFilterTab(IPostParameters variableContext, Specification ds, int connectionSequenceNumber) throws ManifoldCFException
ManifoldCFExceptionprotected String processMetadataTab(IPostParameters variableContext, Specification ds, int connectionSequenceNumber) throws ManifoldCFException
ManifoldCFExceptionpublic void viewSpecification(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber) throws ManifoldCFException, IOException
viewSpecification in interface IRepositoryConnectorviewSpecification in class BaseRepositoryConnectorout - is the output to which any HTML should be sent.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.ManifoldCFExceptionIOExceptionprotected String[] getFolderNames() throws ManifoldCFException, ServiceInterruption
protected static String makeDocumentURI(String urlTemplate, String folderName, String id)
protected static void addFindParameterNode(ConfigParams parameters, String findParameterName, String findParameterValue)
protected static void removeNodes(ConfigParams parameters, String nodeTypeName)
protected static void removeNodes(Specification ds, String nodeTypeName)
protected static void addIncludedMetadataNode(Specification ds, String metadataName)
protected static void addFindParameterNode(Specification ds, String findParameterName, String findParameterValue)
protected static void addFolderNode(Specification ds, String folderName)
protected static String createDocumentIdentifier(String folderName, String emailID)
protected static String extractFolderNameFromDocumentIdentifier(String di)
protected static String extractEmailIDFromDocumentIdentifier(String di)
protected static String makeSafeFolderName(String folderName)
protected static String unpackSafeFolderName(String packedFolderName)
protected static void handleMessagingException(javax.mail.MessagingException e,
String context)
throws ManifoldCFException,
ServiceInterruption
protected static void handleIOException(IOException e, String context) throws ManifoldCFException, ServiceInterruption