/*******************************************************************************
 * Copyright (c) 2004, 2005 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.data.oda.jdbc.ui.provider;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.util.ArrayList;

import org.eclipse.datatools.connectivity.oda.design.DataSourceDesign;

/**
 * interface to Manage Jdbc Data Sources,a set functions such as getting meta
 * data from a Jdbc Data Source. <br>JdbcMetaDataProvider is an implement of this
 * interface.
 */
public interface IMetaDataProvider
{
	/**
	 * Get <tt>java.sql.Connection</tt> from the Model data source handle 
	 * @param dataSourceHandle the Model data source handle
	 * @return connection 
	 */
	public Connection connect( DataSourceDesign dataSourceDesign );

	/**
	 * Get connection of the current MetaDataProvider
	 * @return connection
	 */
	public Connection getConnection( );

	/**
	 * Close the connection of the MetaDataProvider
	 */
	public void closeConnection( );

	/**
	 * Gets the CataLog for the Jdbc connection
	 */
	public String getDataBaseName( );

	/**
	 * Gets the Meta Data for the connection
	 */
	public DatabaseMetaData getMetaData( );

	
	/**
	 * Get a resultset of Schemas
	 */
	public ResultSet getAllSchema( );

	/**
	 * Checks whether schema is supported
	 */
	public boolean isSchemaSupported( );

	/**
	 * @param schemaPattern:
	 *            The schem from which the tables will be selected
	 * @param namePattern:
	 *            Will be used to return all objects matching this string
	 * @param Type:
	 *            All the standard Jdbc Types such as "TABLE", "VIEW", "SYSTEM
	 *            TABLE"
	 * @return : The ResultSet containing the Tables
	 */
	public ResultSet getAlltables( String cataLog, String schemaPattern,
			String namePattern, String[] types );

	public ArrayList getColumns( String catalog, String schemaPattern,
			String tableNamePattern, String columnNamePattern );

//	public ArrayList getCrossReferences( String primarySchema,
//			String primaryTable, String foreignSchema, String foreignTable );

	/**
	 * Gets the CataLog for the Jdbc connection
	 */
	public String getCatalog( );

	/**
	 * 
	 * @return the Catalog Separator
	 */
	public String getCatalogSeparator( );

	/**
	 * get all procedures from special catalog, schema, and namepattern
	 * @param cataLog
	 * @param schemaPattern
	 * @param namePattern
	 * @return procedure list
	 */
	public ArrayList getAllProcedure( String cataLog, String schemaPattern,
			String namePattern );
	
	/**
	 * get procedures columns metadata
	 * @param catalog
	 * @param schemaPattern
	 * @param procedureNamePattern
	 * @param columnNamePattern
	 * @return
	 */
	public ArrayList getProcedureColumns(String catalog,
			  String schemaPattern,
			  String procedureNamePattern, 
			  String columnNamePattern);

	/**
	 * is stored procedure supported
	 * @return
	 */
	public boolean isProcedureSupported( );
}
