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

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

public final class Context
extends Object

Represents an object that contains references for resources required to create and maintain a sender destination (BlockingSenderDestination, NonBlockingSenderDestination, FireAndForgetDestination). Every sender destination is associated with some context. The same context can be shared between different destinations if they share a connection factory, a credentials collector, or both. When using transport protocols other than HTTP, or different authentication mechanisms, there may be more shared information.

It is important to use the same Context for all related Destination objects to minimize unnecessary connections, authentication attempts, and so on.

Since:
BlackBerry API 6.0.0

Constructor Summary
Context(String name)
          Creates a Context object.
Context(String name, CredentialsCollector credentialsCollector)
          Creates a Context object.
Context(String name, ConnectionFactory connectionFactory)
          Creates a Context object.
Context(String name, ConnectionFactory connectionFactory, CredentialsCollector credentialsCollector)
          Creates a Context object.
 
Method Summary
 ConnectionFactory getConnectionFactory()
          Returns the ConnectionFactory for this Context.
 CredentialsCollector getCredentialsCollector()
          Returns the CredentialsCollector for this Context.
 String getName()
          Returns the name of the context.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

Context

public Context(String name)
Creates a Context object. The connection factory specified will be used for all destinations associated with a given context.

Parameters:
name - The name of the context. A destination should be associated with a given context by providing the context's name in one of createXXXSenderDestination() methods of DestinationFactory.
Since:
BlackBerry API 6.0.0

Context

public Context(String name,
               CredentialsCollector credentialsCollector)
Creates a Context object. The connection factory specified will be used for all destinations associated with a given context.

Parameters:
name - The name of the context. A destination should be associated with a given context by providing the context's name in one of createXXXSenderDestination() methods of DestinationFactory.
credentialsCollector - Provides credential information used for sending messages to destinations that require some form of authentication, such as URLs.
Since:
BlackBerry API 6.0.0

Context

public Context(String name,
               ConnectionFactory connectionFactory)
Creates a Context object. The connection factory specified will be used for all destinations associated with a given context.

Parameters:
name - The name of the context. A destination should be associated with a given context by providing the context's name in one of createXXXSenderDestination() methods of DestinationFactory.
connectionFactory - Manages connections required for sending messages to destinations.
Since:
BlackBerry API 6.0.0

Context

public Context(String name,
               ConnectionFactory connectionFactory,
               CredentialsCollector credentialsCollector)
Creates a Context object. The connection factory specified will be used for all destinations associated with a given context.

Parameters:
name - The name of the context. A destination should be associated with a given context by providing the context's name in one of createXXXSenderDestination() methods of DestinationFactory.
connectionFactory - Manages connections required for sending messages to destinations.
credentialsCollector - Provides credential information used for sending messages to destinations that require some form of authentication, such as URLs.
Since:
BlackBerry API 6.0.0


Method Detail

getName

public String getName()
Returns the name of the context.

Returns:
The name of context.
Since:
BlackBerry API 6.0.0

getConnectionFactory

public ConnectionFactory getConnectionFactory()
Returns the ConnectionFactory for this Context.

Returns:
A ConnectionFactory.
Since:
BlackBerry API 6.0.0

getCredentialsCollector

public CredentialsCollector getCredentialsCollector()
Returns the CredentialsCollector for this Context.

Returns:
A CredentialsCollector.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.