Java event handlers for a data source element
The DataSource event handler interface has four methods that you can use to respond to events. A Java class to handle these events must implement the IDataSourceEventHandler interface or extend the DataSourceAdapter class. All the event methods receive an IReportContext object. All the methods except the afterClose( ) method also receive an IDataSourceInstance object. These interfaces are discussed later in this chapter. Table 38‑2 lists the methods that you can implement for a DataSource element.
Table 38‑2 Data source event handler methods
Method
Description
beforeOpen( IDataSourceInstance dataSource, IReportContext reportContext )
Called immediately before opening a data source. This handler is often used to change connection properties, such as user name and password.
afterOpen( IDataSourceInstance dataSource, IReportContext reportContext )
Called immediately after opening the data source.
beforeClose( IDataSourceInstance dataSource, IReportContext reportContext )
Called immediately before closing the data source.
afterClose( IReportContext reportContext )
Called immediately after closing the data source.