You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Function:

Automatic update of configuration

Where to Use?

Everywhere: locations, locationSets, location DBF and attribute files

Why to Use?

To let the system be updated by other maintenance programs.

Description:

Functionality to automatically import and process regional configuration changes in locations, locationSets, location DBF and attribute files

Available since:

DelftFEWS2008.01, update in 2009.01 (DBF, maplayers)

Contents

Overview

To be able to have other programs that maintain the list locations, locationSets etc, it is possible to import configuration changes through an import that imports update script files.
The configuration update works like a regular data import. There is a moduleinstance that imports PI update script files from an import directory. The script file contains options for the next possible configuration updates:

  • addLocation: Add location to the Locations file.
  • addLocationSetItem: Add an existing location to a location set. Also adds location information to linked IdMaps and ValidationRuleSets.
  • removeLocationSetItem: Remove a location from a location set. The location information is also removed from linked IdMaps and ValidationRuleSets.
  • editLocation: Edit an already existing location in the Locations file.
  • editLocationSetItem: Edit linked information for a location that is already present in the locationSet.
  • importRatingCurves: Import rating curves from xml file(s) in the FEWS rating curves format. The imported rating curves are added to the ratingCurves xml file in the RegionConfigFiles directory. If a rating curve with the same ratingCurveId as an existing rating curve is imported, then the existing rating curve will be replaced.
  • importMapLayerFiles: Import dbf files that contain location attributes. The imported dbf files are put into the mapLayerFiles configuration directory. This only works for dbf files for which an older version is already present in the configuration. If the dbf files to import would make the configuration invalid, then an error is logged and none of the dbf files will be imported.

ConfigManager

This functionality only works for configurations that are distributed through the database via the Config Manager.

Configuration

Configuration Update Script ModuleConfigFile

See the schema of the import moduleinstance at configUpdateScriptConfig.xsd

The config file is very simple:

ConfigUpdate.xml
<?xml version="1.0" encoding="UTF-8"?>
<configUpdateScriptConfig 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.wldelft.nl/fews" 
    xsi:schemaLocation="http://www.wldelft.nl/fews 
                    http://fews.wldelft.nl/schemas/version1.0/configUpdateScriptConfig.xsd">

  <versionIncrement>0.1</versionIncrement>
  <scriptDirectory>$IMPORT_FOLDER$/ConfigUpdate</scriptDirectory>
  <failedDirectory>$IMPORT_FAILED_FOLDER$/ConfigUpdate</failedDirectory>
</configUpdateScriptConfig>

versionIncrement = Number to increment configuration file version with. Note that the increment should be zero in case no version numbers are used in the config files.
scriptDirectory = Location of script files to be imported.
failedDirectory = Files that could not be imported due to an error are copied to this directory.
backupDirectory = Successfully imported files are moved to this directory.

PI Configuration Update Script

In the import directory the configuration update script files should be available. See the schema of the import moduleinstance at pi_configupdatescript.xsd

PI_UpdateScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<configUpdateScript version="1.2" 
   xsi:schemaLocation="http://www.wldelft.nl/fews/PI 
                      http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_configupdatescript.xsd"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews/PI">
   <updateCommand>
     <importMapLayerFiles>
	<importPath></importPath>
     </importMapLayerFiles>
   </updateCommand>

.... or

  <updateCommand>
    <addLocation>
      <location id="loc2" name="loc2">
        <description>description</description>
        <shortName>short</shortName>
        <toolTip>new location</toolTip>
        <x>1</x>
        <y>2</y>
        <z>3</z>
      </location>
    </addLocation>
  </updateCommand>

.... or

  <updateCommand>
    <addLocationSetItem locationId="loc2" locationSetId="Boezem_Poldergemaal_H.meting">
      <idMapData idMapId="IdImportCAW" internalParameterId="H.meting" externalLocationId="C-new-ext" externalParameterId="P-new-ext"/>
      <validationRuleData parameterId="H.meting" hardMax="150" hardMin="-10" rateOfRise="10" rateOfFall="-10"/>
    </addLocationSetItem>
  </updateCommand>

</configUpdateScript>

Note that the importPath is relative to the location of the PI script file.

Sample input and output

Not available

Error and warning messages

Description of errors and warnings that may be generated

Error:

Error message

Action:

Action to fix

Known issues

None

Related modules and documentation

None

Technical reference

Entry in moduleDescriptors:

Specification of: ENTRY and DESCRIPTION in the SystemConfigFiles\ModuleDescriptors.xml

  <moduleDescriptor id="ConfigUpdateScript">
    <className>nl.wldelft.fews.system.plugin.configupdatescript.ConfigUpdateScript</className>
  </moduleDescriptor>
  • No labels