SAP NetWeaver '04

Package com.sapportals.wcm.util.channels

Contains interfaces and classes for sending messages to recipients.

See:
          Description

Interface Summary
IChannel A channel is the abstraction of an transport mechanism for sending messages to recipients.
IChannelList A list of IChannel s.
IChannelListIterator Iterator for a IChannelList .
IRecipient Recipients are objects, where messages can be sent to via a channel.
IRecipientList A list of IRecipient s.
IRecipientListIterator Iterator for a IRecipientList .
 

Class Summary
AbstractChannel Base class for IChannel -implementations.
ChannelFactory A factory to retrieve IChannel s.
RecipientFactory A factory to retrieve IRecipient s.
 

Exception Summary
PartialSendException The PartialSendException indicates, that some recipients couldn't be addressed.
 

Package com.sapportals.wcm.util.channels Description

Contains interfaces and classes for sending messages to recipients.

Package Specification

Purpose

IChannels are mechanisms, via which messages are sent from a sender to a receiver. IChannels can be obtained through the ChannelFactory.
IRecipients are single persons or distribution lists with addresses for the several IChannels. The format of these addresses are specific to the different channels. IRecipients can be obtained through the RecipientFactory.

Installation

Each channel must be configured in order to be accessible through the ChannelFactory with the following parameter:

PropertyRequiredDescription
classyes The class that is used for the specified channel, like com.sapportals.wcm.util.channels.wcm.EmailChannel for EMAIL.

The different channel implementations require additional parameters.

The follwing parameters are valid  for an EmailChannel:

PropertyRequiredDescription
serveryes The mail server that is used to send eMail notifications to.
userno The user used to log into the server. Default: no user.
passwordno The password of the user. Default: no password
typeno Specifies, which email protocol is used, either SMTP or IMAP. Default: SMTP.

The follwing parameters are valid  for an SmsChannel:

PropertyRequiredDescription
serveryes The mail server that is used to send the SMS-eMail and which passes the eMail to the SMS-Gateway.
userno The user used to log into the server, default: no user.
passwordno The password of the user, default: no password
gatewayno The eMail address of the SMS gateway (see field). Default: (empty String)
prefixno SmsChannel: A prefix to use for the eMail address or eMail subject (see field). Default: (empty String) 
fieldno SmsChannel: Defines the way, the eMail for the eMail-SMS-gateway is build. If 'to' is specified, the eMail-to-field will be constructed from prefix, actual address and gateway. If 'subject' is specified, the eMail-to-field will be constructed from gateway, the eMail-subject-field will be constructed from prefix and actual address.
Example: if prefix is set to 'Number=', gateway is set to 'sms@smtp.server' and the actual address for the person to send the SMS to is set to '++49123456789' the result would be:
For subject:
    to = sms@smtp.server
    subject = Number=++49123456789
For to:
    to = Number=++49123456789sms@smtp.server
    subject = 
Default: subject.
formatno Define the message MIME format (overwrite format from XSL). Default: (MIME format from XSL, usualy text/plain)

The following is a sample configuration for an EmailChannel:

class = com.sapportals.wcm.util.channels.wcm.EmailChannel
server = mailserver.sap.com
user = user
passwd = passwd
type = SMTP

The following is a sample configuration for an EmailChannel:

class = com.sapportals.wcm.util.channels.wcm.SmsChannel
server = mailserver.sap.com
gateway = sms@sap.com
user = user
passwd = passwd
prefix = number=
field = subject
format = text/plain

 

Implementation notes

Sending MimeMessages or text via IChannels to IRecipients.

To send a plain text (for example hello world) from the user myself to the recipient someone via his/her perferred channel, the following code shows how to do that:

IRecipient myself = RecipientFactory.getInstance().getRecipient("myself");
IRecipient someone = RecipientFactory.getInstance().getRecipient("someone");
IChannel channel = recipient.getDefaultChannel();
recipient.sendTo(channel, channel.getRecipientAddress(myself), "messagetitle", "hello world", "text/plain");
To retrieve an eMail channel, the code could look like this:
IChannel channel = ChannelFactory.getInstance().getFirstChannelForType(ChannelFactory.EMAIL);
If the addresses are already known in the channel's format, no recipient objects are needed:
channel.sendTo("recipient.someone@somewhere", "sender.myself@sap", "messagetitle", "hello world", "text/plain");

Issues

Related Documentation


SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.