Switching from one DataSource
to another is a two-step process:
Prepare the next
DataSource
, using theSwitchingDataSource.prepareNextDataSource(String pName)
method. Pass this method the short name of theDataSource
you want to switch to. This sets thenextDataSource
property.Execute the switch, using the
SwitchingDataSource.performSwitch()
method.
The prepareNextDataSource
and performSwitch
methods send a SwitchingDataSourceEvent
to each listener specified by the SwitchingDataSourceEventListener
property of the SwitchingDataSource
. This event can be of type PREPARE or SWITCH.
When you invoke the SwitchingDataSource.performSwitch()
method, the SwitchingDataSource
switches the value of the currentDataSource
property to the DataSource
specified by the nextDataSource
property.