|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jsieve.util.check.ScriptCheckMailAdapter
public class ScriptCheckMailAdapter
Checks script execution for an email. The wrapped email is set by called
setMail(javax.mail.Message)
. Actions are recorded on executedActions
and can
be retrieved by getExecutedActions()
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.jsieve.mail.MailAdapter |
---|
MailAdapter.Address |
Constructor Summary | |
---|---|
ScriptCheckMailAdapter()
|
Method Summary | |
---|---|
void |
addAction(Action action)
Method addAction adds an Action to the List of Actions to be performed by the receiver. |
void |
executeActions()
Method executeActions. |
java.util.List<Action> |
getActions()
Method getActions answers the List of Actions accumulated by the receiver. |
java.lang.String |
getContentType()
Method getContentType returns string/mime representation of the message type. |
java.util.List<Action> |
getExecutedActions()
Gets the actions accumulated when executedActions was last
called. |
java.util.List<java.lang.String> |
getHeader(java.lang.String name)
Method getHeader answers a List of all of the headers in the receiver whose name is equal to the passed name. |
java.util.List<java.lang.String> |
getHeaderNames()
Method getHeaderNames answers a List of all of the headers in the receiver. |
javax.mail.Message |
getMail()
Gets the wrapped email. |
java.util.List<java.lang.String> |
getMatchingHeader(java.lang.String name)
Method getMatchingHeader answers a List of all of the headers in the receiver with the passed name. |
int |
getSize()
Method getSize answers the receiver's message size in octets. |
boolean |
isInBodyText(java.lang.String phraseCaseInsensitive)
Is the given phrase found in the body text of this mail? This search should be case insensitive. |
MailAdapter.Address[] |
parseAddresses(java.lang.String headerName)
Parses the named header value into individual addresses. |
MailAdapter.Address[] |
parseAddresses(java.lang.String headerName,
javax.mail.Message message)
Parses the value from the given message into addresses. |
void |
reset()
Resets executed and accumlated actions. |
void |
setContext(SieveContext context)
Sets the context for the current sieve script execution. |
void |
setMail(javax.mail.Message mail)
Sets the wrapped email and reset() s the adapter ready for another
execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScriptCheckMailAdapter()
Method Detail |
---|
public javax.mail.Message getMail()
Message
, possibly nullpublic void setMail(javax.mail.Message mail)
reset()
s the adapter ready for another
execution.
mail
- Message
, possibly nullpublic void addAction(Action action)
addAction
in interface MailAdapter
action
- public void executeActions() throws SieveException
executeActions
in interface MailAdapter
SieveException
public java.util.List<Action> getExecutedActions()
executedActions
was last
called.
List
of Action
s, not null. This list is a
modifiable copypublic java.util.List<Action> getActions()
getActions
in interface MailAdapter
List
of Action
's, not null, possibly
unmodifiablepublic void reset()
public java.util.List<java.lang.String> getHeader(java.lang.String name) throws SieveMailException
getHeader
in interface MailAdapter
name
-
List
not null, possibly empty
SieveMailException
public java.util.List<java.lang.String> getHeaderNames() throws SieveMailException
getHeaderNames
in interface MailAdapter
List
, not null possible empty, possible
unmodifiable
SieveMailException
public java.util.List<java.lang.String> getMatchingHeader(java.lang.String name) throws SieveMailException
Method getMatchingHeader answers a List of all of the headers in the receiver with the passed name. If no headers are found an empty List is returned.
This method differs from getHeader(String) in that it ignores case and the whitespace prefixes and suffixes of a header name when performing the match, as required by RFC 3028. Thus "From", "from ", " From" and " from " are considered equal.
getMatchingHeader
in interface MailAdapter
name
-
List
, not null possibly empty
SieveMailException
public int getSize() throws SieveMailException
getSize
in interface MailAdapter
SieveMailException
public java.lang.String getContentType() throws SieveMailException
getContentType
in interface MailAdapter
SieveMailException
public MailAdapter.Address[] parseAddresses(java.lang.String headerName) throws SieveMailException
MailAdapter
Parses the named header value into individual addresses.
Headers should be matched in a way that ignores case and the whitespace prefixes and suffixes of a header name when performing the match, as required by RFC 3028. Thus "From", "from ", " From" and " from " are considered equal.
parseAddresses
in interface MailAdapter
headerName
- name of the header whose value is to be split
SieveMailException
- when the header value cannot be readpublic MailAdapter.Address[] parseAddresses(java.lang.String headerName, javax.mail.Message message) throws SieveMailException
headerName
- header name, to be matched case insensitivelymessage
- Message
, not null
Address
array, not null possibly empty
SieveMailException
public boolean isInBodyText(java.lang.String phraseCaseInsensitive) throws SieveMailException
MailAdapter
isInBodyText
in interface MailAdapter
phraseCaseInsensitive
- the phrase to search
SieveMailException
- when the search cannot be completedpublic void setContext(SieveContext context)
MailAdapter
Sets the context for the current sieve script execution.
Sieve engines MUST
set this property before any calls
related to the execution of a script are made.
Implementations intended to be shared between separate threads of
execution MUST
ensure that they manage concurrency contexts,
for example by storage in a thread local variable. Engines MUST
- for a script execution - ensure that all calls are made within the
same thread of execution.
setContext
in interface MailAdapter
context
- the current context,
or null to clear the contest once the execution of a script has completed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |