|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pentaho.di.job.entries.getpop.MailConnection
public class MailConnection
MailConnection handles the process of connecting to, reading from POP3/IMAP.
Constructor Summary | |
---|---|
MailConnection(LogChannelInterface log,
int protocol,
String server,
int port,
String username,
String password,
boolean usessl,
boolean useproxy,
String proxyusername)
Construct a new Database MailConnection |
Method Summary | |
---|---|
void |
clearFilters()
Clear search terms. |
void |
closeFolder(boolean expunge)
Close folder. |
void |
connect()
Open the connection. |
void |
deleteMessage()
Delete current fetched message |
void |
deleteMessages(boolean setCounter)
Delete messages. |
void |
disconnect()
Disconnect from the server and close folder, connection. |
void |
disconnect(boolean expunge)
Disconnect from the server and close folder, connection. |
void |
fetchNext()
Get next message. |
boolean |
folderExists(String foldername)
Check if a folder exists on server (only IMAP). |
int |
getAttachedFilesCount(Pattern pattern)
Returns attached files count for the current message |
int |
getDeletedMessagesCounter()
|
javax.mail.Folder |
getFolder()
|
String |
getFolderName()
Returns the foldername. |
javax.mail.Message |
getMessage()
Returns the current message. |
String |
getMessageBody()
|
javax.mail.Message[] |
getMessages()
Returns all messages. |
int |
getMessagesCount()
Returns the number of messages. |
int |
getMovedMessagesCounter()
Returns count of moved messages. |
int |
getProtocol()
Returns the protocol. |
String |
getProxyUsername()
|
int |
getSavedAttachedFilesCounter()
|
int |
getSavedMessagesCounter()
|
String |
getServer()
Returns the server name/Ip. |
javax.mail.Store |
getStore()
|
boolean |
isConnected()
|
boolean |
isMessageDeleted()
Returns if message is deleted |
boolean |
isMessageDraft()
Returns if message is Draft |
boolean |
isMessageFlagged()
Returns if message is read |
boolean |
isMessageNew()
Returns if message is new |
boolean |
isMessageRead()
Returns if message is read |
boolean |
isUseProxy()
|
boolean |
isUseSSL()
|
void |
moveMessage()
Move current message to a target folder. |
void |
moveMessages()
Move messages to a folder. |
void |
openFolder(boolean write)
Open the default folder (INBOX) |
void |
openFolder(String foldername,
boolean write)
Open the folder. |
void |
openFolder(String foldername,
boolean defaultFolder,
boolean write)
Open the folder. |
void |
retrieveMessages()
Retrieve all messages from server |
String[] |
returnAllFolders()
Returns all subfolders of the current folder |
String[] |
returnAllFolders(javax.mail.Folder folder)
Returns all subfolders of the specified folder |
String[] |
returnAllFolders(String folder)
Returns all subfolders of the folder folder |
void |
saveAttachedFiles(String foldername)
Save attached files to a folder. |
void |
saveAttachedFiles(String foldername,
Pattern pattern)
Save attached files to a folder. |
void |
saveMessageContentToFile(String filename,
String foldername)
Export message content to a filename. |
void |
setBodyTerm(String bodyfilter,
boolean notTerm)
Search all messages with body containing the word bodyfilter |
void |
setDestinationFolder(String foldername,
boolean createFolder)
Set destination folder |
void |
setFlagTermDraft()
|
void |
setFlagTermFlagged()
|
void |
setFlagTermNew()
|
void |
setFlagTermNotDraft()
|
void |
setFlagTermNotFlagged()
|
void |
setFlagTermOld()
|
void |
setFlagTermRead()
|
void |
setFlagTermUnread()
|
void |
setReceipientTerm(String receipient)
Set filter on receipient. |
void |
setReceivedDateTermBetween(Date beginDate,
Date endDate)
|
void |
setReceivedDateTermEQ(Date receiveddate)
Set filter on message received date. |
void |
setReceivedDateTermGT(Date pastDate)
Set filter on message received date. |
void |
setReceivedDateTermLT(Date futureDate)
Set filter on message received date. |
void |
setSenderTerm(String sender,
boolean notTerm)
Set filter on message sender. |
void |
setSubjectTerm(String subject,
boolean notTerm)
Set filter on subject. |
String |
toString()
|
void |
updateSavedAttachedFilesCounter()
|
void |
updateSavedMessagesCounter()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MailConnection(LogChannelInterface log, int protocol, String server, int port, String username, String password, boolean usessl, boolean useproxy, String proxyusername) throws KettleException
protocol
- the protocol used : MailConnection.PROTOCOL_POP3 or MailConnection.PROTOCOL_IMAP.server
- the target server (ip ou name)port
- port number on the serverpassword
- usessl
- specify if the connection is established via SSLuseproxy
- specify if we use proxy authenticationproxyusername
- proxy authorised user
KettleException
Method Detail |
---|
public boolean isConnected()
public boolean isUseSSL()
public boolean isUseProxy()
public String getProxyUsername()
public javax.mail.Store getStore()
public javax.mail.Folder getFolder()
public void connect() throws KettleException
KettleException
- if something went wrong.public void openFolder(boolean write) throws KettleException
write
- open the folder in write mode
KettleException
- if something went wrong.public void openFolder(String foldername, boolean write) throws KettleException
foldername
- the name of the folder to openwrite
- open the folder in write mode
KettleException
- if something went wrong.public void openFolder(String foldername, boolean defaultFolder, boolean write) throws KettleException
foldername
- the name of the folder to opendefaultFolder
- true to open the default folder (INBOX)write
- open the folder in write mode
KettleException
- if something went wrong.public void clearFilters()
public void disconnect() throws KettleException
KettleException
public void closeFolder(boolean expunge) throws KettleException
expunge
- expunge folder
KettleException
public void setSubjectTerm(String subject, boolean notTerm)
subject
- messages will be filtered on subjectnotTerm
- negate conditionpublic void setBodyTerm(String bodyfilter, boolean notTerm)
bodyfilter
- notTerm
- negate conditionpublic void setSenderTerm(String sender, boolean notTerm)
sender
- messages will be filtered on sendernotTerm
- negate conditionpublic void setReceipientTerm(String receipient)
receipient
- messages will be filtered on receipientnotTerm
- negate conditionpublic void setReceivedDateTermEQ(Date receiveddate)
receiveddate
- messages will be filtered on receiveddatenotTerm
- negate conditionpublic void setReceivedDateTermLT(Date futureDate)
futureDate
- messages will be filtered on futureDatenotTerm
- negate conditionpublic void setReceivedDateTermGT(Date pastDate)
pastDate
- messages will be filtered on pastDatenotTerm
- negate conditionpublic void setReceivedDateTermBetween(Date beginDate, Date endDate)
public void setFlagTermNew()
public void setFlagTermOld()
public void setFlagTermRead()
public void setFlagTermUnread()
public void setFlagTermFlagged()
public void setFlagTermNotFlagged()
public void setFlagTermDraft()
public void setFlagTermNotDraft()
public void retrieveMessages() throws KettleException
KettleException
public void disconnect(boolean expunge) throws KettleException
expunge
- expunge folder
KettleException
public void saveMessageContentToFile(String filename, String foldername) throws KettleException
filename
- the target filenamefoldername
- the parent folder of filename
KettleException.
KettleException
public void saveAttachedFiles(String foldername) throws KettleException
foldername
- the target foldername
KettleException.
KettleException
public void saveAttachedFiles(String foldername, Pattern pattern) throws KettleException
foldername
- the target foldernamepattern
- regular expression to filter on files
KettleException.
KettleException
public void deleteMessage() throws KettleException
KettleException
public void setDestinationFolder(String foldername, boolean createFolder) throws KettleException
foldername
- destination foldernamecreateFolder
- flag create folder if needed
KettleException
public void moveMessage() throws KettleException
KettleException
public String getFolderName()
public String getServer()
public int getProtocol()
public javax.mail.Message[] getMessages()
public void fetchNext() throws KettleException
KettleException
public javax.mail.Message getMessage()
public int getMessagesCount()
public void updateSavedMessagesCounter()
public int getSavedMessagesCounter()
public int getSavedAttachedFilesCounter()
public void updateSavedAttachedFilesCounter()
public int getDeletedMessagesCounter()
public int getMovedMessagesCounter()
public void deleteMessages(boolean setCounter) throws KettleException
KettleException
public void moveMessages() throws KettleException
KettleException
public boolean folderExists(String foldername)
foldername
- the name of the folder
public String[] returnAllFolders(javax.mail.Folder folder) throws KettleException
taget
- parent folder
KettleException
public String[] returnAllFolders() throws KettleException
KettleException
public String[] returnAllFolders(String folder) throws KettleException
folder
- target folder
KettleException
public String getMessageBody() throws Exception
Exception
public boolean isMessageNew()
public boolean isMessageRead()
public boolean isMessageFlagged()
public boolean isMessageDeleted()
public boolean isMessageDraft()
public String toString()
toString
in class Object
public int getAttachedFilesCount(Pattern pattern) throws KettleException
pattern
- (optional)
KettleException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |