Integrating domain module into iServer Manager |
SuperMap iServer is constructed based on a three-layer architecture: the service provider layer, the service component layer and the service interface layer. It provides the users with a flexible and open service extension mechanism, and the users can extend the modules from any layer.
SuperMap iServer can integrate the domain modules extended by users into the iServer WebManager. Users can configure and manage the custom modules through accessing http://<server>:<port>/iserver/manager.
Except for the domain module implementation class, the JS file for the interface management and the metainfo file for identifying the resource module, should be added while integrating. Before starting SuperMap iServer, copy the domain module implementation class and the related files to %SuperMap iServer_HOME%\webapps\iserver\WEB-INF (under lib if it is a jar package; under classes if it is a class file). The steps of configuring the domain services through the iServer WebManager are shown in Figure 1.
Figure 1 How to configure domain services through the iServer WebManager
A metainfo files (*.properties) is used for defining the domain module, and its name is identical to the class name of the domain module, TemperatureProvider.properties for instance. The encoding format of the file is utf-8. The location of the metainfo files for each layer's modules is as follows:
The metainfo content is as follows:
implementation= <The absolute path of the domain module class>
paramType= <The absolute path of the corresponding domain module configuration class >
alias= <The domain module alias>
A *.js file is used for displaying the configuration items of the domain module on the Web interface. It supports Simplified Chinese and English. Its encoding format is utf-8. It is placed in *.jar (or classes) /ext/js. The content is as follows:
res.<The full path of domain module implement class> = [<Parameter configuration object 1>,<Parameter configuration object 2>...];
typeToDisplayMapping<The full path of domain module implement class> = "The domain module alias";
Where, typeToDisplayMapping represents that mapping the full path of domain module implement class to corresponding domain module alias.
The parameter configuration objects provided by SuperMap iServer are:
The configParam object can be constructed through "new configParam(name,chName,fileType,isNecessary)", and the parameters are introduced below:
Table 1 configParam parameters
Name | Description |
name | The name of the parameter in the configuration class. |
chName | The parameter description on the page. |
fileType |
The type of the parameter, which can be Text, Select, File, Checkbox, Password, Object, ObjectArray or Array. Please see Table 2. |
isNecessary |
Whether the parameter is required. True indicates required, and false indicates optional. |
Value | Description |
Text |
The text type. The text is input directly. |
Select |
The select type. It displays as a drop-down box. |
File |
The file type. It shows as a text select box. |
Checkbox |
It shows as a check box. |
Password |
The password type. For example, the Password on the Add WMS Map Service Provider page. |
Object |
It can include multiple child parameters. For example, the Service description information on the Add WMS Service Interface page. |
ObjectArray |
The object array type. Multiple Object objects can be added. For example, the Default map setting list on the Add Local Map Service page. |
Array |
The array type. It shows as a list box. |
The optionsConfigParam object can be constructed through "new optionsConfigParam (name, chName, fileType, isNecessay, options)", and the parameters are introduced below:
Table 3 Parameters for optionsConfigParam object construction
Name | Description |
name |
The parameter name in the configuration class. |
chName |
The parameter description on the page. |
fileType |
The type of the parameter, which can be Text, Select, File, Checkbox, Password, Object, ObjectArray or Array. Please see Table 2. |
isNecessary |
Whether the parameter is required. True indicates required, and false indicates optional. |
options |
Used for storing optional values. |
The defaultConfigParam object can be constructed through "defaultConfigParam (name, chName, fileType, isNecessay, defaultValue)", and the parameters are introduced below:
Table 4 Parameters for defaultConfigParam object construction
Name | Description |
name |
The parameter name in the configuration class. |
chName |
The parameter description on the page. |
fileType |
The type of the parameter, which can be Text, Select, File, Checkbox, Password, Object, ObjectArray or Array. Please see Table 2.. |
isNecessary |
Whether the parameter is required. True indicates required, and false indicates optional. |
options | Used for storing optional values. |
defaultValue |
Used for storing the default value. |
The following is an example of integrating a domain service provider into SuperMap iServer Manager.
In the example for Extending Domain Services, there is a temperature service provider. Its implementation class is com.supermap.sample.temprature.TempratureProvider, and the corresponding configuration class is com.supermap.sample.temprature FileSetting, in which filePath is the configuration item.
The TempratureProvider class is a service provider implementation class. Define the alias "Temperature service provider".
Write the module implementation class and compile it.
Compose the metainfo file TemperatureProvider.properties, as shown below:
implementation=com.supermap.sample.temperature.TemperatureProvider
paramType=com.supermap.sample.temperature.FileSetting
alias=Temperature service provider
Write FileSetting.js file as follows:
res.temperature service provider= [new configParam("filePath", "temperature service provider path", "Text", false)];
Compile TemperatureProvider.properties, FileSetting.js together with the implementation class to generate a Jar package, the structure of which is shown as below:
Figure 3 The structure of the Jar package
Copy the Jar package (like temprature_SCSp.jar) to SueprMap iServer Java_HOME%\webapps\iserver\WEB-INF\lib. Restart SuperMap iServer service to complete the integration of the temperature service provider module into SuperMap iServer Manager.
Note: When using Eclipse to package the Jar package, check Add directory entries, as shown below:
Figure 4 Jar export
On the Services/Service providers page, click Create service provider, input a name, select the type Temperature service provider (specified in the metainfo file). The corresponding configuration items will be displayed ()corresponding to the temperature service provider (the properties in the module configuration class, the ailas and display style are specified in FileSetting.js file), and then you need to set the items.
Figure 5 Create the temperature service provider
Click ok to finish.