***  This class provides Binary Compatibility only, not Source Compatibility  ***

com.sas.services.publish.alerts
Class AlertUtil

com.sas.services.publish.alerts.AlertUtil

public class AlertUtil

Utility class used for sending alert notifications. The incoming XML should have the following form:

  <Notifications> optional
    <Notification type="mail text/plain | mail text/html | portlet">
      <To>
        <EmailAddress></EmailAddress>
        <Bcc></Bcc>
        <SMTPHost></SMTPHost>
        <SMTPPort></SMTPPort>
        <SMTPSubject charset="charset"></SMTPSubject>
        <SMTPFrom name="personal-name" charset="charset&guot;></SMTPFrom>
        <SMTPReplyTo name="personal-name" charset="charset&guot;></SMTPReplyTo>
        <SMTPUser></SMTPUser>
        <SMTPPassword></SMTPPassword>
        <SMTPDomain></SMTPDomain>
        <Userid domain="authentication domain"></Userid>
        <Attachments>    
          <Attachment type="dav|file|url" path="file-path"
                      name="filename-to-use-in-email"
                      domain="authentication domain"/>
          <Attachment type="file|url" path="file-path" 
                      name="filename-to-use-in-email"
                      domain="authentication domain" 
                      contentType="user-specified-MIME-type"/>
          <Attachment type="file|url" 
                      path="file-path"
                      name="filename-to-use-in-email"
                      domain="authentication domain" 
                      cid="content-ID"/>
          <Attachment type="file|url" 
                      path="file-path" 
                      name="filename-to-use-in-email" 
                      domain="authentication domain" 
                      cid="content-ID"
                      contentType="user-specified-MIME-type"/>
      </Attachments>
      </To>
      <Template name="name-of-template">
        <Dir type="dav|file|url" path="path-to-file" 
                domain="authentication domain"/>
        <MergeVariables>
          <Variable name="name-of-substitution-variable"></Variable>
          ...
          <Variable name="name-of-substitution-variable"></Variable>
        </MergeVariables>
      </Template>
    </Notification>
   </Notifications>
 

Explanations of the elements are in the following table:

Element Description
Notifications This is an optional element but should be used to indicate multiple notifications within this XML specification.
Notification Indicates the start of the alert notification information. One or more notification elements may be specified. Supported attributes include:
  • type - the type of notification to send. Supported types include "mail text/html", "mail text/plain" or "portlet". The "portlet" type indicates that the alert notification should be sent to the user's personal repository in WebDAV.
To Begins the transport specific information that will identify where to send the notification.
EmailAddress Defines the email recipient of the notification. This element is only used by mail notifications. Multiple email addresses, separated by commas, may be specified.
Bcc Defines the blind carbon copy recipient of the notification. This element is only used by mail notifications.
SMTPHost Defines the SMTP server to connect to. This element is only used by mail notifications.
SMTPPort Defines the port of the SMTP server. This element is only used by mail notifications.
SMTPSubject Defines the subject of the email message. This element is only used by mail notifications. Supported (optional) attributes include:
  • charset - if the subject contains non US-ASCII characters, it will be encoded using the specified charset. If this charset attribute is not specified and the subject contains non US-ASCII characters, the UTF-8 encoding will be used. If the subject contains only US-ASCII characters, no encoding is done and it is used as is.
SMTPFrom Defines the FROM field of the email message. This element is only used by mail notifications. Supported (optional) attributes include:
  • name - the personal name for this email address
  • charset - if the personal name contains non US-ASCII characters, then the name will be encoded using the specified charset. If this charset attribute is not specified and the personal name contains non US-ASCII characters, the UTF-8 encoding will be used. If the name contains only US-ASCII characters, no encoding is done and the name is used as is.
SMTPReplyTo Defines the ReplyTo field of the email message. This element is only used by mail notifications. Supported (optional) attributes include:
  • name - the personal name for this email address
  • charset - if the personal name contains non US-ASCII characters, then the name will be encoded using the specified charset. If this charset attribute is not specified and the personal name contains non US-ASCII characters, the UTF-8 encoding will be used. If the name contains only US-ASCII characters, no encoding is done and the name is used as is.
SMTPUser Defines the username to use when binding to the SMTP server. This element is only used by mail notifications.
SMTPPassword Defines the password to use when binding to the SMTP server. This element is only used by mail notifications.
SMTPDomain Defines the authentication domain to use when binding to the SMTP server. This element is only used by mail notifications. If the SMTPUser and SMTPPassword elements are specified, they will be used when binding to the SMTP server. If they are NOT specified, this authentication domain will be used to determine the credentials when binding to the SMTP server.
Userid The WebDAV userid. This element is only used by portlet notifications. Portlet notifications will be sent to the personal repository (inbox) of the specified userid. Format should be userid, domain\\userid or user@domain. Supported attributes include:
  • domain - Identifies the authentication domain. When delivering the notification to the personal repository of the user, the authentication domain will be used to determine what credentials to use when binding to the WebDAV server.
