Bondi logo

The Bondi appconfig Module - Version 1.1

12 May 2009

Authors


Abstract

To configure applications from the Web context

Table of Contents


Summary of Methods

InterfaceMethod
AppConfigManagerDOMString get(DOMString key)
void set(DOMString key, DOMString value)
AppConfigManagerObject

1. Introduction

This module exposes facilities that relate to application settings and preferences, including:

- static settings defined by the author of the web application.

- settings read and/or modified programmatically by the web application when it runs.

It is intended that these settings are persisted on a per-installation basis.

Code example
        // Define the success callback.
        function successCB() {
                // Get some application settings.
                var smtpServer = bondi.appconfig.get('smtp.server');
                var smtpPort   = bondi.appconfig.get('smtp.port');
        }

        // Define the error callback.
        function errorCB(err) {
                alert("Failed to acquire BONDI appconfig API: " + err.message);
        }

        // Request the appconfig feature.
        bondi.requestFeature(successCB, errorCB, "appconfig");

 

1.1. Feature set

This is the URI used to declare this API's feature set, for use in bondi.requestFeature. For the URL, the list of features included by the feature set is provided.

http://bondi.omtp.org/api/appconfig

All AppConfig features

Includes API features:

  • http://bondi.omtp.org/api/appconfig.set
  • http://bondi.omtp.org/api/appconfig.get

1.2. Features

This is the list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions covered is provided.

When any of the features

is successfully requested, the interface AppConfigManager is instantiated, and the resulting object appears in the global namespace as Bondi.appConfigManager.

http://bondi.omtp.org/api/appconfig.get

appconfig settings retrieval operations.

Device capabilities:

  • appconfig.get
http://bondi.omtp.org/api/appconfig.set

appconfig set value operations

Device capabilities:

  • appconfig.set

1.3. Device capabilities

appconfig.set

Sets application configuration setting

Security parameters:

  • key: configuration setting key
appconfig.get

Gets application configuration setting

Security parameters:

  • key: configuration setting key

2. Interfaces

2.1. AppConfigManager

Interface to set/retrieve appconfig settings.

        interface AppConfigManager {
                DOMString get(in DOMString key)
                        raises(SecurityError);

                void set(in DOMString key, in DOMString value)
                        raises(SecurityError);
        };

Methods

get

Retrieves the setting value for the given key.

Signature
DOMString get(in DOMString key);
Parameters
  • key: the key of the setting to retrieve
Return value
the value of the given key, or undefined if key not found.
Exceptions
  • SecurityError:

    PERMISSION_DENIED_ERROR when access is denied by the security policy.

API features
http://bondi.omtp.org/api/appconfig.get
Code example
        // Get some application settings.
        var smtpServer = bondi.appconfig.get('smtp.server');
        var smtpPort   = bondi.appconfig.get('smtp.port');
 
set

Set the value for the given key.

Signature
void set(in DOMString key, in DOMString value);
Parameters
  • key: key of the setting to set
  • value: the value to set
Exceptions
  • SecurityError:

    PERMISSION_DENIED_ERROR when access is denied by the security policy.

API features
http://bondi.omtp.org/api/appconfig.set
Code example
        // Change an application setting.
        bondi.appconfig.set('smtp.port','25');
 

2.2. AppConfigManagerObject

Specifies what is instantiated at feature request

        interface AppConfigManagerObject {
                readonly attribute AppConfigManager appConfigManager; 
        };
        Bondi implements AppConfigManagerObject;