Configuration schema path settings

From Apache OpenOffice Wiki
Jump to: navigation, search

New schema

The code below is taken from the schema (xcs) file for path settings (Paths.xcs). A schema defines a pattern that can be used and reused for configuration settings in data (xcu) files.

Paths.xcs

<?xml version='1.0' encoding='UTF-8'?>
 
<oor:component-schema
	oor:name="Paths"
	oor:package="org.openoffice.Office"
	xml:lang="en-US"
	xmlns:oor="http://openoffice.org/2001/registry"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
<templates>
 
	<group oor:name="MultiPath">
		<prop oor:name="Unused" oor:type="xs:string" />
	</group>
 
	<group oor:name="NamedPath">
		<set  oor:name="InternalPaths" oor:node-type="MultiPath"  />
		<prop oor:name="UserPaths"     oor:type="oor:string-list" />
		<prop oor:name="WritePath"     oor:type="xs:string"       />
	</group>
 
</templates>
 
<component>
	<set oor:name="Paths" oor:node-type="NamedPath" />
</component>
 
</oor:component-schema>

The schema contains a "templates" section where the elements and their types are defined. A "group" defines a structure, a fixed combination of elements with their own type (that could be group also). A "prop" defines an element with an elementary or a list type. A list is a non-extendable array of elements. As all configuration entries it can be overwritten in a "higher" layer of the configuration but it can't be extended. The "set" type can be seen as an extendable array, though the elements are not accessed by index but by name.

Data based on new schema

Here's an excerpt of the corresponding data (Paths.xcu) taken from an OOo2.0.4 installation:

Paths.xcu

<?xml version='1.0' encoding='UTF-8'?>
 
<oor:component-data oor:name="Paths" oor:package="org.openoffice.Office" 
    xmlns:install="http://openoffice.org/2004/installation" 
    xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <node oor:name="Paths">
                <node oor:name="Temp" oor:op="fuse" oor:mandatory="true">
                        <prop oor:name="IsSinglePath" oor:finalized="true">
                                <value>true</value>
                        </prop>
                        <node oor:name="InternalPaths" oor:finalized="true"/>
                        <prop oor:name="UserPaths" oor:finalized="true"/>
                        <prop oor:name="WritePath">
                                <value>$(temp)</value>
                        </prop>
                </node>
                <node oor:name="Template" oor:op="fuse" oor:mandatory="true">
                        <node oor:name="InternalPaths">
                                <node oor:name="$(insturl)/share/template/$(vlang)" oor:op="fuse"/>
                        </node>
                        <prop oor:name="WritePath">
                                <value>$(userurl)/template</value>
                        </prop>
                </node>
        </node>
</oor:component-data>

The "Temp" path setting is a "SinglePath" setting and so only the "WritePath" value can be changed, the other elements are fixed and empty. The "Template" path setting allows to add new folders into the "UserPaths" that replace the old setting in the Common.xcu. This is where any changes in the Path Options dialog go (see below). The "WritePath" is the folder that can be used by OpenOffice.org to place something it. The "InternalPaths" element contains all folders that may contain something and can't be changed by the users, but they can be extended by UNO packages.

The old schema shown below contains an entry for each and every path setting. If a new path setting should be added the schema needs to be changed. Moreover, the template needs to be changed what makes the change incompatible. In the new schema it is easy to add a new path setting as the set of path settings itself is extendable.

Old schema

Common.xcs

<?xml version='1.0' encoding='UTF-8'?>
 
<oor:component-schema 
        oor:name="Common" 
        oor:package="org.openoffice.Office" 
        xml:lang="en-US" xmlns:oor="http://openoffice.org/2001/registry" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
<templates>
 
        <group oor:name="Path">
 
                <group oor:name="Current">
                        <prop oor:name="OfficeInstall" oor:type="xs:string"/>
                        <prop oor:name="OfficeInstallURL" oor:type="xs:string"/>
                        <prop oor:name="Addin" oor:type="xs:string"/>
                        <prop oor:name="AutoCorrect" oor:type="oor:string-list"/>
                        <prop oor:name="AutoText" oor:type="oor:string-list"/>
                        <prop oor:name="Backup" oor:type="xs:string"/>
                        <prop oor:name="Basic" oor:type="oor:string-list"/>
                        <prop oor:name="Bitmap" oor:type="xs:string"/>
                        <prop oor:name="Config" oor:type="xs:string"/>
                        <prop oor:name="Dictionary" oor:type="xs:string"/>
                        <prop oor:name="Favorite" oor:type="xs:string"/>
                        <prop oor:name="Filter" oor:type="xs:string"/>
                        <prop oor:name="Gallery" oor:type="oor:string-list"/>
                        <prop oor:name="Graphic" oor:type="xs:string"/>
                        <prop oor:name="Help" oor:type="xs:string"/>
                        <prop oor:name="Linguistic" oor:type="xs:string"/>
                        <prop oor:name="Module" oor:type="xs:string"/>
                        <prop oor:name="Palette" oor:type="xs:string"/>
                        <prop oor:name="Plugin" oor:type="oor:string-list"/>
                        <prop oor:name="Storage" oor:type="xs:string"/>
                        <prop oor:name="Temp" oor:type="xs:string"/>
                        <prop oor:name="Template" oor:type="oor:string-list"/>
                        <prop oor:name="UIConfig" oor:type="oor:string-list"/>
                        <prop oor:name="UserConfig" oor:type="xs:string"/>
                        <prop oor:name="UserDictionary" oor:type="xs:string"/>
                        <prop oor:name="Work" oor:type="xs:string"/>
                </group>
 
                <group oor:name="Default">
                        <prop oor:name="OfficeInstall" oor:type="xs:string"/>
                        <prop oor:name="OfficeInstallURL" oor:type="xs:string"/>
                        <prop oor:name="Addin" oor:type="xs:string"/>
                        <prop oor:name="AutoCorrect" oor:type="oor:string-list"/>
                        <prop oor:name="AutoText" oor:type="oor:string-list"/>
                        <prop oor:name="Backup" oor:type="xs:string"/>
                        <prop oor:name="Basic" oor:type="oor:string-list"/>
                        <prop oor:name="Bitmap" oor:type="xs:string"/>
                        <prop oor:name="Config" oor:type="xs:string"/>
                        <prop oor:name="Dictionary" oor:type="xs:string"/>
                        <prop oor:name="Favorite" oor:type="xs:string"/>
                        <prop oor:name="Filter" oor:type="xs:string"/>
                        <prop oor:name="Gallery" oor:type="oor:string-list"/>
                        <prop oor:name="Graphic" oor:type="xs:string"/>
                        <prop oor:name="Help" oor:type="xs:string"/>
                        <prop oor:name="Linguistic" oor:type="xs:string"/>
                        <prop oor:name="Module" oor:type="xs:string"/>
                        <prop oor:name="Palette" oor:type="xs:string"/>
                        <prop oor:name="Plugin" oor:type="oor:string-list"/>
                        <prop oor:name="Storage" oor:type="xs:string"/>
                        <prop oor:name="Temp" oor:type="xs:string"/>
                        <prop oor:name="Template" oor:type="oor:string-list"/>
                        <prop oor:name="UIConfig" oor:type="oor:string-list"/>
                        <prop oor:name="UserConfig" oor:type="xs:string"/>
                        <prop oor:name="UserDictionary" oor:type="xs:string"/>
                        <prop oor:name="Work" oor:type="xs:string"/>
                </group>
        </group>
 
