public class MessagingFactory extends Object
Modifier and Type | Field and Description |
---|---|
static String |
APPID_PREFIX
For internal use.
|
static String |
APPROLE_APPID_PREFIX
For internal use.
|
Constructor and Description |
---|
MessagingFactory() |
Modifier and Type | Method and Description |
---|---|
static Address |
buildAddress(String deviceAddress,
DeliveryType deliveryType,
String emailMode)
Build a
Address object. |
static Address |
buildAddress(String deviceAddress,
String deliveryType,
String emailMode)
Build a
Address object. |
static AccessPoint |
createAccessPoint(AccessPoint.AccessPointType apType,
DeliveryType deliveryType,
String value)
Create a new access point.
|
static AccessPoint |
createAccessPoint(AccessPoint.AccessPointType apType,
DeliveryType deliveryType,
String value,
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,
String keyword)
Create a new access point from an Address object.
|
static Address |
createAddress(String address)
Create a new
Address object from
address . |
static Address[] |
createAddress(String[] addresses)
Create a list of
Address objects from
addresses . |
static ApplicationInfo |
createApplicationInfo()
Creates a new ApplicationInfo object.
|
static Address |
createAppRoleAddress(String roleName,
String applicationId)
Create a new Application Role
Address object. |
static MessageFilter |
createBlacklistFilter(String pattern)
Create a "blacklist" filter.
|
static Message |
createMessage()
Create a new message.
|
static MessageFilter |
createMessageFilter(String pattern,
MessageFilter.FieldType field,
String fieldName,
MessageFilter.Action action)
Create a new MessageFilter.
|
static MessageInfo |
createMessageInfo()
Create a MessageInfo object.
|
static MessageQuery |
createMessageQuery()
Create a new MessagingQuery.
|
static MessagingClient |
createMessagingClient(Map<String,Object> parameters)
Create a MessagingClient instance.
|
static Message |
createTextMessage(String textContent)
Create a text message with text/plain content type.
|
static Message |
createTextMessage(String textContent,
String charset)
Create a text message with text/plain content type and specified
charset.
|
static MessageFilter |
createWhitelistFilter(String pattern)
Create a "whitelist" filter.
|
static List<String> |
expandAccessPoint(AccessPoint accessPoint)
Utility method to generate a list containing the expanded set of
addresses from an access point.
|
static List<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 String |
getRecipientType(Address address)
Return the recipient type (To/Cc/Bcc) of an address.
|
static void |
remove(MessagingClient clientInstance)
Remove this Messaging Client instance.
|
public static final String APPID_PREFIX
public static final String APPROLE_APPID_PREFIX
public static MessagingClient createMessagingClient(Map<String,Object> parameters) throws MessagingException
remove(MessagingClient)
method.
In typical use, no parameters need to be specified for a client
application to be functional. Some parameters are useful to
override default behavior:
ApplicationInfo.APPLICATION_NAME
.ApplicationInfo.SDPM_SECURITY_PRINCIPAL
. If a security principal is specified, then all subsequent
requests involving the application's resources (messages, access
points, etc.) must be made using the same security principal.MessagingConstants.MESSAGE_LISTENER_THREADS
and
MessagingConstants.STATUS_LISTENER_THREADS
. UserTransaction
.Listener
): by setting the
MessagingConstants.LISTENER_TRANSACTED_MODE
parameter. Boolean.TRUE (default value) results in a created
transaction before the listener callback. The transaction will be
committed unless an Exception (or
ListenerException
with retriable==true) is thrown by the application. Setting the
parameter to Boolean.FALSE means that the listener callback would
be done without a transaction, that is, only a single delivery
would occur, regardless of any Exception. MessagingConstants.LISTENER_ACKNOWLEDGEMENT_MODE
parameter has been deprecated and replaced by the
LISTENER_TRANSACTED_MODE
parameter.
parameters
- A set of configuration properties for the instance being
created.MessagingException
public static void remove(MessagingClient clientInstance)
clientInstance
- the client instance to remove.public static ApplicationInfo createApplicationInfo()
public static AccessPoint createAccessPoint(AccessPoint.AccessPointType apType, DeliveryType deliveryType, String value)
apType
- the access point type.deliveryType
- the access point address delivery type.value
- the access point address value.public static AccessPoint createAccessPoint(AccessPoint.AccessPointType apType, DeliveryType deliveryType, String value, String keyword)
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.public static AccessPoint createAccessPoint(Address address)
address
- an object of oracle.sdp.messaging.Address interfaceIllegalArgumentException
- if address is null.public static AccessPoint createAccessPoint(Address address, String keyword)
address
- an object of oracle.sdp.messaging.Address interfacekeyword
- 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.IllegalArgumentException
- if address is null.public static List<String> expandAccessPoint(AccessPoint accessPoint)
accessPoint
- the access point to expandpublic static List<String> expandAccessPoint(AccessPoint accessPoint, boolean withKeyword)
accessPoint
- the access point to expandwithKeyword
- flag indicating whether the access point keyword should
be included in the returned strings.public static Address createAddress(String address)
Address
object from
address
.address
- a well-formatted address in String form. The format must
be of the form "deliveryType:address
". For
example: "Email:user@example.com". Alternatively, to
address users or groups, you may specify "
User:username
" or "
Group:groupname
". For example: "User:johndoe" or "Group:johndoe_team". IllegalArgumentException
- if an Address cannot be created from the
provided address String.public static Address createAppRoleAddress(String roleName, String applicationId)
Address
object.roleName
- the application role name.applicationId
- the application id (name) to which the role name belong.
If set to null, application id is set to
oracle.security.
jps.internal.api.runtime.AppSecurityContext
.getApplicationID().IllegalArgumentException
- if roleName is null.public static Address[] createAddress(String[] addresses)
Address
objects from
addresses
.addresses
- a list of well-formatted addresses in String form.IllegalArgumentException
- if an Address cannot be created from any
of the provided address Strings.public static Address buildAddress(String deviceAddress, String deliveryType, String emailMode)
Address
object.deviceAddress
- the device addressdeliveryType
- the delivery typeemailMode
- 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.Address
object.IllegalArgumentException
- if an Address cannot be built.public static Address buildAddress(String deviceAddress, DeliveryType deliveryType, String emailMode)
Address
object.deviceAddress
- the device addressdeliveryType
- the delivery typeemailMode
- 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.Address
object.IllegalArgumentException
- if an Address cannot be built.public static String getRecipientType(Address address)
address
- public static Message createMessage()
public static Message createTextMessage(String textContent) throws MessagingException
textContent
- the plain text content to set in the message.MessagingException
public static Message createTextMessage(String textContent, String charset) throws MessagingException
textContent
- the plain text content to set in the message.charset
- the charset name, such as UTF-8 or US-ASCII.charset
" set
as the content type.MessagingException
public static MessageInfo createMessageInfo()
public static MessageQuery createMessageQuery()
public static MessageFilter createMessageFilter(String pattern, MessageFilter.FieldType field, String fieldName, MessageFilter.Action action)
Note that:
FieldType.SENDER
,
FieldType.RECIPIENT
, or
FieldType.REPLYTO
, the value is a UMS Address value, i.e. in the
form "deliveryType:address", for example "EMAIL:user@example.com"
FieldType.HEADER
, the drivers add the values in a driver
specific way. For example, if an email contains the header
"From: Example Name <user@example.com>", the email driver
will add the header "From" with the value
"Example Name <user@example.com>". Note that the address in
the example is as found in email headers, and not in the form of
an UMS Address (e.g. EMAIL:user@example.com).FieldType.CONTENT
, note that clients often add text content with
trailing control characters, e.g. a line could have a terminator
that is a carriage-return character followed immediately by a
newline character ("\r\n"). In that case a matching pattern like
"(?s)hello.*" would work, as "(?s)" would enable Dotall mode thus
making the "." match any character including the line terminator.
pattern
- The pattern to match the incoming message against. The
pattern should be a Java Pattern
. The matching will be executed as a
case-insensitive matching. For example:.*foo.*
^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.public static MessageFilter createBlacklistFilter(String pattern)
Pattern
.public static MessageFilter createWhitelistFilter(String pattern)
Copyright © 2006, 2017 Oracle and/or its affiliates. All rights reserved.