com.motorola.oem.websession
Class WebSessionManager

java.lang.Object
  extended by OEM
      extended by com.motorola.oem.websession.WebSessionManager

public final class WebSessionManager
extends OEM

 WebSessionManager class provides a full control over the internet configuration.
 
Enables operations such: Add - addWebSession(com.motorola.oem.websession.WebSession) Delete - removeWebSession(int) Update - updateWebSession(com.motorola.oem.websession.WebSession, int) Handle web session provisioning by browser message listener - see example 6 in websession package. Each one of these parameters is stored in a Web Session. Two types of connections are dependent of the internet configuration (1) Standard Internet connection - used for all javax.microedition.io (std. MIDP2.0), including OTADownload API (2) MMS connection - used for MMS send/receive Note: User may store up to getMaxWebSessions() Web sessions. Web Sessions are stored in the non-volatile memory section. There are four predefined (reserved) web sessions entries : Java Session - Web session parameters for Standard Internet connection. Mms Session - Web session parameters for MMS send/receive. Prov Session - Web session parameters received by a Browser Message (READ ONLY). FOTA Session - Web session parameters for Firmware upgrade (see User Guide). These web sessions must contain operator specific values for successful internet connection.

See Also:
WebSession, OTADownload

Field Summary
static int AUTH_METHOD_NETWPIN
          NETWPIN security method for Browser message.
static int AUTH_METHOD_USERNETWPIN
          USERNETWPIN security method for Browser message.
static int AUTH_METHOD_USERPIN
          USERPIN security method for Browser message.
static int AUTH_METHOD_USERPINMAC
          USERPINMAC security method for Browser message.
static int BROWSER_SETTINGS_PROVISIONING_MMS
          Prov Session contains settings for MMS session provisioning.
static int BROWSER_SETTINGS_PROVISIONING_WEB
          Prov Session contains settings for web session provisioning.
static int SESSION_INDEX_INVALID
          Predefined index for not existing web session.
static int SESSION_INDEX_JAVA
          Predefined index for "Java Session" web session.
static int SESSION_INDEX_MMS
          Predefined index for "Mms Session" web session.
static int SESSION_INDEX_PROV
          Predefined index for "Prov Session" web session.
 
Method Summary
 int acceptBrowserMsg()
          Accepts a WebSession provided Over The Air.
 int acceptBrowserMsg(java.lang.String pin)
          Accepts a WebSession provided Over The Air.
static int addWebSession(WebSession webSession)
          Store a new WebSession entry in the device's non-volatile memory.
static int findWebSessionByName(java.lang.String name)
          Return index of WebSession with the specified session name.
static int getCurrentWebSessionIndex()
          Get index of the current Web Session.
static WebSessionManager getInstance()
          Returns a reference to the class's single instance.
static int getMaxWebSessions()
          Get the value of the maximum WebSessions amount allowed to be stored.
static int getNumberWebSessions()
          Get the number of WebSessions stored on the device.
static WebSession getWebSession(int webSessionIndex)
          Get a copy of the Web Session entry with the specified webSessionIndex.
 void rejectBrowserMsg()
          Rejects a WebSession provided Over The Air.
static boolean removeWebSession(int webSessionIndex)
          Remove a WebSession entry from the non-volatile memory.
 void setBrowserMsgListener(WebSessionBrowserMsgListener listener)
          Set A listener for WebSession events.
static boolean setCurrentWebSession(int webSessionIndex)
          Set the Web Session's settings for the active internet configuration for MIDP connection.
static boolean updateWebSession(WebSession webSession, int webSessionIndex)
          Update an existing WebSession entry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION_INDEX_INVALID

public static final int SESSION_INDEX_INVALID
Predefined index for not existing web session.

See Also:
Constant Field Values

SESSION_INDEX_JAVA

public static final int SESSION_INDEX_JAVA
Predefined index for "Java Session" web session.

See Also:
Constant Field Values

SESSION_INDEX_MMS

public static final int SESSION_INDEX_MMS
Predefined index for "Mms Session" web session.

See Also:
Constant Field Values

SESSION_INDEX_PROV

public static final int SESSION_INDEX_PROV
Predefined index for "Prov Session" web session.

See Also:
Constant Field Values

AUTH_METHOD_NETWPIN

public static final int AUTH_METHOD_NETWPIN
NETWPIN security method for Browser message. Authentication is performed automatically and does not require the user to provide any PIN. User should call method acceptBrowserMsg() to accept the Browser Message.

See Also:
Constant Field Values

AUTH_METHOD_USERPIN

public static final int AUTH_METHOD_USERPIN
USERPIN security method for Browser message. Authentication requires the user to provide a PIN. User should call the method acceptBrowserMsg(String pin) to accept the Browser Message.

