Configuring data service provider |
SuperMap iServer supports the following types of data service providers:
Configure a local data service provider as illustrated below:
<provider name="ugcDataProvider1" class="com.supermap.services.providers.UGCDataProvider"> <config class="com.supermap.services.providers.UGCDataProviderSetting"> <workspacePath>../../samples/data/World/World.sxwu</workspacePath> <excludedFieldsInDatasources> <com.supermap.services.providers.ExcludedFieldsInDatasource> <dataSourceName>World</dataSourceName> <!-- Set exclusion fields --> <excludedFieldsInDatasets> <com.supermap.services.providers.ExcludedFieldsInDataset> <datasetName>Countries</datasetName> <excludedFields>SMID,SmUserID</excludedFields> </com.supermap.services.providers.ExcludedFieldsInDataset> </excludedFieldsInDatasets> <com.supermap.services.providers.ExcludedFieldsInDatasource> </excludedFieldsInDatasources> <!-- Delayed commit configuration --> <dataProviderDelayCommitSetting> <enabled>false</enabled> <logEntireErrorMsg>true</logEntireErrorMsg> <dayOfWeek>1,2,3,4,5,6,7</dayOfWeek> <hour>3</hour> <minute>0</minute> <commitMode>SPECIFICTIME</commitMode> <countToCommit>1000</countToCommit> <updateInterval>300</updateInterval> <cachePath>/output</cachePath> </dataProviderDelayCommitSetting> <!-- Set the info of the datasources and datasets to be published --> <datasourceInfos> <com.supermap.services.providers.FilteredDatasourceInfo> <datasourceName>China</datasourceName> <includedDatasetNames> <string>World_Continent_pg</string> <string>Island_B_pg</string> <string>World_Ocean_txt</string> </includedDatasetNames> </com.supermap.services.providers.FilteredDatasourceInfo> </datasourceInfos> </config> </provider>
Where the class in <provider> identifies the implementation class of the local data service provider. The class in <config> identifies the configuration class corresponding to the local data service provider, that is, UGCDataProviderSetting. The contents of <config> are the corresponding configuration items.
<workspacePath>server=../samples/data/World/World.sxwu;password=supermap</workspacePath>In addition, the workspace path supports reading from environment variables and system configuration files. It can be written as:
<workspacePath>server=${datapath1}/World.sxwu;password=supermap</workspacePath>For details, see: Presetting local workspace path
Where, com.supermap.services.providers.ExcludedFieldsInDatasource and com.supermap.services.providers.ExcludedFieldsInDataset are the implementation class for exclusion fields. <dataSourceName> is the name of datasource, <datasetName> is the name of dataset, <excludedFields> is the fields you want to exclude.
a. When the datasource name exists, you need to set:
b. When the datasource name does not exist, you need to set:
Configure a REST data service provider as illustrated below:
<provider name="restMapProvider1" class="com.supermap.services.providers.RESTDataProvider"> <config class="com.supermap.services.providers.RESTDataProviderSetting"> <restServiceRootURL>http://localhost:8090/iserver/services/rest</restServiceRootURL> <token>GsXST0cE0CumxQUFXBX7Oopin4<token> </config> </provider>
Where the class of <provider> identifies the implementation class of the REST data service provider, the class in <config> identifies the configuration class corresponding to the REST data service provider, that is, RestDataProviderSetting, and the contents of <config> are the corresponding configuration items.
Configure a ArcGIS REST feature service provider as illustrated below:
<provider class="com.supermap.services.providers.ArcGISRestDataProvider" enabled="true" name="arcgisRestDataProvider-test"> <config class="com.supermap.services.providers.ArcGISRestDataProviderSetting"> <restServiceRootURL>http://localhost:6080/arcgis/rest/services/SampleWorldCities/FeatureServer</restServiceRootURL> <token>51fda53ceb25478cb37fa059ab013160</token> </config> </provider>
Where the class of <provider> identifies the implementation class of the ArcGIS REST feature service provider, the class of <config> identifies the ArcGISRestDataProviderSetting, and the content of <config> is its corresponding configuring items:
Configure a WFS data service provider as illustrated below:
<provider class="com.supermap.services.providers.WFSDataProvider" enabled="true" name="wfsDataProvider-test"> <config class="com.supermap.services.providers.WFSDataProviderSetting"> <serviceRootURL>http://localhost:8090/iserver/services/data-world/wfs100/utf-8</serviceURL> </config> </provider>
Where the class of <provider> identifies the implementation class of the REST data service provider, the class of <config> identifies the WFSDataProviderSetting, and the content of <config> is its corresponding configuring items:
Configure a GeoPackage data service provider, as shown below:
<provider class="com.supermap.services.providers.GeoPackageDataProvider" enabled="true" name="gpkgData-samplevectors"> <config class="com.supermap.services.providers.GeoPackageDataProviderSetting"> <filePath>../../samples/sample_vectors.gpkg</filePath> </config> </provider>
Where the class of <provider> identifies the implementation class of GeoPackage data service provider, the class of <config> identifies the configuration class corresponding to GeoPackage data service provider, namely the contents in GeoPackageDataProviderSetting correspond to the contents in GeoPackageDataProviderSetting.
The configuration of a Shape data service provider is shown below:
<provider class="com.supermap.services.providers.ShapeFileDataProvider" enabled="true" name="ShapedataProvider-"> <config class="com.supermap.services.providers.ShapeFileDataProviderSetting"> <shpDir>E:/supermap/data/shp</shpDir> <charset>UTF-8</charset> </config> </provider>
The class attribute in <provider> represents the implementation class of the Shape data service provider, the class attribute in the <config> represents the configuration class of Shape data service provider, that is ShapeFileDataProviderSetting, and the contents of <config> are the configuration items of ShapeFileDataProviderSetting as follows:
The configuration of a PostGIS data service provider is shown below:
<provider class="com.supermap.services.providers.PostgisDataProvider" enabled="true" name="data-postGIS"> <config class="com.supermap.services.providers.PostgisDataProviderSetting"> <dbType>postgis</dbType> <host>192.168.17.212</host> <port>5432</port> <database>postGIS</database> <user>postgres</user> <passwd>iserver</passwd> </config> </provider>
The class attribute in <provider> represents the implementation class of the PostGIS data service provider, the class attribute in the <config> represents the configuration class of PostGIS data service provider, that is PostgisDataProviderSetting, and the contents of <config> are the configuration items of PostgisDataProviderSetting as follows:
The configuration of a HBase data service provider is shown below:
<provider class="com.supermap.services.providers.HBaseDataProvider" enabled="true" name="data-hbase"> <config class="com.supermap.services.providers.HBaseDataProviderSetting"> <maxFeatures>1000</maxFeatures> <catalog>hbase</catalog> <zookeepers>localhost:2181</zookeepers> </config> </provider>
The class attribute in <provider> represents the implementation class of the HBase data service provider, the class attribute in the <config> represents the configuration class of HBase data service provider, that is HBaseDataProviderSetting, and the contents of <config> are the configuration items of HBaseDataProviderSetting as follows: