if( preparedQuery != null ) preparedQuery.setAppContext( applContext ); return preparedQuery;
	static PreparedDataSourceQuery newInstance( DataEngineImpl dataEngine,			IQueryDefinition queryDefn ) throws DataException	{		assert dataEngine != null;		assert queryDefn != null;				IBaseDataSetDesign dset = dataEngine.getDataSetDesign( queryDefn.getDataSetName( ) );		if ( dset == null )		{			DataException e = new DataException( ResourceConstants.UNDEFINED_DATA_SET,					queryDefn.getDataSetName( ) );			logger.logp( Level.WARNING,					PreparedDataSourceQuery.class.getName( ),					"newInstance",					"Data set {" + queryDefn.getDataSetName( ) + "} is not defined",					e );			throw e;		}					if ( dset instanceof IScriptDataSetDesign )		{			return new PreparedScriptDSQuery( dataEngine, queryDefn, dset );		}		if ( dset instanceof IOdaDataSetDesign )		{			return new PreparedExtendedDSQuery( dataEngine, queryDefn, dset );		}		else		{			DataException e = new DataException( ResourceConstants.UNSUPPORTED_DATASET_TYPE,					dset.getName() );			logger.logp( Level.FINE,					PreparedDataSourceQuery.class.getName( ),					"newInstance",					"Unsupported data source type",					e );			throw e;		}	}