See Also:
Constant Field Values

AUTH_METHOD_USERNETWPIN

public static final int AUTH_METHOD_USERNETWPIN
USERNETWPIN security method for Browser message. Authentication requires the user to provide a PIN. User should call the method acceptBrowserMsg(String pin) to accept the Browser Message.

See Also:
Constant Field Values

AUTH_METHOD_USERPINMAC

public static final int AUTH_METHOD_USERPINMAC
USERPINMAC security method for Browser message. Authentication requires the user to provide a PIN. User should call the method acceptBrowserMsg(String pin) to accept the Browser Message.

See Also:
Constant Field Values

BROWSER_SETTINGS_PROVISIONING_WEB

public static final int BROWSER_SETTINGS_PROVISIONING_WEB
Prov Session contains settings for web session provisioning.

See Also:
Constant Field Values

BROWSER_SETTINGS_PROVISIONING_MMS

public static final int BROWSER_SETTINGS_PROVISIONING_MMS
Prov Session contains settings for MMS session provisioning.

See Also:
Constant Field Values
Method Detail

getInstance

public static WebSessionManager getInstance()
                                     throws WebSessionException
Returns a reference to the class's single instance. If the instance does not exist, then one is created and its reference is returned.

Throws:
WebSessionException - Failed to construct WebSessionManager.

acceptBrowserMsg

public int acceptBrowserMsg(java.lang.String pin)
                     throws WebSessionException
Accepts a WebSession provided Over The Air.
This method is used when a PIN code is required.
When PIN code is not required, use acceptBrowserMsg() instead.

NOTE: This method should be called from WebSessionBrowserMsgListener.onBrowserMsgReceived(int) handler.

Parameters:
pin - code to check authentication
Returns:
Browser Settings provisioning type. Possible return values:
BROWSER_SETTINGS_PROVISIONING_WEB,
BROWSER_SETTINGS_PROVISIONING_MMS,
Throws:
WebSessionException - Browser settings update failed

acceptBrowserMsg

public int acceptBrowserMsg()
                     throws WebSessionException
Accepts a WebSession provided Over The Air.
This method is used when a PIN code is not required.
When PIN code is required, use acceptBrowserMsg(String) instead.

NOTE: This method should be called from WebSessionBrowserMsgListener.onBrowserMsgReceived(int) handler.

Returns:
Browser Settings provisioning type. Possible return values:
BROWSER_SETTINGS_PROVISIONING_WEB,
BROWSER_SETTINGS_PROVISIONING_MMS,
Throws:
WebSessionException - If browser settings update failed

rejectBrowserMsg

public void rejectBrowserMsg()
Rejects a WebSession provided Over The Air.
This method rejects the new Browser Settings.
NOTE: This method should be called from WebSessionBrowserMsgListener.onBrowserMsgReceived(int) handler.


addWebSession

public static int addWebSession(WebSession webSession)
                         throws WebSessionException,
                                java.lang.NullPointerException,
                                java.lang.IllegalArgumentException
Store a new WebSession entry in the device's non-volatile memory.

