Class AbstractNetUtilities

  • Direct Known Subclasses:
    ClientNetUtilities

    public abstract class AbstractNetUtilities
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected abstract void _sendEmail​(java.lang.String smtpSettingsName, java.lang.String from, java.lang.String subject, java.lang.String body, boolean html, java.lang.String[] recipients, java.lang.String[] ccRecipients, java.lang.String[] bccRecipients, java.lang.String[] attachNamesArg, byte[][] attachBytesArg, int timeout, int retries, java.lang.String priority, java.lang.String[] replyTo)
      Sends an email with or without authorization and attachments, depending an what arguments are null.
      protected abstract void _sendEmail​(java.lang.String smtp, java.lang.String from, java.lang.String subject, java.lang.String body, boolean html, java.lang.String[] recips, java.lang.String username, java.lang.String password, java.lang.String priority, java.lang.String[] attachNamesArg, byte[][] attachBytesArg, int timeout, java.lang.String[] replyTo)
      Deprecated.
      protected java.lang.String generateEmailContentType​(boolean isHtml)
      Generates the email Content-Type header with character encoding.
      static java.lang.String getHostName()  
      static java.lang.String getIpAddress()  
      protected abstract java.util.List<java.lang.String> getRemoteServers​(java.lang.Boolean getRunningOnly)
      Returns a list of Gateway Network servers that are visible on the local Gateway.
      java.util.List<java.lang.String> getRemoteServers​(org.python.core.PyObject[] values, java.lang.String[] keywords)  
      JythonHttpClient httpClient​(org.python.core.PyObject[] pyArgs, java.lang.String[] keywords)  
      static java.lang.String httpDelete​(org.python.core.PyObject[] pyArgs, java.lang.String[] keywords)  
      static java.lang.String httpGet​(org.python.core.PyObject[] pyArgs, java.lang.String[] keywords)  
      static java.lang.String httpPost​(java.lang.String url, org.python.core.PyDictionary params)  
      static java.lang.String httpPost​(org.python.core.PyObject[] pyArgs, java.lang.String[] keywords)  
      static java.lang.String httpPut​(java.lang.String url, org.python.core.PyDictionary params)  
      static java.lang.String httpPut​(org.python.core.PyObject[] pyArgs, java.lang.String[] keywords)  
      void sendAuthEmail​(java.lang.String smtp, java.lang.String from, java.lang.String subject, java.lang.String body, boolean html, java.lang.String[] recips, java.lang.String username, java.lang.String password)  
      void sendAuthEmail​(java.lang.String smtp, java.lang.String from, java.lang.String subject, java.lang.String body, boolean html, java.lang.String[] recips, java.lang.String username, java.lang.String password, java.lang.String[] attachNamesArg, byte[][] attachBytesArg)  
      void sendAuthEmail​(java.lang.String smtp, java.lang.String from, java.lang.String subject, java.lang.String body, boolean html, java.lang.String[] recips, java.lang.String username, java.lang.String password, java.lang.String[] attachNamesArg, byte[][] attachBytesArg, int timeout)  
      void sendEmail​(org.python.core.PyObject[] pyArgs, java.lang.String[] keywords)
      smtpProfile added in ver 7.8.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractNetUtilities

        protected AbstractNetUtilities​(CommonContext commonContext)
    • Method Detail

      • sendAuthEmail

        public void sendAuthEmail​(java.lang.String smtp,
                                  java.lang.String from,
                                  java.lang.String subject,
                                  java.lang.String body,
                                  boolean html,
                                  java.lang.String[] recips,
                                  java.lang.String username,
                                  java.lang.String password)
      • sendAuthEmail

        public void sendAuthEmail​(java.lang.String smtp,
                                  java.lang.String from,
                                  java.lang.String subject,
                                  java.lang.String body,
                                  boolean html,
                                  java.lang.String[] recips,
                                  java.lang.String username,
                                  java.lang.String password,
                                  java.lang.String[] attachNamesArg,
                                  byte[][] attachBytesArg)
      • sendAuthEmail

        public void sendAuthEmail​(java.lang.String smtp,
                                  java.lang.String from,
                                  java.lang.String subject,
                                  java.lang.String body,
                                  boolean html,
                                  java.lang.String[] recips,
                                  java.lang.String username,
                                  java.lang.String password,
                                  java.lang.String[] attachNamesArg,
                                  byte[][] attachBytesArg,
                                  int timeout)
      • sendEmail

        public void sendEmail​(org.python.core.PyObject[] pyArgs,
                              java.lang.String[] keywords)
        smtpProfile added in ver 7.8. If the user passes in a smtpProfile name then smtp, timeout, username and password will be ignored, even if they are passed in. Those keywords are only retained for backwards compatibility with existing scripts.

        Also added in 7.8.0 is cc and bcc

      • _sendEmail

        @Deprecated
        protected abstract void _sendEmail​(java.lang.String smtp,
                                           java.lang.String from,
                                           java.lang.String subject,
                                           java.lang.String body,
                                           boolean html,
                                           java.lang.String[] recips,
                                           java.lang.String username,
                                           java.lang.String password,
                                           java.lang.String priority,
                                           java.lang.String[] attachNamesArg,
                                           byte[][] attachBytesArg,
                                           int timeout,
                                           java.lang.String[] replyTo)
        Deprecated.
        Sends an email with or without authorization and attachments, depending an what arguments are null. This method is retained for backwards compatibility
        Parameters:
        smtp - Address of the mail server, for example, mail.mycompany.com
        from - An email address to use as the email's from address. Also the return address.
        subject - The subject of the email.
        body - The body of the email.
        html - A boolean (0/1) indicating whether or not the body is HTML formatted.
        recips - A python sequence of recipient email addresses.
        replyTo - A python sequence of reply-to email addresses.
      • _sendEmail

        protected abstract void _sendEmail​(java.lang.String smtpSettingsName,
                                           java.lang.String from,
                                           java.lang.String subject,
                                           java.lang.String body,
                                           boolean html,
                                           java.lang.String[] recipients,
                                           java.lang.String[] ccRecipients,
                                           java.lang.String[] bccRecipients,
                                           java.lang.String[] attachNamesArg,
                                           byte[][] attachBytesArg,
                                           int timeout,
                                           int retries,
                                           java.lang.String priority,
                                           java.lang.String[] replyTo)
        Sends an email with or without authorization and attachments, depending an what arguments are null.
        Parameters:
        smtpSettingsName - Name of an existing smtpSettings record to use
        from - An email address to use as the email's from address. Also the return address.
        subject - The subject of the email.
        body - The body of the email.
        html - A boolean (0/1) indicating whether or not the body is HTML formatted.
        recipients - A python sequence of recipient email addresses.
        attachNamesArg - List of attachment names
        attachBytesArg - List of attachment data, must be the same length as the names
        replyTo - A python sequence of reply-to email addresses.
        Since:
        7.8.0
      • getIpAddress

        public static java.lang.String getIpAddress()
      • getHostName

        public static java.lang.String getHostName()
      • httpGet

        public static java.lang.String httpGet​(org.python.core.PyObject[] pyArgs,
                                               java.lang.String[] keywords)
      • httpPost

        public static java.lang.String httpPost​(java.lang.String url,
                                                org.python.core.PyDictionary params)
      • httpPost

        public static java.lang.String httpPost​(org.python.core.PyObject[] pyArgs,
                                                java.lang.String[] keywords)
      • httpPut

        public static java.lang.String httpPut​(java.lang.String url,
                                               org.python.core.PyDictionary params)
      • httpPut

        public static java.lang.String httpPut​(org.python.core.PyObject[] pyArgs,
                                               java.lang.String[] keywords)
      • httpDelete

        public static java.lang.String httpDelete​(org.python.core.PyObject[] pyArgs,
                                                  java.lang.String[] keywords)
      • httpClient

        public JythonHttpClient httpClient​(org.python.core.PyObject[] pyArgs,
                                           java.lang.String[] keywords)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getRemoteServers

        public java.util.List<java.lang.String> getRemoteServers​(org.python.core.PyObject[] values,
                                                                 java.lang.String[] keywords)
                                                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getRemoteServers

        protected abstract java.util.List<java.lang.String> getRemoteServers​(java.lang.Boolean getRunningOnly)
                                                                      throws java.lang.Exception
        Returns a list of Gateway Network servers that are visible on the local Gateway.
        Parameters:
        getRunningOnly - set to true to indicate that only currently reachable servers should be returned
        Returns:
        a List of Strings representing ServerIds
        Throws:
        java.lang.Exception
      • generateEmailContentType

        protected java.lang.String generateEmailContentType​(boolean isHtml)
        Generates the email Content-Type header with character encoding. Tries UTF-8 but if the system does not support this encoding then it falls back to the system default encoding using Charset.defaultCharset()
        Parameters:
        isHtml - Flag which indicates if this email content is HTML (set) or Plain Text (unset).
        Returns:
        The email Content-Type header including the character encoding.