Configuring Service Components from an XML File |
The service components combine and encapsulate the functions of different service providers into coarse-grained modules, such as map components and data components. At the same time, it supports assembling one or more service components into a component set to provide services. The service components are configured in the < component > node, and the component set is configured in the < componentSet > node.
Both service components and sets of service components can be combined with service interfaces to provide service instances. Assuming a REST service interface called "rest" has been configured (see: Configuration of Service Interface Layer), in the configuration of the map world component above, the "rest" interface has been bound. Therefore, the URI of the service instance provided by the combination of the map world component and the rest service interface is as follows:
http://<server>:<port>/iserver/services/map-world/rest
http://<server>:<port>/iserver/services/components-rest/rest
They respectively represent the root directory of REST services contained in the map world service component and the root directory of REST services contained in the components rest component set. Through the latter, all REST services contained in the map-world, data-world, 3D-sample, and transportational-sample service components can be accessed.
The service interface type of different service components bindings are not exactly the same. Currently, the correspondence between service components and service interfaces in SuperMap iServer is shown in Table 1 Comparison between service components and service interfaces.
Table 1 Comparison between service components and service interfaces
service component type | service interface type | Predefined service interfaces |
map component (MapImpl) |
REST Interface (RestServlet) ArcGIS REST Interface (AGSRestServlet) Baidu REST Interface (Baidu RestServlet) Google REST Interface (Google RestServlet) WMS Interface (WMSServlet) WMTS Interface (WMTSServlet) |
rest、arcgisrest1、baidurest1、googlerest1 wms111、wms130 wmts100、wmts-china |
data component (DataImpl) |
REST Interface (RestServlet) ArcGIS REST Interface (AGSRestServlet) WFS Interface (WFSSServlet) WCS Interface (WCSServlet) |
rest 、arcgisrest1 wfs100、wfs200 wcs111、wcs112 |
image component (ImageImpl) |
REST/JSR Interface (JaxrsServletForJersey) WMTS Interface (WMTSServlet) |
restjsr,wmts100 |
spatial analyst component (SpatialAnalystImpl) |
REST/JSR interface (JaxrsServletForJersey) WPS Interface (WPS Servlet) |
restjsr wps100 |
transportation analyst component (TransportationAnalystImpl) |
REST Interface (RestServlet) ArcGIS REST Interface (AGSRestServlet) |
rest、arcgisrest1 |
traffic transfer analyst component (TrafficTransferAnalystImpl) |
REST/JSR interface (JaxrsServletForJersey) | restjsr |
3d component (RealspaceImpl) |
REST Interface (RestServlet) | rest |
Three-dimensional network analysis (NetworkAnalyst3DImpl) |
REST/JSR interface (JaxrsServletForJersey) | restjsr |
Spatial modeling service components (GeoprocessorComponent) |
GP Interface (Geoprocess sorServlet) | gpserver |
plot component (PlotImpl) |
REST Interface (RestServlet) | rest |
vector tile component (VectorTileImpl) | ArcGIS REST Interface (AGSRestServlet) |
arcgisrest1 |
address matching component (AddressMatchImpl) |
REST/JSR interface (JaxrsServletForJersey) ArcGIS REST Interface (AGSRestServlet) |
restjsr、arcgisrest1 |
Note 1: iServer advanced and iEdge provide this interface.
The structure of the < component > and < componentSet > in the config file is as follows:
<application> ... <componentSets> ... <componentSet> ... <componentSet/> </componentSets> <components> ... <component> ... <component/> </components> </application>
Example of map component configuration:
<component name="map-china400" class="com.supermap.services.components.impl.MapImpl" interfaceNames="rest,wms111,wms130,wmts100,wmts-china" providers="ugcMapProvider-China400"> <config class="com.supermap.services.components.MapConfig"> <useCache>false</useCache> <tileCacheConfig class="com.supermap.services.tilesource.UGCV5TileSourceInfo"> <datastoretype>TILES</datastoretype>
<type>UGCV5</type> <outputPath>./output/cache</outputPath>
<storageType>Original</storageType> </tileCacheConfig> <vectorTileCacheConfig class="com.supermap.services.tilesource.SVTilesTileSourceInfo"> <datastoretype>TILES</datastoretype> <type>SVTiles</type> </vectorTileCacheConfig> <useVectorTileCache>true</useVectorTileCache> <expired>0</expired> <cacheReadOnly>false</cacheReadOnly> </config> </component>
The class attribute of the <component> node identifies the implementation class of the map component; The providers attribute refers to the collection of service providers used by the map component (see: Configuration at the Service Provider Layer); The interacteName property identifies the service interface bound to the service component, and multiple service interfaces are separated by ",". See: Configuration of Service Interface Layer. The <config> node is the configuration item corresponding to the implementation of this map component, corresponding to the interface configuration class MapConfig. The following parameters are optional::
Please notice:
1. When you need to use the map tile cache capability, it is recommended to configure the map component cache first and set the type to UGCV5.
2. When the tile resampling function is turned on, if you modify the style or data of the original map, the picture returned may be the original one. At this time, you need to manually clean up the cache and browse the picture again,
Example of data component configuration:
<component name="data-world" class="com.supermap.services.components.impl.DataImpl" interfaceNames="rest,wfs100,wfs200,wcs111,wcs112" providers="ugcDataProvider-World"> <config class="com.supermap.services.components.DataConfig"> <editable>true</editable> <cacheStrategyConfig> <maxElementInMemory>100</maxElementInMemory> <timeToLiveSeconds>3</timeToLiveSeconds> <timeToIdleSeconds>3</timeToIdleSeconds> </cacheStrategyConfig> </config> </component>
Among them, the class attribute of the <component> node identifies the component type, corresponding to the implementation class DataImpl, The < config > node is the configuration item corresponding to the Data component, which is the interface configuration class DataConfig. Main parameter description:
< editable> Property, indicating whether it is editable. When editable is true Can be edited when.
< cacheStrategyConfig> Property, indicating the data query cache-related settings:
Example of vector tile component configuration:
<component class="com.supermap.services.components.impl.VectorTileImpl" enabled="true" initPriority="0" instanceCount="0" interfaceNames="arcgisrest" name="vectorTile-China" providers="vectorTile-China"> <config class="com.supermap.services.components.VectorTileConfig"> </config> </component>
Among them, the class attribute of the <component> node identifies the component type, corresponding to the implementation class VectorTileImpl, The < config > node is the configuration item corresponding to the Vector Tile component, which is the interface configuration class VectorTileConfig.
Example of image component configuration:
<component class="com.supermap.services.components.impl.ImageImpl" enabled="true" initPriority="0" instanceCount="0" interfaceNames="wmts100,restjsr" name="imageservice-ChinaImages" providers="imageservice-ChinaImages"> <config class="com.supermap.services.components.ImageConfig"> <editable>false</editable> <downloadable>false</downloadable> </config> </component>
The class attribute of the < component > node identifies the component type and corresponds to the implementation class ImageImpl. The < config > node is the configuration item corresponding to the image component, that is, the interface configuration class ImageConfig. Description of main parameters:
< editable> Property, indicating whether it is editable. When editable is true, it can be edited.
< downloadable> Property, indicating whether the image data asset can be downloaded. When downloadable is true, it can be downloaded.
The < componentSet > node can assemble one or more service components into a service components set. An example of a < componentSet > node is as follows:
<componentSet name="components-rest"> <component-reference name="map-world"></component-reference> <component-reference name="3D-sample"></component-reference> <component-reference name="data-world"></component-reference> <component-reference name="transportationanalyst-sample"></component-reference> </componentSet>
Add a custom component type and configure it in the system config file (iserver-system.xml). The example is as follows:
<component-type alias="SuperMap 自定义服务组件" configClass="com.supermap.services.components.SMConfig"> com.supermap.services.components.impl.SMImpl </component-type>
Wherein the com.supermap.services.components.impl.SMImpl is the implementation class of the user-defined service component type, and the com.supermap.services.components.SMConfig is the configuration class of the user-defined service component type.
The structure of the < component-type > node in the config file is as follows:
<server> <management> … <component-types> … <component-type> … </component-type> </component-types> </management> </server>
Take the data component as an example. The example is as follows:
<component name="data-world" class="com.supermap.services.components.impl.DataImpl" enabled="true" initOnCreate="true" initPriority="0" instanceCount="0" interfaceNames="rest,wfs100,wfs200,wcs111,wcs112" providers="ugcDataProvider-World"> <config class="com.supermap.services.components.DataConfig"> <editable>true</editable> </config> </component>
Where, for a < com ponent > node:
< initOnCreate> Property: Whether the service instance needs to be initialized immediately. After the service instance dynamic function is enabled, the default is false. The true indicates that the service instance will be initialized immediately when the iServer is started; false indicates that the service instance will not be initialized immediately, that is, the service instance will be initialized after the iServer is started.
Note that this parameter is only valid when the service instance dynamization feature is enabled.