Parameters:
webSession - A WebSession to add
Returns:
A reference index to the newly added session entry
Throws:
java.lang.NullPointerException - Specified webSession is null
java.lang.IllegalArgumentException - One or more of the WebSession
parameters is out of range. In such a case, the first invalid parameter encountered is reported.
WebSessionException -
  • Total WebSessions amount reached the getMaxWebSessions().
    Error code is - WebSessionException.AMOUNT_OUT_OF_BOUNDS_ERROR
  • WebSession already exists.
    Error code is - WebSessionException.ALREADY_EXIST_ERROR
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    getMaxWebSessions(), WebSession

    updateWebSession

    public static boolean updateWebSession(WebSession webSession,
                                           int webSessionIndex)
                                    throws WebSessionException,
                                           java.lang.NullPointerException,
                                           java.lang.IllegalArgumentException
    Update an existing WebSession entry.

    Parameters:
    webSession - A well initialized WebSession instance.
    webSessionIndex - A reference to the WebSession entry to update.
    Returns:
    true if update was successful, false otherwise.
    Throws:
    java.lang.NullPointerException - Specified webSession is null.
    java.lang.IllegalArgumentException - One or more of the WebSession
    parameters is out of range. In such a case, the first invalid parameter encountered is reported.
    WebSessionException -
  • webSessionIndex is invalid, or out of range: 1 to getMaxWebSessions().
    Error code is - WebSessionException.AMOUNT_OUT_OF_BOUNDS_ERROR
  • No existing WebSession entry matches the webSessionIndex parameter.
    Error code is - WebSessionException.INDEX_NOT_FOUND_ERROR
  • WebSession name is Read Only.
    Error code is - WebSessionException.READ_ONLY_ERROR
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    getMaxWebSessions(), getWebSession(int), WebSession

    removeWebSession

    public static boolean removeWebSession(int webSessionIndex)
                                    throws WebSessionException
    Remove a WebSession entry from the non-volatile memory.

    Parameters:
    webSessionIndex - A reference to the WebSession entry.
    Returns:
    true if removal was successful, false otherwise
    Throws:
    WebSessionException -
  • webSessionIndex is invalid, or out of range: 1 to getMaxWebSessions().
    Error code is - WebSessionException.INDEX_NOT_FOUND_ERROR
  • No existing WebSession entry matches the webSessionIndex parameter.
    Error code is - WebSessionException.INDEX_NOT_FOUND_ERROR
  • WebSession is Read Only.
    Error code is - WebSessionException.READ_ONLY_ERROR
  • WebSession is predefined.
    Error code is - WebSessionException.CANNOT_BE_REMOVED_ERROR
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    addWebSession(com.motorola.oem.websession.WebSession)

    setCurrentWebSession

    public static boolean setCurrentWebSession(int webSessionIndex)
                                        throws WebSessionException
    Set the Web Session's settings for the active internet configuration for MIDP connection. The default current session is 'Java session'.

    NOTE: The current index is stored in the non-volatile memory.
    When deleting the current web session, the index will be invalid, and 'Java Session' will be used for MIDP connection.
    Set 'Java Session' as the current web session to restore default behavior.

    Parameters:
    webSessionIndex - A reference to the WebSession entry to set as current.
    Returns:
    true for success, false otherwise
    Throws:
    WebSessionException -
  • webSessionIndex is out of range: 1 to getMaxWebSessions().
  • No existing WebSession entry matches the WebSessionIndex parameter ).
    Error code is - WebSessionException.INDEX_NOT_FOUND_ERROR
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    addWebSession(com.motorola.oem.websession.WebSession)

    getCurrentWebSessionIndex

    public static int getCurrentWebSessionIndex()
                                         throws WebSessionException
    Get index of the current Web Session.

    Returns:
    index of the WebSession if it exists or SESSION_INDEX_INVALID if session does not exist
    Throws:
    WebSessionException -
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    setCurrentWebSession(int)

    getWebSession

    public static WebSession getWebSession(int webSessionIndex)
                                    throws WebSessionException
    Get a copy of the Web Session entry with the specified webSessionIndex.

    Parameters:
    webSessionIndex - A reference to the WebSession entry
    Returns:
    WebSession on success, null on failure
    Throws:
    WebSessionException -
  • webSessionIndex is invalid, or out of range: 1 to getMaxWebSessions().
    Error code is - WebSessionException.INDEX_OUT_OF_BOUNDS_ERROR
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    addWebSession(com.motorola.oem.websession.WebSession), updateWebSession(com.motorola.oem.websession.WebSession, int), setCurrentWebSession(int)

    getMaxWebSessions

    public static final int getMaxWebSessions()
    Get the value of the maximum WebSessions amount allowed to be stored.

    Returns:
    maximum WebSessions amount allowed to be stored
    See Also:
    addWebSession(com.motorola.oem.websession.WebSession), updateWebSession(com.motorola.oem.websession.WebSession, int)

    getNumberWebSessions

    public static int getNumberWebSessions()
                                    throws WebSessionException
    Get the number of WebSessions stored on the device.

    Returns:
    Number of stored WebSessions
    Throws:
    WebSessionException -
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.
  • See Also:
    addWebSession(com.motorola.oem.websession.WebSession), updateWebSession(com.motorola.oem.websession.WebSession, int)

    findWebSessionByName

    public static int findWebSessionByName(java.lang.String name)
                                    throws WebSessionException,
                                           java.lang.NullPointerException
    Return index of WebSession with the specified session name.

    Parameters:
    name - The name of websession to find
    Returns:
    index of the WebSession with the specified session name if it exists or SESSION_INDEX_INVALID if session does not exist
    Throws:
    java.lang.NullPointerException -
  • Web session name is null.
  • WebSessionException -
  • Device is not ready yet.
    Error code is - WebSessionException.PLATFORM_NOT_READY_ERROR
    or WebSessionException.SIM_CARD_NOT_READY_ERROR.

  • setBrowserMsgListener

    public void setBrowserMsgListener(WebSessionBrowserMsgListener listener)
    Set A listener for WebSession events.
    User can reconfigure existing listener at any time.

    Parameters:
    listener - External listener object to receive events. Setting null listener will cause masking of WebSession events.