com.funambol.util
Class ConnectionConfig

java.lang.Object
  extended by com.funambol.util.ConnectionConfig

public class ConnectionConfig
extends java.lang.Object

Connection Configurations repository: this class is needed to configure the connections using the carrier parameters in order to access the network. Configurations are useful both for socket and Http connections. It should be suitable that every class that perform a call to the open method of the javax.microedition.io.Connetor class use this class in oder to have working configurations loaded when the application runs. This class is mostly used into the Blackberry implementation as the device doesn't allow simple URL request to be sent on the network without APN or interface parameters. For more information about this topic see the Blackberry developers guide.


Field Summary
protected static int APN_TABLE_CONFIG
          2: Apn table - APNGateway class defined - configurations index
protected static java.lang.String APN_TABLE_CONFIG_DESCRIPTION
          Apn table - APNGateway class defined - configurations description
protected static int BES_CONFIG
          4: BES configuration index
protected static java.lang.String BES_CONFIG_DESCRIPTION
          Straight connection - works only with BES
protected static int CONFIG_NONE
          -1: No config has been set
protected static java.lang.String CONFIG_NONE_DESCRIPTION
          Description when no config has been set
protected static int MAX_CONFIG_NUMBER
          Maximum configurations number
protected static java.lang.String NO_DESCRIPTION
          Empty String: Value to initialize the configurations Descriptions
protected static java.lang.String NO_PARAMETERS
          Empty String: Value to initialize the configurations parameters
protected static int PERMISSION_DENIED
          1: Permission denied value
protected static int PERMISSION_GRANTED
          0: Permission granted value
protected static int PERMISSION_UNDEFINED
          -1: Permission undefined value
protected static int SERVICE_BOOK_CONFIG
          3: Service book configurations index
protected static java.lang.String SERVICE_BOOK_CONFIG_DESCRIPTION
          Service book configurations description
protected static int TCP_CONFIG
          1: TCP user's defined configurations index
protected static java.lang.String TCP_CONFIG_DESCRIPTION
          TCP user's defined configurations description
protected static int WIFI_CONFIG
          0: Wifi configurations index
protected static java.lang.String WIFI_CONFIG_DESCRIPTION
          WIFI configuration description
 
Constructor Summary
ConnectionConfig()
           
 
Method Summary
protected static java.lang.String getAPNFromConfig(int configId)
          Retrieves the APN for the given configuration
static int getBESConfigurationID()
          Returns the id of the BES configuration if defined.
protected static BlackberryConfiguration[] getBlackberryConfigurations()
          Get the available configurations array
static java.lang.String getConfigsDescription()
          Get the configurations description
protected static java.lang.String getConfigurationDescription(int configId)
          Get the description related to the given configurations index
static java.lang.String getWorkingConfigurationDescription()
          Accessor method that return the current working configurations description
static boolean isAvailable(int configuration)
          Accessor Method to get the configuration availability run-time
static boolean isDirectTCP(int configuration)
          Returns true if the given configuration works through a BIS or carrier APN (direct tcp)
protected static boolean isUSCarrier()
          Check if the data connection provider is US based
static boolean isUserConfirmationNeeded()
          Check if user must allow the APN usage.
protected static void refreshServiceBookConfigurations()
          Refresh the configuration parameters.
static void removeSavedConfig()
          Remove the saved working configurations ID.
static void resetConfigurationsPermissions()
          Reset all of the configurations' permission to the initial state value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CONFIG_NUMBER

protected static final int MAX_CONFIG_NUMBER
Maximum configurations number

See Also:
Constant Field Values

CONFIG_NONE

protected static final int CONFIG_NONE
-1: No config has been set

See Also:
Constant Field Values

WIFI_CONFIG

protected static final int WIFI_CONFIG
0: Wifi configurations index

See Also:
Constant Field Values

TCP_CONFIG

protected static final int TCP_CONFIG
1: TCP user's defined configurations index

See Also:
Constant Field Values

APN_TABLE_CONFIG

protected static final int APN_TABLE_CONFIG
2: Apn table - APNGateway class defined - configurations index

See Also:
Constant Field Values

SERVICE_BOOK_CONFIG

protected static final int SERVICE_BOOK_CONFIG
3: Service book configurations index

