Configuring service |
All services of SuperMap iServer are configured through the configuration file. For details, see: iServer configuration file instruction. The domain services are custom service, so the configuration information of the component need to be added in iserver-services.xml.
This section implemented a new service interface and uses dependency injection method; therefore, a service interface node needs to be configured in the interface configuration file, and the service component configuration also needs to be modified. Below shows how to configure each item:
Modify the Temperature component node and set interfaceNames as "temperatureInterface":
<!-- Temperature component -->
<component name="Temperature" class="com.supermap.sample.temperature.Temperature" providers="TemperatureProviderset" interfaceNames="temperatureInterface">
<config class="com.supermap.sample.temperature.TemperatureParam">
<mapName>China</mapName>
</config>
</component>
Configure the providerSet node as follows:
<!-- Temperature providerSet -->
<providerSet name="TemperatureProviderset">
<provider-reference name="ugcMapProvider-China400" enabled="true"></provider-reference>
<provider-reference name="temperatureProvider" enabled="true"></provider-reference>
</providerSet>
Configure temperatureProvider. ugcMapProvider-China400 has been configured in iserver-services-samples.xml by default.
<!-- Temperature Provider-->
<provider name="temperatureProvider" class="com.supermap.sample.temperature.TemperatureProvider">
<config class="com.supermap.sample.temperature.FileSetting">
<filePath>../Temperature.txt</filePath>
</config>
</provider>
According to above configuration, place the Temperature.txt file in %SuperMap iServer_HOME% folder.
Add an interface node to the iserver-services-interfaces.xml file as follows:
<!--Temperature Interface-->
<interface name="temperatureInterface" class="com.supermap.sample.temperature.TemperatureServlet">
</interface>