org.apache.cocoon.mail
Class MailAction

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.acting.AbstractAction
          extended byorg.apache.cocoon.acting.ServiceableAction
              extended byorg.apache.cocoon.mail.MailAction
All Implemented Interfaces:
org.apache.cocoon.acting.Action, Serviceable, ThreadSafe

public class MailAction
extends org.apache.cocoon.acting.ServiceableAction
implements ThreadSafe

This action creates javamail objects, and puts XMLizable object wrappers of these objects into the request attribute map.

This action enables javamail access as action. It creates an http sesion, and puts the MailContext object into the session attributes.

Since:
Cocoon 2.1, 16 December 2002
Version:
$Id: MailAction.html 1304280 2012-03-23 11:18:01Z ilgrosso $
See Also:
MailContext

Field Summary
static String REQUEST_ATTRIBUTE_FOLDER
          Request attribute name of a XMLizable folder
static String REQUEST_ATTRIBUTE_FOLDERS
          Request attribute name of a XMLizable folders object
static String REQUEST_ATTRIBUTE_MESSAGE
          Request attribute name of a XMLizable message object
static String REQUEST_ATTRIBUTE_MESSAGES
          Request attribute name of a XMLizable messages object
 
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
 
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
 
Fields inherited from interface org.apache.cocoon.acting.Action
ROLE
 
Constructor Summary
MailAction()
           
 
Method Summary
 Map act(org.apache.cocoon.environment.Redirector redirector, org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String source, Parameters par)
          Execute mail commands.
protected  void checkProviders(Session session)
          Check that the provider need is available
protected  String filter(String tokenStart, String tokenEnd, String s, Properties tokens)
          Replace occurences of TOKEN_STARTxxxTOKEN_END by value of entry xxx in tokens table.
protected  String getURLNameExpanded(String storeURLNameTemplate, String userid, String password)
          Gets the uRLNameExpanded attribute of the MailGenerator object
protected  void populateRequestAttribute(org.apache.cocoon.environment.Request request, MailContext mailContext)
          Populate request attribute map.
protected  void putXMLizerToRequestAttribute(org.apache.cocoon.environment.Request request, Iterator resultIterator)
          Put XMLizable javamail objects into request attribute map
protected  List retrieveJavaMailObjects(MailContext mailContext)
          Retrieve javamail objects
 
Methods inherited from class org.apache.cocoon.acting.ServiceableAction
service
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_ATTRIBUTE_FOLDER

public static final String REQUEST_ATTRIBUTE_FOLDER
Request attribute name of a XMLizable folder

See Also:
Constant Field Values

REQUEST_ATTRIBUTE_FOLDERS

public static final String REQUEST_ATTRIBUTE_FOLDERS
Request attribute name of a XMLizable folders object

See Also:
Constant Field Values

REQUEST_ATTRIBUTE_MESSAGE

public static final String REQUEST_ATTRIBUTE_MESSAGE
Request attribute name of a XMLizable message object

See Also:
Constant Field Values

REQUEST_ATTRIBUTE_MESSAGES

public static final String REQUEST_ATTRIBUTE_MESSAGES
Request attribute name of a XMLizable messages object

See Also:
Constant Field Values
Constructor Detail

MailAction

public MailAction()
Method Detail

act

public Map act(org.apache.cocoon.environment.Redirector redirector,
               org.apache.cocoon.environment.SourceResolver resolver,
               Map objectModel,
               String source,
               Parameters par)
        throws Exception
Execute mail commands.

Specified by:
act in interface org.apache.cocoon.acting.Action
Parameters:
redirector - Cocoon's redirector
resolver - Cocoon's source resolver, used for testing if a source is resolvable
source - the source, e.g.: index.html
objectModel - Description of the Parameter
par - Description of the Parameter
Throws:
Exception - Description of the Exception

getURLNameExpanded

protected String getURLNameExpanded(String storeURLNameTemplate,
                                    String userid,
                                    String password)
Gets the uRLNameExpanded attribute of the MailGenerator object

Parameters:
storeURLNameTemplate - Description of the Parameter
userid - Description of the Parameter
password - Description of the Parameter
Returns:
The uRLNameExpanded value

filter

protected String filter(String tokenStart,
                        String tokenEnd,
                        String s,
                        Properties tokens)
Replace occurences of TOKEN_STARTxxxTOKEN_END by value of entry xxx in tokens table.

Parameters:
tokenStart - token start marker
tokenEnd - token end marker
s - the string examined
tokens - Description of the Parameter
Returns:
String replaced all tokenized entries of original String s.

checkProviders

protected void checkProviders(Session session)
Check that the provider need is available

Parameters:
session - The javamail Session used for checking its providers.

populateRequestAttribute

protected void populateRequestAttribute(org.apache.cocoon.environment.Request request,
                                        MailContext mailContext)
                                 throws Exception
Populate request attribute map.

Execute mail command, and populate request attribute map with XMLizable javamail objects, created by the mail command

Parameters:
request - triggering the creation of javamail objects
mailContext - javamail context, store, session, folders
Throws:
Exception - Description of the Exception

putXMLizerToRequestAttribute

protected void putXMLizerToRequestAttribute(org.apache.cocoon.environment.Request request,
                                            Iterator resultIterator)
Put XMLizable javamail objects into request attribute map

Parameters:
request - holding the destination attribute map
resultIterator - Iterator of

retrieveJavaMailObjects

protected List retrieveJavaMailObjects(MailContext mailContext)
                                throws org.apache.cocoon.ProcessingException
Retrieve javamail objects

Parameters:
mailContext - Description of the Parameter
Returns:
List of retrieved javamail objects
Throws:
org.apache.cocoon.ProcessingException - thrown iff retrieval fails


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.