Class JavamailInputNode
- java.lang.Object
-
- com.levigo.jadice.server.internal.NodeInternal
-
- com.levigo.jadice.server.Node
-
- com.levigo.jadice.server.javamail.JavamailInputNode
-
public class JavamailInputNode extends Node
ANode
used to fetch data from a JavaMail compatible message store. With the JavaMail RI store implementations this enables access to IMAP and POP3 message stores. Third-party providers may allow access to other messaging systems using the same API.As this node is a data source it must not have a predecessor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.levigo.jadice.server.Node
Node.Cardinality
-
-
Constructor Summary
Constructors Constructor Description JavamailInputNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFolderName()
String
getHostName()
long
getImapMessageUID()
Node.Cardinality
getInputCardinality()
Return the input cardinality of this node, i.e.javax.mail.search.SearchTerm
getMessageFilter()
Get the message filter.String
getPassword()
String
getPathSelector()
int
getPort()
Get the port number to use.Properties
getSessionProperties()
Get the session properties.String
getStoreProtocol()
String
getUsername()
String
getWorkerClassName()
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name.boolean
isAllowOnlyOneMessage()
Get whether to allow just one message to match the filter.boolean
isIgnoreOriginalMimeTypes()
boolean
isUnpackMultipart()
void
setAllowOnlyOneMessage(boolean allowOnlyOneMessage)
Set whether to allow just one message to match the filter.void
setFolderName(String folderName)
Set the folder name from which to retrieve the message.void
setHostName(String hostName)
Set host name of the server hosting the message store.void
setIgnoreOriginalMimeTypes(boolean ignoreOriginalMimeTypes)
Set whether the original MIME-type information should be ignored.void
setImapMessageUID(long imapMessageUID)
Set the UID of an IMAP message to select.void
setMessageFilter(javax.mail.search.SearchTerm messageFilter)
Set the message filter.void
setPassword(String password)
Set the password corresponding to the user accountvoid
setPathSelector(String pathSelector)
Set path selector of the message parts to include.void
setPort(int port)
Set the port number to use.void
setSessionProperties(Properties sessionProperties)
Set the JavaMail session properties.void
setStoreProtocol(String storeProtocol)
Set the store protocol to use.void
setUnpackMultipart(boolean unpackMultipart)
Set this flag to indicate whethermultipart/*
parts of a message are decomposed into individual streams (true
) or forwarded as a whole(false
).void
setUsername(String username)
Set the user name used for authentication with the message store..-
Methods inherited from class com.levigo.jadice.server.Node
addTransportReceiver, appendSuccessor, apply, equals, getJob, getOutputCardinality, getPredecessors, getSubsidiaryNodes, getSuccessors, getTransportSender, getUUID, hashCode, initialize, prependPredecessor, remove, validateConfiguration
-
-
-
-
Field Detail
-
ALL_PARTS
public static final String ALL_PARTS
Path selector to select everything.- See Also:
- Constant Field Values
-
-
Method Detail
-
getWorkerClassName
public String getWorkerClassName()
Description copied from class:Node
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name. By default, the worker class name is- The same as the node name with the trailing "Node" replaced by "Worker" if the node name ends in "Node"
- The node class name with an appended "Worker" otherwise.
This behavior can be overridden in concrete subclasses.
- Overrides:
getWorkerClassName
in classNode
- Returns:
- the full qualified class name of the worker of this node.
-
getInputCardinality
public Node.Cardinality getInputCardinality()
Description copied from class:Node
Return the input cardinality of this node, i.e. how many bundles (not streams!) it expects to process. By default, nodes are "pipe-style", i.e. one input, one output.- Overrides:
getInputCardinality
in classNode
- Returns:
Node.Cardinality.NONE
as this node accepts no input bundles
-
getSessionProperties
public Properties getSessionProperties()
Get the session properties.- Returns:
- the session properties
-
setSessionProperties
public void setSessionProperties(Properties sessionProperties)
Set the JavaMail session properties.- Parameters:
sessionProperties
- properties of the session when retrieving messages- See Also:
Session
-
getFolderName
public String getFolderName()
- Returns:
- the folder name
-
setFolderName
public void setFolderName(String folderName)
Set the folder name from which to retrieve the message.Default value:
INBOX
- Parameters:
folderName
- a folder name
-
getStoreProtocol
public String getStoreProtocol()
- Returns:
- the message store protocol (e.g.
IMAP
,POP3
, …).
-
setStoreProtocol
public void setStoreProtocol(String storeProtocol)
Set the store protocol to use. With the reference implementation allowed values includeimap
(default value) andpop3
.- Parameters:
storeProtocol
- the protocol to access the message store.
-
getHostName
public String getHostName()
- Returns:
- host name of the server hosting the message store
-
setHostName
public void setHostName(String hostName)
Set host name of the server hosting the message store.- Parameters:
hostName
- a host name
-
getPassword
public String getPassword()
- Returns:
- the password that is used for authentication.
-
setPassword
public void setPassword(String password)
Set the password corresponding to the user account- Parameters:
password
- the user password- See Also:
setUsername(String)
-
getPort
public int getPort()
Get the port number to use.- Returns:
- the port number
-
setPort
public void setPort(int port)
Set the port number to use.Default value:
-1
, that means to use the standard port for the given protocol- Parameters:
port
- a port number- See Also:
setStoreProtocol(String)
-
getUsername
public String getUsername()
- Returns:
- the the user name used for authentication.
-
setUsername
public void setUsername(String username)
Set the user name used for authentication with the message store..- Parameters:
username
- a user name
-
getMessageFilter
public javax.mail.search.SearchTerm getMessageFilter()
Get the message filter.- Returns:
- the message filter (or
null
)
-
setMessageFilter
public void setMessageFilter(javax.mail.search.SearchTerm messageFilter)
Set the message filter. This message filter used to identify the message(s) to be retrieved.Implementation note: This filter must not be used in combination with an
IMAP message UID
Default value:
null
- Parameters:
messageFilter
- filter for messages to be retrieved- See Also:
SearchTerm
,Folder.search(SearchTerm)
-
isAllowOnlyOneMessage
public boolean isAllowOnlyOneMessage()
Get whether to allow just one message to match the filter.- Returns:
true
iff at most one message must match the filter.
-
setAllowOnlyOneMessage
public void setAllowOnlyOneMessage(boolean allowOnlyOneMessage)
Set whether to allow just one message to match the filter.Make sure that exactly one message is matched by the search filter. As there is no portable (across store implementations) unique message identifier, a combination of message headers must be used, to uniquely identify a message. Setting this flag to
true
ensures that exactly one message is matched. If more than one message matches themessage filter
, the job is aborted.Default value:
false
- Parameters:
allowOnlyOneMessage
- flag if exactly one message is allowed to match the filter
-
getPathSelector
public String getPathSelector()
- Returns:
- path the path selector.
-
setPathSelector
public void setPathSelector(String pathSelector)
Set path selector of the message parts to include.Message parts are structured in a virtual path of the form
i0/i1/i2/…
within
denoting the zero-based index of the part within the message structure.i0
denotes the message number, i.e. the index within the list of matched messages, itself. Please note that this path structure is purely artificial. The path numbering is not, in any way, reflected in the MIME stream.Shell-like wildcards may be used to select more than one part, however, this implementation is limited to just one path selector. Examples:
- Select just the third part of the first message which must contain a
multipart/*
body: 0/2
- Select all parts of the first message:
0/*
- Select all messages:
*
(or set the path selector tonull
)
Default value: select all messages.
- Parameters:
pathSelector
- selector of message parts to include
- Select just the third part of the first message which must contain a
-
getImapMessageUID
public long getImapMessageUID()
- Returns:
- the UID of an IMAP message to select.
-
setImapMessageUID
public void setImapMessageUID(long imapMessageUID)
Set the UID of an IMAP message to select. This may only be set, if the message filter has not yet been set and the store protocol isimap
.- Parameters:
imapMessageUID
- the UID of an IMAP message
-
isIgnoreOriginalMimeTypes
public boolean isIgnoreOriginalMimeTypes()
- Returns:
- whether the original MIME-type information should be ignored.
-
setIgnoreOriginalMimeTypes
public void setIgnoreOriginalMimeTypes(boolean ignoreOriginalMimeTypes)
Set whether the original MIME-type information should be ignored.This flag indicates whether the original MIME-type information from any MIME-encoded messages should be mistrusted. If set to
true
, all MIME types are set toStreamDescriptor.UNKNOWN_MIME_TYPE
("unknown") and the original MIME type information is propagated using the property "PURPORTED_MIME_TYPE". This option can be used to let thecom.levigo.jadice.server.documentplatform.StreamAnalysisNode
determine the actual MIME types in cases when the purported information is unreliable.An exception from the mistrust are the
multipart/*
,text/*
andmessage/*
types—for those types the information must be trusted. Default value:true
as the original information is usually rather unreliable.- Parameters:
ignoreOriginalMimeTypes
- flag if or if not to ignore the original MIME typ
-
isUnpackMultipart
public boolean isUnpackMultipart()
- Returns:
- whether decomposition of
multipart/*
parts is enabled.
-
setUnpackMultipart
public void setUnpackMultipart(boolean unpackMultipart)
Set this flag to indicate whethermultipart/*
parts of a message are decomposed into individual streams (true
) or forwarded as a whole(false
).Default value:
false
- Parameters:
unpackMultipart
- flag if or if not to unpackmultipart/*
parts
-
-