org.apache.jsieve.mailet
Class SieveMailAdapter

java.lang.Object
  extended by org.apache.jsieve.mailet.SieveMailAdapter
All Implemented Interfaces:
MailAdapter, EnvelopeAccessors, ActionContext

public class SieveMailAdapter
extends java.lang.Object
implements MailAdapter, EnvelopeAccessors, ActionContext

Class SieveMailAdapter implements a MailAdapter for use in a Mailet environment.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.jsieve.mail.MailAdapter
MailAdapter.Address
 
Constructor Summary
SieveMailAdapter(org.apache.mailet.Mail aMail, org.apache.mailet.MailetContext aMailetContext, ActionDispatcher dispatcher, Poster poster)
          Constructor for SieveMailAdapter.
 
Method Summary
 void addAction(Action action)
          Adds an Action.
protected  java.util.List<Action> computeActions()
          Returns a new List of actions.
 void executeActions()
           
 java.util.List<Action> getActions()
          Returns the List of actions.
 java.lang.String getContentType()
           
 java.util.List<java.lang.String> getEnvelope(java.lang.String name)
           
 java.lang.String getEnvelopeFrom()
          Returns the from.
 java.util.List<java.lang.String> getEnvelopeNames()
           
protected  java.util.Map<java.lang.String,java.lang.String> getEnvelopes()
          Method getEnvelopes.
 java.lang.String getEnvelopeTo()
          Returns the sole recipient or null if there isn't one.
 java.util.List<java.lang.String> getHeader(java.lang.String name)
           
 java.util.List<java.lang.String> getHeaderNames()
           
 org.apache.commons.logging.Log getLog()
          Gets the log.
 org.apache.mailet.Mail getMail()
          Returns the mail.
 org.apache.mailet.MailetContext getMailetContext()
          Returns the mailetContext.
 java.util.List<java.lang.String> getMatchingEnvelope(java.lang.String name)
           
 java.util.List<java.lang.String> getMatchingHeader(java.lang.String name)
           
protected  javax.mail.internet.MimeMessage getMessage()
          Returns the message.
 java.lang.String getServerInfo()
          Gets name (including version) of this server.
 int getSize()
           
 boolean isInBodyText(java.lang.String phraseCaseInsensitive)
           
 MailAdapter.Address[] parseAddresses(java.lang.String arg)
           
 void post(org.apache.mailet.MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage mail)
          Posts the given mail.
 void post(java.lang.String uri, javax.mail.internet.MimeMessage mail)
          Experimental mail delivery.
protected  void setActions(java.util.List<Action> actions)
          Sets the actions.
 void setContext(SieveContext context)
           
 void setLog(org.apache.commons.logging.Log log)
           
protected  void setMail(org.apache.mailet.Mail mail)
          Sets the mail.
protected  void setMailetContext(org.apache.mailet.MailetContext mailetContext)
          Sets the mailetContext.
 java.lang.String toString()
           
protected  void updateActions()
          Updates the actions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SieveMailAdapter

public SieveMailAdapter(org.apache.mailet.Mail aMail,
                        org.apache.mailet.MailetContext aMailetContext,
                        ActionDispatcher dispatcher,
                        Poster poster)
Constructor for SieveMailAdapter.

Parameters:
aMail -
aMailetContext -
Method Detail

setLog

public void setLog(org.apache.commons.logging.Log log)

getMessage

protected javax.mail.internet.MimeMessage getMessage()
                                              throws javax.mail.MessagingException
Returns the message.

Returns:
MimeMessage
Throws:
javax.mail.MessagingException

getActions

public java.util.List<Action> getActions()
Returns the List of actions.

Specified by:
getActions in interface MailAdapter
Returns:
List

computeActions

protected java.util.List<Action> computeActions()
Returns a new List of actions.

Returns:
List

addAction

public void addAction(Action action)
Adds an Action.

Specified by:
addAction in interface MailAdapter
Parameters:
action - The action to set

executeActions

public void executeActions()
                    throws SieveException
Specified by:
executeActions in interface MailAdapter
Throws:
SieveException
See Also:
MailAdapter.executeActions()

setActions

protected void setActions(java.util.List<Action> actions)
Sets the actions.

Parameters:
actions - The actions to set

updateActions

protected void updateActions()
Updates the actions.


getHeader

public java.util.List<java.lang.String> getHeader(java.lang.String name)
                                           throws SieveMailException
Specified by:
getHeader in interface MailAdapter
Throws:
SieveMailException
See Also:
MailAdapter.getHeader(String)

