ModelDteApiAdapter adaptor = new ModelDteApiAdapter( context, context .getSharedScope( ) );   List dataSourceList = rptHandle.getAllDataSources( ); for ( int i = 0; i < dataSourceList.size( ); i++ ) { DataSourceHandle dataSource = (DataSourceHandle) dataSourceList .get( i ); try { dteEngine.defineDataSource( adaptor .createDataSourceDesign( dataSource ) ); } catch ( BirtException be ) { logger.log( Level.SEVERE, be.getMessage( ), be ); context.addException( dataSource, be ); } }
	public void prepare( Report report, Map appContext )	{		ReportDesignHandle rptHandle = report.getReportDesign( );		ModelDteApiAdapter adaptor = new ModelDteApiAdapter( context, context				.getSharedScope( ) );		// Handling data sources		List dataSourceList = rptHandle.getAllDataSources( );		for ( int i = 0; i < dataSourceList.size( ); i++ )		{			DataSourceHandle dataSource = (DataSourceHandle) dataSourceList					.get( i );			try			{				dteEngine.defineDataSource( adaptor						.createDataSourceDesign( dataSource ) );			}			catch ( BirtException be )			{				logger.log( Level.SEVERE, be.getMessage( ), be );				context.addException( dataSource, be );			}		}		// Handling data sets		List dataSetList = rptHandle.getAllDataSets( );		for ( int i = 0; i < dataSetList.size( ); i++ )		{			DataSetHandle dataset = (DataSetHandle) dataSetList.get( i );			try			{				dteEngine						.defineDataSet( adaptor.createDataSetDesign( dataset ) );			}			catch ( BirtException be )			{				logger.log( Level.SEVERE, be.getMessage( ), be );				context.addException( dataset, be );			}		}		// build report queries		new ReportQueryBuilder( ).build( report, context );		// 		doPrepareQuery( report, appContext );	}