org.apache.cocoon.mail
Class MailAction

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.acting.AbstractAction
          extended by org.apache.cocoon.acting.ServiceableAction
              extended by org.apache.cocoon.mail.MailAction
All Implemented Interfaces:
Component, LogEnabled, Serviceable, ThreadSafe, Action

public class MailAction
extends 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 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Bernhard Huber
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(Redirector redirector, 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(Request request, MailContext mailContext)
          Populate request attribute map.
protected  void putXMLizerToRequestAttribute(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.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
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(Redirector redirector,
               SourceResolver resolver,
               Map objectModel,
               String source,
               Parameters par)
        throws Exception
Execute mail commands.

Specified by:
act in interface 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
Returns:
Map The returned Map object with sitemap substitution values which can be used in subsequent elements attributes like src= using a xpath like expression: src="mydir/{myval}/foo" If the return value is null the processing inside the element of the sitemap will be skipped.
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(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(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 ProcessingException
Retrieve javamail objects

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


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