org.apache.oozie.action.email
Class EmailActionExecutor

java.lang.Object
  extended by org.apache.oozie.action.ActionExecutor
      extended by org.apache.oozie.action.email.EmailActionExecutor

public class EmailActionExecutor
extends ActionExecutor

Email action executor. It takes to, cc addresses along with a subject and body and sends out an email.


Nested Class Summary
static class EmailActionExecutor.JavaMailAuthenticator
           
 
Nested classes/interfaces inherited from class org.apache.oozie.action.ActionExecutor
ActionExecutor.Context
 
Field Summary
static String CONF_PREFIX
           
static String EMAIL_SMTP_AUTH
           
static String EMAIL_SMTP_FROM
           
static String EMAIL_SMTP_HOST
           
static String EMAIL_SMTP_PASS
           
static String EMAIL_SMTP_PORT
           
static String EMAIL_SMTP_USER
           
 
Fields inherited from class org.apache.oozie.action.ActionExecutor
ERROR_OTHER, MAX_RETRIES, requiresNNJT, RETRY_INTERVAL
 
Constructor Summary
EmailActionExecutor()
           
 
Method Summary
 void check(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action)
          Check if an action has completed.
protected  void email(ActionExecutor.Context context, String[] to, String[] cc, String subject, String body)
           
 void end(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action)
          End an action after it has executed.
 void initActionType()
          Invoked once at system initialization time.
 boolean isCompleted(String externalStatus)
          Return if the external status indicates that the action has completed.
 void kill(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action)
          Kill an action.
 void start(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action)
          Start an action.
protected  void validateAndMail(ActionExecutor.Context context, org.jdom.Element element)
           
 
Methods inherited from class org.apache.oozie.action.ActionExecutor
convertException, disableInit, enableInit, getActionDir, getActionDirPath, getActionSignal, getMaxRetries, getOozieConf, getOozieRuntimeDir, getOozieSystemId, getRetryInterval, getType, registerError, resetInitInfo, setMaxRetries, setRetryInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONF_PREFIX

public static final String CONF_PREFIX
See Also:
Constant Field Values

EMAIL_SMTP_HOST

public static final String EMAIL_SMTP_HOST
See Also:
Constant Field Values

EMAIL_SMTP_PORT

public static final String EMAIL_SMTP_PORT
See Also:
Constant Field Values

EMAIL_SMTP_AUTH

public static final String EMAIL_SMTP_AUTH
See Also:
Constant Field Values

EMAIL_SMTP_USER

public static final String EMAIL_SMTP_USER
See Also:
Constant Field Values

EMAIL_SMTP_PASS

public static final String EMAIL_SMTP_PASS
See Also:
Constant Field Values

EMAIL_SMTP_FROM

public static final String EMAIL_SMTP_FROM
See Also:
Constant Field Values
Constructor Detail

EmailActionExecutor

public EmailActionExecutor()
Method Detail

initActionType

public void initActionType()
Description copied from class: ActionExecutor
Invoked once at system initialization time.

It can be used to register error information for the expected exceptions. Exceptions should be register from subclasses to superclasses to ensure proper detection, same thing that it is done in a normal catch.

This method should invoke the ActionExecutor.registerError(java.lang.String, org.apache.oozie.action.ActionExecutorException.ErrorType, java.lang.String) method to register all its possible errors.

Subclasses overriding must invoke super.

Overrides:
initActionType in class ActionExecutor

start

public void start(ActionExecutor.Context context,
                  org.apache.oozie.client.WorkflowAction action)
           throws ActionExecutorException
Description copied from class: ActionExecutor
Start an action.

The ActionExecutor.Context.setStartData(java.lang.String, java.lang.String, java.lang.String) method must be called within this method.

If the action has completed, the ActionExecutor.Context.setExecutionData(java.lang.String, java.util.Properties) method must be called within this method.

Specified by:
start in class ActionExecutor
Parameters:
context - executor context.
action - the action to start.
Throws:
ActionExecutorException - thrown if the action could not start.

validateAndMail

protected void validateAndMail(ActionExecutor.Context context,
                               org.jdom.Element element)
                        throws ActionExecutorException
Throws:
ActionExecutorException

email

protected void email(ActionExecutor.Context context,
                     String[] to,
                     String[] cc,
                     String subject,
                     String body)
              throws ActionExecutorException
Throws:
ActionExecutorException

end

public void end(ActionExecutor.Context context,
                org.apache.oozie.client.WorkflowAction action)
         throws ActionExecutorException
Description copied from class: ActionExecutor
End an action after it has executed.

The ActionExecutor.Context.setEndData(org.apache.oozie.client.WorkflowAction.Status, java.lang.String) method must be called within this method.

Specified by:
end in class ActionExecutor
Parameters:
context - executor context.
action - the action to end.
Throws:
ActionExecutorException - thrown if the action could not end.

check

public void check(ActionExecutor.Context context,
                  org.apache.oozie.client.WorkflowAction action)
           throws ActionExecutorException
Description copied from class: ActionExecutor
Check if an action has completed. This method must be implemented by Async Action Executors.

If the action has completed, the ActionExecutor.Context.setExecutionData(java.lang.String, java.util.Properties) method must be called within this method.

If the action has not completed, the ActionExecutor.Context.setExternalStatus(java.lang.String) method must be called within this method.

Specified by:
check in class ActionExecutor
Parameters:
context - executor context.
action - the action to end.
Throws:
ActionExecutorException - thrown if the action could not be checked.

kill

public void kill(ActionExecutor.Context context,
                 org.apache.oozie.client.WorkflowAction action)
          throws ActionExecutorException
Description copied from class: ActionExecutor
Kill an action.

The ActionExecutor.Context.setEndData(org.apache.oozie.client.WorkflowAction.Status, java.lang.String) method must be called within this method.

Specified by:
kill in class ActionExecutor
Parameters:
context - executor context.
action - the action to kill.
Throws:
ActionExecutorException - thrown if the action could not be killed.

isCompleted

public boolean isCompleted(String externalStatus)
Description copied from class: ActionExecutor
Return if the external status indicates that the action has completed.

Specified by:
isCompleted in class ActionExecutor
Parameters:
externalStatus - external status to check.
Returns:
if the external status indicates that the action has completed.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.