Difference between revisions of "OOR-document-format"
| Line 186: | Line 186: | ||
|} | |} | ||
| + | Please note that xs:hexBinary values should be used only for small chunks of data (< 256 Byte) that cannot easily be represented otherwise or stored elsewhere. The configuration service is not optimized to handle large BLOBs efficiently. Instead it is recommended to store links (e.g. URLs) to greater chunks of binary data. For example a small icon can be stored in the configuration, but a larger image or an entire icon suite is better stored elsewhere. | ||
| − | + | Also supported are lists (ordered sequences) of each of the basic types. [NOTE: This means that the lists must be homogeneous – mixed lists are not supported]. The configuration treats lists as atomic data-types -- there is no support for accessing lists element-wise or merging the contents of lists. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
List item values are generally separated by whitespace. This is a natural separator, which is used for XMLSchema list types as well. This works well for numeric or boolean types. For lists of strings or binary values this separator can be a problem, if the list contains zero-length values or strings that contain whitespace themselves. Think, for example, of a list of continents like 'Europe Africa South America'; here the whitespace separation doesn't work, as 'South America' itself contains a whitespace character. You can resolve this issue by specifying a separator attribute for each value tag of the property. The list of continents then might be separated by comma: 'Europe,Africa,South America'. | List item values are generally separated by whitespace. This is a natural separator, which is used for XMLSchema list types as well. This works well for numeric or boolean types. For lists of strings or binary values this separator can be a problem, if the list contains zero-length values or strings that contain whitespace themselves. Think, for example, of a list of continents like 'Europe Africa South America'; here the whitespace separation doesn't work, as 'South America' itself contains a whitespace character. You can resolve this issue by specifying a separator attribute for each value tag of the property. The list of continents then might be separated by comma: 'Europe,Africa,South America'. | ||
| + | |||
In addition, a property may be characterized as nillable (or not nillable). If it is nillable, it may assume the special value NIL, which indicates the absence of any particular value. NIL is different from any legal value. In particular, a string/list/binary property having zero length is not NIL. Nillable properties are sometimes also called optional. By default, each property is nillable. | In addition, a property may be characterized as nillable (or not nillable). If it is nillable, it may assume the special value NIL, which indicates the absence of any particular value. NIL is different from any legal value. In particular, a string/list/binary property having zero length is not NIL. Nillable properties are sometimes also called optional. By default, each property is nillable. | ||
| − | The schema may also provide a default value for a property. The default value must be of the appropriate data-type and should fulfill the constraints. A default value is not required, even for properties the are not nillable. | + | The schema may also provide a default value for a property. The default value must be of the appropriate data-type and should fulfill the constraints. A default value is not required, even for properties the are not nillable. |
| + | |||
An additional data-type oor:any can be used within the schema (particularly within templates). A property of this type may not have a default value. In a layer such a property can be given a non-NULL value of any of the types enumerated above. | An additional data-type oor:any can be used within the schema (particularly within templates). A property of this type may not have a default value. In a layer such a property can be given a non-NULL value of any of the types enumerated above. | ||
To support internationalization, properties may be marked localized in the schema. Localized properties (and only localized properties) may assume different values for different locales. This is particularly important for text strings intended for UI display, but may apply to other settings as well. The locale is one of the parameters that is used to select a configuration. Only one language-neutral default value can be provided for a localized property. Locale-specific standard values should be provided in an appropriate layer. | To support internationalization, properties may be marked localized in the schema. Localized properties (and only localized properties) may assume different values for different locales. This is particularly important for text strings intended for UI display, but may apply to other settings as well. The locale is one of the parameters that is used to select a configuration. Only one language-neutral default value can be provided for a localized property. Locale-specific standard values should be provided in an appropriate layer. | ||
Revision as of 14:09, 4 January 2021
OpenOffice.org Registry Format (OOR)
Abstract
This document describes the registry format used for specifying, storing and updating configuration data for OpenOffice.org (OOo) components and applications. It is intended to demonstrate the concepts and facilities of the OOo Registry Format (OOR)and tries to give a quick understanding of how to write configuration schemas and how to use them for their components and applications.
It is a non-normative description targeted to application developers. The normative description of the format can be found at the appendices of this document containing the XMLSchema specifications of the OOR format.
| Revision | Date | Author | Comments |
|---|---|---|---|
| 0.1 | 28/11/01 | Dirk Grobler | Initial draft containing basic concepts |
| 0.2 | 02/12/01 | Dirk Grobler | New sections for advanced concepts, introducing node context and value nodes as common attribute content holder. |
| 0.3 | 12/12/01 | Dirk Grobler | Set elements added and description for Access Control |
| 0.4 | 19/12/01 | Dirk Grobler | Update format description added. |
| 0.5 | 18/01/02 | Dirk Grobler | Combining Update and Fragment format to one format. |
| 0.6 | 24/01/02 | Dirk Grobler | Proof reading, incorporate feedback |
| 0.7 | 12/03/02 | Dirk Grobler | Definition for set extended. New documentation elements like annotation and labels. |
| 0.8 | 19/03/02 | Dirk Grobler | Dropped the Merged Format to reduce complexity. Reintroduced the default node-type for set elements to ensure backward compatibility with the existing format. |
| 0.9 | 19/04/02 | Dirk Grobler | Proof reading |
| 0.9.1 | 28/04/02 | Dirk Grobler | Any datatype added for backward compatibility with old config format. |
| 0.9.2 | 06/05/02 | Dirk Grobler | Update format uses know only oor:node for referencing nodes in the schema. This handling is less error-prone and simpler to understand. |
| 0.9.3 | 25/07/02 | Dirk Grobler | Enriched the component schema by adding versioning and new info elements like author and a deprecated flag. |
| 0.9.4 | 11/20/02 | Joerg Barfurth | Dropped oor:context from Update format; instead now always using oor:package. Descrption adjusted for packages and the update format root node. |
| 0.9.5 | 02/14/03 | Joerg Barfurth | No xsi:nil in schema. Many editorial changes. Added future directions. Updated all schemas to current OOo state. |
| 0.9.6 | 05/22/03 | Joerg Barfurth | Renamed update format root element to component-data (for namespace-correctness); removed spurious nillable attributes from schemas. |
| 0.9.7 | 10-02-04 | Joerg Barfurth | Formatting and typos corrected. Eliminated preformatted lines of excessive length. |
| 0.9.8 | 10-02-04 | Joerg Barfurth | Misplaced 'oor:' prefixes in examples corrected. |
| 0.9.9 | 10-02-04 | Stephan Bergmann | Introduced oor:op="fuse". |
Introduction
There are plenty of file formats and protocols for storing and handling configuration data. There are industry standards like LDAP, binary registry formats, APIs like the JAVA Preferences API and many more. They are all based on the concept of storing key-value pairs and provide a hierarchy to organize these atomic entries.
It is not the intention of reinventing the wheel and providing yet another configuration format, instead of reusing an existing one. The intention is rather to have a format which is compatible to existing standards or allows, at least, an easy mapping to existing formats and also meets the requirements for the OpenOffice.org applications in their different environments. These requirements include:
- Availability on all supported platforms of OpenOffice.org,
- Capability of efficient storing and retrieval of thousands of configuration key-value pairs,
- Support for multiple backends, e.g. file-based or LDAP,
- Support for multiple layers with merging capabilities of default and user-defined settings,
- Human readable, which is important for product support,
- Easy to define and use for application developers.
The targeted audience for this document are application developers and architects, who need to know how to describe and compile an application configuration schema with OOR. Therefore this document is designed more like a Programmer's manual than a functional specification. After providing some background by describing the design principles in the first section, the following sections describe the concepts used by means of an example illustrating most of the facets of the registry document format. The appendices contain the XMLSchema definitions for the OOR format(s), which can be viewed as a reference specification.
Conceptual Framework
The OpenOffice.org Registry format is an XML based meta format. The format is divided into two sub-formats. One of the sub-formats is the Registry Component Schema Format. It defines reusable node types called Templates, and a default configuration hierarchy. The other one is the Registry Update Format, which is used to specify difference and store updates relative to a tree. The full meaning of such an update document only be discovered relative to a configuration schema. The schema document is specified in a way, that it can be provided by the developer or author of the schema and be used unchanged in any deployment. All things that vary between products, localizations, installations or users are specified in layer documents which employ the update format. There also is a virtual third sub-format, which can be used to describe the results of a merging process applied to a configuration schema and several layers of updates. This format is called the Registry Merged Format. It is virtual in that the XML Schema for this is not documented and there are currently no use cases where this format would be required. But if a means to store or transport merged configuration hierarchies is required, such a format can be constructed from the building blocks the current formats provide. This section provides a high-level description of the registry object model, which is the basic conceptual model for the registry document format, and of the OOR sub-formats themselves, which are derived from that model. The following table lists the XML namespaces used by the OOR format and their prefixes.
| Prefix | Description | Namespace |
|---|---|---|
| oor | For elements and attributes, that are particular to the OOR formats. | http://openoffice.org/2001/registry |
| xs | For elements and attributes, which are reused from the XMLSchema definition. | http://www.w3.org/2001/XMLSchema |
| xsi | For elements and attributes which are reused from the XMLSchema instance
definition. These elements and attributes are used only in the update format. |
http://www.w3.org/2001/XMLSchema-instance |
According to the schema definition for OOR, only root elements MUST have a namespace qualifier. All inner (local) elements don't use a qualifier as they are qualified within their context. Throughout the documentation, elements and attributes specified by OOR are not prefixed with the namespace qualifier. Only elements imported from other namespaces are qualified.
Registry Object Model
The Registry Object Model describes a hierarchical data structure. It offers two kinds of elements. On the one hand there are nodes, which combine related elements into logical groupings. On the other hand there are properties, which hold the actual data values. Nodes are the inner elements of the tree, while properties are the leaves of the tree.
All elements have a well-defined type. The type of a property corresponds directly to the type of data it can hold, while the type of a node depends (recursively) on the types of the child nodes and properties it contains and the way those are combined. A node type may be described in the schema as a separate named entity, called a template, or it may be implicit in the definition of a node. Templates allow reusing a type in multiple places in the schema and dynamic creation of nodes of a given type. The following kinds of elements can be used to build a configuration schema:
Properties
Properties, specified by <prop>tags, hold the actual data values. They must have one of a number of supported data types. The following basic data-types are supported:
| xs:string | Plain Text (Sequence of [printable] Unicode characters) |
| xs:boolean | Boolean value (true/false) |
| xs:short | 16 - bit integer number |
| xs:int | 32 - bit integer number |
| xs:long | 64 - bit integer number |
| xs:double | floating point number (value range as for IEEE 64-bit double) |
| xs:hexBinary | Sequence of uninterpreted octets, hex encoded |
Please note that xs:hexBinary values should be used only for small chunks of data (< 256 Byte) that cannot easily be represented otherwise or stored elsewhere. The configuration service is not optimized to handle large BLOBs efficiently. Instead it is recommended to store links (e.g. URLs) to greater chunks of binary data. For example a small icon can be stored in the configuration, but a larger image or an entire icon suite is better stored elsewhere.
Also supported are lists (ordered sequences) of each of the basic types. [NOTE: This means that the lists must be homogeneous – mixed lists are not supported]. The configuration treats lists as atomic data-types -- there is no support for accessing lists element-wise or merging the contents of lists.
List item values are generally separated by whitespace. This is a natural separator, which is used for XMLSchema list types as well. This works well for numeric or boolean types. For lists of strings or binary values this separator can be a problem, if the list contains zero-length values or strings that contain whitespace themselves. Think, for example, of a list of continents like 'Europe Africa South America'; here the whitespace separation doesn't work, as 'South America' itself contains a whitespace character. You can resolve this issue by specifying a separator attribute for each value tag of the property. The list of continents then might be separated by comma: 'Europe,Africa,South America'.
In addition, a property may be characterized as nillable (or not nillable). If it is nillable, it may assume the special value NIL, which indicates the absence of any particular value. NIL is different from any legal value. In particular, a string/list/binary property having zero length is not NIL. Nillable properties are sometimes also called optional. By default, each property is nillable. The schema may also provide a default value for a property. The default value must be of the appropriate data-type and should fulfill the constraints. A default value is not required, even for properties the are not nillable.
An additional data-type oor:any can be used within the schema (particularly within templates). A property of this type may not have a default value. In a layer such a property can be given a non-NULL value of any of the types enumerated above. To support internationalization, properties may be marked localized in the schema. Localized properties (and only localized properties) may assume different values for different locales. This is particularly important for text strings intended for UI display, but may apply to other settings as well. The locale is one of the parameters that is used to select a configuration. Only one language-neutral default value can be provided for a localized property. Locale-specific standard values should be provided in an appropriate layer.
Group-Nodes
Group-Nodes - their element tag in the schema is <group> - are the basic building blocks for organizing related data items. A top-level Component-Node (see below) is a special kind of group-node. A group-node groups together a number of child nodes and a list of properties. The child nodes and properties (sometimes collectively called members) are identified by their names. The type of a group-node is determined by the number of children and properties within the group, their names and their types. Member names must be unique within a group. Each member property may be of a different type, but that type is fixed by the schema and cannot change (unless the schema specifies type any). To change a group-node means to change one of its members. Any kind of node can be a member of a group-node. By nesting groups within groups within groups and so on, a fixed hierarchical data structure can be described.
A group may be marked as extensible. The list of properties in an extensible group can be extended with new properties in a layer. This is useful in situations, where you need to have objects that may have additional characteristics at runtime represented by nodes in a registry layer. An extensible group allows adding additional properties to a node in a layer. It is also possible to remove those settings later in the layer were they were added. Properties declared in the schema cannot be removed. Otherwise dynamically added properties behave as if defined in the schema as nillable, non-localized property of type any.
Set-Nodes
Set-Nodes – using schema element tag <set> - provide a way to describe dynamic parts of the configuration tree. New nodes can be added to and removed from a set in a layer. Thus a set-node is a container of node items. The type of the node items is provided by a node-type attribute or as list of <item> elements, where each item defines a possible node-type. The node-type is a reference to a template of that name in a component schema. A reference to a different component schema is effected by supplying a component attribute that supplies the fully qualified component name. Otherwise the reference is to a template in the same component schema. The items contained in a set are identified by their name. The name must be unique within the set. The type of the set node is determined by its node-type or its list of item node-types alone. The number and names of child nodes may change dynamically in layers. No actual children may be given in the schema.
A set can be changed by removing existing nodes or by inserting new nodes. Nodes to be inserted must conform with one of the allowed item types specified for the container.
The node-type attribute for the set is required even when further items are defined and specifies a default type for an item. Items of that type don't need to specify it in the layer where they are added. Items of a type other than the default type need to specify theit node type in the layer where they are first added. Sets may be used to build recursive data structures, if their node-type directly or indirectly contains a set supporting the same node-type. Like group-nodes, sets can be declared as extensible, which allows adding (dynamic) properties in layers.
Generic Nodes [This feature is planned as an extension, but not implemented yet]
Generic Nodes – using schema element tag <node> - provide a way to describe parts of the configuration tree, that are not controlled by a schema. New nodes and properties can be freely added to and removed from a generic node. Child nodes of a generic node are generic nodes themselves. A predefined hierarchy of generic nodes with some properties can be given in the schema. These nodes will be marked as mandatory (non-removable) in the merged tree.
Functionally a generic node can be simulated by a template type which is a set that has itself as item-type and is extensible (allows adding properties). Only the ability to define a skeleton hierarchy with predefined, typed properties in the schema is a new feature. Generic nodes are needed to interoperate with other configuration systems that have less strict rules for schema usage. For that use case it is also helpful, to have this type as a builtin feature, rather than having to rely on an explicite template.
Component-Nodes
At the outermost level the configuration is divided into components. A component is a collection of configuration data, that may be installed or used independently of other components. Often a component is associated with a particular software component, module or product. Some components may be intended to be shared between several cooperating pieces of software.
A component is characterized by a component configuration schema, also called component schema. The component schema describes a single hierarchy of component specific settings. The root node of this hierarchy is called the component node. The component schema also contains the set of node templates of the component. A component schema may depend upon another component schema. Currently, this dependency can either be purely semantic, i.e., a client accessing settings of a particular component schema regularly needs access to another component schema as well or it can be utilized in the component schema to import and (re)use node templates from another component schema. These dependency relationships must not be circular. If a dependency exists of one component schema on another, then the latter is required to be installed when the dependent schema is installed.
Within the object model, a component-node is a special, non-extensible group-node. It can act only as root node of the whole component configuration hierarchy. When generic nodes will be introduced, there will also be a way to construct generic components, i.e. whose component-node is generic.
Packages
Components contain the settings for a part of an application. The sum of all component settings is called the application or system registry. Within the registry the components are organized into packages. Each package may contain several components and sub-packages. This concept is well known in other areas like JAVA and UNO. On a file system, a package might be represented by a folder and a component by a single OOR xml file. Packages form the outer hierarchy of components. A package name and a local subpackage names are combined using a dot ('.') to obtain the full name of the subpackage. A component name and the name of the package it belongs to are similarly joined to form the fully qualified component name (FQCN). For example package=org.openoffice.Office and name=DataAccess yield the FQCN component=org.openoffice.Office.DataAccess.
Registry Document Types
OOR offers two different kinds of formats, the Registry Component Schema Format (xcs) and the Registry Update Format (xcu). The first format serves as configuration definition format, while the latter one is intended to store instances of configuration data. Note: 'xcs' and 'xcu' are the default file extensions assigned to the formats.
Registry Component Schema Format
The Registry Component Schema Format is a meta format for defining the configuration hierarchy, reusable node types and key value-pairs called properties for a single component or module. Properties may have default values assigned by the schema. In addition, it is possible to provide documentation for each building block (element) of the hierarchy and to set constraints on properties. In a layered view of the registry, the component schema can be regarded as immutable base layer, providing the skeleton of the hierarchy with some default settings. Any kind of dynamic or installation-dependent data, like localized values or items of a set are not part of the schema. Defaults for such data cen be provided in an additional layer document, which uses the Registry Update Format described in the next section.
Registry Update Format
One design goal of OOR is to enable the storage of configuration settings in several layers. A cluster of configuration settings in a layer is also called preferences. Different layers may define global defaults, installation-specific settings, group preferences or policies and individual user preferences.
A typical example is the OpenOffice.org application itself, which supports a multi-user installation. All default settings (the default layer) are stored in a shared folder, often on a network server, which is available to all users of the installation. The user preferences are stored in a separate user folder (user layer) in the user's home directory on on their workstation. Such layers are stored using the update format, which contains only those settings which differ, are new or hidden compared to a default configuration.
When the application reads settings out of the registry on behalf of a user, the settings from the default and user layers are merged by applying the differences stored in the user layer to the default data obtained from the default layer and the schema. A single merged tree is then passed to the application. Any modifications done by the user to this merged tree are translated into changes to the user layer that affect the merged tree in the desired way. A user is also able to reset settings to default settings, which means that settingsare removed from the user layer so that the corresponding default settings are visible again. This way of storing and merging configuration data as differences is efficient in terms of the overall data size stored for an individual user. Another benefit can be found on the administration side. Changing a setting in the default layer will automatically take effect for all users that have not overwritten the settings with their own preferences.
Another difference compared to the Registry Component Schema Format is the nature of the data stored in the Registry Update Format. While the schema provides a set of type definitions and a fixed data hierarchy, the update format contains dynamic data, which can expand the hierarchy (set items) in each layer. One special use of layers is that they can contain value that are adjusted (e.g. translated) for different locales.