JasperReports Server comes with built-in support for JDBC, JNDI, Mondrian, and XML/A data sources for reporting purposes. Each of these custom data sources has an implementation of the com.jaspersoft.jasperserver.api.metadata.jasperreports.service.ReportDataSourceService
interface. This service is responsible for setting up and tearing down data source connections in the server.
The setReportParameterValues(Map parameterValues) is called before running a report and creates the resources needed by JasperReports to obtain a JRDataSource, then it adds them to the parameter map.
The closeConnection() method cleans up any resources allocated in setReportParameterValues().
The custom data source API enables easy integration of a new ReportDataSourceService implementation.
You can find further details on creating and configuring custom data sources in Custom Data Sources.