net.rim.device.api.io.messaging
Class DestinationFactory

java.lang.Object
  extended by net.rim.device.api.io.messaging.DestinationFactory

public class DestinationFactory
extends Object

Creates different types of Destination objects from the net.rim.device.api.io.transport.messaging package. The following Destination types are supported:

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:

Since:
BlackBerry API 6.0.0

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

createBlockingSenderDestination

public static BlockingSenderDestination createBlockingSenderDestination(Context context,
                                                                        URI uri)
                                                                 throws MessagingException
Creates a BlockingSenderDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified. The following forms of URIs are recognized by the library:

createBlockingSenderDestination

public static BlockingSenderDestination createBlockingSenderDestination(Context context,
                                                                        URI uri,
                                                                        MessageProcessor processor)
                                                                 throws MessagingException
Creates a BlockingSenderDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified. The following forms of URIs are recognized by the library:

Parameters:
context - A Context for the Destination.
uri - The URI for this BlockingSenderDestination.
processor - The MessageProcessor that will be used for processing response messages.
Returns:
A BlockingSenderDestination that can be used to send messages to the specified URI.
Throws:
MessagingException - if uri is incorrectly specified.
Since:
BlackBerry API 6.0.0

createNonBlockingSenderDestination

public static NonBlockingSenderDestination createNonBlockingSenderDestination(Context context,
                                                                              URI uri,
                                                                              MessageListener listener)
                                                                       throws MessagingException
Creates a NonBlockingSenderDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified. The following forms of of URIs are recognized by the library:

Parameters:
context - A Context for the Destination.
uri - The URI for this NonBlockingSenderDestination.
listener - The MessageListener to receive asynchronous responses.
Returns:
A NonBlockingSenderDestination that can be used to send messages to the specified URI.
Throws:
MessagingException - if uri is incorrectly specified or if listener is null.
Since:
BlackBerry API 6.0.0

createNonBlockingSenderDestination

public static NonBlockingSenderDestination createNonBlockingSenderDestination(Context context,
                                                                              URI uri,
                                                                              MessageProcessor processor,
                                                                              MessageListener listener)
                                                                       throws MessagingException
Creates a NonBlockingSenderDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified. The following forms of of URIs are recognized by the library:

Parameters:
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.
Returns:
A NonBlockingSenderDestination that can be used to send messages to the specified URI.
Throws:
MessagingException - if uri is incorrectly specified or if listener is null.
Since:
BlackBerry API 6.0.0

createFireAndForgetDestination

public static FireAndForgetDestination createFireAndForgetDestination(Context context,
                                                                      URI uri)
                                                               throws MessagingException
Creates a FireAndForgetDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified. The following forms of URIs are recognized by the library:

Parameters:
context - A Context for the Destination.
uri - The URI for this FireAndForgetDestination.
Returns:
A FireAndForgetDestination that can be used to send messages to the specified URI.
Throws:
MessagingException - if uri is incorrectly specified.
Since:
BlackBerry API 6.0.0

createBlockingReceiverDestination

public static BlockingReceiverDestination createBlockingReceiverDestination(InboundDestinationConfiguration config,
                                                                            URI uri)
                                                                     throws MessagingException
Creates a BlockingReceiverDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified.

createBlockingReceiverDestination receives messages addressed to the following URI forms:

The <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.

Parameters:
config - The InboundDestinationConfiguration to use for listening.
uri - The URI for this BlockingReceiverDestination.
Returns:
A BlockingReceiverDestination that can be used to receive messages at the specified URI.
Throws:
MessagingException - if uri is incorrectly specified.
Since:
BlackBerry API 6.0.0

createBlockingReceiverDestination

public static BlockingReceiverDestination createBlockingReceiverDestination(InboundDestinationConfiguration config,
                                                                            URI uri,
                                                                            MessageProcessor processor)
                                                                     throws MessagingException
Creates a BlockingReceiverDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified.

createBlockingReceiverDestination receives messages addressed to the following URI forms:

The <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.

Parameters:
config - The InboundDestinationConfiguration to use for listening.
uri - The URI for this BlockingReceiverDestination.
processor - The MessageProcessor that will be used for processing incoming messages.
Returns:
A BlockingReceiverDestination that can be used to receive messages at the specified URI.
Throws:
MessagingException - if uri is incorrectly specified.
Since:
BlackBerry API 6.0.0

createNonBlockingReceiverDestination

public static NonBlockingReceiverDestination createNonBlockingReceiverDestination(InboundDestinationConfiguration config,
                                                                                  URI uri,
                                                                                  MessageListener listener)
                                                                           throws MessagingException
Creates a NonBlockingReceiverDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified.

createNonBlockingReceiverDestination receives messages addressed to the following URI forms:

The <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.

Parameters:
config - The InboundDestinationConfiguration to use for listening.
uri - The URI for this NonBlockingReceiverDestination.
listener - The MessageListener to use for asynchronous receiving of messages.
Returns:
A NonBlockingReceiverDestination that can be used to receive messages at the specified URI.
Throws:
MessagingException - if uri is incorrectly specified.
Since:
BlackBerry API 6.0.0

createNonBlockingReceiverDestination

public static NonBlockingReceiverDestination createNonBlockingReceiverDestination(InboundDestinationConfiguration config,
                                                                                  URI uri,
                                                                                  MessageProcessor processor,
                                                                                  MessageListener listener)
                                                                           throws MessagingException
Creates a NonBlockingReceiverDestination that uses a ConnectionFactory or CredentialsCollector provided by the context specified.

createNonBlockingReceiverDestination receives messages addressed to the following URI forms:

The <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.

Parameters:
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.
Returns:
NonBlockingReceiverDestination that can be used to receive messages at the specified URI.
Throws:
MessagingException - if uri is incorrectly specified.
Since:
BlackBerry API 6.0.0

getSenderDestination

public static SenderDestination getSenderDestination(String contextName,
                                                     URI uri)
Retrieves a SenderDestination resource associated with this sender context for the specified URI. The following forms of URIs are recognized by the library:

getReceiverDestination

public static ReceiverDestination getReceiverDestination(URI uri)
Retrieves a ReceiverDestination resource for the specified URI. ReceiverDestination receives messages addressed to the following URI forms:

The <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.

Parameters:
uri - The URI to get the Destination for.
Returns:
A Destination that should be cast to the corresponding type (e.g. NonblockingReceiverDestination, BlockingSenderDestination, etc.), or null if not found.
Since:
BlackBerry API 6.0.0





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