This example demonstrates how to add a DataSource
to the Ignition Reporting module. In this example we utilitize some
open source libraries to very quickly add datasources in the form of Json responses from REST endpoints on the web.
The Reporting API provides a simple process to add DataSources. It requires a few things:
- Create the DataSource by implementing
ReportDataSource
in the Gateway Scope. - Create a Java-serializable data object that can be passed between the Gateway and Designer
- Register the DataSource in the GatewayHook by calling
GatewayDataSourceRegistry.get().register()
in the hook'sstartup()
method. - Create a DataSource UI for configuration by extending
DataSourceConfigPanel
, and implementingAbstractDataSourceConfigFactory
within it. - Register the factory with the DesignerHook.
The DataSource
itself simply provides a way to add to the existing Map<String, Object>
. While there may be some
flexibility in the structure of the Data that the reporting engine can handle, it is recommended that Datasets
(com.inductiveautomation.ignition.common.Dataset
) are used for compatibility.