getHeaderNames

public java.util.List<java.lang.String> getHeaderNames()
                                                throws SieveMailException
Specified by:
getHeaderNames in interface MailAdapter
Throws:
SieveMailException
See Also:
MailAdapter.getHeaderNames()

getMatchingHeader

public java.util.List<java.lang.String> getMatchingHeader(java.lang.String name)
                                                   throws SieveMailException
Specified by:
getMatchingHeader in interface MailAdapter
Throws:
SieveMailException
See Also:
MailAdapter.getMatchingHeader(String)

getSize

public int getSize()
            throws SieveMailException
Specified by:
getSize in interface MailAdapter
Throws:
SieveMailException
See Also:
MailAdapter.getSize()

getEnvelopes

protected java.util.Map<java.lang.String,java.lang.String> getEnvelopes()
Method getEnvelopes.

Returns:
Map

getEnvelope

public java.util.List<java.lang.String> getEnvelope(java.lang.String name)
                                             throws SieveMailException
Specified by:
getEnvelope in interface EnvelopeAccessors
Throws:
SieveMailException
See Also:
EnvelopeAccessors.getEnvelope(String)

getEnvelopeNames

public java.util.List<java.lang.String> getEnvelopeNames()
                                                  throws SieveMailException
Specified by:
getEnvelopeNames in interface EnvelopeAccessors
Throws:
SieveMailException
See Also:
EnvelopeAccessors.getEnvelopeNames()

getMatchingEnvelope

public java.util.List<java.lang.String> getMatchingEnvelope(java.lang.String name)
                                                     throws SieveMailException
Specified by:
getMatchingEnvelope in interface EnvelopeAccessors
Throws:
SieveMailException
See Also:
EnvelopeAccessors.getMatchingEnvelope(String)

getEnvelopeFrom

public java.lang.String getEnvelopeFrom()
Returns the from.

Returns:
String

getEnvelopeTo

public java.lang.String getEnvelopeTo()
Returns the sole recipient or null if there isn't one.

Returns:
String

getMail

public org.apache.mailet.Mail getMail()
Returns the mail.

Returns:
Mail

setMail

protected void setMail(org.apache.mailet.Mail mail)
Sets the mail.

Parameters:
mail - The mail to set

getMailetContext

public org.apache.mailet.MailetContext getMailetContext()
Returns the mailetContext.

Returns:
MailetContext

setMailetContext

protected void setMailetContext(org.apache.mailet.MailetContext mailetContext)
Sets the mailetContext.

Parameters:
mailetContext - The mailetContext to set

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getContentType

public java.lang.String getContentType()
                                throws SieveMailException
Specified by:
getContentType in interface MailAdapter
Throws:
SieveMailException

parseAddresses

public MailAdapter.Address[] parseAddresses(java.lang.String arg)
                                     throws SieveMailException,
                                            InternetAddressException
Specified by:
parseAddresses in interface MailAdapter
Throws:
SieveMailException
InternetAddressException

getLog

public org.apache.commons.logging.Log getLog()
Description copied from interface: ActionContext
Gets the log.

Specified by:
getLog in interface ActionContext
Returns:
not null

getServerInfo

public java.lang.String getServerInfo()
Description copied from interface: ActionContext
Gets name (including version) of this server.

Specified by:
getServerInfo in interface ActionContext
Returns:
not nul

post

public void post(java.lang.String uri,
                 javax.mail.internet.MimeMessage mail)
          throws javax.mail.MessagingException
Description copied from interface: ActionContext
Experimental mail delivery. POST verb indicate that mail should be attached to the collection indicated by the given URI.

Specified by:
post in interface ActionContext
Parameters:
uri - indicates the destination to which the mail to added. ATM the value should be mailbox://@localhost/
mail - not null
Throws:
javax.mail.MessagingException

post

public void post(org.apache.mailet.MailAddress sender,
                 java.util.Collection recipients,
                 javax.mail.internet.MimeMessage mail)
          throws javax.mail.MessagingException
Description copied from interface: ActionContext
Posts the given mail.

Specified by:
post in interface ActionContext
Parameters:
sender - possibly null
recipients - not null
mail - not null
Throws:
javax.mail.MessagingException - when mail cannot be posted

isInBodyText

public boolean isInBodyText(java.lang.String phraseCaseInsensitive)
                     throws SieveMailException
Specified by:
isInBodyText in interface MailAdapter
Throws:
SieveMailException

setContext

public void setContext(SieveContext context)
Specified by:
setContext in interface MailAdapter


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.