Attachments Begins the attachment definition. This is an optional element that is only used by mail notifications. This should only be specified if there are attachments to be included in the message.
Attachment Indicates attachments to include with the mail message. Supported attributes include:
  • type - the path type. Supported types include "dav, url or file".
  • path - The physical file path or URL that defines the attachment file.
  • name - An optional attribute that identifies the filename to use for this attachment when it is included in the mail message. By default, the attachment's name will be the name of the physical file as specified on the path attribute. This name attribute can be specified to override this behavior. It allows the caller to have control of the attachment name when it inserted into the mail message.
  • domain - Identifies the authentication domain for the WebDAV server. This attribute is only recognized when the attachment is stored on a WebDAV server (type=dav); otherwise it will be ignored. If the attachment file is stored on a WebDAV server, the authentication domain will be used to determine what credentials to use when binding to the server.
  • cid - An optional attribute that identifies the content-id to use for this attachment. If the cid attribute is not specified, then the file will just be attached to the mail message (not embedded). Otherwise, if the cid attribute is provided, then the specified file will be embedded in the mail message. The value of the cid attribute will be used to set the value of the Content-ID header for the mail message. The caller is responsible for making sure the text of the mail message contains the corresponding cid URL to reference this cid value.
  • contentType - An optional attribute that represents the MIME type for this attachment. If not specified, the MIME type will determined based on the extension of the attachment file. Only specify this attribute if you want to override this default behavior.
Template Begins the template definition. The template is a file that enables a site to customize the contents of an alert notification. The templates can contain variables that will be substituted with the corresponding merge variable values. View com.sas.services.publish.alerts.TemplateInterface for more general information on how the template is used. Supported attributes include:
  • name - the name of the template file
Dir Defines how to access the template file. Supported attributes include:
  • type - the path type. Supported types include "dav, url or file".
  • path - The physical file path or URL that defines the template file.
  • domain - Identifies the authentication domain for the WebDAV server. This attribute is only recognized when the template is stored on a WebDAV server (type=dav); otherwise it will be ignored. If the template is stored on a WebDAV server, the authentication domain will be used to determine what credentials to use when binding to the server.
MergeVariables Defines the start of the merge variable definitions. The specified template can contain variables that will be substituted with the corresponding merge variable values.
Variable Defines a merge variable for this template. Supported attributes include:
  • name - The name of the merge variable.
  • path - The value to be substituted for this merge variable.


Constructor Summary
AlertUtil()
           
 
Method Summary
static void notify(org.w3c.dom.Document doc, LoggerInterface logger)
          Deprecated. The Logging Service has been deprecated. Use sendNotification(Document doc, SessionContextInterface sessionContext, MailServiceInterface mailService)
static void notify(org.w3c.dom.Document doc, LoggerInterface logger, SessionContextInterface sessionContext)
          Deprecated. The Logging Service has been deprecated. Use sendNotification(Document doc, SessionContextInterface sessionContext, MailServiceInterface mailService)
static void notify(org.w3c.dom.Document doc, LoggerInterface logger, SessionContextInterface sessionContext, com.sas.svcs.mail.client.MailServiceInterface mailService)
          Deprecated. The Logging Service has been deprecated. Use sendNotification(Document doc, SessionContextInterface sessionContext, MailServiceInterface mailService)
static void sendNotification(org.w3c.dom.Document doc, SessionContextInterface sessionContext, com.sas.svcs.mail.client.MailServiceInterface mailService)
          Parses the notification XML and sends the alert notifications to the specified destinations via the WIP's Mail Service.
 

Constructor Detail

AlertUtil

public AlertUtil()
Method Detail

notify

public static void notify(org.w3c.dom.Document doc,
                          LoggerInterface logger)
                   throws ServiceException
Deprecated. The Logging Service has been deprecated. Use sendNotification(Document doc, SessionContextInterface sessionContext, MailServiceInterface mailService)

Parses the notification XML and sends the alert notifications to the specified destinations.

Parameters:
doc - the alert notification event
logger - the logger to use for logging alert notification activity
Throws:
ServiceException - if an error occurs processing the alert notification.

notify

public static void notify(org.w3c.dom.Document doc,
                          LoggerInterface logger,
                          SessionContextInterface sessionContext)
                   throws ServiceException
Deprecated. The Logging Service has been deprecated. Use sendNotification(Document doc, SessionContextInterface sessionContext, MailServiceInterface mailService)

Parses the notification XML and sends the alert notifications to the specified destinations.

Parameters:
doc - the alert notification event
logger - the logger to use for logging alert notification activity
sessionContext - the session context. The user context (bound to the session context) is used to determine credentials when binding to various servers.
Throws:
ServiceException - if an error occurs processing the alert notification.

notify

public static void notify(org.w3c.dom.Document doc,
                          LoggerInterface logger,
                          SessionContextInterface sessionContext,
                          com.sas.svcs.mail.client.MailServiceInterface mailService)
                   throws ServiceException,
                          java.lang.IllegalArgumentException
Deprecated. The Logging Service has been deprecated. Use sendNotification(Document doc, SessionContextInterface sessionContext, MailServiceInterface mailService)

Parses the notification XML and sends the alert notifications to the specified destinations via the WIP's Mail Service.

Parameters:
doc - the alert notification event
logger - the logger to use for logging alert notification activity
sessionContext - the session context. The user context (bound to the session context) is used to determine credentials when binding to various servers.
mailService - the WIP Mail Service
Throws:
ServiceException - if an error occurs processing the alert notification.
java.lang.IllegalArgumentException - if mailService is null

sendNotification

public static void sendNotification(org.w3c.dom.Document doc,
                                    SessionContextInterface sessionContext,
                                    com.sas.svcs.mail.client.MailServiceInterface mailService)
                             throws ServiceException,
                                    java.lang.IllegalArgumentException
Parses the notification XML and sends the alert notifications to the specified destinations via the WIP's Mail Service.

Parameters:
doc - the alert notification event
sessionContext - the session context. The user context (bound to the session context) is used to determine credentials when binding to various servers.
mailService - the WIP Mail Service
Throws:
ServiceException - if an error occurs processing the alert notification.
java.lang.IllegalArgumentException - if mailService is null

***  This class provides Binary Compatibility only, not Source Compatibility  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.