Class ExceptionEmailer

    • Field Detail

      • enableSSL

        public Parameter enableSSL
        Enable the Secure Sockets Layer (SSL) protocol.
      • passwordFile

        public FileParameter passwordFile
        The file that the password is stored in.
      • reallySendMail

        public Parameter reallySendMail
        If true, then actually send the email. This is a boolean that defaults to false, meaning that the message is only sent to the output port. This parameter will be set back to false in the wrapup() method, to help prevent duplicate mailings.
      • replyTo

        public StringParameter replyTo
        The address to which replies should be directed. This is a comma-separated list that defaults to an empty string, which indicates that the reply should go to the address specified by from.
      • SMTPHostName

        public StringParameter SMTPHostName
        Host name for the send mail server.
      • SMTPUserName

        public StringParameter SMTPUserName
        User name for the send mail server.
      • statusMessage

        public StringParameter statusMessage
        A status message reflecting the success or failure of actions taken upon occurrence of an exception. Implemented as a public parameter so the message can be displayed in the icon.
      • to

        public StringParameter to
        Email address(es) to which this is sent. This is a comma-separated list that defaults to "nobody1@nowhere.com, nobody2@nowhere.com".
    • Constructor Detail

      • ExceptionEmailer

        public ExceptionEmailer​(NamedObj container,
                                java.lang.String name)
                         throws IllegalActionException,
                                NameDuplicationException
        Invoked by an exception handler (e.g. CatchExceptionAttribute) when an exception occurs. Some subscribers may need to set up access to resources (such as opening a file) prior to being notified of an exception. These could extend AbstractInitalizableAttribute to do so.

        This attribute requires the JavaMail 1.5 javax.mail.jar file be in the classpath.

        To use this actor, download javax.mail.jar https://java.net/projects/javamail/pages/Home and place it in $PTII/vendors/misc/javamail. Below are the steps:

            cd $PTII/vendors/misc/javamail
             wget --no-check-certificate http://java.net/projects/javamail/downloads/download/javax.mail.jar
             cd $PTII
             ./configure
          

        In Eclipse, you will then need to refresh the project.

        *
        Parameters:
        container - The container.
        name - The name.
        Throws:
        IllegalActionException - If the superclass throws it.
        NameDuplicationException - If the superclass throws it.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        React to a change in an attribute. This method is called by a contained attribute when its value changes. In this class, if the SMTP host or user name is changed, this method forgets the password.
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the change is not acceptable to this container (not thrown in this base class).
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace.
        Overrides:
        clone in class AbstractInitializableAttribute
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        Object.clone()
      • exceptionHandled

        public boolean exceptionHandled​(boolean succesful,
                                        java.lang.String message)
        Description copied from interface: ExceptionSubscriber
        Invoked by an exception handler (e.g. ExceptionManager) after an exception has been handled.
        Specified by:
        exceptionHandled in interface ExceptionSubscriber
        Parameters:
        succesful - True if the exception was successfully handled; false otherwise
        message - A status message from the exception handler
        Returns:
        True if the subscriber successfully processed the information; false otherwise (for example, an ExceptionEmailer that fails to send an email)
      • exceptionOccurred

        public boolean exceptionOccurred​(java.lang.String policy,
                                         java.lang.Throwable exception)
        Send a mail upon occurrence of an exception.
        Specified by:
        exceptionOccurred in interface ExceptionSubscriber
        Parameters:
        policy - The exception handling policy
        exception - The exception that occurred
        Returns:
        True if email was sent successfully (or if notification message was successfully generated if reallySendMail is false), false otherwise