Package adams.flow.sink
Class SendEmail
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,MultiAttemptSupporter,MultiAttemptWithWaitSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,VariableChangeListener,Actor,ErrorHandler,InputConsumer,Serializable,Comparable
public class SendEmail extends AbstractSink implements MultiAttemptWithWaitSupporter
Actor for sending emails.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-name <java.lang.String> (property: name) The name of the actor. default: SendEmail
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false min-user-mode: Expert
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false min-user-mode: Expert
-send-email <adams.core.net.SendEmail> (property: sendEmail) The engine for sending the emails. default: adams.core.net.JavaMailSendEmail
-num-attempts <int> (property: numAttempts) The maximum number of initialization attempts to undertake. default: 3 minimum: 1
-attempt-interval <int> (property: attemptInterval) The time in msec to wait before the next attempt. default: 1000 minimum: 0
-queue <boolean> (property: queue) Whether to queue the emails rather than waiting for them to be sent. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_AttemptIntervalthe interval between attempts.protected intm_NumAttemptsthe maximum number of initialization attempts.protected booleanm_Queuewhether to queue the emails rather than waiting for sending to finish.protected SendEmailm_SendEmailfor sending the emails.protected List<SwingWorker>m_Sendingthe emails still to send.-
Fields inherited from class adams.flow.sink.AbstractSink
BACKUP_INPUT, m_InputToken
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description SendEmail()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the class that the consumer accepts.StringattemptIntervalTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.intgetAttemptInterval()Returns the time to wait between attempts in msec.intgetNumAttempts()Returns the maximum number of initialization attempts.booleangetQueue()Returns whether the emails are queue rather than being waited on.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.SendEmailgetSendEmail()Returns the object for sending emails.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected voidinitSession()Initializes the SMTP session if required.StringnumAttemptsTipText()Returns the tip text for this property.StringqueueTipText()Returns the tip text for this property.StringsendEmailTipText()Returns the tip text for this property.voidsetAttemptInterval(int value)Sets the time to wait between attempts in msec.voidsetNumAttempts(int value)Sets the maximum number of initialization attempts.voidsetQueue(boolean value)Sets whether to queue the emails rather than waiting for each to be sent.voidsetSendEmail(SendEmail value)Sets the object for sending emails.StringsetUp()Initializes the item for flow execution.voidstopExecution()Stops the execution.voidwrapUp()Cleans up after the execution has finished.-
Methods inherited from class adams.flow.sink.AbstractSink
backupState, currentInput, hasInput, input, postExecute, restoreState
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, pruneBackup, reset, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_SendEmail
protected SendEmail m_SendEmail
for sending the emails.
-
m_NumAttempts
protected int m_NumAttempts
the maximum number of initialization attempts.
-
m_AttemptInterval
protected int m_AttemptInterval
the interval between attempts.
-
m_Queue
protected boolean m_Queue
whether to queue the emails rather than waiting for sending to finish.
-
m_Sending
protected List<SwingWorker> m_Sending
the emails still to send.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractActor- Returns:
- null if no info available, otherwise short string
-
setSendEmail
public void setSendEmail(SendEmail value)
Sets the object for sending emails.- Parameters:
value- the object
-
getSendEmail
public SendEmail getSendEmail()
Returns the object for sending emails.- Returns:
- the object
-
sendEmailTipText
public String sendEmailTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumAttempts
public void setNumAttempts(int value)
Sets the maximum number of initialization attempts.- Specified by:
setNumAttemptsin interfaceMultiAttemptSupporter- Parameters:
value- the maximum
-
getNumAttempts
public int getNumAttempts()
Returns the maximum number of initialization attempts.- Specified by:
getNumAttemptsin interfaceMultiAttemptSupporter- Returns:
- the maximum
-
numAttemptsTipText
public String numAttemptsTipText()
Returns the tip text for this property.- Specified by:
numAttemptsTipTextin interfaceMultiAttemptSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAttemptInterval
public void setAttemptInterval(int value)
Sets the time to wait between attempts in msec.- Specified by:
setAttemptIntervalin interfaceMultiAttemptWithWaitSupporter- Parameters:
value- the time in msec
-
getAttemptInterval
public int getAttemptInterval()
Returns the time to wait between attempts in msec.- Specified by:
getAttemptIntervalin interfaceMultiAttemptWithWaitSupporter- Returns:
- the time in msec
-
attemptIntervalTipText
public String attemptIntervalTipText()
Returns the tip text for this property.- Specified by:
attemptIntervalTipTextin interfaceMultiAttemptWithWaitSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setQueue
public void setQueue(boolean value)
Sets whether to queue the emails rather than waiting for each to be sent.- Parameters:
value- true if to queue
-
getQueue
public boolean getQueue()
Returns whether the emails are queue rather than being waited on.- Returns:
- true if to queue
-
queueTipText
public String queueTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
acceptsin interfaceInputConsumer- Returns:
- adams.core.net.Email.class
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUpin interfaceActor- Overrides:
setUpin classAbstractActor- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
initSession
protected void initSession() throws ExceptionInitializes the SMTP session if required.- Throws:
Exception- if initialization fails
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractSink
-
-