See Also:
Constant Field Values

BES_CONFIG

protected static final int BES_CONFIG
4: BES configuration index

See Also:
Constant Field Values

CONFIG_NONE_DESCRIPTION

protected static final java.lang.String CONFIG_NONE_DESCRIPTION
Description when no config has been set

See Also:
Constant Field Values

WIFI_CONFIG_DESCRIPTION

protected static final java.lang.String WIFI_CONFIG_DESCRIPTION
WIFI configuration description

See Also:
Constant Field Values

TCP_CONFIG_DESCRIPTION

protected static final java.lang.String TCP_CONFIG_DESCRIPTION
TCP user's defined configurations description

See Also:
Constant Field Values

APN_TABLE_CONFIG_DESCRIPTION

protected static final java.lang.String APN_TABLE_CONFIG_DESCRIPTION
Apn table - APNGateway class defined - configurations description

See Also:
Constant Field Values

SERVICE_BOOK_CONFIG_DESCRIPTION

protected static final java.lang.String SERVICE_BOOK_CONFIG_DESCRIPTION
Service book configurations description

See Also:
Constant Field Values

BES_CONFIG_DESCRIPTION

protected static final java.lang.String BES_CONFIG_DESCRIPTION
Straight connection - works only with BES

See Also:
Constant Field Values

PERMISSION_DENIED

protected static final int PERMISSION_DENIED
1: Permission denied value

See Also:
Constant Field Values

PERMISSION_GRANTED

protected static final int PERMISSION_GRANTED
0: Permission granted value

See Also:
Constant Field Values

PERMISSION_UNDEFINED

protected static final int PERMISSION_UNDEFINED
-1: Permission undefined value

See Also:
Constant Field Values

NO_PARAMETERS

protected static final java.lang.String NO_PARAMETERS
Empty String: Value to initialize the configurations parameters

See Also:
Constant Field Values

NO_DESCRIPTION

protected static final java.lang.String NO_DESCRIPTION
Empty String: Value to initialize the configurations Descriptions

See Also:
Constant Field Values
Constructor Detail

ConnectionConfig

public ConnectionConfig()
Method Detail

isAvailable

public static boolean isAvailable(int configuration)
Accessor Method to get the configuration availability run-time

Returns:
true if the device bearer

isDirectTCP

public static boolean isDirectTCP(int configuration)
Returns true if the given configuration works through a BIS or carrier APN (direct tcp)


getBESConfigurationID

public static int getBESConfigurationID()
Returns the id of the BES configuration if defined. -1 otherwise.


getBlackberryConfigurations

protected static BlackberryConfiguration[] getBlackberryConfigurations()
Get the available configurations array

Returns:
BlackberryConfiguration[] representing the array with the available configurations

isUSCarrier

protected static boolean isUSCarrier()
Check if the data connection provider is US based

Returns:
true if an US carrier APN is found in the address book

getAPNFromConfig

protected static java.lang.String getAPNFromConfig(int configId)
Retrieves the APN for the given configuration

Parameters:
configId - the configuration index
Returns:
the String formatted APN

refreshServiceBookConfigurations

protected static void refreshServiceBookConfigurations()
Refresh the configuration parameters. Useful when the servicebook changed


getConfigurationDescription

protected static java.lang.String getConfigurationDescription(int configId)
Get the description related to the given configurations index

Parameters:
configId - the configurations index
Returns:
String description for the given configurations index

getConfigsDescription

public static java.lang.String getConfigsDescription()
Get the configurations description

Returns:
a string describing the current configurations descriptions

getWorkingConfigurationDescription

public static java.lang.String getWorkingConfigurationDescription()
Accessor method that return the current working configurations description

Returns:
String related to the current working configurations description

isUserConfirmationNeeded

public static boolean isUserConfirmationNeeded()
Check if user must allow the APN usage. In US countries this check returns false

Returns:
false if the country retrieved by the service book is US, true otherwise

removeSavedConfig

public static void removeSavedConfig()
Remove the saved working configurations ID. This method is used when we're unable to connect, to avoid trying the same configurations every time.


resetConfigurationsPermissions

public static void resetConfigurationsPermissions()
Reset all of the configurations' permission to the initial state value



Copyright © 2001-2009 Funambol.