class VirtualReportDataSourceServiceFactory extends JdbcReportDataSourceServiceFactory {

    public ReportDataSourceService createService(ReportDataSource dataSource) {
        if (dataSource instanceof VirtualReportDataSource) {
            // master data source - virtual data source
            DataSource ds;
            VirtualReportDataSource virtualDataSource = (VirtualReportDataSource) dataSource;
            TimeZone timeZone = getTimeZoneByDataSourceTimeZone(virtualDataSource.getTimezone());
            try {
                // generate JDBC data source from virtual data source
                ds = virtualDataSourceHandler.getSqlDataSource(ExecutionContextImpl.getRuntimeExecutionContext(), virtualDataSource);
                return new VirtualDataSourceService(ds, timeZone);
            } catch (JSResourceAcessDeniedException accessDeniedEx) {
                if (log.isDebugEnabled()) log.debug(accessDeniedEx, accessDeniedEx);
                throw accessDeniedEx;
            } catch (Exception e) {
                if (log.isDebugEnabled())
                    log.debug(e, e);
                throw new JSExceptionWrapper(e);
            }
        } else {
            // sub data source - JDBC data source
            // DO NOT use the JDBC data source pooling in JdbcReportDataSourceServiceFactory for JDBC sub data source
            if (dataSource instanceof AwsReportDataSource) {
                return awsDataSourceServiceFactory.createService(dataSource);
            } else if (dataSource instanceof AzureSqlReportDataSource) {
                return azureSqlDataSourceServiceFactory.createService(dataSource);
            } else {
                return super.createService(dataSource);
            }
        }
    }

    public  VirtualReportDataSourceServiceFactory();

}