This page explains the specifications of the service definition XML used to configure RaSC services.
The service definition XML is a setting file to specify configurations such as the command line of a user program, and the number of process instances for parallel execution. The following shows an example of a service definition XML that has a minimum of elements:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="target" class="jp.go.nict.langrid.servicecontainer.handler.TargetServiceFactory">
<property name="service">
<bean class="jp.go.nict.wisdom.wrapper.StdIOCommandService">
<property name="cmdLine" value="___PATH_TO_PROGRAM___" />
<property name="delimiterIn" value="___INPUT_DELIMITER___" />
<property name="delimiterOut" value="___OUTPUT_DELIMITER___" />
</bean>
</property>
</bean>
</beans>
In the service definition XML, the following two types of configurations are specified.
The following explains each of the above.
You can select a strategy of parallel or non-parallel execution by setting one of the following Java class names in /beans/bean/property[@name='service']/bean/@class (description with XPath):
The following explains each of the above items.
For standard non-parallel execution, specify jp.go.nict.wisdom.wrapper.StdIOCommandService.
This mechanism is intended for the most standard processing. It is recommended when you do not need parallelization. This mechanism:
For standard parallel execution, specify jp.go.nict.wisdom.wrapper.StdIOCommandParallelArrayService.
This mechanism is intended for standard parallel execution. When this mechanism is selected, the RaSC service:
For processing on string joined from array elements, specify jp.go.nict.wisdom.wrapper.StdIOCommandArrayJoinService.
In the implementation of String[] analyzeArray(String[]), instead of executing String analyze (String) for array elements, it combines the elements in the argument of analayzeArray into one character string and performs analyze once with the string.
You must configure parameters shown in Parameters required for StdIOCommandArrayJoinService.
For parallel processing on each of array elements, specify jp.go.nict.wisdom.wrapper.StdIOCommandParallelService.
Under /beans/bean/property[@name='service']/bean/, you can specify parameters in the following format:
<property name="___PARAM_NAME___" value="___PARAM_VALE___" />
cmdLine: | Set a command to start a user program. If a directory name and/or filename includes a space character(s), use cmdArray instead. Note that specifying both will cause an error. |
---|---|
cmdArray: | Set each element of the command line with the value tag under the list tag. Refer to How should I configure a service definition XML when a directory or filename includes a space in the command line? for details. |
delimiterIn: | Delimiter characters for input. The linefeed code must be represented as \n (In default, \n will be replaced with the linefeed code in each environment. See also: useEnvLineSeparator). |
delimiterOut: | Delimiter characters for output. The linefeed code must be represented as \n (In default, \n will be replaced with the linefeed code in each environment. See also: useEnvLineSeparator). |
includeDelim: | Set whether delimiter characters are included in the result. When setting it to true, output result includes the delimiter characters. |
---|---|
poolSize: | Set the number of process instances of a user program to be started. The parallel execution is to be performed with the number of processes specified here as the limit. |
initPoolSize: | Specify the number of process instances of a user program that must be started immediately after a RaSC service is started. As default, new processes will be created according to poolSize as the limit when a request is received. |
pollTimeOut: | The waiting time when the number of processes reaches poolSize and the processes are all busy. If no process becomes free after the time specified here (in units of ms) elapses, an error will be returned. |
timeOut: | The timeout time for reading outputs from a user program. If any output is not available when the time specified here (in units of ms) elapses, an error will be returned and a user program will be restarted. |
startWait: | The time from when a user program was started and to when a request for calling the program is accepted (in units of ms). |
restartWait: | The time from when a user program was restarted due to any reason to when a request is accepted (in units of ms). |
bufSize: | Buffer size for I/O (in bytes) |
directory: | Set the working directory of the user program. |
environment: | Set environment variables. See How to set environment variables for a program running on RaSC for example. (Since ver. 1.0.2) |
useEnvLineSeparator: | |
Set whether RaSC uses a new line code defined in the environment. The default value is true. See also: useEnvLineSeparator (Since ver. 1.0.2) |
internalDelimiterIn: | |
---|---|
Delimiter to join each element of an input | |
internalDelimiterOut: | |
Delimiter to split an output | |
includeInternalDelim: | |
Setting whether a delimiter is included after split output using internalDelimiterOut. The default value is false. |