/*
 *************************************************************************
 * 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.data.oda.impl;

import org.eclipse.birt.data.oda.IConnection;
import org.eclipse.birt.data.oda.IDriver;
import org.eclipse.birt.data.oda.LogConfiguration;
import org.eclipse.birt.data.oda.OdaException;

/**
 * Default implementation of IDriver 
 * for a simple ODA runtime driver.
 * @deprecated	As of BIRT 2.0, replaced by
 * 		{@link org.eclipse.datatools.connectivity.oda.impl.SimpleDriver} .
 * 		<br>The BIRT ODA run-time framework has been migrated to the 
 * 		Eclipse Data Tools Platform (DTP) project.
 */
public class SimpleDriver implements IDriver
{
	/**
	 * @see org.eclipse.birt.data.oda.IDriver#getConnection(java.lang.String)
	 */
	public IConnection getConnection( String dataSourceType ) throws OdaException
	{
		return newConnection( dataSourceType );
	}
	
	/**
	 * Override to return a specific IConnection instance based on the 
	 * type of data source.
	 * @param connectionType	the type of the IConnection to instantiate for the data source.
	 * @return	an IConnection instance.
	 * @throws OdaException	if data source error occurs.
	 */
	protected IConnection newConnection( String dataSourceType ) throws OdaException
	{
	    // assumes that only one type of data source is supported by the simple driver;
	    // ignores given argument
		return new SimpleConnection();
	}

	/**
	 * @see org.eclipse.birt.data.oda.IDriver#setLogConfiguration(org.eclipse.birt.data.oda.LogConfiguration)
	 */
	public void setLogConfiguration( LogConfiguration logConfig ) throws OdaException
	{
		// do nothing; assumes simple driver has no logging
	}

	/**
	 * @see org.eclipse.birt.data.oda.IDriver#getMaxConnections()
	 */
	public int getMaxConnections() throws OdaException
	{
		return 0;	// no limit
	}
}
