Class NetworkConnectionManager
- java.lang.Object
-
- com.blackberry.workspaces.api.sdk.NetworkConnectionManager
-
- All Implemented Interfaces:
IConnection
public class NetworkConnectionManager extends Object implements IConnection
NetworkConnectionManager
-
-
Constructor Summary
Constructors Constructor Description NetworkConnectionManager(String url, String subDomain)
NetworkConnectionManager constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyProxySettings(HttpURLConnection request)
applyProxySettingsString
getLastFoundProxyAddress()
getLastFoundProxyAddressEnums.ProxyType
getProxyType()
getProxyTypeString
getServerApiUrl()
getServerApiUrlString
getServerHostName()
getServerHostNameString
getServerUrl()
getServerUrlString
getSubdomain()
getSubdomainboolean
getUseCredentials()
getUseCredentialsboolean
isConnectedToInternet()
isConnectedToInternetboolean
isConnectedToInternet2()
isConnectedToInternet2void
saveProxySettings(Enums.ProxyType proxyType, String addr, String usr, String pass, int port, boolean useCredentials)
saveProxySettingsvoid
setServerUrl(String m_ServerUrl)
setServerUrlboolean
shouldAskUserForConnectionSettings()
shouldAskUserForConnectionSettingsboolean
shouldAskUserForProxyCredentials()
shouldAskUserForProxyCredentialsEnums.ConnectionError
testConnectionSettings()
testConnectionSettingsEnums.ConnectionError
testConnectionSettings(Enums.ProxyType proxyType, boolean useProxyAuthentication, String proxyUrl, String usr, String pass, int port)
testConnectionSettings Test connection to defined server and proxyEnums.ConnectionError
testConnectionSettings(String serverUrl, Enums.ProxyType proxyType, boolean useProxyAuthentication, String proxyUrl, String usr, String pass, int port)
testConnectionSettings Test connection to defined server and proxy
-
-
-
Method Detail
-
getLastFoundProxyAddress
public String getLastFoundProxyAddress()
getLastFoundProxyAddress- Specified by:
getLastFoundProxyAddress
in interfaceIConnection
- Returns:
- String m_LastFoundProxyAddress
-
getServerUrl
public String getServerUrl()
getServerUrl- Specified by:
getServerUrl
in interfaceIConnection
- Returns:
- String m_ServerUrl
-
setServerUrl
public void setServerUrl(String m_ServerUrl)
setServerUrl- Specified by:
setServerUrl
in interfaceIConnection
- Parameters:
m_ServerUrl
-
-
getServerApiUrl
public String getServerApiUrl()
getServerApiUrl- Specified by:
getServerApiUrl
in interfaceIConnection
- Returns:
- String m_ServerUrl + "/api"
-
getServerHostName
public String getServerHostName()
getServerHostName- Specified by:
getServerHostName
in interfaceIConnection
- Returns:
- String ServerHostName
-
getProxyType
public Enums.ProxyType getProxyType()
getProxyType- Specified by:
getProxyType
in interfaceIConnection
- Returns:
- ProxyType
- See Also:
Enums.ProxyType
-
getUseCredentials
public boolean getUseCredentials()
getUseCredentials- Specified by:
getUseCredentials
in interfaceIConnection
- Returns:
- boolean m_UseCredentials
-
getSubdomain
public String getSubdomain()
getSubdomain- Specified by:
getSubdomain
in interfaceIConnection
- Returns:
- String subdomain
-
shouldAskUserForConnectionSettings
public boolean shouldAskUserForConnectionSettings()
shouldAskUserForConnectionSettings- Specified by:
shouldAskUserForConnectionSettings
in interfaceIConnection
- Returns:
- true if there is no issues with the connection
-
shouldAskUserForProxyCredentials
public boolean shouldAskUserForProxyCredentials()
shouldAskUserForProxyCredentials- Specified by:
shouldAskUserForProxyCredentials
in interfaceIConnection
- Returns:
- true if the user need to define proxy settings, else returns false If a proxy server is in used (checked in the config) we check the user and password are valid Else (a proxy server is not set) we check if there is a proxy server in the network (checking error 407)
-
testConnectionSettings
public Enums.ConnectionError testConnectionSettings()
testConnectionSettings- Specified by:
testConnectionSettings
in interfaceIConnection
- Returns:
- ConnectionError
- See Also:
Enums.ConnectionError
-
testConnectionSettings
public Enums.ConnectionError testConnectionSettings(Enums.ProxyType proxyType, boolean useProxyAuthentication, String proxyUrl, String usr, String pass, int port)
testConnectionSettings Test connection to defined server and proxy- Specified by:
testConnectionSettings
in interfaceIConnection
- Parameters:
proxyType
-useProxyAuthentication
-proxyUrl
-usr
-pass
-port
-- Returns:
- ConnectionError
- See Also:
Enums.ConnectionError
-
testConnectionSettings
public Enums.ConnectionError testConnectionSettings(String serverUrl, Enums.ProxyType proxyType, boolean useProxyAuthentication, String proxyUrl, String usr, String pass, int port)
testConnectionSettings Test connection to defined server and proxy- Specified by:
testConnectionSettings
in interfaceIConnection
- Parameters:
serverUrl
-proxyType
-useProxyAuthentication
-proxyUrl
-usr
-pass
-port
-- Returns:
- ConnectionError
- See Also:
Enums.ConnectionError
-
saveProxySettings
public void saveProxySettings(Enums.ProxyType proxyType, String addr, String usr, String pass, int port, boolean useCredentials)
saveProxySettings- Specified by:
saveProxySettings
in interfaceIConnection
- Parameters:
proxyType
-addr
-usr
-pass
-port
-useCredentials
-
-
applyProxySettings
public void applyProxySettings(HttpURLConnection request)
applyProxySettings- Specified by:
applyProxySettings
in interfaceIConnection
- Parameters:
request
-
-
isConnectedToInternet
public boolean isConnectedToInternet()
isConnectedToInternet- Specified by:
isConnectedToInternet
in interfaceIConnection
- Returns:
- True if connected to internet; Otherwise false
-
isConnectedToInternet2
public boolean isConnectedToInternet2()
isConnectedToInternet2- Specified by:
isConnectedToInternet2
in interfaceIConnection
- Returns:
- true if connected to internet; Otherwise false
-
-