Oracle Fusion Middleware User Messaging Service 11.1.1.7.0 Java API Reference
E14011-05

oracle.sdp.messaging
Class MessagingFactory

java.lang.Object
  extended by oracle.sdp.messaging.MessagingFactory

public class MessagingFactory
extends java.lang.Object

MessagingFactory is a factory class to create various messaging objects. The methods in this class can be used to create Messages, Addresses, AccessPoints, MessageFilters, and MessageQueries.

Since:
11.1.1.3.0

Constructor Summary
MessagingFactory()
           
 
Method Summary
static Address buildAddress(java.lang.String deviceAddress, DeliveryType deliveryType, java.lang.String emailMode)
          Build a Address object.
static Address buildAddress(java.lang.String deviceAddress, java.lang.String deliveryType, java.lang.String emailMode)
          Build a Address object.
static AccessPoint createAccessPoint(AccessPoint.AccessPointType apType, DeliveryType deliveryType, java.lang.String value)
          Create a new access point.
static AccessPoint createAccessPoint(AccessPoint.AccessPointType apType, DeliveryType deliveryType, java.lang.String value, java.lang.String keyword)
          Create a new access point.
static AccessPoint createAccessPoint(Address address)
          Create a new access point from an Address object.
static AccessPoint createAccessPoint(Address address, java.lang.String keyword)
          Create a new access point from an Address object.
static Address createAddress(java.lang.String address)
          Create a new Address object from address.
static Address[] createAddress(java.lang.String[] addresses)
          Create a list of Address objects from addresses.
static MessageFilter createBlacklistFilter(java.lang.String pattern)
          Create a "blacklist" filter.
static Message createMessage()
          Create a new message.
static MessageFilter createMessageFilter(java.lang.String pattern, MessageFilter.FieldType field, java.lang.String fieldName, MessageFilter.Action action)
          Create a new MessageFilter.
static MessageInfo createMessageInfo()
          Create a MessageInfo object.
static MessageQuery createMessageQuery()
          Create a new MessagingQuery.
static Message createTextMessage(java.lang.String textContent)
          Create a text message with text/plain content type.
static Message createTextMessage(java.lang.String textContent, java.lang.String charset)
          Create a text message with text/plain content type and specified charset.
static MessageFilter createWhitelistFilter(java.lang.String pattern)
          Create a "whitelist" filter.
static List<java.lang.String> expandAccessPoint(AccessPoint accessPoint)
          Utility method to generate a list containing the expanded set of addresses from an access point.
static List<java.lang.String> expandAccessPoint(AccessPoint accessPoint, boolean withKeyword)
          Utility method to generate a list containing the expanded set of addresses from an access point, either with our without keywords included.
static java.lang.String getRecipientType(Address address)
          Return the recipient type (To/Cc/Bcc) of an address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagingFactory

public MessagingFactory()
Method Detail

createAccessPoint

public static AccessPoint createAccessPoint(AccessPoint.AccessPointType apType,
                                            DeliveryType deliveryType,
                                            java.lang.String value)
Create a new access point.

Parameters:
apType - the access point type.
deliveryType - the access point address delivery type.
value - the access point address value.
Returns:
a new access point with the specified apType, deliveryType and value.

createAccessPoint

public static AccessPoint createAccessPoint(AccessPoint.AccessPointType apType,
                                            DeliveryType deliveryType,
                                            java.lang.String value,
                                            java.lang.String keyword)
Create a new access point.

Parameters:
apType - the access point type.
deliveryType - the access point address delivery type.
value - the access point address value.
keyword - the access point keyword value. If a keyword is specified, incoming messages will only match the access point if the first token of the message's subject (if present) or text/plain part (if present) matches the keyword.
Returns:
a new access point with the specified apType, deliveryType, value, and keyword.

createAccessPoint

public static AccessPoint createAccessPoint(Address address)
Create a new access point from an Address object.

Parameters:
address - an object of oracle.sdp.messaging.Address interface
Returns:
an AccessPoint of type SINGLE_ADDRESS built from the input address.

createAccessPoint

public static AccessPoint createAccessPoint(Address address,
                                            java.lang.String keyword)
Create a new access point from an Address object.

Parameters:
address - an object of oracle.sdp.messaging.Address interface
keyword - the access point keyword value. If a keyword is specified, incoming messages will only match the access point if the first token of the message's subject (if present) or text/plain part (if present) matches the keyword. * @return an AccessPoint of type SINGLE_ADDRESS built from the input address and keyword.

expandAccessPoint

public static List<java.lang.String> expandAccessPoint(AccessPoint accessPoint)
Utility method to generate a list containing the expanded set of addresses from an access point. If this is a single address access point, the address is returned. If this is a number range access point, then the range expression is expanded and all addresses within the range are returned. Equivalent to calling expandAccessPoint(accessPoint, true)

Parameters:
accessPoint - the access point to expand
Returns:
a list containing the expanded set of addresses from the access point.

expandAccessPoint

public static List<java.lang.String> expandAccessPoint(AccessPoint accessPoint,
                                                       boolean withKeyword)
Utility method to generate a list containing the expanded set of addresses from an access point, either with our without keywords included. If this is a single address access point, the address is returned. If this is a number range access point, then the range expression is expanded and all addresses within the range are returned.

Parameters:
accessPoint - the access point to expand
withKeyword - flag indicating whether the access point keyword should be included in the returned strings.
Returns:
a list containing the expanded set of addresses from the access point.

createAddress

public static Address createAddress(java.lang.String address)
Create a new Address object from address.

Parameters:
address - a well-formatted address in String form. The format must be of the form "deliveryType:address". For example: "Email:john.doe@oracle.com". Alternatively, to address users or groups, you may specify "User:username" or "Group:groupname". For example: "User:johndoe" or "Group:johndoe_team".
Failover addresses can be specified using a comma separator. For example: "SMS:1234,Email:john.doe@oracle.com" will construct an address object with the "SMS:1234" as the first address, and "Email:john.doe@oracle.com" as the failover address.
Returns:
the corresponding Address object.

createAddress

public static Address[] createAddress(java.lang.String[] addresses)
Create a list of Address objects from addresses.

Parameters:
addresses - a list of well-formatted addresses in String form.
Returns:
corresponding list of Address objects.

buildAddress

public static Address buildAddress(java.lang.String deviceAddress,
                                   java.lang.String deliveryType,
                                   java.lang.String emailMode)
Build a Address object.

Parameters:
deviceAddress - the device address
deliveryType - the delivery type
emailMode - the email mode of the address - available options are: null OR Address.EMAIL_MODE_TO, Address.EMAIL_MODE_CC, Address.EMAIL_MODE_BCC for Email delivery type.
Returns:
an Address object.

buildAddress

public static Address buildAddress(java.lang.String deviceAddress,
                                   DeliveryType deliveryType,
                                   java.lang.String emailMode)
Build a Address object.

Parameters:
deviceAddress - the device address
deliveryType - the delivery type
emailMode - the email mode of the address - available options are: null OR Address.EMAIL_MODE_TO, Address.EMAIL_MODE_CC, Address.EMAIL_MODE_BCC for Email delivery type.
Returns:
an Address object.

getRecipientType

public static java.lang.String getRecipientType(Address address)
Return the recipient type (To/Cc/Bcc) of an address. The result of this method is generally only meaningful for Email addresses. Other address types will return the default value of "To".

Parameters:
address -
Returns:
Either "To", "Cc", or "Bcc".

createMessage

public static Message createMessage()
Create a new message.

Returns:
a new message.

createTextMessage

public static Message createTextMessage(java.lang.String textContent)
                                 throws MessagingException
Create a text message with text/plain content type.

Parameters:
textContent - the plain text content to set in the message.
Returns:
a message created with the specified textContent set as the content and with text/plain set as the content type.
Throws:
MessagingException

createTextMessage

public static Message createTextMessage(java.lang.String textContent,
                                        java.lang.String charset)
                                 throws MessagingException
Create a text message with text/plain content type and specified charset.

Parameters:
textContent - the plain text content to set in the message.
charset - the charset name, such as UTF-8 or US-ASCII.
Returns:
a message created with the specified textContent set as the content and with text/plain; charset="charset" set as the content type.
Throws:
MessagingException

createMessageInfo

public static MessageInfo createMessageInfo()
Create a MessageInfo object.

Returns:
a MessageInfo object.

createMessageQuery

public static MessageQuery createMessageQuery()
Create a new MessagingQuery.

Returns:
a new MessageQuery object

createMessageFilter

public static MessageFilter createMessageFilter(java.lang.String pattern,
                                                MessageFilter.FieldType field,
                                                java.lang.String fieldName,
                                                MessageFilter.Action action)
Create a new MessageFilter.

Parameters:
pattern - The pattern to match the incoming message against. The pattern should be a Java Pattern. For example:
To match the substring "foo" anywhere within the specified field, the correct pattern is .*foo.*
To match a field starting with foo, the correct pattern is ^foo.*
field - The part of the message to match against.
fieldName - If "field" is HEADER or METADATA, this parameter determines which header or metadata entry to match against.
action - The action to take if the filter and message match. The action is taken immediately, so no further filters will be processed.

createBlacklistFilter

public static MessageFilter createBlacklistFilter(java.lang.String pattern)
Create a "blacklist" filter. Matches against an incoming message's sender address, and rejects the message if the sender matches the given pattern. As above, the pattern should be a Java Pattern.


createWhitelistFilter

public static MessageFilter createWhitelistFilter(java.lang.String pattern)
Create a "whitelist" filter. Matches against an incoming message's sender address, and accepts the message if the sender matches the given pattern.


Oracle Fusion Middleware User Messaging Service 11.1.1.7.0 Java API Reference
E14011-05

Copyright © 2009, 2013 Oracle and/or its affiliates. All rights reserved.