Bondi logo

The Bondi appconfig Module - Version 1.1

February 2010

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

Copyright 2010 OMTP Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

- static settings defined by the widget author in the configuration document using the preference element

- 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, similar to the the localstorage attribute

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 the feature

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

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

appconfig read and write operations on the appconfig settings.

Device capabilities:

  • appconfig

1.3. Device capabilities

appconfig

Sets and gets application configuration setting

2. Interfaces

2.1. AppConfigManager

Interface to set/retrieve appconfig key/values.

        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.

Code example
 function load(){
        pws = bondi.appconfig.get("password");
        document.getElementById("passwords").value = pws;
 }
 
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.

Code example
 function save() {
        pws = document.getElementById("passwords").value;
        bondi.appconfig.set("password", pws);
 }
 

2.2. AppConfigManagerObject

Specifies what is instantiated at feature request

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