|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.util.ConnectionManager
public class ConnectionManager
Controls all of the connections requested by the API implementations.
It is strongly recommended to use this class instead of the direct call to
the Connector.open(String url) method. This class is based on the singleton
pattern: it has private constructor and just one instance to be referenced
calling the method ConnectionManager.getInstance() by other classes. The
connection logic switch between all of the BlackberryConfiguration object
returned by the Connection config class. The usage of the returned
configuration is the following:
1. WIFI Network - just on the wifi capable devices, skipped if the wifi
bearer is not present;
2. Custom TCP configuration - Manually configured by the user
3. APN gateway configuration - Carrier's Country based Configuration
4. Blackberry ServiceBook configuration WAP Transport entry - Blackberry
ServiceBook based Configuration
NOTE 1: When a wifi network is no more available the system tries to
configure a GPRS data connection in the same session.
NOTE 2: When the Manually configured TCP configuration is cancelled or become
invalid (i.e.: an invalid APN is substituted to a valid one), the TCP
configuration won't ever be used during the same session but the system will
switch other provided configurations.
Note 3:When a configuration that is not WIFI or TCP based is validated, that
configuration will be used for the entire session.
Field Summary | |
---|---|
protected static int |
workingConfigID
WORKING configurations ID |
Constructor Summary | |
---|---|
protected |
ConnectionManager()
Singleton realization: Private constructor Use getInstance() method to acces the public methods |
Method Summary | |
---|---|
ConnectionListener |
getConnectionListener()
Accessor method to get the current connection listener |
static ConnectionManager |
getInstance()
Singleton implementation: |
javax.microedition.io.Connection |
open(java.lang.String url)
Open up a connection to the given url with the default CLDC 1.0 API default values for the stream (READ_WRITE) and the value TRUE for the availability of InterruptedIOException to be thrown |
javax.microedition.io.Connection |
open(java.lang.String url,
int accessMode,
boolean enableTimeoutException)
Open up a connection to the given url with the given access accessMode and |
HttpConnectionAdapter |
openHttpConnection(java.lang.String url,
java.lang.Object extra)
Open up a connection to the given url with the given access accessMode and |
SocketAdapter |
openSocketConnection(java.lang.String addr,
int port,
int mode,
boolean timeout)
Open a socket connection to the given URL |
void |
setConnectionListener(ConnectionListener cl)
Accessor method to set the connection listener |
void |
setFixedApn(java.lang.String apn)
Set the Connection parameters for this connection given the apn string |
void |
unsetFixedApn()
Disable the connection parameters for the fixed APN usage. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int workingConfigID
Constructor Detail |
---|
protected ConnectionManager()
Method Detail |
---|
public static ConnectionManager getInstance()
public javax.microedition.io.Connection open(java.lang.String url) throws java.io.IOException
url
- The URL for the connection
java.io.IOException
public javax.microedition.io.Connection open(java.lang.String url, int accessMode, boolean enableTimeoutException) throws java.io.IOException
url
- The URL for the connectionaccessMode
- the access accessMode that can be READ, WRITE, READ_WRITEenableTimeoutException
- A flag to indicate that the caller wants to
enable the throwing of InterruptedIOException when a connection timeout
occurs
java.io.IOException
public void setConnectionListener(ConnectionListener cl)
cl
- the connection listener to be setpublic ConnectionListener getConnectionListener()
public void setFixedApn(java.lang.String apn)
apn
- the fixed apn to be used.public void unsetFixedApn()
public HttpConnectionAdapter openHttpConnection(java.lang.String url, java.lang.Object extra) throws java.io.IOException
url
- The URL for the connectionextra
- is some extra information that can be specified to specific
implementations
java.io.IOException
public SocketAdapter openSocketConnection(java.lang.String addr, int port, int mode, boolean timeout) throws java.io.IOException
addr
- is the server addressport
- the portmode
- can be READ_WRITEtimeout
- enable timeout on IO operations
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |