Overview
The DataWare import function (<importType>DataWare</importType>) imports data from REST services that return XML content.
The REST Service URLs look as follows http://servername:portnumber/rest/read/data/parameter/startdate/enddate/location
Configuring the Import
To make the importer known to FEWS, the import module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:
<?xml version="1.0" encoding="UTF-8"?> <moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0"> ... <moduleInstanceDescriptor id="ImportDataWare"> <moduleId>TimeSeriesImportRun</moduleId> </moduleInstanceDescriptor> ... </moduleInstanceDescriptors>
An example of the DataWare import configuration will be given here. The importType is named DataWare which should be configured in the general section of the import. De URL to the rest service should be configured here as well. The actual data to be retrieved can be tuned by adding setting the relativeViewPeriod and the timeSeries to specify the locations and parameters. N.B.: the used parameters and locations have to be specified in the Parameters.xml and Locations.xml config.
TimeZone is assumed to be configured in the general section, otherwise GMT is assumed.
<?xml version="1.0" encoding="UTF-8"?> <timeSeriesImportRun xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd"> <import> <general> <importType>DataWare</importType> <serverUrl>http://server:port/rest/read/data/</serverUrl> <relativeViewPeriod unit="day" start="-1" end="0" startOverrulable="true" endOverrulable="true"/> <importTimeZone> <timeZoneName>GMT-5</timeZoneName> </importTimeZone> </general> <timeSeriesSet> <moduleInstanceId>ImportDataWare</moduleInstanceId> <valueType>scalar</valueType> <parameterId>19839</parameterId> <locationId>1ha</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="nonequidistant" /> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> <timeSeriesSet> <moduleInstanceId>ImportDataWare</moduleInstanceId> <valueType>scalar</valueType> <parameterId>19840</parameterId> <locationId>1ha</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="nonequidistant" /> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> <timeSeriesSet> <moduleInstanceId>ImportDataWare</moduleInstanceId> <valueType>scalar</valueType> <parameterId>19839</parameterId> <locationId>2ha</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="nonequidistant" /> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> <timeSeriesSet> <moduleInstanceId>ImportDataWare</moduleInstanceId> <valueType>scalar</valueType> <parameterId>19840</parameterId> <locationId>2ha</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="nonequidistant" /> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> </import> </timeSeriesImportRun>
The previous configuration will result in the following 4 REST urls being used:
http://server:port/rest/read/data/19839/2015-01-04/2015-01-05/1ha http://server:port/rest/read/data/19839/2015-01-04/2015-01-05/1ha http://server:port/rest/read/data/19840/2015-01-04/2015-01-05/2ha http://server:port/rest/read/data/19840/2015-01-04/2015-01-05/2ha
Example XML response from DataWare service
<ArrayOfData xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Data><Key>19839</Key><Time>2014-11-01 00:00:00.000</Time><Value>58.2457</Value><Quality>29</Quality></Data> ...