|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.io.messaging.DestinationFactory
public class DestinationFactory
Creates different types of Destination objects from the
net.rim.device.api.io.transport.messaging package. The following
Destination types are supported:
BlockingSenderDestinationNonBlockingSenderDestinationBlockingReceiverDestinationNonBlockingReceiverDestinationFireAndForgetDestination
A Destination provides methods to send and receive messages.
BlockingSenderDestination and NonBlockingSenderDestination
objects send messages to a URI end point, and provide the means to receive a
response. A FireAndForgetDestination object sends a message and
expects no response. BlockingReceiverDestination and
NonBlockingReceiverDestination objects listen for incoming push
messages from a BlackBerry® Enterprise Server or through the
BlackBerry® Push Service. These objects also listen for messages sent as
result of interprocess communication with other applications on the device.
Use the following methods to manage the lifecycle of a Destination object:
DestinationFactory.createXXXDestination()
Creates a Destination of the type specified. You can reuse a
Destination instead of creating a new object. For more information
about reusing Destination objects, see getSenderDestination()
and getReceiverDestination().
The createXXXDestination method creates a queue to hold
all messages for the Destination object it returns. If the
queue for this destination already exists, then createXXXDestination
will assign the Destination object a reference to it.
SenderDestination objects require a Context. The
Context contains references to a CredentialsCollector
and a ConnectionFactory.
If these objects are not specified by the Context, then default
objects are used. Multiple SenderDestination objects that share the same
credentials and ConnectionFactory
should share a single Context to minimize connection and login attempts.
When creating ReceiverDestination objects, you must specify
an InboundDestinationConfiguration object that defines how messages
from a particular push initiator should be processed when they arrive.
Use the InboundDestinationConfigurationFactory to create an
InboundDestinationConfiguration.
Note: When creating a receiver destination for BlackBerry
Enterprise Server or BlackBerry Push Service push initiators,
createXXXReceiverDestination() uses the Push API
(net.rim.blackberry.api.push) to register with the BlackBerry
infrastructure to receive push messages.
Destination.pause()
You can suspend the operation of a Destination object by
invoking pause(). In the paused state, no Messages will be
delivered to MessageListener objects nor will they retrieved for transmission
over a network connection.
If a Destination is already paused, a second call will have
no effect. Invoking getXXXDestination() will return a valid Destination.
Destination.resume()
Restores the ability of the Destination specified object to send and receive messages.
Destination.release()
Detaches a Destination from a message queue, and removes all
resources required for sending and receiving messages.
The underlying message queue and push subscriptions are preserved. The API will continue to try to deliver any queued outgoing messages, and receive push messages.
You can invoke release() when your application is not in a
state to send or receive messages. The API will automatically invoke
release() when your application closes.
Destination.destroy()
Detaches a Destination from a message queue, removes all
resources required for sending and receiving messages, and destroys the
message queue. The delivery of all messages is cancelled, and responses are
discarded. In addition, the API will unsubscribe from any push initiators
associated with this queue, and unregister from the BlackBerry infrastructure
for push messages for the URI associated with this queue.
| Method Summary | ||
|---|---|---|
static BlockingReceiverDestination |
createBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri)
Creates a BlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static BlockingReceiverDestination |
createBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri,
MessageProcessor processor)
Creates a BlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static BlockingSenderDestination |
createBlockingSenderDestination(Context context,
URI uri)
Creates a BlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static BlockingSenderDestination |
createBlockingSenderDestination(Context context,
URI uri,
MessageProcessor processor)
Creates a BlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static FireAndForgetDestination |
createFireAndForgetDestination(Context context,
URI uri)
Creates a FireAndForgetDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static NonBlockingReceiverDestination |
createNonBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri,
MessageListener listener)
Creates a NonBlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static NonBlockingReceiverDestination |
createNonBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri,
MessageProcessor processor,
MessageListener listener)
Creates a NonBlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static NonBlockingSenderDestination |
createNonBlockingSenderDestination(Context context,
URI uri,
MessageListener listener)
Creates a NonBlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static NonBlockingSenderDestination |
createNonBlockingSenderDestination(Context context,
URI uri,
MessageProcessor processor,
MessageListener listener)
Creates a NonBlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. |
|
static ReceiverDestination |
getReceiverDestination(URI uri)
Retrieves a ReceiverDestination resource for the specified URI. |
|
static SenderDestination |
getSenderDestination(String contextName,
URI uri)
Retrieves a SenderDestination resource associated with this sender
context for the specified URI. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static BlockingSenderDestination createBlockingSenderDestination(Context context,
URI uri)
throws MessagingException
BlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. The following forms of
URIs are recognized by the library:
BlockingSenderDestination that will send messages to the specified URL using HTTP.
BlockingSenderDestination that will send messages to the specified URL
using HTTPS.
BlockingSenderDestination that will send messages to an application
named "deviceAppName" running on the device and listening on the URI local:///
context - A Context for the Destination.uri - The URI for this BlockingSenderDestination.
BlockingSenderDestination that can be used to send messages to the specified URI.
MessagingException - if uri is incorrectly specified.
public static BlockingSenderDestination createBlockingSenderDestination(Context context,
URI uri,
MessageProcessor processor)
throws MessagingException
BlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. The following forms of
URIs are recognized by the library:
BlockingSenderDestination that will send messages to the specified URL
using HTTP.
BlockingSenderDestination that will send messages to the specified URL.
using HTTPS
BlockingSenderDestination that will send messages to an application
named "deviceAppName" running on the device and listening on the URI local:///
context - A Context for the Destination.uri - The URI for this BlockingSenderDestination.processor - The MessageProcessor that will be used for processing response messages.
BlockingSenderDestination that can be used to send messages to the specified URI.
MessagingException - if uri is incorrectly specified.
public static NonBlockingSenderDestination createNonBlockingSenderDestination(Context context,
URI uri,
MessageListener listener)
throws MessagingException
NonBlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. The following forms of
of URIs are recognized by the library:
NonBlockingSenderDestination that will send messages to the specified
URL using HTTP.
NonBlockingSenderDestination that will send messages to the
specified URL using HTTPS.
NonBlockingSenderDestination that will send messages to an application
named "deviceAppName" running on the device and listening on the URI local:///
context - A Context for the Destination.uri - The URI for this NonBlockingSenderDestination.listener - The MessageListener to receive asynchronous responses.
NonBlockingSenderDestination that can be used to send messages to the specified URI.
MessagingException - if uri is incorrectly specified or if
listener is null.
public static NonBlockingSenderDestination createNonBlockingSenderDestination(Context context,
URI uri,
MessageProcessor processor,
MessageListener listener)
throws MessagingException
NonBlockingSenderDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. The following forms of
of URIs are recognized by the library:
NonBlockingSenderDestination that will send messages to the specified
URL using HTTP.
NonBlockingSenderDestination that will send messages to the
specified URL using HTTPS.
NonBlockingSenderDestination that will send messages to an application
named "deviceAppName" running on the device and listening on the URI local:///
context - A Context for the Destination.uri - The URI for this NonBlockingSenderDestination.processor - The MessageProcessor that will be used for processing response messages.listener - The MessageListener to receive asynchronous responses.
NonBlockingSenderDestination that can be used to send messages to the specified URI.
MessagingException - if uri is incorrectly specified or if
listener is null.
public static FireAndForgetDestination createFireAndForgetDestination(Context context,
URI uri)
throws MessagingException
FireAndForgetDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified. The following forms of
URIs are recognized by the library:
FireAndForgetDestination sender destination that will send messages to
the specified URL using HTTP.
FireAndForgetDestination sender destination that will send messages
to the specified URL using HTTPS.
FireAndForgetDestination that will send messages to an application
named "deviceAppName" running on the device and listening on the URI local:///
context - A Context for the Destination.uri - The URI for this FireAndForgetDestination.
FireAndForgetDestination that can be used to send messages to the specified URI.
MessagingException - if uri is incorrectly specified.
public static BlockingReceiverDestination createBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri)
throws MessagingException
BlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified.
createBlockingReceiverDestination receives messages addressed to the following URI forms:
local:///<path> - for interprocess communicationlocal://:<port>/<path> - for BlackBerry®
Push Service or BlackBerry® Enterprise Server push messagesThe <path> parameter of the URI allows an application to identify logical sub-groups of push messages delivered to a port. This enables an application to associate different receivers for different groups of messages that arrive on a port. The <path> should be specified by the push initiator in the Request-URI header element of a push message. The <path> parameter is optional.
The <port> parameter in the URI refers to the push subscription port assigned by the BlackBerry Push Service or BlackBerry Enterprise Server administrator.
config - The InboundDestinationConfiguration to use for listening.uri - The URI for this BlockingReceiverDestination.
BlockingReceiverDestination that can be used to receive messages at the specified URI.
MessagingException - if uri is incorrectly specified.
public static BlockingReceiverDestination createBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri,
MessageProcessor processor)
throws MessagingException
BlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified.
createBlockingReceiverDestination receives messages addressed to the following URI forms:
local:///<path> - for interprocess communicationlocal://:<port>/<path> - for BlackBerry®
Push Service or BlackBerry® Enterprise Server push messagesThe <path> parameter of the URI allows an application to identify logical sub-groups of push messages delivered to a port. This enables an application to associate different receivers for different groups of messages that arrive on a port. The <path> should be specified by the push initiator in the Request-URI header element of a push message. The <path> parameter is optional.
The <port> parameter in the URI refers to the push subscription port assigned by the BlackBerry Push Service or BlackBerry Enterprise Server administrator.
config - The InboundDestinationConfiguration to use for listening.uri - The URI for this BlockingReceiverDestination.processor - The MessageProcessor that will be used for processing incoming messages.
BlockingReceiverDestination that can be used to receive messages at the specified URI.
MessagingException - if uri is incorrectly specified.
public static NonBlockingReceiverDestination createNonBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri,
MessageListener listener)
throws MessagingException
NonBlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified.
createNonBlockingReceiverDestination receives messages addressed to the following URI forms:
local:///<path> - for interprocess communicationlocal://:<port>/<path> - for BlackBerry®
Push Service or BlackBerry® Enterprise Server push messagesThe <path> parameter of the URI allows an application application to identify logical sub-groups of push messages delivered to a port. This enables an application to associate different listeners for different groups of messages that arrive on a port. The <path> should be specified by the push initiator in the Request-URI header element of a push message. The <path> parameter is optional.
The <port> parameter in the URI refers to the push subscription port assigned by the BlackBerry Push Service or BlackBerry Enterprise Server administrator.
config - The InboundDestinationConfiguration to use for listening.uri - The URI for this NonBlockingReceiverDestination.listener - The MessageListener to use for asynchronous receiving of messages.
NonBlockingReceiverDestination that can be used to receive messages at the specified URI.
MessagingException - if uri is incorrectly specified.
public static NonBlockingReceiverDestination createNonBlockingReceiverDestination(InboundDestinationConfiguration config,
URI uri,
MessageProcessor processor,
MessageListener listener)
throws MessagingException
NonBlockingReceiverDestination that uses a ConnectionFactory
or CredentialsCollector provided by the context specified.
createNonBlockingReceiverDestination receives messages addressed to the following URI forms:
local:///<path> - for interprocess communicationlocal://:<port>/<path> - for BlackBerry®
Push Service or BlackBerry® Enterprise Server push messagesThe <path> parameter of the URI allows an application application to identify logical sub-groups of push messages delivered to a port. This enables an application to associate different listeners for different groups of messages that arrive on a port. The <path> should be specified by the push initiator in the Request-URI header element of a push message. The <path> parameter is optional.
The <port> parameter in the URI refers to the push subscription port assigned by the BlackBerry Push Service or BlackBerry Enterprise Server administrator.
config - The InboundDestinationConfiguration to use for listening.uri - The URI for this NonBlockingReceiverDestination.processor - The MessageProcessor that will be used for processing incoming messages.listener - The MessageListener to use for asynchronous receiving of messages.
NonBlockingReceiverDestination that can be used to receive messages at the specified URI.
MessagingException - if uri is incorrectly specified.
public static SenderDestination getSenderDestination(String contextName,
URI uri)
SenderDestination resource associated with this sender
context for the specified URI. The following forms of
URIs are recognized by the library:
BlockingSenderDestination that will send messages to the specified URL using HTTP.
BlockingSenderDestination that will send messages to the specified URL
using HTTPS.
BlockingSenderDestination that will send messages to an application
named "deviceAppName" running on the device and listening on the URI local:///deviceAppName/
contextName - The context to get the Destination for.uri - The URI to get the Destination for.
Destination that should be cast to the corresponding
type (for example, NonBlockingReceiverDestination,
BlockingSenderDestination, etc.), or
null if not found.public static ReceiverDestination getReceiverDestination(URI uri)
ReceiverDestination resource for the specified URI.
ReceiverDestination receives messages addressed to the following URI forms:
local:///<path> - for interprocess communicationlocal://:<port>/<path> - for BlackBerry®
Push Service or BlackBerry® Enterprise Server push messagesThe <path> parameter of the URI allows an application to identify logical sub-groups of push messages delivered to a port. This enables an application to associate different receivers for different groups of messages that arrive on a port. The <path> should be specified by the push initiator in the Request-URI header element of a push message. The <path> parameter is optional.
The <port> parameter in the URI refers to the push subscription port assigned by the BlackBerry Push Service or BlackBerry Enterprise Server administrator.
uri - The URI to get the Destination for.
Destination that should be cast to the corresponding
type (e.g. NonblockingReceiverDestination,
BlockingSenderDestination, etc.), or
null if not found.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal