On many occasions a dfx script isn’t executed directly in esProc, but instead esProc is integrated into a third-party application. In such cases, in order to use the external library feature, you need to get raqsoftConfig.xml from 【esProc installation root directory】/esProc/config directory and add the following code manually in the configuration file’s <Runtime><EsProc> ... </EsProc></Runtime>, specifying the reference path of jars the external library needs:
<extLibsPath> path of external library folder </extLibsPath>
<importLibs>
<lib> name of external library folder </lib>
</importLibs>
Now we take embedding esProc into a Java application as an example to look at how YModelCli external library can be used in a third-party application:
1. Load jar files esProc JDBC needs
Put all jar files esProc JDBC needs in place. Find details in Deploying JDBC.
2. Configure esProc JDBC raqsoftConfig.xml file
Find details in Configuring raqsoftConfig.xml.
3. Load jar files of YModelCli
Copy YModelCli external library’s core jar (scu-ym2-cli-2.10.jar) and files listed below into a separate directory, like D:\extlib\YModelCli:
apache-ant-zip-2.3.jar
commons-io-2.4.jar
fastjson-1.2.58.jar
gson-2.8.0.jar
jackson-annotations-2.9.6.jar
jackson-core-2.9.6.jar
jackson-databind-2.9.6.jar
jackson-databind-2.9.6-sources.jar
jackson-dataformat-msgpack-0.8.14.jar
mining.jar
msgpack-0.6.12.jar
msgpack-core-0.8.16.jar
userconfig.xml
4. Add external library node <lib> in esProc JDBC’s raqsoftConfig.xml file
Configure external library node <lib>. In step 3 we already put jar file YModelCli needs under D:\ extlib\YModelCli directory and add the node directly:
<Esproc>
… …
//Configure path of external library folder
<extLibsPath>D:\extlib</extLibsPath>
<importLibs>
//Configure name of external library folder
<lib>YModelCli</lib>
</importLibs>
</Esproc>
5. Deploy the dfx file for accessing YModelCli
|
A |
|
1 |
=ym2_env("F:/ymodel") |
Initialize environment |
2 |
=ym2_pcfload("F:/ymodel/data/train.pcf") |
Return a pcf object |
3 |
=ym2_predict(A2,"F:/ymodel/data/train.csv") |
Perform data prediction |
4 |
>ym2_close(A3) |
Release resource |
Find how to deploy the dfx file in Invocation from Java.
Now you can invoke a dfx file within a Java application.