Connecting to the external library from a third-party application

On many occasions, we do not execute the SPL script directory in esProc; instead, we integrate esProc to a third-party application to do the job. In those cases, in order to use the external library feature, we need get raqsoftConfig.xml from esProc installation root directory/esProc/config and add the following code to the file’s <Runtime><EsProc> ... </EsProc></Runtime> to specify the path of referencing the necessary jars used by the external library:

<extLibsPath>external library folder path</extLibsPath>

<importLibs>

<lib> external library folder name</lib> 

</importLibs>

Take embedding esProc in a Java application as an example, below explains how to use reportliteCli external library in a third-party application:

1. Load jars used by esProc JDBC

See Tutorial - Deploying JDBC to load jar files used by esProc JDBC.

2. Configure esProc JDBC’s raqsoftConfig.xml file

See Tutorial - Configuring raqsoftConfig.xml.

3. Load jars used by reportliteCli external library

Copy the core jar of reportliteCli external library (scu-reportlite-cli-2.10.jar) and jars listed below from report class path (installation root directory\reportlite\lib) to an independent directory (such as D:\ extlib\ReportLiteCli):

scu-reportlite-cli-2.10.jar

esproc-ext-********.jar

htmlparser-1.6.jar

pdfbox-2.0.27.jar

fontbox-2.0.27.jar

graphics-box2.0.27.jar

mail-1.4.4.jar

reportlite.jar

jboss-servlet-api_3.1-1.0.0.jar

commons-codec-1.15.jar

core-3.3.0.jar

batik-all-1.16.jar

poi-5.2.5.jar

poi-ooxml-5.2.5.jar

poi-ooxml-lite-5.2.5.jar

Among them, scu-reportlite-cli-2.10.jar is the core jar of reportliteCli external library.

Note: you can use the above necessary jars as needed in practical uses.

 

4. Configure xml file for reportliteCli external library

Copy raqsoftConfig.xml located ininstallation root directory\reportlite\config and rename the file raqsoftConfigReportLite.xml (you can rename it as you like), where you need to configure the following nodes:

<Report>

<home> </home>  // Configure report main directory

<styleConfig> </styleConfig>  // Configure report layout

</Report>

Note:

<home> configures the report’s default storage directory; when importing a report through a relative path, the path is relative to the main directory configured here.

<styleConfig> configures report layout file’s path; it can be empty.

 

5. Configure data source

If the report to be imported uses a data source, you need to configure a namesake and same-structure data source in reportliteCli external library’s xml file (which is raqsoftConfigReportLite.xml in step 4). If the report does not use a data source, just skip this step.

<DB name="demo">

<property name="url" value="jdbc:hsqldb:hsql://127.0.0.1/demo" />

<property name="driver" value="org.hsqldb.jdbcDriver" />

<property name="type" value="13" />

<property name="user" value="sa" />

<property name="password" />

<property name="batchSize" value="1000" />

<property name="autoConnect" value="true" />

… …

</DB>

If you want to execute the spl file at command line, you need to configure autoConnect property value as true in xml file’s data source node, otherwise no data source can be found.

 

6. Add external library node <lib> to esProc JDBC’s raqsoftConfig.xml file:

Configure external library node <lib>. In step 3 we’ve already put jars used by reportliteCli external library in D:\extlib\ReportLiteCli. Now we add the node directly:

<Esproc>

… …

// Configure path of external library folder

<extLibsPath>D:\extlib</extLibsPath>

<importLibs>

// Configure external library folder’s name

<lib>ReportLiteCli</lib>

</importLibs>

</Esproc>

 

7. Configure and access reportliteCli external file’s spl file

 

A

 

1

>reportlite_config("D:\\extlib\\ReportLiteCli\\raqsoftConfigReportLite.xml")

Read ReportLite’s configuration file information

2

=reportlite_open("D:\\test.rptx")

Read test.rptx

3

=reportlite_run(A2)

Compute test.rptx

See Tutorial - Java Invocation to learn how to deploy a spl file.

Now you can invoke the above spl file in the Java application.