</templates>
 
<component>
        <group oor:name="Path">
                <group oor:name="Current">
                        <prop oor:name="OfficeInstall" oor:type="xs:string"/>
                        <prop oor:name="OfficeInstallURL" oor:type="xs:string"/>
                        <prop oor:name="Addin" oor:type="xs:string"/>
                        <prop oor:name="AutoCorrect" oor:type="oor:string-list"/>
                        <prop oor:name="AutoText" oor:type="oor:string-list"/>
                        <prop oor:name="Backup" oor:type="xs:string"/>
                        <prop oor:name="Basic" oor:type="oor:string-list"/>
                        <prop oor:name="Bitmap" oor:type="xs:string"/>
                        <prop oor:name="Config" oor:type="xs:string"/>
                        <prop oor:name="Dictionary" oor:type="xs:string"/>
                        <prop oor:name="Favorite" oor:type="xs:string"/>
                        <prop oor:name="Filter" oor:type="xs:string"/>
                        <prop oor:name="Gallery" oor:type="oor:string-list"/>
                        <prop oor:name="Graphic" oor:type="xs:string"/>
                        <prop oor:name="Help" oor:type="xs:string"/>
                        <prop oor:name="Linguistic" oor:type="xs:string"/>
                        <prop oor:name="Module" oor:type="xs:string"/>
                        <prop oor:name="Palette" oor:type="xs:string"/>
                        <prop oor:name="Plugin" oor:type="oor:string-list"/>
                        <prop oor:name="Storage" oor:type="xs:string"/>
                        <prop oor:name="Temp" oor:type="xs:string"/>
                        <prop oor:name="Template" oor:type="oor:string-list"/>
                        <prop oor:name="UIConfig" oor:type="oor:string-list"/>
                        <prop oor:name="UserConfig" oor:type="xs:string"/>
                        <prop oor:name="UserDictionary" oor:type="xs:string"/>
                        <prop oor:name="Work" oor:type="xs:string"/>
                </group>
 
                <group oor:name="Default">
                        <prop oor:name="OfficeInstall" oor:type="xs:string"/>
                        <prop oor:name="OfficeInstallURL" oor:type="xs:string"/>
                        <prop oor:name="Addin" oor:type="xs:string"/>
                        <prop oor:name="AutoCorrect" oor:type="oor:string-list"/>
                        <prop oor:name="AutoText" oor:type="oor:string-list"/>
                        <prop oor:name="Backup" oor:type="xs:string"/>
                        <prop oor:name="Basic" oor:type="oor:string-list"/>
                        <prop oor:name="Bitmap" oor:type="xs:string"/>
                        <prop oor:name="Config" oor:type="xs:string"/>
                        <prop oor:name="Dictionary" oor:type="xs:string"/>
                        <prop oor:name="Favorite" oor:type="xs:string"/>
                        <prop oor:name="Filter" oor:type="xs:string"/>
                        <prop oor:name="Gallery" oor:type="oor:string-list"/>
                        <prop oor:name="Graphic" oor:type="xs:string"/>
                        <prop oor:name="Help" oor:type="xs:string"/>
                        <prop oor:name="Linguistic" oor:type="xs:string"/>
                        <prop oor:name="Module" oor:type="xs:string"/>
                        <prop oor:name="Palette" oor:type="xs:string"/>
                        <prop oor:name="Plugin" oor:type="oor:string-list"/>
                        <prop oor:name="Storage" oor:type="xs:string"/>
                        <prop oor:name="Temp" oor:type="xs:string"/>
                        <prop oor:name="Template" oor:type="oor:string-list"/>
                        <prop oor:name="UIConfig" oor:type="oor:string-list"/>
                        <prop oor:name="UserConfig" oor:type="xs:string"/>
                        <prop oor:name="UserDictionary" oor:type="xs:string"/>
                        <prop oor:name="Work" oor:type="xs:string"/>
                </group>
        </group>
 
</component>
 
</oor:component-schema>
Personal tools